xmcp 1.1.3 → 1.3.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/cloudflare.d.ts +1 -0
- package/dist/cloudflare.js +2 -2
- package/dist/config/index.d.ts +35 -35
- package/dist/config/schemas/experimental/index.d.ts +4 -4
- package/dist/config.js +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +13 -13
- package/dist/node.d.ts +55 -0
- package/dist/node.js +1 -0
- package/dist/runtime/adapter-express.js +24 -22
- package/dist/runtime/adapter-fastify.js +24 -22
- package/dist/runtime/adapter-nestjs.js +24 -22
- package/dist/runtime/adapter-nextjs.js +24 -22
- package/dist/runtime/adapter-tanstack-cloudflare.js +240 -0
- package/dist/runtime/adapter-tanstack.js +244 -0
- package/dist/runtime/cloudflare-worker.js +32 -30
- package/dist/runtime/contexts/request-context.d.ts +24 -0
- package/dist/runtime/headers.js +1 -1
- package/dist/runtime/http.js +46 -44
- package/dist/runtime/stdio.js +19 -17
- package/dist/runtime/utils/content.d.ts +7 -0
- package/dist/runtime/utils/mcp-middleware.d.ts +14 -0
- package/dist/runtime/utils/server.d.ts +2 -1
- package/dist/runtime/utils/tools.d.ts +2 -1
- package/dist/runtime/utils/transformers/prompt.d.ts +7 -5
- package/dist/runtime/utils/transformers/tool.d.ts +1 -0
- package/dist/runtime/vercel.js +46 -44
- package/dist/types/declarations.d.ts +3 -0
- package/dist/types/mcp-middleware.d.ts +17 -0
- package/dist/types/prompt.d.ts +1 -0
- package/dist/types/resource.d.ts +3 -0
- package/dist/utils/context.d.ts +3 -1
- package/package.json +9 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,()=>(()=>{"use strict";var e={6982(e){e.exports=require("crypto")},9896(e){e.exports=require("fs")},6928(e){e.exports=require("path")}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{let e,t,i,n,o,s,l,c,u,d,p;r.r(a),r.d(a,{xmcpHandler:()=>hT});var m,h,f,y,g,v,_,b,S,$,w,R,k,x,P,E=Object.create,T=Object.defineProperty,j=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyNames,O=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),q=(e,t,r)=>(r=null!=e?E(O(e)):{},((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,n=C(t),o=0,s=n.length;o<s;o++)i=n[o],I.call(e,i)||i===r||T(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(a=j(t,i))||a.enumerable});return e})(!t&&e&&e.__esModule?r:T(r,"default",{value:e,enumerable:!0}),e));let A=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),z=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),M=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),L=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),Z=Object.freeze({status:"aborted"});function V(e,t,r){function a(r,a){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:a,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,a);let i=o.prototype,n=Object.keys(i);for(let e=0;e<n.length;e++){let t=n[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class n extends i{}function o(e){var t;let i=r?.Parent?new n:this;for(let r of(a(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(o,"init",{value:a}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class D extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class U extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(S=globalThis).__zod_globalConfig??(S.__zod_globalConfig={});let F=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(F,e),F}let J=/^[cC][0-9a-z]{6,}$/,B=/^[0-9a-z]+$/,K=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G=/^[0-9a-vA-V]{20}$/,W=/^[A-Za-z0-9]{27}$/,X=/^[a-zA-Z0-9_-]{21}$/,Y=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Q=/^([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})$/,ee=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)$/,et=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,er=/^(?:(?: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])$/,ea=/^(([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}|:))$/,ei=/^((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])$/,en=/^(([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])$/,eo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,el=/^https?$/,ec=/^\+[1-9]\d{6,14}$/,eu="(?:(?:\\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])))",ed=RegExp(`^${eu}$`);function ep(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 em=/^-?\d+$/,eh=/^-?\d+(?:\.\d+)?$/,ef=/^(?:true|false)$/i,ey=/^null$/i,eg=/^[^A-Z]*$/,ev=/^[^a-z]*$/;function e_(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 eb(e,t){return"bigint"==typeof t?t.toString():t}function eS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function e$(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let ew=Symbol("evaluating");function eR(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==ew)return void 0===a&&(a=ew,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ek(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ex(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function eP(e){return JSON.stringify(e)}let eE="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eT(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ej=eS(()=>{if(F.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eC(e){if(!1===eT(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eT(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function eO(e){return eC(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let eI=new Set(["string","number","symbol"]);function eN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eq(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function eA(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 ez={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 eM(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 eL(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eZ(e){return"string"==typeof e?e:e?.message}function eV(e,t,r){let a=e.message?e.message:eZ(e.inst?._zod.def?.error?.(e))??eZ(t?.error?.(e))??eZ(r.customError?.(e))??eZ(r.localeError?.(e))??"Invalid input",{inst:i,continue:n,input:o,...s}=e;return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=o),s}function eD(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eU(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let eF=V("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eH={number:"number",bigint:"bigint",object:"date"},eJ=V("$ZodCheckLessThan",(e,t)=>{eF.init(e,t);let r=eH[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<a&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eB=V("$ZodCheckGreaterThan",(e,t)=>{eF.init(e,t);let r=eH[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>a&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eK=V("$ZodCheckMultipleOf",(e,t)=>{eF.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let a,i,n;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=r.value/t.value),n=Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<n?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})}}),eG=V("$ZodCheckNumberFormat",(e,t)=>{eF.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,n]=ez[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=i,a.maximum=n,r&&(a.pattern=em)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>n&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),eW=V("$ZodCheckMaxLength",(e,t)=>{var r;eF.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 a=r.value;if(a.length<=t.maximum)return;let i=eD(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eX=V("$ZodCheckMinLength",(e,t)=>{var r;eF.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 a=r.value;if(a.length>=t.minimum)return;let i=eD(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eY=V("$ZodCheckLengthEquals",(e,t)=>{var r;eF.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 a=r.value,i=a.length;if(i===t.length)return;let n=eD(a),o=i>t.length;r.issues.push({origin:n,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eQ=V("$ZodCheckStringFormat",(e,t)=>{var r,a;eF.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})}):(a=e._zod).check??(a.check=()=>{})}),e0=V("$ZodCheckRegex",(e,t)=>{eQ.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})}}),e1=V("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eg),eQ.init(e,t)}),e2=V("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ev),eQ.init(e,t)}),e9=V("$ZodCheckIncludes",(e,t)=>{eF.init(e,t);let r=eN(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=a,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),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})}}),e4=V("$ZodCheckStartsWith",(e,t)=>{eF.init(e,t);let r=RegExp(`^${eN(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})}}),e3=V("$ZodCheckEndsWith",(e,t)=>{eF.init(e,t);let r=RegExp(`.*${eN(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})}}),e6=V("$ZodCheckOverwrite",(e,t)=>{eF.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class e5{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(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let e8=(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,eb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},e7=V("$ZodError",e8),te=V("$ZodError",e8,{Parent:Error}),tt=e=>(t,r,a,i)=>{let n=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new D;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eV(e,n,H())));throw eE(t,i?.callee),t}return o.value},tr=e=>async(t,r,a,i)=>{let n=a?{...a,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eV(e,n,H())));throw eE(t,i?.callee),t}return o.value},ta=e=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new D;return n.issues.length?{success:!1,error:new(e??e7)(n.issues.map(e=>eV(e,i,H())))}:{success:!0,data:n.value}},ti=ta(te),tn=e=>async(t,r,a)=>{let i=a?{...a,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(e=>eV(e,i,H())))}:{success:!0,data:n.value}},to=tn(te),ts={major:4,minor:4,patch:3},tl=V("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;let a=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&a.unshift(e),a))for(let r of t._zod.onattach)r(e);if(0===a.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let a,i=eM(e);for(let n of t){if(n._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)||!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=n._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new D;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=eM(e,t)))});else{if(e.issues.length===t)continue;i||(i=eM(e,t))}}return a?a.then(()=>e):e},r=(r,i,n)=>{if(eM(r))return r.aborted=!0,r;let o=t(i,a,n);if(o instanceof Promise){if(!1===n.async)throw new D;return o.then(t=>e._zod.parse(t,n))}return e._zod.parse(o,n)};e._zod.run=(i,n)=>{if(n.skipChecks)return e._zod.parse(i,n);if("backward"===n.direction){let t=e._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,n)):r(t,i,n)}let o=e._zod.parse(i,n);if(o instanceof Promise){if(!1===n.async)throw new D;return o.then(e=>t(e,a,n))}return t(o,a,n)}}eR(e,"~standard",()=>({validate:t=>{try{let r=ti(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return to(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),tc=V("$ZodString",(e,t)=>{var r;let a;tl.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${a}$`)),e._zod.parse=(r,a)=>{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}}),tu=V("$ZodStringFormat",(e,t)=>{eQ.init(e,t),tc.init(e,t)}),td=V("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Q),tu.init(e,t)}),tp=V("$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=ee(e))}else t.pattern??(t.pattern=ee());tu.init(e,t)}),tm=V("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=et),tu.init(e,t)}),th=V("$ZodURL",(e,t)=>{tu.init(e,t),e._zod.check=r=>{try{let a=r.value.trim();if(!t.normalize&&t.protocol?.source===el.source&&!/^https?:\/\//i.test(a))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:r.value=a;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tf=V("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tu.init(e,t)}),ty=V("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=X),tu.init(e,t)}),tg=V("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=J),tu.init(e,t)}),tv=V("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=B),tu.init(e,t)}),t_=V("$ZodULID",(e,t)=>{t.pattern??(t.pattern=K),tu.init(e,t)}),tb=V("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G),tu.init(e,t)}),tS=V("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=W),tu.init(e,t)}),t$=V("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=ep({precision:t.precision}),a=["Z"],t.local&&a.push(""),t.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${a.join("|")})`,t.pattern=RegExp(`^${eu}T(?:${i})$`)),tu.init(e,t)}),tw=V("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ed),tu.init(e,t)}),tR=V("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${ep(t)}$`)),tu.init(e,t)}),tk=V("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Y),tu.init(e,t)}),tx=V("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=er),tu.init(e,t),e._zod.bag.format="ipv4"}),tP=V("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ea),tu.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})}}}),tE=V("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ei),tu.init(e,t)}),tT=V("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=en),tu.init(e,t),e._zod.check=r=>{let a=r.value.split("/");try{if(2!==a.length)throw Error();let[e,t]=a;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 tj(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tC=V("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eo),tu.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tj(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tO=V("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=es),tu.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!es.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tj(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})}}),tI=V("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ec),tu.init(e,t)}),tN=V("$ZodJWT",(e,t)=>{tu.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.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})}}),tq=V("$ZodNumber",(e,t)=>{tl.init(e,t),e._zod.pattern=e._zod.bag.pattern??eh,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),r}}),tA=V("$ZodNumberFormat",(e,t)=>{eG.init(e,t),tq.init(e,t)}),tz=V("$ZodBoolean",(e,t)=>{tl.init(e,t),e._zod.pattern=ef,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),tM=V("$ZodNull",(e,t)=>{tl.init(e,t),e._zod.pattern=ey,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),tL=V("$ZodAny",(e,t)=>{tl.init(e,t),e._zod.parse=e=>e}),tZ=V("$ZodUnknown",(e,t)=>{tl.init(e,t),e._zod.parse=e=>e}),tV=V("$ZodNever",(e,t)=>{tl.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tD(e,t,r){e.issues.length&&t.issues.push(...eL(r,e.issues)),t.value[r]=e.value}let tU=V("$ZodArray",(e,t)=>{tl.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let n=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},a);s instanceof Promise?n.push(s.then(t=>tD(t,r,e))):tD(s,r,e)}return n.length?Promise.all(n).then(()=>r):r}});function tF(e,t,r,a,i,n){let o=r in a;if(e.issues.length){if(i&&n&&!o)return;t.issues.push(...eL(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function tH(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 a=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(a)}}function tJ(e,t,r,a,i,n){let o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===c){o.push(i);continue}let n=l.run({value:t[i],issues:[]},a);n instanceof Promise?e.push(n.then(e=>tF(e,r,i,t,u,d))):tF(n,r,i,t,u,d)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:n}),e.length)?Promise.all(e).then(()=>r):r}let tB=V("$ZodObject",(e,t)=>{let r;tl.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape");if(!a?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=eS(()=>tH(t));eR(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let a=e[t]._zod;if(a.values)for(let e of(r[t]??(r[t]=new Set),a.values))r[t].add(e)}return r});let n=t.catchall;e._zod.parse=(t,a)=>{r??(r=i.value);let o=t.value;if(!eT(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,n="optional"===r._zod.optout,c=r._zod.run({value:o[e],issues:[]},a);c instanceof Promise?s.push(c.then(r=>tF(r,t,e,o,i,n))):tF(c,t,e,o,i,n)}return n?tJ(s,o,t,a,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),tK=V("$ZodObjectJIT",(e,t)=>{let r,a;tB.init(e,t);let i=e._zod.parse,n=eS(()=>tH(t)),o=!F.jitless,s=o&&ej.value,l=t.catchall;e._zod.parse=(c,u)=>{a??(a=n.value);let d=c.value;return eT(d)?o&&s&&u?.async===!1&&!0!==u.jitless?(r||(r=(e=>{let t=new e5(["shape","payload","ctx"]),r=n.value,a=e=>{let t=eP(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let n of(t.write("const newResult = {};"),r.keys)){let r=i[n],o=eP(n),s=e[n],l=s?._zod?.optin==="optional",c=s?._zod?.optout==="optional";t.write(`const ${r} = ${a(n)};`),l&&c?t.write(`
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,()=>(()=>{"use strict";var e={6982(e){e.exports=require("crypto")},9896(e){e.exports=require("fs")},6928(e){e.exports=require("path")}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{let e,t,i,n,o,s,l,c,u,d,p;r.r(a),r.d(a,{xmcpHandler:()=>hN});var m,h,f,y,g,v,_,b,S,$,w,R,k,x,P,E=Object.create,T=Object.defineProperty,j=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyNames,O=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),q=(e,t,r)=>(r=null!=e?E(O(e)):{},((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,n=C(t),o=0,s=n.length;o<s;o++)i=n[o],I.call(e,i)||i===r||T(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(a=j(t,i))||a.enumerable});return e})(!t&&e&&e.__esModule?r:T(r,"default",{value:e,enumerable:!0}),e));let A=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),z=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),M=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),L=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),Z=Object.freeze({status:"aborted"});function V(e,t,r){function a(r,a){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:a,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,a);let i=o.prototype,n=Object.keys(i);for(let e=0;e<n.length;e++){let t=n[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class n extends i{}function o(e){var t;let i=r?.Parent?new n:this;for(let r of(a(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(o,"init",{value:a}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class D extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class U extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(S=globalThis).__zod_globalConfig??(S.__zod_globalConfig={});let F=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(F,e),F}let J=/^[cC][0-9a-z]{6,}$/,B=/^[0-9a-z]+$/,K=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G=/^[0-9a-vA-V]{20}$/,W=/^[A-Za-z0-9]{27}$/,X=/^[a-zA-Z0-9_-]{21}$/,Y=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Q=/^([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})$/,ee=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)$/,et=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,er=/^(?:(?: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])$/,ea=/^(([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}|:))$/,ei=/^((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])$/,en=/^(([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])$/,eo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,el=/^https?$/,ec=/^\+[1-9]\d{6,14}$/,eu="(?:(?:\\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])))",ed=RegExp(`^${eu}$`);function ep(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 em=/^-?\d+$/,eh=/^-?\d+(?:\.\d+)?$/,ef=/^(?:true|false)$/i,ey=/^null$/i,eg=/^[^A-Z]*$/,ev=/^[^a-z]*$/;function e_(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 eb(e,t){return"bigint"==typeof t?t.toString():t}function eS(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function e$(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let ew=Symbol("evaluating");function eR(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==ew)return void 0===a&&(a=ew,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ek(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ex(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function eP(e){return JSON.stringify(e)}let eE="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eT(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ej=eS(()=>{if(F.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eC(e){if(!1===eT(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eT(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function eO(e){return eC(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let eI=new Set(["string","number","symbol"]);function eN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eq(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function eA(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 ez={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 eM(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 eL(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function eZ(e){return"string"==typeof e?e:e?.message}function eV(e,t,r){let a=e.message?e.message:eZ(e.inst?._zod.def?.error?.(e))??eZ(t?.error?.(e))??eZ(r.customError?.(e))??eZ(r.localeError?.(e))??"Invalid input",{inst:i,continue:n,input:o,...s}=e;return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=o),s}function eD(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eU(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let eF=V("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eH={number:"number",bigint:"bigint",object:"date"},eJ=V("$ZodCheckLessThan",(e,t)=>{eF.init(e,t);let r=eH[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<a&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eB=V("$ZodCheckGreaterThan",(e,t)=>{eF.init(e,t);let r=eH[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>a&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eK=V("$ZodCheckMultipleOf",(e,t)=>{eF.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let a,i,n;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=r.value/t.value),n=Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<n?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})}}),eG=V("$ZodCheckNumberFormat",(e,t)=>{eF.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,n]=ez[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=i,a.maximum=n,r&&(a.pattern=em)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>n&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),eW=V("$ZodCheckMaxLength",(e,t)=>{var r;eF.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 a=r.value;if(a.length<=t.maximum)return;let i=eD(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eX=V("$ZodCheckMinLength",(e,t)=>{var r;eF.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 a=r.value;if(a.length>=t.minimum)return;let i=eD(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eY=V("$ZodCheckLengthEquals",(e,t)=>{var r;eF.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 a=r.value,i=a.length;if(i===t.length)return;let n=eD(a),o=i>t.length;r.issues.push({origin:n,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eQ=V("$ZodCheckStringFormat",(e,t)=>{var r,a;eF.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})}):(a=e._zod).check??(a.check=()=>{})}),e0=V("$ZodCheckRegex",(e,t)=>{eQ.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})}}),e1=V("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eg),eQ.init(e,t)}),e2=V("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ev),eQ.init(e,t)}),e9=V("$ZodCheckIncludes",(e,t)=>{eF.init(e,t);let r=eN(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=a,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),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})}}),e4=V("$ZodCheckStartsWith",(e,t)=>{eF.init(e,t);let r=RegExp(`^${eN(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})}}),e3=V("$ZodCheckEndsWith",(e,t)=>{eF.init(e,t);let r=RegExp(`.*${eN(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})}}),e6=V("$ZodCheckOverwrite",(e,t)=>{eF.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class e5{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(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let e8=(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,eb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},e7=V("$ZodError",e8),te=V("$ZodError",e8,{Parent:Error}),tt=e=>(t,r,a,i)=>{let n=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new D;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eV(e,n,H())));throw eE(t,i?.callee),t}return o.value},tr=e=>async(t,r,a,i)=>{let n=a?{...a,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eV(e,n,H())));throw eE(t,i?.callee),t}return o.value},ta=e=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new D;return n.issues.length?{success:!1,error:new(e??e7)(n.issues.map(e=>eV(e,i,H())))}:{success:!0,data:n.value}},ti=ta(te),tn=e=>async(t,r,a)=>{let i=a?{...a,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(e=>eV(e,i,H())))}:{success:!0,data:n.value}},to=tn(te),ts={major:4,minor:4,patch:3},tl=V("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;let a=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&a.unshift(e),a))for(let r of t._zod.onattach)r(e);if(0===a.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let a,i=eM(e);for(let n of t){if(n._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)||!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=n._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new D;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=eM(e,t)))});else{if(e.issues.length===t)continue;i||(i=eM(e,t))}}return a?a.then(()=>e):e},r=(r,i,n)=>{if(eM(r))return r.aborted=!0,r;let o=t(i,a,n);if(o instanceof Promise){if(!1===n.async)throw new D;return o.then(t=>e._zod.parse(t,n))}return e._zod.parse(o,n)};e._zod.run=(i,n)=>{if(n.skipChecks)return e._zod.parse(i,n);if("backward"===n.direction){let t=e._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,n)):r(t,i,n)}let o=e._zod.parse(i,n);if(o instanceof Promise){if(!1===n.async)throw new D;return o.then(e=>t(e,a,n))}return t(o,a,n)}}eR(e,"~standard",()=>({validate:t=>{try{let r=ti(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return to(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),tc=V("$ZodString",(e,t)=>{var r;let a;tl.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${a}$`)),e._zod.parse=(r,a)=>{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}}),tu=V("$ZodStringFormat",(e,t)=>{eQ.init(e,t),tc.init(e,t)}),td=V("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Q),tu.init(e,t)}),tp=V("$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=ee(e))}else t.pattern??(t.pattern=ee());tu.init(e,t)}),tm=V("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=et),tu.init(e,t)}),th=V("$ZodURL",(e,t)=>{tu.init(e,t),e._zod.check=r=>{try{let a=r.value.trim();if(!t.normalize&&t.protocol?.source===el.source&&!/^https?:\/\//i.test(a))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:r.value=a;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tf=V("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tu.init(e,t)}),ty=V("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=X),tu.init(e,t)}),tg=V("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=J),tu.init(e,t)}),tv=V("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=B),tu.init(e,t)}),t_=V("$ZodULID",(e,t)=>{t.pattern??(t.pattern=K),tu.init(e,t)}),tb=V("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G),tu.init(e,t)}),tS=V("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=W),tu.init(e,t)}),t$=V("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=ep({precision:t.precision}),a=["Z"],t.local&&a.push(""),t.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${a.join("|")})`,t.pattern=RegExp(`^${eu}T(?:${i})$`)),tu.init(e,t)}),tw=V("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ed),tu.init(e,t)}),tR=V("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${ep(t)}$`)),tu.init(e,t)}),tk=V("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Y),tu.init(e,t)}),tx=V("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=er),tu.init(e,t),e._zod.bag.format="ipv4"}),tP=V("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ea),tu.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})}}}),tE=V("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ei),tu.init(e,t)}),tT=V("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=en),tu.init(e,t),e._zod.check=r=>{let a=r.value.split("/");try{if(2!==a.length)throw Error();let[e,t]=a;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 tj(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tC=V("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eo),tu.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tj(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tO=V("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=es),tu.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!es.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tj(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})}}),tI=V("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ec),tu.init(e,t)}),tN=V("$ZodJWT",(e,t)=>{tu.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.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})}}),tq=V("$ZodNumber",(e,t)=>{tl.init(e,t),e._zod.pattern=e._zod.bag.pattern??eh,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),r}}),tA=V("$ZodNumberFormat",(e,t)=>{eG.init(e,t),tq.init(e,t)}),tz=V("$ZodBoolean",(e,t)=>{tl.init(e,t),e._zod.pattern=ef,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),tM=V("$ZodNull",(e,t)=>{tl.init(e,t),e._zod.pattern=ey,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),tL=V("$ZodAny",(e,t)=>{tl.init(e,t),e._zod.parse=e=>e}),tZ=V("$ZodUnknown",(e,t)=>{tl.init(e,t),e._zod.parse=e=>e}),tV=V("$ZodNever",(e,t)=>{tl.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tD(e,t,r){e.issues.length&&t.issues.push(...eL(r,e.issues)),t.value[r]=e.value}let tU=V("$ZodArray",(e,t)=>{tl.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let n=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},a);s instanceof Promise?n.push(s.then(t=>tD(t,r,e))):tD(s,r,e)}return n.length?Promise.all(n).then(()=>r):r}});function tF(e,t,r,a,i,n){let o=r in a;if(e.issues.length){if(i&&n&&!o)return;t.issues.push(...eL(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function tH(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 a=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(a)}}function tJ(e,t,r,a,i,n){let o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===c){o.push(i);continue}let n=l.run({value:t[i],issues:[]},a);n instanceof Promise?e.push(n.then(e=>tF(e,r,i,t,u,d))):tF(n,r,i,t,u,d)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:n}),e.length)?Promise.all(e).then(()=>r):r}let tB=V("$ZodObject",(e,t)=>{let r;tl.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape");if(!a?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=eS(()=>tH(t));eR(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let a=e[t]._zod;if(a.values)for(let e of(r[t]??(r[t]=new Set),a.values))r[t].add(e)}return r});let n=t.catchall;e._zod.parse=(t,a)=>{r??(r=i.value);let o=t.value;if(!eT(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,n="optional"===r._zod.optout,c=r._zod.run({value:o[e],issues:[]},a);c instanceof Promise?s.push(c.then(r=>tF(r,t,e,o,i,n))):tF(c,t,e,o,i,n)}return n?tJ(s,o,t,a,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),tK=V("$ZodObjectJIT",(e,t)=>{let r,a;tB.init(e,t);let i=e._zod.parse,n=eS(()=>tH(t)),o=!F.jitless,s=o&&ej.value,l=t.catchall;e._zod.parse=(c,u)=>{a??(a=n.value);let d=c.value;return eT(d)?o&&s&&u?.async===!1&&!0!==u.jitless?(r||(r=(e=>{let t=new e5(["shape","payload","ctx"]),r=n.value,a=e=>{let t=eP(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let n of(t.write("const newResult = {};"),r.keys)){let r=i[n],o=eP(n),s=e[n],l=s?._zod?.optin==="optional",c=s?._zod?.optout==="optional";t.write(`const ${r} = ${a(n)};`),l&&c?t.write(`
|
|
2
2
|
if (${r}.issues.length) {
|
|
3
3
|
if (${o} in input) {
|
|
4
4
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
@@ -59,18 +59,18 @@
|
|
|
59
59
|
|
|
60
60
|
`)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),c=r(c,u),l)?tJ([],d,c,u,a,e):c:i(c,u):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c)}});function tG(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!eM(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>eV(e,a,H())))}),t)}let tW=V("$ZodUnion",(e,t)=>{tl.init(e,t),eR(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),eR(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),eR(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),eR(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=>e$(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(a,i)=>{if(r)return r(a,i);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:a.value,issues:[]},i);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>tG(t,a,e,i)):tG(o,a,e,i)}}),tX=V("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tW.init(e,t);let r=e._zod.parse;eR(e._zod,"propValues",()=>{let e={};for(let r of t.options){let a=r._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(a))for(let a of(e[t]||(e[t]=new Set),r))e[t].add(a)}return e});let a=eS(()=>{let e=t.options,r=new Map;for(let a of e){let e=a._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,a)}}return r});e._zod.parse=(i,n)=>{let o=i.value;if(!eT(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=a.value.get(o?.[t.discriminator]);return s?s._zod.run(i,n):t.unionFallback||"backward"===n.direction?r(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(a.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),tY=V("$ZodIntersection",(e,t)=>{tl.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,i=t.left._zod.run({value:a,issues:[]},r),n=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([t,r])=>tQ(e,t,r)):tQ(e,i,n)}});function tQ(e,t,r){let a,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(a??(a=r),r.keys))i.has(e)||i.set(e,{}),i.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)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let n=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(n.length&&a&&e.issues.push({...a,keys:n}),eM(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eC(t)&&eC(r)){let a=Object.keys(r),i=Object.keys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};n[a]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};a.push(n.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let t0=V("$ZodRecord",(e,t)=>{tl.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!eC(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let n=[],o=t.keyType._zod.values;if(o){let s;r.value={};let l=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){l.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>eV(e,a,H())),input:s,path:[s],inst:e});continue}let c=o.value,u=t.valueType._zod.run({value:i[s],issues:[]},a);u instanceof Promise?n.push(u.then(e=>{e.issues.length&&r.issues.push(...eL(s,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...eL(s,u.issues)),r.value[c]=u.value)}for(let e in i)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},a);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&eh.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},a);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>eV(e,a,H())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},a);l instanceof Promise?n.push(l.then(e=>{e.issues.length&&r.issues.push(...eL(o,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...eL(o,l.issues)),r.value[s.value]=l.value)}return n.length?Promise.all(n).then(()=>r):r}}),t1=V("$ZodEnum",(e,t)=>{tl.init(e,t);let r=e_(t.entries),a=new Set(r);e._zod.values=a,e._zod.pattern=RegExp(`^(${r.filter(e=>eI.has(typeof e)).map(e=>"string"==typeof e?eN(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let n=t.value;return a.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),t2=V("$ZodLiteral",(e,t)=>{if(tl.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?eN(e):e?eN(e.toString()):String(e)).join("|")})$`),e._zod.parse=(a,i)=>{let n=a.value;return r.has(n)||a.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),a}}),t9=V("$ZodTransform",(e,t)=>{tl.init(e,t),e._zod.optin="optional",e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new U(e.constructor.name);let i=t.transform(r.value,r);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new D;return r.value=i,r.fallback=!0,r}});function t4(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let t3=V("$ZodOptional",(e,t)=>{tl.init(e,t),e._zod.optin="optional",e._zod.optout="optional",eR(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),eR(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${e$(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let a=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>t4(e,a)):t4(i,a)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),t6=V("$ZodExactOptional",(e,t)=>{t3.init(e,t),eR(e._zod,"values",()=>t.innerType._zod.values),eR(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),t5=V("$ZodNullable",(e,t)=>{tl.init(e,t),eR(e._zod,"optin",()=>t.innerType._zod.optin),eR(e._zod,"optout",()=>t.innerType._zod.optout),eR(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${e$(e.source)}|null)$`):void 0}),eR(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)}),t8=V("$ZodDefault",(e,t)=>{tl.init(e,t),e._zod.optin="optional",eR(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 a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>t7(e,t)):t7(a,t)}});function t7(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let re=V("$ZodPrefault",(e,t)=>{tl.init(e,t),e._zod.optin="optional",eR(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))}),rt=V("$ZodNonOptional",(e,t)=>{tl.init(e,t),eR(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,a)=>{let i=t.innerType._zod.run(r,a);return i instanceof Promise?i.then(t=>rr(t,e)):rr(i,e)}});function rr(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 ra=V("$ZodCatch",(e,t)=>{tl.init(e,t),e._zod.optin="optional",eR(e._zod,"optout",()=>t.innerType._zod.optout),eR(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(a=>(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>eV(e,r,H()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>eV(e,r,H()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ri=V("$ZodPipe",(e,t)=>{tl.init(e,t),eR(e._zod,"values",()=>t.in._zod.values),eR(e._zod,"optin",()=>t.in._zod.optin),eR(e._zod,"optout",()=>t.out._zod.optout),eR(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let a=t.out._zod.run(e,r);return a instanceof Promise?a.then(e=>rn(e,t.in,r)):rn(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>rn(e,t.out,r)):rn(a,t.out,r)}});function rn(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 ro=V("$ZodPreprocess",(e,t)=>{ri.init(e,t)}),rs=V("$ZodReadonly",(e,t)=>{tl.init(e,t),eR(e._zod,"propValues",()=>t.innerType._zod.propValues),eR(e._zod,"values",()=>t.innerType._zod.values),eR(e._zod,"optin",()=>t.innerType?._zod?.optin),eR(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(rl):rl(a)}});function rl(e){return e.value=Object.freeze(e.value),e}let rc=V("$ZodLazy",(e,t)=>{tl.init(e,t),eR(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),eR(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),eR(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),eR(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),eR(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),ru=V("$ZodCustom",(e,t)=>{eF.init(e,t),tl.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,i=t.fn(a);if(i instanceof Promise)return i.then(t=>rd(t,r,a,e));rd(i,r,a,e)}});function rd(e,t,r,a){if(!e){let e={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(eU(e))}}Symbol("ZodOutput"),Symbol("ZodInput");($=globalThis).__zod_globalRegistry??($.__zod_globalRegistry=new class e{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 a={...r,...this._map.get(e)};return Object.keys(a).length?a:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let rp=globalThis.__zod_globalRegistry;function rm(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eA(t)})}function rh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eA(t)})}function rf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...eA(t)})}function ry(e,t){return new eJ({check:"less_than",...eA(t),value:e,inclusive:!1})}function rg(e,t){return new eJ({check:"less_than",...eA(t),value:e,inclusive:!0})}function rv(e,t){return new eB({check:"greater_than",...eA(t),value:e,inclusive:!1})}function r_(e,t){return new eB({check:"greater_than",...eA(t),value:e,inclusive:!0})}function rb(e,t){return new eK({check:"multiple_of",...eA(t),value:e})}function rS(e,t){return new eW({check:"max_length",...eA(t),maximum:e})}function r$(e,t){return new eX({check:"min_length",...eA(t),minimum:e})}function rw(e,t){return new eY({check:"length_equals",...eA(t),length:e})}function rR(e){return new e6({check:"overwrite",tx:e})}function rk(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??rp,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 rx(e,t,r={path:[],schemaPath:[]}){var a;let i=e._zod.def,n=t.seen.get(e);if(n)return n.count++,r.schemaPath.includes(e)&&(n.cycle=r.path),n.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let a={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,a);else{let r=o.schema,n=t.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(e,t,r,a)}let n=e._zod.parent;n&&(o.ref||(o.ref=n),rx(n,t,a),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&function e(t,r){let a=r??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,a);if("set"===i.type)return e(i.valueType,a);if("lazy"===i.type)return e(i.getter(),a);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,a);if("intersection"===i.type)return e(i.left,a)||e(i.right,a);if("record"===i.type||"map"===i.type)return e(i.keyType,a)||e(i.valueType,a);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,a)||e(i.out,a);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],a))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,a))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,a))return!0;if(i.rest&&e(i.rest,a))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function rP(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=a.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.`);a.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let a=t[1],{ref:i,defId:n}=(t=>{let a="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${i("__shared")}#/${a}/${n}`}}if(t[1]===r)return{ref:"#"};let i=`#/${a}/`,n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:i+n}})(t);a.def={...a.schema},n&&(a.defId=n);let o=a.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let a=r[1];if(t===r[0]){i(r);continue}if(e.external){let a=e.external.registry.get(r[0])?.id;if(t!==r[0]&&a){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||a.cycle||a.count>1&&"ref"===e.reused){i(r);continue}}}function rE(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,n={...i},o=r.ref;if(r.ref=null,o){a(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,n),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){a(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())a(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$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");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&i.id===n&&delete i.id;let o=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,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:rT(t,"input",e.processors),output:rT(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rT=(e,t,r={})=>a=>{let{libraryOptions:i,target:n}=a??{},o=rk({...i??{},target:n,io:t,processors:r});return rx(e,o),rP(o,e),rE(o,e)},rj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rC=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:n,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),o&&(r.format=rj[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];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}))])}},rO=(e,t,r,a)=>{let{minimum:i,maximum:n,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(i??-1/0),d="number"==typeof l&&l<=(n??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 i&&(r.minimum=i),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof s&&(r.multipleOf=s)},rI=(e,t,r,a)=>{r.type="boolean"},rN=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rq=(e,t,r,a)=>{r.not={}},rA=(e,t,r,a)=>{},rz=(e,t,r,a)=>{},rM=(e,t,r,a)=>{let i=e_(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},rL=(e,t,r,a)=>{let i=e._zod.def,n=[];for(let e of i.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 n.push(Number(e));else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},rZ=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rV=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rD=(e,t,r,a)=>{let i=e._zod.def,{minimum:n,maximum:o}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=rx(i.element,t,{...a,path:[...a.path,"items"]})},rU=(e,t,r,a)=>{let i=e._zod.def;r.type="object",r.properties={};let n=i.shape;for(let e in n)r.properties[e]=rx(n[e],t,{...a,path:[...a.path,"properties",e]});let o=new Set([...new Set(Object.keys(n))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=rx(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rF=(e,t,r,a)=>{let i=e._zod.def,n=!1===i.inclusive,o=i.options.map((e,r)=>rx(e,t,{...a,path:[...a.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=o:r.anyOf=o},rH=(e,t,r,a)=>{let i=e._zod.def,n=rx(i.left,t,{...a,path:[...a.path,"allOf",0]}),o=rx(i.right,t,{...a,path:[...a.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(n)?n.allOf:[n],...s(o)?o.allOf:[o]]},rJ=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let n=i.keyType,o=n._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=rx(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=rx(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=rx(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},rB=(e,t,r,a)=>{let i=e._zod.def,n=rx(i.innerType,t,a),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},rK=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},rG=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},rW=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rX=(e,t,r,a)=>{let i,n=e._zod.def;rx(n.innerType,t,a),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},rY=(e,t,r,a)=>{let i=e._zod.def,n=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?n?i.out:i.in:i.out;rx(o,t,a),t.seen.get(e).ref=o},rQ=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},r0=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},r1=(e,t,r,a)=>{let i=e._zod.innerType;rx(i,t,a),t.seen.get(e).ref=i},r2={string:rC,number:rO,boolean:rI,bigint:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:rN,undefined:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:rq,any:rA,unknown:rz,date:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:rM,literal:rL,nan:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,a)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},file:(e,t,r,a)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:n,maximum:o,mime:s}=e._zod.bag;void 0!==n&&(i.minLength=n),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},success:(e,t,r,a)=>{r.type="boolean"},custom:rZ,function:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:rV,map:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:rD,object:rU,union:rF,intersection:rH,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>rx(e,t,{...a,path:[...a.path,n,r]})),l=i.rest?rx(i.rest,t,{...a,path:[...a.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,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:rJ,nullable:rB,nonoptional:rK,default:rG,prefault:rW,catch:rX,pipe:rY,readonly:rQ,promise:(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:r0,lazy:r1};function r9(e,t){if("_idmap"in e){let r=rk({...t,processors:r2}),a={};for(let t of e._idmap.entries()){let[e,a]=t;rx(a,r)}let i={};for(let n of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=n;rP(r,t),i[e]=rE(r,t)}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=rk({...t,processors:r2});return rx(e,r),rP(r,e),rE(r,e)}let r4=V("ZodISODateTime",(e,t)=>{t$.init(e,t),a_.init(e,t)});function r3(e){return new r4({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eA(e)})}let r6=V("ZodISODate",(e,t)=>{tw.init(e,t),a_.init(e,t)});function r5(e){return new r6({type:"string",format:"date",check:"string_format",...eA(e)})}let r8=V("ZodISOTime",(e,t)=>{tR.init(e,t),a_.init(e,t)}),r7=V("ZodISODuration",(e,t)=>{tk.init(e,t),a_.init(e,t)}),ae=V("ZodError",(e,t)=>{e7.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=(e,i=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>a({issues:e},[...i,...n.path]));else if("invalid_key"===n.code)a({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)a({issues:n.issues},[...i,...n.path]);else{let e=[...i,...n.path];if(0===e.length)r._errors.push(t(n));else{let a=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(a[r]=a[r]||{_errors:[]},a[r]._errors.push(t(n))):a[r]=a[r]||{_errors:[]},a=a[r],i++}}}};return a(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},a=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eb,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eb,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),at=tt(ae),ar=tr(ae),aa=ta(ae),ai=tn(ae),an=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tt(ae)(e,t,a)},ao=(e,t,r)=>tt(ae)(e,t,r),as=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tr(ae)(e,t,a)},al=async(e,t,r)=>tr(ae)(e,t,r),ac=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return ta(ae)(e,t,a)},au=(e,t,r)=>ta(ae)(e,t,r),ad=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tn(ae)(e,t,a)},ap=async(e,t,r)=>tn(ae)(e,t,r),am=new WeakMap;function ah(e,t,r){let a=Object.getPrototypeOf(e),i=am.get(a);if(i||(i=new Set,am.set(a,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(a,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 af=V("ZodType",(e,t)=>(tl.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rT(e,"input"),output:rT(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let a=rk({...r,processors:t});return rx(e,a),rP(a,e),rE(a,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>at(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>aa(e,t,r),e.parseAsync=async(t,r)=>ar(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ai(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>an(e,t,r),e.decode=(t,r)=>ao(e,t,r),e.encodeAsync=async(t,r)=>as(e,t,r),e.decodeAsync=async(t,r)=>al(e,t,r),e.safeEncode=(t,r)=>ac(e,t,r),e.safeDecode=(t,r)=>au(e,t,r),e.safeEncodeAsync=async(t,r)=>ad(e,t,r),e.safeDecodeAsync=async(t,r)=>ap(e,t,r),ah(e,"ZodType",{check(...e){let t=this.def;return this.clone(ex(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 eq(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 iw({type:"custom",check:"custom",fn:e,...eA(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let a,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eU(e,t.value,a._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=a),e.continue??(e.continue=!a._zod.def.abort),t.issues.push(eU(e)))},e(t.value,t)),(i=new eF({check:"custom",...eA(t)}))._zod.check=r,a=i}(e,t))},overwrite(e){return this.check(rR(e))},optional(){return il(this)},exactOptional(){var e;return e=this,new ic({type:"optional",innerType:e})},nullable(){return id(this)},nullish(){return il(id(this))},nonoptional(e){var t;return t=this,new ih({type:"nonoptional",innerType:t,...eA(e)})},array(){return aY(this)},or(e){return a9([this,e])},and(e){return a5(this,e)},transform(e){return iv(this,io(e))},default(e){var t,r;return t=this,r=e,new ip({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():eO(r)}})},prefault(e){var t,r;return t=this,r=e,new im({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():eO(r)}})},catch(e){var t,r;return t=this,new iy({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return iv(this,e)},readonly(){var e;return e=this,new ib({type:"readonly",innerType:e})},describe(e){let t=this.clone();return rp.add(t,{description:e}),t},meta(...e){if(0===e.length)return rp.get(this);let t=this.clone();return rp.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:()=>rp.get(e)?.description,configurable:!0}),e)),ay=V("_ZodString",(e,t)=>{tc.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rC(e,t,r,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,ah(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new e0({check:"string_format",format:"regex",...eA(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new e9({check:"string_format",format:"includes",...eA(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new e4({check:"string_format",format:"starts_with",...eA(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new e3({check:"string_format",format:"ends_with",...eA(t),suffix:e})}(...e))},min(...e){return this.check(r$(...e))},max(...e){return this.check(rS(...e))},length(...e){return this.check(rw(...e))},nonempty(...e){return this.check(r$(1,...e))},lowercase(e){return this.check(new e1({check:"string_format",format:"lowercase",...eA(e)}))},uppercase(e){return this.check(new e2({check:"string_format",format:"uppercase",...eA(e)}))},trim(){return this.check(rR(e=>e.trim()))},normalize(...e){return this.check(function(e){return rR(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(rR(e=>e.toLowerCase()))},toUpperCase(){return this.check(rR(e=>e.toUpperCase()))},slugify(){return this.check(rR(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),ag=V("ZodString",(e,t)=>{tc.init(e,t),ay.init(e,t),e.email=t=>e.check(rm(ab,t)),e.url=t=>e.check(rf(aw,t)),e.jwt=t=>e.check(new aM({type:"string",format:"jwt",check:"string_format",abort:!1,...eA(t)})),e.emoji=t=>e.check(new aR({type:"string",format:"emoji",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(rh(aS,t)),e.uuid=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,...eA(t)})),e.uuidv4=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eA(t)})),e.uuidv6=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eA(t)})),e.uuidv7=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eA(t)})),e.nanoid=t=>e.check(new ak({type:"string",format:"nanoid",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(rh(aS,t)),e.cuid=t=>e.check(new ax({type:"string",format:"cuid",check:"string_format",abort:!1,...eA(t)})),e.cuid2=t=>e.check(new aP({type:"string",format:"cuid2",check:"string_format",abort:!1,...eA(t)})),e.ulid=t=>e.check(new aE({type:"string",format:"ulid",check:"string_format",abort:!1,...eA(t)})),e.base64=t=>e.check(new aq({type:"string",format:"base64",check:"string_format",abort:!1,...eA(t)})),e.base64url=t=>e.check(new aA({type:"string",format:"base64url",check:"string_format",abort:!1,...eA(t)})),e.xid=t=>e.check(new aT({type:"string",format:"xid",check:"string_format",abort:!1,...eA(t)})),e.ksuid=t=>e.check(new aj({type:"string",format:"ksuid",check:"string_format",abort:!1,...eA(t)})),e.ipv4=t=>e.check(new aC({type:"string",format:"ipv4",check:"string_format",abort:!1,...eA(t)})),e.ipv6=t=>e.check(new aO({type:"string",format:"ipv6",check:"string_format",abort:!1,...eA(t)})),e.cidrv4=t=>e.check(new aI({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eA(t)})),e.cidrv6=t=>e.check(new aN({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eA(t)})),e.e164=t=>e.check(new az({type:"string",format:"e164",check:"string_format",abort:!1,...eA(t)})),e.datetime=t=>e.check(r3(t)),e.date=t=>e.check(r5(t)),e.time=t=>e.check(new r8({type:"string",format:"time",check:"string_format",precision:null,...eA(t)})),e.duration=t=>e.check(new r7({type:"string",format:"duration",check:"string_format",...eA(t)}))});function av(e){return new ag({type:"string",...eA(e)})}let a_=V("ZodStringFormat",(e,t)=>{tu.init(e,t),ay.init(e,t)}),ab=V("ZodEmail",(e,t)=>{tm.init(e,t),a_.init(e,t)}),aS=V("ZodGUID",(e,t)=>{td.init(e,t),a_.init(e,t)}),a$=V("ZodUUID",(e,t)=>{tp.init(e,t),a_.init(e,t)}),aw=V("ZodURL",(e,t)=>{th.init(e,t),a_.init(e,t)}),aR=V("ZodEmoji",(e,t)=>{tf.init(e,t),a_.init(e,t)}),ak=V("ZodNanoID",(e,t)=>{ty.init(e,t),a_.init(e,t)}),ax=V("ZodCUID",(e,t)=>{tg.init(e,t),a_.init(e,t)}),aP=V("ZodCUID2",(e,t)=>{tv.init(e,t),a_.init(e,t)}),aE=V("ZodULID",(e,t)=>{t_.init(e,t),a_.init(e,t)}),aT=V("ZodXID",(e,t)=>{tb.init(e,t),a_.init(e,t)}),aj=V("ZodKSUID",(e,t)=>{tS.init(e,t),a_.init(e,t)}),aC=V("ZodIPv4",(e,t)=>{tx.init(e,t),a_.init(e,t)}),aO=V("ZodIPv6",(e,t)=>{tP.init(e,t),a_.init(e,t)}),aI=V("ZodCIDRv4",(e,t)=>{tE.init(e,t),a_.init(e,t)}),aN=V("ZodCIDRv6",(e,t)=>{tT.init(e,t),a_.init(e,t)}),aq=V("ZodBase64",(e,t)=>{tC.init(e,t),a_.init(e,t)}),aA=V("ZodBase64URL",(e,t)=>{tO.init(e,t),a_.init(e,t)}),az=V("ZodE164",(e,t)=>{tI.init(e,t),a_.init(e,t)}),aM=V("ZodJWT",(e,t)=>{tN.init(e,t),a_.init(e,t)}),aL=V("ZodNumber",(e,t)=>{tq.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rO(e,t,r,a),ah(e,"ZodNumber",{gt(e,t){return this.check(rv(e,t))},gte(e,t){return this.check(r_(e,t))},min(e,t){return this.check(r_(e,t))},lt(e,t){return this.check(ry(e,t))},lte(e,t){return this.check(rg(e,t))},max(e,t){return this.check(rg(e,t))},int(e){return this.check(aD(e))},safe(e){return this.check(aD(e))},positive(e){return this.check(rv(0,e))},nonnegative(e){return this.check(r_(0,e))},negative(e){return this.check(ry(0,e))},nonpositive(e){return this.check(rg(0,e))},multipleOf(e,t){return this.check(rb(e,t))},step(e,t){return this.check(rb(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 aZ(e){return new aL({type:"number",checks:[],...eA(e)})}let aV=V("ZodNumberFormat",(e,t)=>{tA.init(e,t),aL.init(e,t)});function aD(e){return new aV({type:"number",check:"number_format",abort:!1,format:"safeint",...eA(e)})}let aU=V("ZodBoolean",(e,t)=>{tz.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rI(e,t,r,a)});function aF(e){return new aU({type:"boolean",...eA(e)})}let aH=V("ZodNull",(e,t)=>{tM.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rN(e,t,r,a)});function aJ(e){return new aH({type:"null",...eA(e)})}let aB=V("ZodAny",(e,t)=>{tL.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rA(e,t,r,a)}),aK=V("ZodUnknown",(e,t)=>{tZ.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rz(e,t,r,a)});function aG(){return new aK({type:"unknown"})}let aW=V("ZodNever",(e,t)=>{tV.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rq(e,t,r,a)}),aX=V("ZodArray",(e,t)=>{tU.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rD(e,t,r,a),e.element=t.element,ah(e,"ZodArray",{min(e,t){return this.check(r$(e,t))},nonempty(e){return this.check(r$(1,e))},max(e,t){return this.check(rS(e,t))},length(e,t){return this.check(rw(e,t))},unwrap(){return this.element}})});function aY(e,t){return new aX({type:"array",element:e,...eA(t)})}let aQ=V("ZodObject",(e,t)=>{tK.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rU(e,t,r,a),eR(e,"shape",()=>t.shape),ah(e,"ZodObject",{keyof(){return it(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:aG()})},loose(){return this.clone({...this._zod.def,catchall:aG()})},strict(){return this.clone({...this._zod.def,catchall:new aW({type:"never",...eA(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eC(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 a=ex(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ek(this,"shape",r),r}});return eq(e,a)}(this,e)},safeExtend(e){var t=this;if(!eC(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=ex(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return ek(this,"shape",r),r}});return eq(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ex(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ek(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return eq(t,r)},pick(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ex(e._zod.def,{get shape(){let e={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);t[a]&&(e[a]=r.shape[a])}return ek(this,"shape",e),e},checks:[]});return eq(e,i)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ex(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return ek(this,"shape",a),a},checks:[]});return eq(e,i)}(this,e)},partial(...e){return function(e,t,r){let a=t._zod.def.checks;if(a&&a.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ex(t._zod.def,{get shape(){let a=t._zod.def.shape,i={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)i[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return ek(this,"shape",i),i},checks:[]});return eq(t,i)}(is,this,e[0])},required(...e){var t,r;let a;return t=this,r=e[0],a=ex(t._zod.def,{get shape(){let e=t._zod.def.shape,a={...e};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new ih({type:"nonoptional",innerType:e[t]}))}else for(let t in e)a[t]=new ih({type:"nonoptional",innerType:e[t]});return ek(this,"shape",a),a}}),eq(t,a)}})});function a0(e,t){return new aQ({type:"object",shape:e??{},...eA(t)})}function a1(e,t){return new aQ({type:"object",shape:e,catchall:aG(),...eA(t)})}let a2=V("ZodUnion",(e,t)=>{tW.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rF(e,t,r,a),e.options=t.options});function a9(e,t){return new a2({type:"union",options:e,...eA(t)})}let a4=V("ZodDiscriminatedUnion",(e,t)=>{a2.init(e,t),tX.init(e,t)});function a3(e,t,r){return new a4({type:"union",options:t,discriminator:e,...eA(r)})}let a6=V("ZodIntersection",(e,t)=>{tY.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rH(e,t,r,a)});function a5(e,t){return new a6({type:"intersection",left:e,right:t})}let a8=V("ZodRecord",(e,t)=>{t0.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rJ(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function a7(e,t,r){return new a8(t&&t._zod?{type:"record",keyType:e,valueType:t,...eA(r)}:{type:"record",keyType:av(),valueType:e,...eA(t)})}let ie=V("ZodEnum",(e,t)=>{t1.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rM(e,t,r,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let i={};for(let a of e)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new ie({...t,checks:[],...eA(a),entries:i})},e.exclude=(e,a)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ie({...t,checks:[],...eA(a),entries:i})}});function it(e,t){return new ie({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eA(t)})}let ir=V("ZodLiteral",(e,t)=>{t2.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rL(e,t,r,a),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 ia(e,t){return new ir({type:"literal",values:Array.isArray(e)?e:[e],...eA(t)})}let ii=V("ZodTransform",(e,t)=>{t9.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rV(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new U(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(eU(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(eU(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function io(e){return new ii({type:"transform",transform:e})}let is=V("ZodOptional",(e,t)=>{t3.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r0(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function il(e){return new is({type:"optional",innerType:e})}let ic=V("ZodExactOptional",(e,t)=>{t6.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r0(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iu=V("ZodNullable",(e,t)=>{t5.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rB(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function id(e){return new iu({type:"nullable",innerType:e})}let ip=V("ZodDefault",(e,t)=>{t8.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rG(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),im=V("ZodPrefault",(e,t)=>{re.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rW(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),ih=V("ZodNonOptional",(e,t)=>{rt.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rK(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iy=V("ZodCatch",(e,t)=>{ra.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rX(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ig=V("ZodPipe",(e,t)=>{ri.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rY(e,t,r,a),e.in=t.in,e.out=t.out});function iv(e,t){return new ig({type:"pipe",in:e,out:t})}let i_=V("ZodPreprocess",(e,t)=>{ig.init(e,t),ro.init(e,t)}),ib=V("ZodReadonly",(e,t)=>{rs.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rQ(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iS=V("ZodLazy",(e,t)=>{rc.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r1(e,t,r,a),e.unwrap=()=>e._zod.def.getter()});function i$(e){return new iS({type:"lazy",getter:e})}let iw=V("ZodCustom",(e,t)=>{ru.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rZ(e,t,r,a)});function iR(e,t){return new i_({type:"pipe",in:io(e),out:t})}w||(w={});let ik="2025-11-25",ix=[ik,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iP="io.modelcontextprotocol/protocolVersion",iE="io.modelcontextprotocol/clientInfo",iT="io.modelcontextprotocol/serverInfo",ij="io.modelcontextprotocol/clientCapabilities",iC="io.modelcontextprotocol/subscriptionId",iO="io.modelcontextprotocol/logLevel",iI=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),iI),aY(iI)])),iN=a7(av(),iI),iq=aY(iI),iA=a9([av(),aZ().int()]),iz=av(),iM=a0({ttl:aZ().optional()}),iL=a0({taskId:av()}),iZ=a1({progressToken:iA.optional(),"io.modelcontextprotocol/related-task":iL.optional()}),iV=a0({_meta:iZ.optional()}),iD=iV.extend({task:iM.optional()}),iU=a0({method:av(),params:iV.loose().optional()}),iF=a0({_meta:iZ.optional()}),iH=a0({method:av(),params:iF.loose().optional()}),iJ=a1({get[iT](){return i5.optional().catch(void 0)}}),iB=a1({_meta:iJ.optional()}),iK=a9([av(),aZ().int()]),iG=a0({jsonrpc:ia("2.0"),id:iK,...iU.shape}).strict(),iW=a0({jsonrpc:ia("2.0"),...iH.shape}).strict(),iX=a0({jsonrpc:ia("2.0"),id:iK,result:iB}).strict(),iY=a0({jsonrpc:ia("2.0"),id:iK.optional(),error:a0({code:aZ().int(),message:av(),data:aG().optional()})}).strict(),iQ=a9([iG,iW,iX,iY]),i0=a9([iX,iY]),i1=iB.strict(),i2=iF.extend({requestId:iK.optional(),reason:av().optional()}),i9=iH.extend({method:ia("notifications/cancelled"),params:i2}),i4=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),i3=a0({icons:aY(i4).optional()}),i6=a0({name:av(),title:av().optional()}),i5=i6.extend({...i6.shape,...i3.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),i8=a5(a0({applyDefaults:aF().optional()}),iN),i7=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:i8.optional(),url:iN.optional()}),iN.optional())),ne=a1({list:iN.optional(),cancel:iN.optional(),requests:a1({sampling:a1({createMessage:iN.optional()}).optional(),elicitation:a1({create:iN.optional()}).optional()}).optional()}),nt=a1({list:iN.optional(),cancel:iN.optional(),requests:a1({tools:a1({call:iN.optional()}).optional()}).optional()}),nr=a0({experimental:a7(av(),iN).optional(),sampling:a0({context:iN.optional(),tools:iN.optional()}).optional(),elicitation:i7.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:ne.optional(),extensions:a7(av(),iN).optional()}),na=iV.extend({protocolVersion:av(),capabilities:nr,clientInfo:i5}),ni=iU.extend({method:ia("initialize"),params:na}),nn=a0({experimental:a7(av(),iN).optional(),logging:iN.optional(),completions:iN.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:nt.optional(),extensions:a7(av(),iN).optional()}),no=iB.extend({protocolVersion:av(),capabilities:nn,serverInfo:i5,instructions:av().optional()}),ns=iH.extend({method:ia("notifications/initialized"),params:iF.optional()}),nl=iU.extend({method:ia("server/discover"),params:iV.optional()}),nc=iB.extend({supportedVersions:aY(av()),capabilities:nn,instructions:av().optional()}),nu=iU.extend({method:ia("ping"),params:iV.optional()}),nd=a0({progress:aZ(),total:il(aZ()),message:il(av())}),np=a0({...iF.shape,...nd.shape,progressToken:iA}),nm=iH.extend({method:ia("notifications/progress"),params:np}),nh=iV.extend({cursor:iz.optional()}),nf=iU.extend({params:nh.optional()}),ny=iB.extend({nextCursor:iz.optional()}),ng=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()}),nv=ng.extend({text:av()}),n_=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),nb=ng.extend({blob:n_}),nS=it(["user","assistant"]),n$=a0({audience:aY(nS).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),nw=a0({...i6.shape,...i3.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:n$.optional(),_meta:il(a1({}))}),nR=a0({...i6.shape,...i3.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:n$.optional(),_meta:il(a1({}))}),nk=nf.extend({method:ia("resources/list")}),nx=ny.extend({resources:aY(nw)}),nP=nf.extend({method:ia("resources/templates/list")}),nE=ny.extend({resourceTemplates:aY(nR)}),nT=iV.extend({uri:av()}),nj=iU.extend({method:ia("resources/read"),params:nT}),nC=iB.extend({contents:aY(a9([nv,nb]))}),nO=iH.extend({method:ia("notifications/resources/list_changed"),params:iF.optional()}),nI=iU.extend({method:ia("resources/subscribe"),params:nT}),nN=iU.extend({method:ia("resources/unsubscribe"),params:nT}),nq=a0({toolsListChanged:aF().optional(),promptsListChanged:aF().optional(),resourcesListChanged:aF().optional(),resourceSubscriptions:aY(av()).optional()}),nA=iV.extend({notifications:nq}),nz=iU.extend({method:ia("subscriptions/listen"),params:nA}),nM=iF.extend({notifications:nq}),nL=iH.extend({method:ia("notifications/subscriptions/acknowledged"),params:nM}),nZ=iJ.extend({[iC]:iK}),nV=iB.extend({_meta:nZ}),nD=iF.extend({uri:av()}),nU=iH.extend({method:ia("notifications/resources/updated"),params:nD}),nF=a0({name:av(),description:il(av()),required:il(aF())}),nH=a0({...i6.shape,...i3.shape,description:il(av()),arguments:il(aY(nF)),_meta:il(a1({}))}),nJ=nf.extend({method:ia("prompts/list")}),nB=ny.extend({prompts:aY(nH)}),nK=iV.extend({name:av(),arguments:a7(av(),av()).optional()}),nG=iU.extend({method:ia("prompts/get"),params:nK}),nW=a0({type:ia("text"),text:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nX=a0({type:ia("image"),data:n_,mimeType:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nY=a0({type:ia("audio"),data:n_,mimeType:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nQ=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),n0=a0({type:ia("resource"),resource:a9([nv,nb]),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),n1=nw.extend({type:ia("resource_link")}),n2=a9([nW,nX,nY,n1,n0]),n9=a0({role:nS,content:n2}),n4=iB.extend({description:av().optional(),messages:aY(n9)}),n3=iH.extend({method:ia("notifications/prompts/list_changed"),params:iF.optional()}),n6=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),n5=a0({taskSupport:it(["required","optional","forbidden"]).optional()}),n8=a0({...i6.shape,...i3.shape,description:av().optional(),inputSchema:a0({type:ia("object"),properties:a7(av(),iI).optional(),required:aY(av()).optional()}).catchall(aG()),outputSchema:a1({$schema:av().optional()}).optional(),annotations:n6.optional(),execution:n5.optional(),_meta:a7(av(),aG()).optional()}),n7=nf.extend({method:ia("tools/list")}),oe=ny.extend({tools:aY(n8)}),ot=iB.extend({content:aY(n2).default([]),structuredContent:aG().optional(),isError:aF().optional()}),or=ot.or(iB.extend({toolResult:aG()})),oa=iD.extend({name:av(),arguments:a7(av(),aG()).optional()}),oi=iU.extend({method:ia("tools/call"),params:oa}),on=iH.extend({method:ia("notifications/tools/list_changed"),params:iF.optional()}),oo=a0({autoRefresh:aF().default(!0),debounceMs:aZ().int().nonnegative().default(300)}),os=it(["debug","info","notice","warning","error","critical","alert","emergency"]),ol=iV.extend({level:os}),oc=iU.extend({method:ia("logging/setLevel"),params:ol}),ou=iF.extend({level:os,logger:av().optional(),data:aG()}),od=iH.extend({method:ia("notifications/message"),params:ou}),op=a0({name:av().optional()}),om=a0({hints:aY(op).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),oh=a0({mode:it(["auto","required","none"]).optional()}),of=a0({type:ia("tool_result"),toolUseId:av().describe("The unique identifier for the corresponding tool call."),content:aY(n2),structuredContent:aG().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),oy=a3("type",[nW,nX,nY]),og=a3("type",[nW,nX,nY,nQ,of]),ov=a0({role:nS,content:a9([og,aY(og)]),_meta:a7(av(),aG()).optional()}),o_=iD.extend({messages:aY(ov),modelPreferences:om.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:iN.optional(),tools:aY(n8).optional(),toolChoice:oh.optional()}),ob=iU.extend({method:ia("sampling/createMessage"),params:o_}),oS=iB.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens"]).or(av())),role:nS,content:oy}),o$=iB.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens","toolUse"]).or(av())),role:nS,content:a9([og,aY(og)])}),ow=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),oR=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),ok=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),ox=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),oP=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),oE=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),oT=a9([ox,oP]),oj=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),oC=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()}),oO=a9([oj,oC]),oI=a9([oE,oT,oO]),oN=a9([oI,ow,oR,ok]),oq=iD.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),oN),required:aY(av()).optional()}).catchall(aG())}),oA=iD.extend({mode:ia("url"),message:av(),elicitationId:av(),url:av().url()}),oz=a9([oq,oA]),oM=iU.extend({method:ia("elicitation/create"),params:oz}),oL=iF.extend({elicitationId:av()}),oZ=iH.extend({method:ia("notifications/elicitation/complete"),params:oL}),oV=iB.extend({action:it(["accept","decline","cancel"]),content:iR(e=>null===e?void 0:e,a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional())}),oD=a0({type:ia("ref/resource"),uri:av()}),oU=a0({type:ia("ref/prompt"),name:av()}),oF=iV.extend({ref:a9([oU,oD]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()}),oH=iU.extend({method:ia("completion/complete"),params:oF}),oJ=iB.extend({completion:a1({values:aY(av()).max(100),total:il(aZ().int()),hasMore:il(aF())})}),oB=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),oK=iU.extend({method:ia("roots/list"),params:iV.optional()}),oG=iB.extend({roots:aY(oB)}),oW=iH.extend({method:ia("notifications/roots/list_changed"),params:iF.optional()}),oX=a1({ttl:aZ().optional(),pollInterval:aZ().optional()}),oY=it(["working","input_required","completed","failed","cancelled"]),oQ=a0({taskId:av(),status:oY,ttl:a9([aZ(),aJ()]),createdAt:av(),lastUpdatedAt:av(),pollInterval:il(aZ()),statusMessage:il(av())}),o0=iB.extend({task:oQ}),o1=iF.merge(oQ),o2=iH.extend({method:ia("notifications/tasks/status"),params:o1}),o9=iU.extend({method:ia("tasks/get"),params:iV.extend({taskId:av()})}),o4=iB.merge(oQ),o3=iU.extend({method:ia("tasks/result"),params:iV.extend({taskId:av()})}),o6=iB.loose(),o5=nf.extend({method:ia("tasks/list")}),o8=ny.extend({tasks:aY(oQ)}),o7=iU.extend({method:ia("tasks/cancel"),params:iV.extend({taskId:av()})}),se=iB.merge(oQ),st=a9([nu,ni,nl,oH,oc,nG,nJ,nk,nP,nj,nI,nN,nz,oi,n7]),sr=a9([i9,nm,ns,oW]),sa=a9([i1,oS,o$,oV,oG]),si=a9([nu,ob,oM,oK]),sn=a9([i9,nm,od,nU,nO,on,n3,nL,oZ]),so=a9([i1,no,nc,oJ,n4,nB,nx,nE,nC,ot,oe,nV]),ss=rf(aw,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),Z}).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"}),sl=a1({resource:av().url(),authorization_servers:aY(ss).optional(),jwks_uri:av().url().optional(),scopes_supported:aY(av()).optional(),bearer_methods_supported:aY(av()).optional(),resource_signing_alg_values_supported:aY(av()).optional(),resource_name:av().optional(),resource_documentation:av().optional(),resource_policy_uri:av().url().optional(),resource_tos_uri:av().url().optional(),tls_client_certificate_bound_access_tokens:aF().optional(),authorization_details_types_supported:aY(av()).optional(),dpop_signing_alg_values_supported:aY(av()).optional(),dpop_bound_access_tokens_required:aF().optional()}),sc=a1({issuer:av(),authorization_endpoint:ss,token_endpoint:ss,registration_endpoint:ss.optional(),scopes_supported:aY(av()).optional(),response_types_supported:aY(av()),response_modes_supported:aY(av()).optional(),grant_types_supported:aY(av()).optional(),token_endpoint_auth_methods_supported:aY(av()).optional(),token_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),service_documentation:ss.optional(),revocation_endpoint:ss.optional(),revocation_endpoint_auth_methods_supported:aY(av()).optional(),revocation_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),introspection_endpoint:av().optional(),introspection_endpoint_auth_methods_supported:aY(av()).optional(),introspection_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),code_challenge_methods_supported:aY(av()).optional(),client_id_metadata_document_supported:aF().optional(),authorization_response_iss_parameter_supported:aF().optional().catch(void 0)}),su=a1({issuer:av(),authorization_endpoint:ss,token_endpoint:ss,userinfo_endpoint:ss.optional(),jwks_uri:ss,registration_endpoint:ss.optional(),scopes_supported:aY(av()).optional(),response_types_supported:aY(av()),response_modes_supported:aY(av()).optional(),grant_types_supported:aY(av()).optional(),acr_values_supported:aY(av()).optional(),subject_types_supported:aY(av()),id_token_signing_alg_values_supported:aY(av()),id_token_encryption_alg_values_supported:aY(av()).optional(),id_token_encryption_enc_values_supported:aY(av()).optional(),userinfo_signing_alg_values_supported:aY(av()).optional(),userinfo_encryption_alg_values_supported:aY(av()).optional(),userinfo_encryption_enc_values_supported:aY(av()).optional(),request_object_signing_alg_values_supported:aY(av()).optional(),request_object_encryption_alg_values_supported:aY(av()).optional(),request_object_encryption_enc_values_supported:aY(av()).optional(),token_endpoint_auth_methods_supported:aY(av()).optional(),token_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),display_values_supported:aY(av()).optional(),claim_types_supported:aY(av()).optional(),claims_supported:aY(av()).optional(),service_documentation:av().optional(),claims_locales_supported:aY(av()).optional(),ui_locales_supported:aY(av()).optional(),claims_parameter_supported:aF().optional(),request_parameter_supported:aF().optional(),request_uri_parameter_supported:aF().optional(),require_request_uri_registration:aF().optional(),op_policy_uri:ss.optional(),op_tos_uri:ss.optional(),client_id_metadata_document_supported:aF().optional(),authorization_response_iss_parameter_supported:aF().optional().catch(void 0)}),sd=a0({...su.shape,...sc.pick({code_challenge_methods_supported:!0}).shape}),sp=a0({access_token:av(),id_token:av().optional(),token_type:av(),expires_in:new aL({type:"number",coerce:!0,checks:[],...eA(void 0)}).optional(),scope:av().optional(),refresh_token:av().optional()}).strip(),sm=a0({issued_token_type:ia("urn:ietf:params:oauth:token-type:id-jag"),access_token:av(),token_type:av().optional(),expires_in:aZ().optional(),scope:av().optional()}).strip(),sh=a0({error:av(),error_description:av().optional(),error_uri:av().optional()}),sf=ss.optional().or(ia("").transform(()=>void 0)),sy=a0({redirect_uris:aY(ss),token_endpoint_auth_method:av().optional(),grant_types:aY(av()).optional(),response_types:aY(av()).optional(),application_type:av().optional(),client_name:av().optional(),client_uri:ss.optional(),logo_uri:sf,scope:av().optional(),contacts:aY(av()).optional(),tos_uri:sf,policy_uri:av().optional(),jwks_uri:ss.optional(),jwks:new aB({type:"any"}).optional(),software_id:av().optional(),software_version:av().optional(),software_statement:av().optional()}).strip(),sg=a0({client_id:av(),client_secret:av().optional(),client_id_issued_at:aZ().optional(),client_secret_expires_at:aZ().optional()}).strip(),sv=sy.merge(sg),s_=a0({error:av(),error_description:av().optional()}).strip(),sb=a0({token:av(),token_type_hint:av().optional()}).strip(),sS=Symbol.for("mcp.sdk.errorBrands");function s$(e,t){let r=new Set,a=t;for(;"function"==typeof a;){let e=a.mcpBrand;Object.prototype.hasOwnProperty.call(a,"mcpBrand")&&"string"==typeof e&&r.add(e),a=Object.getPrototypeOf(a)}0!==r.size&&Object.defineProperty(e,sS,{value:r,enumerable:!1,configurable:!0})}function sw(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,sS)){let r=t[sS];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",s$(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 sR=((m={}).NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m);var sk=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",s$(this,new.target)}};(class extends sk{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 sx={};function sP(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sE(e,t){let r={};for(let[a,i]of Object.entries(e)){if(void 0===i)continue;let e=void 0===t?void 0:t[a];if(void 0===e){r[a]=i;continue}if(sP(i)&&sP(e)){let t={};for(let[r,n]of Object.entries(i))void 0!==n&&void 0===e[r]&&("elicitation"!==a||"form"!==r||void 0!==e.form||void 0!==e.url)&&(t[r]=n);Object.keys(t).length>0&&(r[a]=t)}}return Object.keys(r).length>0?r:void 0}let sT="2026-07-28",sj=[sT];function sC(e){return e.filter(e=>e>=sT)}function sO(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 sI=["task","inputRequests","requestState"];function sN(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||sI.some(t=>t in e)?e:{...e,content:[]}}function sq(){let t,r,a,i,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w,R,k,x,P,E,T,j,C,O,I,N,q,A,z,M,L,Z,V,D,U,F,H,J,B,K,G,W,X,Y,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,ey,eg,ev,e_,eb,eS,e$,ew,eR,ek,ex,eP,eE,eT,ej,eC,eO,eI,eN,eq,eA,ez,eM,eL,eZ,eV,eD,eU,eF,eH,eJ,eB,eK,eG,eW,eX,eY,eQ,e0,e1,e2,e9,e4,e3,e6,e5,e8,e7,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,ty,tg,tv,t_,tb,tS,t$;return e??=(t=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),t),aY(t)])),r=a7(av(),t),a=a9([av(),aZ().int()]),i=av(),n=a0({ttl:aZ().optional()}),o=a0({taskId:av()}),c=(l=a0({_meta:(s=a1({progressToken:a.optional(),"io.modelcontextprotocol/related-task":o.optional()})).optional()})).extend({task:n.optional()}),u=a0({method:av(),params:l.loose().optional()}),d=a0({_meta:s.optional()}),p=a0({method:av(),params:d.loose().optional()}),m=a1({_meta:s.optional()}),h=a9([av(),aZ().int()]),f=m.strict(),y=d.extend({requestId:h.optional(),reason:av().optional()}),g=p.extend({method:ia("notifications/cancelled"),params:y}),v=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),_=a0({icons:aY(v).optional()}),S=(b=a0({name:av(),title:av().optional()})).extend({...b.shape,..._.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),$=a5(a0({applyDefaults:aF().optional()}),r),w=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:$.optional(),url:r.optional()}),r.optional())),R=a1({list:r.optional(),cancel:r.optional(),requests:a1({sampling:a1({createMessage:r.optional()}).optional(),elicitation:a1({create:r.optional()}).optional()}).optional()}),k=a1({list:r.optional(),cancel:r.optional(),requests:a1({tools:a1({call:r.optional()}).optional()}).optional()}),x=a0({experimental:a7(av(),r).optional(),sampling:a0({context:r.optional(),tools:r.optional()}).optional(),elicitation:w.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:R.optional(),extensions:a7(av(),r).optional()}),P=l.extend({protocolVersion:av(),capabilities:x,clientInfo:S}),E=u.extend({method:ia("initialize"),params:P}),T=a0({experimental:a7(av(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:k.optional(),extensions:a7(av(),r).optional()}),j=m.extend({protocolVersion:av(),capabilities:T,serverInfo:S,instructions:av().optional()}),C=p.extend({method:ia("notifications/initialized"),params:d.optional()}),O=u.extend({method:ia("ping"),params:l.optional()}),I=a0({progress:aZ(),total:il(aZ()),message:il(av())}),N=a0({...d.shape,...I.shape,progressToken:a}),q=p.extend({method:ia("notifications/progress"),params:N}),A=l.extend({cursor:i.optional()}),z=u.extend({params:A.optional()}),M=m.extend({nextCursor:i.optional()}),Z=(L=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()})).extend({text:av()}),V=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D=L.extend({blob:V}),F=a0({audience:aY(U=it(["user","assistant"])).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),H=a0({...b.shape,..._.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:F.optional(),_meta:il(a1({}))}),J=a0({...b.shape,..._.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:F.optional(),_meta:il(a1({}))}),B=z.extend({method:ia("resources/list")}),K=M.extend({resources:aY(H)}),G=z.extend({method:ia("resources/templates/list")}),W=M.extend({resourceTemplates:aY(J)}),X=l.extend({uri:av()}),Y=u.extend({method:ia("resources/read"),params:X}),Q=m.extend({contents:aY(a9([Z,D]))}),ee=p.extend({method:ia("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:ia("resources/subscribe"),params:X}),er=u.extend({method:ia("resources/unsubscribe"),params:X}),ea=d.extend({uri:av()}),ei=p.extend({method:ia("notifications/resources/updated"),params:ea}),en=a0({name:av(),description:il(av()),required:il(aF())}),eo=a0({...b.shape,..._.shape,description:il(av()),arguments:il(aY(en)),_meta:il(a1({}))}),es=z.extend({method:ia("prompts/list")}),el=M.extend({prompts:aY(eo)}),ec=l.extend({name:av(),arguments:a7(av(),av()).optional()}),eu=u.extend({method:ia("prompts/get"),params:ec}),ed=a0({type:ia("text"),text:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),ep=a0({type:ia("image"),data:V,mimeType:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),em=a0({type:ia("audio"),data:V,mimeType:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),eh=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),ef=a0({type:ia("resource"),resource:a9([Z,D]),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),ev=a0({role:U,content:eg=a9([ed,ep,em,ey=H.extend({type:ia("resource_link")}),ef])}),e_=m.extend({description:av().optional(),messages:aY(ev)}),eb=p.extend({method:ia("notifications/prompts/list_changed"),params:d.optional()}),eS=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),e$=a0({taskSupport:it(["required","optional","forbidden"]).optional()}),ew=a0({...b.shape,..._.shape,description:av().optional(),inputSchema:a0({type:ia("object"),properties:a7(av(),t).optional(),required:aY(av()).optional()}).catchall(aG()),outputSchema:a0({type:ia("object"),properties:a7(av(),t).optional(),required:aY(av()).optional()}).catchall(aG()).optional(),annotations:eS.optional(),execution:e$.optional(),_meta:a7(av(),aG()).optional()}),eR=z.extend({method:ia("tools/list")}),ek=M.extend({tools:aY(ew)}),ex=m.extend({content:aY(eg),structuredContent:a7(av(),aG()).optional(),isError:aF().optional()}),eP=c.extend({name:av(),arguments:a7(av(),aG()).optional()}),eE=u.extend({method:ia("tools/call"),params:eP}),eT=p.extend({method:ia("notifications/tools/list_changed"),params:d.optional()}),ej=it(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=l.extend({level:ej}),eO=u.extend({method:ia("logging/setLevel"),params:eC}),eI=d.extend({level:ej,logger:av().optional(),data:aG()}),eN=p.extend({method:ia("notifications/message"),params:eI}),eq=a0({name:av().optional()}),eA=a0({hints:aY(eq).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),ez=a0({mode:it(["auto","required","none"]).optional()}),eM=a0({type:ia("tool_result"),toolUseId:av().describe("The unique identifier for the corresponding tool call."),content:aY(eg),structuredContent:a0({}).loose().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),eL=a3("type",[ed,ep,em]),eV=a0({role:U,content:a9([eZ=a3("type",[ed,ep,em,eh,eM]),aY(eZ)]),_meta:a7(av(),aG()).optional()}),eD=c.extend({messages:aY(eV),modelPreferences:eA.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:r.optional(),tools:aY(ew).optional(),toolChoice:ez.optional()}),eU=u.extend({method:ia("sampling/createMessage"),params:eD}),eF=m.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens"]).or(av())),role:U,content:eL}),eH=m.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens","toolUse"]).or(av())),role:U,content:a9([eZ,aY(eZ)])}),eJ=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),eB=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),eK=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),eG=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),eW=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),eX=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),eY=a9([eG,eW]),eQ=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),e1=a9([eQ,e0=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()})]),e2=a9([eX,eY,e1]),e9=a9([e2,eJ,eB,eK]),e4=c.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),e9),required:aY(av()).optional()}).catchall(aG())}),e6=a9([e4,e3=c.extend({mode:ia("url"),message:av(),elicitationId:av(),url:av().url()})]),e5=u.extend({method:ia("elicitation/create"),params:e6}),e8=d.extend({elicitationId:av()}),e7=p.extend({method:ia("notifications/elicitation/complete"),params:e8}),te=m.extend({action:it(["accept","decline","cancel"]),content:iR(e=>null===e?void 0:e,a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional())}),tt=a0({type:ia("ref/resource"),uri:av()}),tr=a0({type:ia("ref/prompt"),name:av()}),ta=l.extend({ref:a9([tr,tt]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()}),ti=u.extend({method:ia("completion/complete"),params:ta}),tn=m.extend({completion:a1({values:aY(av()).max(100),total:il(aZ().int()),hasMore:il(aF())})}),to=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),ts=u.extend({method:ia("roots/list"),params:l.optional()}),tl=m.extend({roots:aY(to)}),tc=p.extend({method:ia("notifications/roots/list_changed"),params:d.optional()}),tu=a1({ttl:aZ().optional(),pollInterval:aZ().optional()}),td=it(["working","input_required","completed","failed","cancelled"]),tp=a0({taskId:av(),status:td,ttl:a9([aZ(),aJ()]),createdAt:av(),lastUpdatedAt:av(),pollInterval:il(aZ()),statusMessage:il(av())}),tm=m.extend({task:tp}),th=d.merge(tp),tf=p.extend({method:ia("notifications/tasks/status"),params:th}),ty=u.extend({method:ia("tasks/get"),params:l.extend({taskId:av()})}),tg=m.merge(tp),tv=u.extend({method:ia("tasks/result"),params:l.extend({taskId:av()})}),t_=m.loose(),tb=z.extend({method:ia("tasks/list")}),tS=M.extend({tasks:aY(tp)}),t$=u.extend({method:ia("tasks/cancel"),params:l.extend({taskId:av()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,TaskMetadataSchema:n,RelatedTaskMetadataSchema:o,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:g,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:k,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:P,InitializeRequestSchema:E,ServerCapabilitiesSchema:T,InitializeResultSchema:j,InitializedNotificationSchema:C,PingRequestSchema:O,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:A,PaginatedRequestSchema:z,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:Z,BlobResourceContentsSchema:D,RoleSchema:U,AnnotationsSchema:F,ResourceSchema:H,ResourceTemplateSchema:J,ListResourcesRequestSchema:B,ListResourcesResultSchema:K,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:W,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Y,ReadResourceResultSchema:Q,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:eo,ListPromptsRequestSchema:es,ListPromptsResultSchema:el,GetPromptRequestParamsSchema:ec,GetPromptRequestSchema:eu,TextContentSchema:ed,ImageContentSchema:ep,AudioContentSchema:em,ToolUseContentSchema:eh,EmbeddedResourceSchema:ef,ResourceLinkSchema:ey,ContentBlockSchema:eg,PromptMessageSchema:ev,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eb,ToolAnnotationsSchema:eS,ToolExecutionSchema:e$,ToolSchema:ew,ListToolsRequestSchema:eR,ListToolsResultSchema:ek,CallToolResultSchema:ex,CallToolRequestParamsSchema:eP,CallToolRequestSchema:eE,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eO,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eq,ModelPreferencesSchema:eA,ToolChoiceSchema:ez,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eD,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eJ,StringSchemaSchema:eB,NumberSchemaSchema:eK,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eW,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eY,UntitledMultiSelectEnumSchemaSchema:eQ,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e6,ElicitRequestSchema:e5,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:e7,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:to,ListRootsRequestSchema:ts,ListRootsResultSchema:tl,RootsListChangedNotificationSchema:tc,TaskCreationParamsSchema:tu,TaskStatusSchema:td,TaskSchema:tp,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:th,TaskStatusNotificationSchema:tf,GetTaskRequestSchema:ty,GetTaskResultSchema:tg,GetTaskPayloadRequestSchema:tv,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tb,ListTasksResultSchema:tS,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(tp),ClientRequestSchema:a9([O,E,ti,eO,eu,es,B,G,Y,et,er,eE,eR,ty,tv,tb,t$]),ClientNotificationSchema:a9([g,q,C,tc,tf]),ClientResultSchema:a9([f,eF,eH,te,tl,tg,tS,tm]),ServerRequestSchema:a9([O,eU,e5,ts,ty,tv,tb,t$]),ServerNotificationSchema:a9([g,q,eN,ei,ee,eT,eb,tf,e7]),ServerResultSchema:a9([f,j,tn,e_,el,K,W,Q,ex,ek,tg,tS,tm]),CallToolResultWireSchema:aG().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of sI)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(sN).pipe(ex)})}function sA(e){return"object"!==e.type}let sz=new Set(["const","enum","default","examples"]),sM=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function sL(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let sZ={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},sV={"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},sD={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 sU(){if(t)return t;let e=sq();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 sF(e){return Object.prototype.hasOwnProperty.call(sZ,e)}function sH(e){return Object.prototype.hasOwnProperty.call(sV,e)}function sJ(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sB(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(sZ),Object.keys(sV);let sK={ok:!1,reason:"not-in-era"};function sG(e){return sJ(e)&&sJ(e.outputSchema)&&sA(e.outputSchema)}let sW={era:"2025-11-25",hasRequestMethod:sF,hasNotificationMethod:sH,validateRequest:(e,t)=>sB(sF(e)?sU().requestSchemas[e]:void 0,t),validateResult:(e,t)=>sB(Object.prototype.hasOwnProperty.call(sD,e)?sU().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>sB(sH(e)?sU().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>sK,validateInputResponse:()=>sK,samplingResultVariant:(e,t)=>{let r=sq();return sB(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=sO(e),a=r.structuredContent;if(void 0===a)return r;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==t&&sA(t);return i||n?{...r,structuredContent:{result:a}}:r},decodeResult(e,t){if(sJ(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=>sG(e))?{...t,tools:r.map(e=>sG(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(sL(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let a="string"==typeof(t=e.$schema)&&z.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,i=(e,t)=>{if(Array.isArray(e))return e.map(e=>i(e,!1));if(null===e||"object"!=typeof e||!t&&sL(e.$id))return e;let r={},n=!1;for(let[o,s]of Object.entries(e))t?r[o]=i(s,!1):("$ref"===o||"$dynamicRef"===o)&&"string"==typeof s?r[o]="#"===s?"#/properties/result":s.startsWith("#/")?`#/properties/result${s.slice(1)}`:s:"$recursiveRef"===o&&"#"===s&&a?n=!0:sz.has(o)?r[o]=s:sM.has(o)?r[o]=i(s,!0):r[o]=i(s,!1);return n&&("$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:i(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function sX(){return i??=function(){let e=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),e),aY(e)])),t=a7(av(),e),r=a9([av(),aZ().int()]),a=av(),i=a9([av(),aZ().int()]),n=it(["user","assistant"]),o=it(["debug","info","notice","warning","error","critical","alert","emergency"]),s=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=a0({ttl:aZ().optional()}),c=a0({taskId:av()}),u=a1({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=a0({_meta:u.optional()}),p=d.extend({task:l.optional()}),m=a0({_meta:u.optional()}),h=a0({method:av(),params:m.loose().optional()}),f=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),y=a0({icons:aY(f).optional()}),g=a0({name:av(),title:av().optional()}),v=g.extend({...g.shape,...y.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),_=a5(a0({applyDefaults:aF().optional()}),t),b=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:_.optional(),url:t.optional()}),t.optional())),S=a1({list:t.optional(),cancel:t.optional(),requests:a1({sampling:a1({createMessage:t.optional()}).optional(),elicitation:a1({create:t.optional()}).optional()}).optional()}),$=a1({list:t.optional(),cancel:t.optional(),requests:a1({tools:a1({call:t.optional()}).optional()}).optional()}),w=a0({experimental:a7(av(),t).optional(),sampling:a0({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:S.optional(),extensions:a7(av(),t).optional()}),R=a0({experimental:a7(av(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:$.optional(),extensions:a7(av(),t).optional()}),k=a0({progress:aZ(),total:il(aZ()),message:il(av())}),x=a0({...m.shape,...k.shape,progressToken:r}),P=h.extend({method:ia("notifications/progress"),params:x}),E=m.extend({level:o,logger:av().optional(),data:aG()}),T=h.extend({method:ia("notifications/message"),params:E}),j=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()}),C=j.extend({text:av()}),O=j.extend({blob:s}),I=a0({audience:aY(n).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),N=a0({...g.shape,...y.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:I.optional(),_meta:il(a1({}))}),q=a0({...g.shape,...y.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:I.optional(),_meta:il(a1({}))}),A=h.extend({method:ia("notifications/resources/list_changed"),params:m.optional()}),z=m.extend({uri:av()}),M=h.extend({method:ia("notifications/resources/updated"),params:z}),L=a0({name:av(),description:il(av()),required:il(aF())}),Z=a0({...g.shape,...y.shape,description:il(av()),arguments:il(aY(L)),_meta:il(a1({}))}),V=h.extend({method:ia("notifications/prompts/list_changed"),params:m.optional()}),D=a0({type:ia("text"),text:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),U=a0({type:ia("image"),data:s,mimeType:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),F=a0({type:ia("audio"),data:s,mimeType:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),H=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),J=a0({type:ia("resource"),resource:a9([C,O]),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),B=N.extend({type:ia("resource_link")}),K=a9([D,U,F,B,J]),G=a0({role:n,content:K}),W=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),X=h.extend({method:ia("notifications/tools/list_changed"),params:m.optional()}),Y=a0({name:av().optional()}),Q=a0({hints:aY(Y).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),ee=a0({mode:it(["auto","required","none"]).optional()}),et=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),er=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),ea=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),ei=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),en=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),eo=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),es=a9([ei,en]),el=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),ec=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()}),eu=a9([el,ec]),ed=a9([eo,es,eu]),ep=a9([ed,et,er,ea]),em=p.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),ep),required:aY(av()).optional()}).catchall(aG())}),eh=a0({type:ia("ref/resource"),uri:av()}),ef=a0({type:ia("ref/prompt"),name:av()}),ey=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),eg=w.shape,ev=a0({experimental:eg.experimental,sampling:eg.sampling,elicitation:eg.elicitation,roots:eg.roots,extensions:eg.extensions}),e_=R.shape,eb=a0({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=a1({progressToken:r.optional(),[iP]:av(),[iE]:v.optional(),[ij]:ev,[iO]:o.optional()}),e$=a0({...g.shape,...y.shape,description:av().optional(),inputSchema:a1({$schema:av().optional(),type:ia("object")}),outputSchema:a1({$schema:av().optional()}).optional(),annotations:W.optional(),_meta:a7(av(),aG()).optional()}),ew=a0({type:ia("tool_result"),toolUseId:av(),content:aY(K),structuredContent:aG().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),eR=a9([D,U,F,H,ew]),ek=a0({role:n,content:a9([eR,aY(eR)]),_meta:a7(av(),aG()).optional()}),ex=av(),eP=a1({[iT]:v.optional().catch(void 0)}),eE=eP.optional();function eT(e){return a1({_meta:eE,resultType:ex.default("complete"),...e})}let ej=eT({}),eC=eT({nextCursor:a.optional()}),eO=eT({content:aY(K),structuredContent:aG().optional(),isError:aF().optional()}),eI=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),tools:aY(e$),nextCursor:a.optional()}),eN=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),prompts:aY(Z),nextCursor:a.optional()}),eq=eT({description:av().optional(),messages:aY(G)}),eA=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resources:aY(N),nextCursor:a.optional()}),ez=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resourceTemplates:aY(q),nextCursor:a.optional()}),eM=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),contents:aY(a9([C,O]))}),eL=eT({completion:a0({values:aY(av()).max(100),total:aZ().int().optional(),hasMore:aF().optional()}).loose()}),eZ=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"])}),eV=eT({ttlMs:aZ().int().min(0).catch(0),cacheScope:it(["public","private"]).catch("private"),supportedVersions:aY(av()),capabilities:eb,instructions:av().optional()}),eD=a0({messages:aY(ek),modelPreferences:Q.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:t.optional(),tools:aY(e$).optional(),toolChoice:ee.optional()}),eU=a0({method:ia("sampling/createMessage"),params:eD}),eF=a0({method:ia("roots/list"),params:a0({_meta:a7(av(),aG()).optional()}).optional()}),eH=a0({...ek.shape,model:av(),stopReason:av().optional()}),eJ=a0({roots:aY(ey)}),eB=a0({action:it(["accept","decline","cancel"]),content:a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional()}),eK=a0({mode:ia("url"),message:av(),url:av().url()}),eG=a9([em,eK]),eW=a0({method:ia("elicitation/create"),params:eG}),eX=a9([eU,eF,eW]),eY=a9([eH,eJ,eB]),eQ=a7(av(),eX),e0=a7(av(),eY),e1=eT({inputRequests:eQ.optional(),requestState:av().optional()}),e2={inputResponses:e0.optional(),requestState:av().optional()},e9=a0({_meta:eS,...e2}),e4=a1({progressToken:r.optional()});function e3(e,t){return a0({method:ia(e),params:a0({_meta:eS,...t})})}function e6(e,t){return a0({method:ia(e),params:a0({_meta:e4.optional(),...t}).optional()})}let e5={name:av(),arguments:a7(av(),aG()).optional(),...e2},e8={cursor:a.optional()},e7=e3("tools/call",e5),te=e3("tools/list",e8),tt=e3("prompts/list",e8),tr=e3("prompts/get",{name:av(),arguments:a7(av(),av()).optional(),...e2}),ta=e3("resources/list",e8),ti=e3("resources/templates/list",e8),tn=e3("resources/read",{uri:av(),...e2}),to={ref:a9([ef,eh]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()},ts=e3("completion/complete",to),tl=e3("server/discover",{}),tc=a0({toolsListChanged:aF().optional(),promptsListChanged:aF().optional(),resourcesListChanged:aF().optional(),resourceSubscriptions:aY(av()).optional()}),tu={notifications:tc},td=e3("subscriptions/listen",tu),tp=eP.extend({"io.modelcontextprotocol/subscriptionId":i}),tm=a1({_meta:tp,resultType:ex.default("complete")}),th={"tools/call":e6("tools/call",e5),"tools/list":e6("tools/list",e8),"prompts/get":e6("prompts/get",{name:av(),arguments:a7(av(),av()).optional()}),"prompts/list":e6("prompts/list",e8),"resources/list":e6("resources/list",e8),"resources/templates/list":e6("resources/templates/list",e8),"resources/read":e6("resources/read",{uri:av()}),"completion/complete":e6("completion/complete",to),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",tu)};function tf(e){return a1({_meta:eE,...e})}let ty={"tools/call":tf({content:aY(K),structuredContent:aG().optional(),isError:aF().optional()}),"tools/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),tools:aY(e$),nextCursor:a.optional()}),"prompts/get":tf({description:av().optional(),messages:aY(G)}),"prompts/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),prompts:aY(Z),nextCursor:a.optional()}),"resources/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resources:aY(N),nextCursor:a.optional()}),"resources/templates/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resourceTemplates:aY(q),nextCursor:a.optional()}),"resources/read":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),contents:aY(a9([C,O]))}),"completion/complete":tf({completion:a0({values:aY(av()).max(100),total:aZ().int().optional(),hasMore:aF().optional()}).loose()}),"server/discover":tf({ttlMs:aZ().int().min(0).catch(0),cacheScope:it(["public","private"]).catch("private"),supportedVersions:aY(av()),capabilities:eb,instructions:av().optional()}),"subscriptions/listen":tf({})},tg=a1({"io.modelcontextprotocol/subscriptionId":i.optional()}),tv=a0({method:ia("notifications/subscriptions/acknowledged"),params:a0({_meta:tg.optional(),notifications:tc})}),t_=a0({_meta:tg.optional(),requestId:i,reason:av().optional()}),tb=a0({method:ia("notifications/cancelled"),params:t_}),tS=e=>a0({jsonrpc:ia("2.0"),id:a9([av(),aZ().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:o,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:f,IconsSchema:y,BaseMetadataSchema:g,ImplementationSchema:v,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:R,ProgressSchema:k,ProgressNotificationParamsSchema:x,ProgressNotificationSchema:P,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:T,ResourceContentsSchema:j,TextResourceContentsSchema:C,BlobResourceContentsSchema:O,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:q,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:Z,PromptListChangedNotificationSchema:V,TextContentSchema:D,ImageContentSchema:U,AudioContentSchema:F,ToolUseContentSchema:H,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:K,PromptMessageSchema:G,ToolAnnotationsSchema:W,ToolListChangedNotificationSchema:X,ModelHintSchema:Y,ModelPreferencesSchema:Q,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:eo,SingleSelectEnumSchemaSchema:es,UntitledMultiSelectEnumSchemaSchema:el,TitledMultiSelectEnumSchemaSchema:ec,MultiSelectEnumSchemaSchema:eu,EnumSchemaSchema:ed,PrimitiveSchemaDefinitionSchema:ep,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:eh,PromptReferenceSchema:ef,RootSchema:ey,ClientCapabilities2026Schema:ev,ServerCapabilities2026Schema:eb,RequestMetaEnvelopeSchema:eS,ToolSchema:e$,ToolResultContentSchema:ew,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:ek,ResultTypeSchema:ex,ResultMetaSchema:eP,ResultSchema:ej,PaginatedResultSchema:eC,CallToolResultSchema:eO,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eq,ListResourcesResultSchema:eA,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eZ,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eD,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eF,CreateMessageResultSchema:eH,ListRootsResultSchema:eJ,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eK,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eW,InputRequestSchema:eX,InputResponseSchema:eY,InputRequestsSchema:eQ,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e7,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:ts,DiscoverRequestSchema:tl,SubscriptionFilterSchema:tc,SubscriptionsListenRequestSchema:td,SubscriptionsListenResultMetaSchema:tp,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:th,dispatchResultSchemas:ty,NotificationMetaSchema:tg,SubscriptionsAcknowledgedNotificationSchema:tv,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tb,notificationSchemas2026:{"notifications/cancelled":tb,"notifications/progress":P,"notifications/message":T,"notifications/resources/updated":M,"notifications/resources/list_changed":A,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":tv},JSONRPCResultResponseSchema:tS(ej),CallToolResultResponseSchema:tS(a9([eO,e1])),ListToolsResultResponseSchema:tS(eI),ListPromptsResultResponseSchema:tS(eN),GetPromptResultResponseSchema:tS(a9([eq,e1])),ListResourcesResultResponseSchema:tS(eA),ListResourceTemplatesResultResponseSchema:tS(ez),ReadResourceResultResponseSchema:tS(a9([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eV)}}()}let sY=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],sQ=Symbol("modelcontextprotocol.resultCacheHintFallback");function s0(e,t){if(void 0===t)return e;let r=e[sQ];if(void 0===r)return{...e,[sQ]:t};let a={},i=r.ttlMs??t.ttlMs;void 0!==i&&(a.ttlMs=i);let n=r.cacheScope??t.cacheScope;return void 0!==n&&(a.cacheScope=n),{...e,[sQ]:a}}function s1(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function s2(e){return"public"===e||"private"===e}function s9(e,t){if(void 0!==e.ttlMs&&!s1(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(void 0!==e.cacheScope&&!s2(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let s4=((h={})[h.ParseError=-32700]="ParseError",h[h.InvalidRequest=-32600]="InvalidRequest",h[h.MethodNotFound=-32601]="MethodNotFound",h[h.InvalidParams=-32602]="InvalidParams",h[h.InternalError=-32603]="InternalError",h[h.ResourceNotFound=-32002]="ResourceNotFound",h[h.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",h[h.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",h[h.UrlElicitationRequired=-32042]="UrlElicitationRequired",h);var s3=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",s$(this,new.target)}static fromError(t,r,a){return t===s4.UrlElicitationRequired&&a&&a.elicitations?new s5(a.elicitations,r):t===s4.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new s8({supported:a.supported,requested:a.requested},r):(t===s4.InvalidParams||t===s4.ResourceNotFound)&&"string"==typeof a?.uri&&(t===s4.ResourceNotFound||1===Object.keys(a).length)?new s6(a.uri,r):t===s4.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new s7({requiredCapabilities:a.requiredCapabilities},r):new e(t,r,a)}},s6=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(s4.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},s5=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(s4.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},s8=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(s4.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},s7=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(s4.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let le=["tools/call","prompts/get","resources/read"],lt=["elicitation/create","sampling/createMessage","roots/list"];function lr(){if(n)return n;let e=sX();return n={request:{"elicitation/create":a0({method:ia("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":a0({method:ia("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":a0({method:ia("roots/list"),params:a1({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function la(e){return lt.includes(e)}function li(e){return la(e)?lr().request[e]:void 0}let ln={"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},lo={"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 ls(e){return Object.prototype.hasOwnProperty.call(ln,e)}function ll(e){return Object.prototype.hasOwnProperty.call(lo,e)}function lc(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lu(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(ln),Object.keys(lo);let ld={ok:!1,reason:"not-in-era"},lp=[iP,ij],lm={era:"2026-07-28",hasRequestMethod:ls,hasNotificationMethod:ll,hasInputRequestMethod:e=>void 0!==li(e),validateRequest:(e,t)=>lu(ls(e)?sX().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>lu(Object.prototype.hasOwnProperty.call(ln,e)?sX().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>lu(ll(e)?sX().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>lu(li(e),t),validateInputResponse:(e,t)=>lu(la(e)?lr().response[e]:void 0,t),samplingResultVariant:()=>ld,outboundEnvelope:e=>({[iP]:e.protocolVersion,[iE]:e.clientInfo,[ij]:e.clientCapabilities,...void 0!==e.logLevel&&{[iO]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of lp)r in e||t.push({key:r,problem:"missing"});let r=sX().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),a=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===a&&"missing"===e.problem)||t.push({key:a,problem:e.message})}return t},projectCallToolResult:e=>sO(e),inputRequestSchema:li,decodeResult(e,t){if(!lc(t))return{kind:"invalid",error:new sk(sR.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new sk(sR.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 sk(sR.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,a=lc(r)?r:{},i=t.requestState;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new sk(sR.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:a,..."string"==typeof i&&{requestState:i}}}if("complete"!==r)return{kind:"invalid",error:new sk(sR.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let a=function(){if(o)return o;let e=sX();return o={"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}}(),i=Object.hasOwn(a,e)?a[e]:void 0;if(void 0!==i){let r=i.safeParse(t);if(!r.success)return{kind:"invalid",error:new sk(sR.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[iT]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[iT]?e:{...e,_meta:{...r,[iT]:t}}})(function(e,t){var r,a;let i=t[sQ];if("complete"!==t.resultType||!sY.includes(e)){let e;return void 0===i?t:(e={...t},delete e[sQ],e)}let n=s1(t.ttlMs)?t.ttlMs:void 0!==(r=i)&&s1(r.ttlMs)?r.ttlMs:0,o=s2(t.cacheScope)?t.cacheScope:void 0!==(a=i)&&s2(a.cacheScope)?a.cacheScope:"private",s={...t,ttlMs:n,cacheScope:o};return delete s[sQ],s}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||le.includes(e))return t;throw new s3(s4.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,a=!1,i=()=>(a||(r={...r},a=!0),r),n=t.tools;"tools/list"===e&&Array.isArray(n)&&n.some(e=>lc(e)&&"execution"in e)&&(i().tools=n.map(e=>{if(!lc(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(lc(o)&&"tasks"in o){let e={...o};delete e.tasks,i().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=sX().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("; ")}`}},lh="2026-07-28";function lf(e){return void 0!==e&&e>=sT?lm:sW}function ly(e){return void 0!==e.revision?lf(e.revision).era:"modern"===e.era?lm.era:sW.era}function lg(e){return l_.some(t=>t.hasRequestMethod(e))}function lv(e){return l_.some(t=>t.hasNotificationMethod(e))}let l_=[sW,lm];function lb(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lS(e){if(!lb(e))return;let t=e._meta;return lb(t)?t:void 0}function l$(e){let t=lS(e);return void 0!==t&&iP in t}function lw(e){let t=lS(e)?.[iP];return"string"==typeof t?t:void 0}function lR(e){return lf(lh).validateEnvelopeMeta(e)}var lk=((e,t)=>{let r={};for(var a in e)T(r,a,{get:e[a],enumerable:!0});return t&&T(r,Symbol.toStringTag,{value:"Module"}),r})({AnnotationsSchema:()=>n$,AudioContentSchema:()=>nY,BaseMetadataSchema:()=>i6,BaseRequestParamsSchema:()=>iV,BlobResourceContentsSchema:()=>nb,BooleanSchemaSchema:()=>ow,CallToolRequestParamsSchema:()=>oa,CallToolRequestSchema:()=>oi,CallToolResultSchema:()=>ot,CancelTaskRequestSchema:()=>o7,CancelTaskResultSchema:()=>se,CancelledNotificationParamsSchema:()=>i2,CancelledNotificationSchema:()=>i9,ClientCapabilitiesSchema:()=>nr,ClientNotificationSchema:()=>sr,ClientRequestSchema:()=>st,ClientResultSchema:()=>sa,ClientTasksCapabilitySchema:()=>ne,CompatibilityCallToolResultSchema:()=>or,CompleteRequestParamsSchema:()=>oF,CompleteRequestSchema:()=>oH,CompleteResultSchema:()=>oJ,ContentBlockSchema:()=>n2,CreateMessageRequestParamsSchema:()=>o_,CreateMessageRequestSchema:()=>ob,CreateMessageResultSchema:()=>oS,CreateMessageResultWithToolsSchema:()=>o$,CreateTaskResultSchema:()=>o0,CursorSchema:()=>iz,DiscoverRequestSchema:()=>nl,DiscoverResultSchema:()=>nc,ElicitRequestFormParamsSchema:()=>oq,ElicitRequestParamsSchema:()=>oz,ElicitRequestSchema:()=>oM,ElicitRequestURLParamsSchema:()=>oA,ElicitResultSchema:()=>oV,ElicitationCompleteNotificationParamsSchema:()=>oL,ElicitationCompleteNotificationSchema:()=>oZ,EmbeddedResourceSchema:()=>n0,EmptyResultSchema:()=>i1,EnumSchemaSchema:()=>oI,GetPromptRequestParamsSchema:()=>nK,GetPromptRequestSchema:()=>nG,GetPromptResultSchema:()=>n4,GetTaskPayloadRequestSchema:()=>o3,GetTaskPayloadResultSchema:()=>o6,GetTaskRequestSchema:()=>o9,GetTaskResultSchema:()=>o4,IconSchema:()=>i4,IconsSchema:()=>i3,ImageContentSchema:()=>nX,ImplementationSchema:()=>i5,InitializeRequestParamsSchema:()=>na,InitializeRequestSchema:()=>ni,InitializeResultSchema:()=>no,InitializedNotificationSchema:()=>ns,JSONArraySchema:()=>iq,JSONObjectSchema:()=>iN,JSONRPCErrorResponseSchema:()=>iY,JSONRPCMessageSchema:()=>iQ,JSONRPCNotificationSchema:()=>iW,JSONRPCRequestSchema:()=>iG,JSONRPCResponseSchema:()=>i0,JSONRPCResultResponseSchema:()=>iX,JSONValueSchema:()=>iI,LegacyTitledEnumSchemaSchema:()=>oE,ListChangedOptionsBaseSchema:()=>oo,ListPromptsRequestSchema:()=>nJ,ListPromptsResultSchema:()=>nB,ListResourceTemplatesRequestSchema:()=>nP,ListResourceTemplatesResultSchema:()=>nE,ListResourcesRequestSchema:()=>nk,ListResourcesResultSchema:()=>nx,ListRootsRequestSchema:()=>oK,ListRootsResultSchema:()=>oG,ListTasksRequestSchema:()=>o5,ListTasksResultSchema:()=>o8,ListToolsRequestSchema:()=>n7,ListToolsResultSchema:()=>oe,LoggingLevelSchema:()=>os,LoggingMessageNotificationParamsSchema:()=>ou,LoggingMessageNotificationSchema:()=>od,ModelHintSchema:()=>op,ModelPreferencesSchema:()=>om,MultiSelectEnumSchemaSchema:()=>oO,NotificationSchema:()=>iH,NotificationsParamsSchema:()=>iF,NumberSchemaSchema:()=>ok,PaginatedRequestParamsSchema:()=>nh,PaginatedRequestSchema:()=>nf,PaginatedResultSchema:()=>ny,PingRequestSchema:()=>nu,PrimitiveSchemaDefinitionSchema:()=>oN,ProgressNotificationParamsSchema:()=>np,ProgressNotificationSchema:()=>nm,ProgressSchema:()=>nd,ProgressTokenSchema:()=>iA,PromptArgumentSchema:()=>nF,PromptListChangedNotificationSchema:()=>n3,PromptMessageSchema:()=>n9,PromptReferenceSchema:()=>oU,PromptSchema:()=>nH,ReadResourceRequestParamsSchema:()=>nT,ReadResourceRequestSchema:()=>nj,ReadResourceResultSchema:()=>nC,RelatedTaskMetadataSchema:()=>iL,RequestIdSchema:()=>iK,RequestMetaSchema:()=>iZ,RequestSchema:()=>iU,ResourceContentsSchema:()=>ng,ResourceLinkSchema:()=>n1,ResourceListChangedNotificationSchema:()=>nO,ResourceRequestParamsSchema:()=>nT,ResourceSchema:()=>nw,ResourceTemplateReferenceSchema:()=>oD,ResourceTemplateSchema:()=>nR,ResourceUpdatedNotificationParamsSchema:()=>nD,ResourceUpdatedNotificationSchema:()=>nU,ResultMetaObjectSchema:()=>iJ,ResultSchema:()=>iB,RoleSchema:()=>nS,RootSchema:()=>oB,RootsListChangedNotificationSchema:()=>oW,SamplingContentSchema:()=>oy,SamplingMessageContentBlockSchema:()=>og,SamplingMessageSchema:()=>ov,ServerCapabilitiesSchema:()=>nn,ServerNotificationSchema:()=>sn,ServerRequestSchema:()=>si,ServerResultSchema:()=>so,ServerTasksCapabilitySchema:()=>nt,SetLevelRequestParamsSchema:()=>ol,SetLevelRequestSchema:()=>oc,SingleSelectEnumSchemaSchema:()=>oT,StringSchemaSchema:()=>oR,SubscribeRequestParamsSchema:()=>nT,SubscribeRequestSchema:()=>nI,SubscriptionFilterSchema:()=>nq,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nM,SubscriptionsAcknowledgedNotificationSchema:()=>nL,SubscriptionsListenRequestParamsSchema:()=>nA,SubscriptionsListenRequestSchema:()=>nz,SubscriptionsListenResultMetaSchema:()=>nZ,SubscriptionsListenResultSchema:()=>nV,TaskAugmentedRequestParamsSchema:()=>iD,TaskCreationParamsSchema:()=>oX,TaskMetadataSchema:()=>iM,TaskSchema:()=>oQ,TaskStatusNotificationParamsSchema:()=>o1,TaskStatusNotificationSchema:()=>o2,TaskStatusSchema:()=>oY,TextContentSchema:()=>nW,TextResourceContentsSchema:()=>nv,TitledMultiSelectEnumSchemaSchema:()=>oC,TitledSingleSelectEnumSchemaSchema:()=>oP,ToolAnnotationsSchema:()=>n6,ToolChoiceSchema:()=>oh,ToolExecutionSchema:()=>n5,ToolListChangedNotificationSchema:()=>on,ToolResultContentSchema:()=>of,ToolSchema:()=>n8,ToolUseContentSchema:()=>nQ,UnsubscribeRequestParamsSchema:()=>nT,UnsubscribeRequestSchema:()=>nN,UntitledMultiSelectEnumSchemaSchema:()=>oj,UntitledSingleSelectEnumSchemaSchema:()=>ox});let lx=e=>iG.safeParse(e).success,lP=e=>iW.safeParse(e).success,lE=e=>iX.safeParse(e).success,lT=e=>iY.safeParse(e).success,lj=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,lC="x-mcp-header",lO=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lI=new Set(["string","integer","boolean","number"]);function lN(e){let t=[],r=new Map,a=(e,i,n)=>{if(null===e||"object"!=typeof e)return;if(lC in e){if(!n||0===i.length)return`${lz(i)}: 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 a=e[lC];if("string"!=typeof a||0===a.length)return`${lz(i)}: x-mcp-header MUST be a non-empty string`;if(!lO.test(a))return`${lz(i)}: x-mcp-header '${a}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let o="string"==typeof e.type?e.type:void 0;if(void 0===o||!lI.has(o))return`${lz(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${o??"<none>"}`;let s=a.toLowerCase(),l=r.get(s);if(void 0!==l)return`x-mcp-header '${a}' is not case-insensitively unique (also declared as '${l}')`;r.set(s,a),t.push({path:i,headerName:a,type:o})}let o=e.properties;if(null!==o&&"object"==typeof o)for(let[e,t]of Object.entries(o)){let r=a(t,[...i,e],n);if(void 0!==r)return r}for(let t of lq){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&lA.has(t)?Object.values(r):[r]){let r=a(e,[...i,`<${t}>`],!1);if(void 0!==r)return r}}},i=a(e,[],!0);return void 0===i?{valid:!0,declarations:t}:{valid:!1,reason:i}}let lq=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],lA=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function lz(e){return 0===e.length?"<root>":e.join(".")}let lM=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,lL=/^-?\d+(\.\d+)?$/;function lZ(e){if(!(e.startsWith("=?base64?")&&e.endsWith("?=")))return e;let t=e.slice(9,e.length-2);if(lM.test(t))try{let e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.codePointAt(t);return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return}}function lV(e,t,r){return{kind:"reject",rung:"param-header-validation",cell:e,httpStatus:400,code:lD,message:`Bad Request: the request headers and body disagree: ${r}`,data:{mismatch:{header:t,body:r}},settled:!0}}let lD=-32020;s4.InvalidRequest,s4.UnsupportedProtocolVersion,s4.InvalidParams,s4.MethodNotFound,s4.InvalidParams,s4.MissingRequiredClientCapability;let lU={[s4.ParseError]:400,[s4.InvalidRequest]:400,[s4.MethodNotFound]:404,[s4.UnsupportedProtocolVersion]:400,[s4.MissingRequiredClientCapability]:400,[lD]:400};function lF(e,t,r,a,i){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:a.code,message:a.message,...void 0!==a.data&&{data:a.data},settled:i}}function lH(e,t,r,a="era-classification"){return lF(a,e,400,new s3(lD,`Bad Request: the request headers and body disagree: ${r}`,{mismatch:{header:t,body:r}}),!0)}let lJ={"tools/call":"name","prompts/get":"name","resources/read":"uri"};function lB(e){let t=0;for(;t<e.length;){let r=e.codePointAt(t);if(9!==r&&32!==r)break;t+=1}let r=e.length;for(;r>t;){let t=e.codePointAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}function lK(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lG(e){return void 0===e?{era:"modern"}:{era:e>=sT?"modern":"legacy",revision:e}}function lW(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function lX(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}let lY=!1,lQ="draft-2020-12";function l0(e,t="input"){let r,a=e["~standard"];if(a.jsonSchema)r=a.jsonSchema[t]({target:lQ});else if("zod"===a.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().");lY||(lY=!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=r9(e,{target:lQ,io:t})}else throw Error(`Schema library "${a.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 a=t[r];if(Array.isArray(a)&&a.length>0)return a.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}}async function l1(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let l2=/\\\.\\d\{(\d+)\}/;function l9(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let l4=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function l3(e){return l4.has(e)||e.startsWith("x-")}let l6=new Set(["$schema",...Object.keys(oq.shape.requestedSchema.shape)]),l5={string:lW([oR,ox,oP,oE]),number:lW([ok]),integer:lW([ok]),boolean:lW([ow]),array:lW([oj,oC])},l8=new Set(oR.shape.format.unwrap().options);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(!lX(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,a=function(e,t){let r={},a=[];for(let[i,n]of Object.entries(e))"properties"===i&&l9(n)?r[i]=Object.fromEntries(Object.entries(n).map(([e,r])=>[e,function(e,t,r,a){if(!l9(e))return e;let i="string"==typeof e.type&&Object.hasOwn(l5,e.type)?l5[e.type]:void 0;if(void 0===i)return e;let n={};for(let[s,l]of Object.entries(e))if(i.has(s)||l3(s))n[s]=l;else if("pattern"===s&&"string"===e.type&&"string"==typeof e.format)if(l8.has(e.format)){var o;"string"==typeof l&&(o=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[rm(ab,void 0)];break;case"uri":r=[rf(aw,void 0)];break;case"date":r=[r5()];break;case"date-time":let a,i;a=l2.exec(t),i=[void 0,-1,0],a&&i.push(Number(a[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>i.map(r=>r3({local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=r9(e,{target:lQ,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(o,l).has(l))||a.push(`${t}.${s}`)}else n[s]=l;else a.push(`${t}.${s}`);return n}(r,`properties.${e}`,t,a)])):l6.has(i)?r[i]=n:l3(i)||a.push(i);if(a.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return r}(function(e){try{return l0(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new s3(s4.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),i=(t=oq.shape.requestedSchema,aa(t,a));if(!i.success)throw new s3(s4.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!l9(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!aa(oN,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(a,i.error.message)}`);let n=function e(t,r,a=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,i)=>e(t,r[i],`${a}[${i}]`)):l9(t)&&l9(r)?Object.entries(t).flatMap(([t,i])=>{let n=a?`${a}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(i,r[t],n):l3(t)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let o=(i.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(i.data.properties,e));if(o.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${o.join(", ")}`);return{...e,mode:"form",requestedSchema:i.data}}(e)}}catch(e){throw e instanceof s3?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 l7={},ce={};function ct(e,t){let r=e.slice(0,-6);l7[r]=t,ce[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"])ct(e,lk[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:sm,OAuthClientInformationFullSchema:sv,OAuthClientInformationSchema:sg,OAuthClientMetadataSchema:sy,OAuthClientRegistrationErrorSchema:s_,OAuthErrorResponseSchema:sh,OAuthMetadataSchema:sc,OAuthProtectedResourceMetadataSchema:sl,OAuthTokenRevocationRequestSchema:sb,OAuthTokensSchema:sp,OpenIdProviderDiscoveryMetadataSchema:sd,OpenIdProviderMetadataSchema:su}))ct(e,t);Object.freeze(l7),Object.freeze(ce);let cr=[iP,iE,ij,iO],ca=["inputResponses","requestState"];function ci(e,t){let r=e.params;if(!cc(r))return{message:e,lifted:{}};let a=r._meta,i=cc(a)?cr.filter(e=>e in a):[],n="request"===t?ca.filter(e=>e in r):[];if(0===i.length&&0===n.length)return{message:e,lifted:{}};let o={},s={...r};if(i.length>0&&cc(a)){let e={},t={...a};for(let r of i)e[r]=a[r],delete t[r];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of n)"inputResponses"===e&&(o.inputResponses=s[e]),"requestState"===e&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function cn(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 a=e.validateResult(t,r);return a.ok?{value:a.value}:{issues:[{message:"invalid"===a.reason?a.message:`not-in-era: ${t}`}]}}}}}let co=(f=void 0,()=>f);function cs(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:()=>t}}}var cl=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;static{s=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ix,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 sk(sR.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,a,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_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 sk(sR.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 a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{a?.(e,t),lE(e)||lT(e)?this._onresponse(e):lx(e)?this._onrequest(e,t):lP(e)?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 sk(sR.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}=ci(e,"notification"),a=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=ly(t.classification);if(e!==a.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${a.era}`))}if(lv(r.method)&&!a.hasNotificationMethod(r.method))return;let i=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(r):i(r,a)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:a,lifted:i}=ci(e,"request"),n=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 o=this._transport,s=(e,t,r)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};o?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=ly(t.classification);if(e!==n.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${e} but this instance serves ${n.era}`));let r=t.classification.revision??e;s(s4.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(lg(a.method)&&!n.hasRequestMethod(a.method))return void s(s4.MethodNotFound,"Method not found");let l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===l)return void s(s4.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(i);if(void 0!==c)return void s(s4.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:a.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);let m=void 0===i.inputResponses?void 0:function(e){let t={},r=[];if(!cu(e))return{accepted:t,droppedKeys:r};for(let[a,i]of Object.entries(e)){if(!cu(i)||"method"in i||"result"in i){r.push(a);continue}t[a]=i}return{accepted:t,droppedKeys:r}}(i.inputResponses),h={sessionId:o?.sessionId,mcpReq:{id:a.id,method:a.method,_meta:a.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===i.requestState?co:(r=i.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lX(t))return d(e,t,r);let i=cn(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,i,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=n.encodeResult(a.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${a.method}: ${e}`)),s(s4.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:a.id};await o?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:s4.InternalError,r={jsonrpc:"2.0",id:a.id,error:{code:n.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await o?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),n(e);return}i(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(lE(e)?e:s3.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 a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lX(t))return this._requestWithSchemaViaCodec(a,e,t,r);let i=cn(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(a,e,i,t)}_negotiatedWireCodec(){return lf(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 lf(void 0);case"server/discover":return lf(lh);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(lg(t)&&!e.hasRequestMethod(t))throw new sk(sR.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 a=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r)}_requestWithSchemaViaCodec(e,t,r,a){let i,n,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c}=a??{},u=Date.now();return new Promise((d,p)=>{let m=e=>{p(e)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){m(e);return}if(a?.signal?.aborted){let e=a.signal.reason;throw e instanceof sk?e:new sk(sR.RequestTimeout,String(e))}let h=e.era===lh&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;n=f;let y={...t,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.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===h?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):h.abort(),p(e instanceof sk?e:new sk(sR.RequestTimeout,String(e))))};this._responseHandlers.set(f,i=>{let n;if(!a?.signal?.aborted){if(v=!0,i instanceof Error)return p(i);try{n=e.decodeResult(t.method,i.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===n.kind)return p(n.error);if("input_required"===n.kind){var o;return a?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(o=n).inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}}):d(this._resolveNonCompleteResult(n,{codec:e,request:t,resultSchema:r,options:a,flowStartedAt:u,retry:(a,i)=>this._requestWithSchemaViaCodec(e,void 0===a?{method:t.method}:{method:t.method,params:a},r,i)}))}l1(r,n.result).then(e=>{e.success?d(e.data):p(new sk(sR.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),i=()=>_(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let b=a?.timeout??6e4;this._setupTimeout(f,b,a?.maxTotalTimeout,()=>_(new sk(sR.RequestTimeout,"Request timed out",{timeout:b})),a?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c,requestSignal:h?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{i&&a?.signal?.removeEventListener("abort",i),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new sk(sR.NotConnected,"Not connected");if(lv(t.method)&&!e.hasNotificationMethod(t.method))throw new sk(sR.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 a=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(a,r).catch(e=>this._onerror(e))});return}await this._transport.send(a,r)}setRequestHandler(e,t,r){let a;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!lg(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);a=(r,a)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(e,r);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(e,r)),!n.ok){if("not-in-era"===n.reason)throw new s3(s4.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value,a))}}else if(r)a=async(a,i)=>{let n=await l1(t.params,{...a.params});if(!n.success)throw new s3(s4.InvalidParams,`Invalid params for ${e}: ${n.error}`);return r(n.data,i)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,a))}_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(!lv(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,a)=>{let i=a.validateNotification(e,r);if(!i.ok){if("not-in-era"===i.reason)throw new s3(s4.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async a=>{let i=await l1(t.params,{...a.params});if(!i.success)throw new s3(s4.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await r(i.data,a)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function cc(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cu(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var cd=q(N(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,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var n,o,s,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(!a.test(u))throw TypeError("invalid media type");var d=new i(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;o=t.exec(l);){if(o.index!==c)throw TypeError("invalid parameter format");c+=o[0].length,n=o[1].toLowerCase(),34===(s=o[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(r,"$1")),d.parameters[n]=s}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})(),1);function cp(e){if(e)try{return cd.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}function cm(e){return"application/json"===e||"application/json"===cp(e)}let ch=/^[A-Za-z0-9._-]{1,128}$/;function cf(e){let t=function(e){let t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ch.test(e)){let r=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return t.isValid}var cy=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(t){e.validateLength(t,1e6,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let r=[],a="",i=0,n=0;for(;i<t.length;)if("{"===t[i]){a&&(r.push(a),a="");let o=t.indexOf("}",i);if(-1===o)throw Error("Unclosed template expression");if(++n>1e4)throw Error("Template contains too many expressions (max 10000)");let s=t.slice(i+1,o),l=this.getOperator(s),c=s.includes("*"),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,1e6,"Variable name");r.push({name:d,operator:l,names:u,exploded:c}),i=o+1}else a+=t[i],i++;return a&&r.push(a),r}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(t,r){return(e.validateLength(t,1e6,"Variable value"),"+"===r||"#"===r)?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];return void 0===a?"":`${r}=${Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator)}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let i=this.expandPart(a,e);i&&(t+=("?"===a.operator||"&"===a.operator)&&r?i.replace("?","&"):i,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let r,a=[];for(let r of t.names)e.validateLength(r,1e6,"Variable name");if("?"===t.operator||"&"===t.operator){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=0===e?"\\"+t.operator:"&";a.push({pattern:i+this.escapeRegExp(r)+"=([^&]+)",name:r})}return a}let i=t.name;switch(t.operator){case"":r=t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r=String.raw`\.([^/,]+)`;break;case"/":r="/"+(t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return a.push({pattern:r,name:i}),a}match(t){e.validateLength(t,1e6,"URI");let r="^",a=[];for(let e of this.parts)if("string"==typeof e)r+=this.escapeRegExp(e);else for(let{pattern:t,name:i}of this.partToRegExp(e))r+=t,a.push({name:i,exploded:e.exploded});r+="$",e.validateLength(r,1e6,"Generated regex pattern");let i=new RegExp(r),n=t.match(i);if(!n)return null;let o={};for(let[e,t]of a.entries()){let{name:r,exploded:a}=t,i=n[e+1];o[r.replace("*","")]=a&&i.includes(",")?i.split(","):i}return o}};function cg(e){if(void 0!==e){if(function(e){if("object"!=typeof e||null===e||lX(e))return!1;let t=Object.getPrototypeOf(e);return(t===Object.prototype||null===t)&&Object.values(e).every(e=>"object"==typeof e&&null!==e&&"_zod"in e)}(e))return a0(e);if("object"==typeof e&&null!==e&&!lX(e)&&Object.values(e).some(e=>"object"==typeof e&&null!==e&&!("_zod"in e)&&"_def"in e&&"string"==typeof e._def?.typeName))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!lX(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var cv=N(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 a=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 i(e,...t){let r=[e[0]],n=0;for(;n<t.length;)s(r,t[n]),r.push(e[++n]);return new a(r)}e._Code=a,e.nil=new a(""),e._=i;let n=new a("+");function o(e,...t){let i=[l(e[0])],c=0;for(;c<t.length;)i.push(n),s(i,t[c]),i.push(n,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var a,i;let n=(a=e[t-1],'""'===(i=e[t+1])?a:'""'===a?i:"string"==typeof a?i instanceof r||'"'!==a[a.length-1]?void 0:"string"!=typeof i?`${a.slice(0,-1)}${i}"`:'"'===i[0]?a.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||a instanceof r?void 0:`"${a}${i.slice(1)}`);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(i),new a(i)}function s(e,t){var i;t instanceof a?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(i=t)||"boolean"==typeof i||null===i?i:l(Array.isArray(i)?i.join(","):i))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=o,e.addCodeArg=s,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},e.stringify=function(e){return new a(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new a(`.${t}`):i`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new a(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new a(e.toString())}}),c_=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=cv();var r,a,i=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=a||(e.UsedValueState=a={}))[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 n=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=n;var o=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:a}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${a}]`}};e.ValueScopeName=o;let s=(0,t._)`\n`;var l=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:i}=a,n=null!=(r=t.key)?r:t.ref,o=this._values[i];if(o){let e=o.get(n);if(e)return e}else o=this._values[i]=new Map;o.set(n,a);let s=this._scope[i]||(this._scope[i]=[]),l=s.length;return s[l]=t.ref,a.setValue(t,{property:i,itemIndex:l}),a}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,n,o={},s){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=o[c]=o[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,a.Started);let o=n(r);if(o){let a=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${a} ${r} = ${o};${this.opts._n}`}else if(o=null==s?void 0:s(r))l=(0,t._)`${l}${o}${this.opts._n}`;else throw new i(r);d.set(r,a.Completed)})}return l}};e.ValueScope=l}),cb=N(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=cv(),r=c_();var a=cv();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var i=c_();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.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 n=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let a=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends n{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=j(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends s{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},p=class extends n{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=j(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends n{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,a=r.length;for(;a--;){let i=r[a];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},h=class extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends m{},y=class extends h{};y.kind="else";var g=class e extends h{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(C(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=j(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&E(e,this.else.names),e}};g.kind="if";var v=class extends h{};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=j(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:a,from:i,to:n}=this;return`for(${t} ${a}=${i}; ${a}<${n}; ${a}++)`+super.render(e)}get names(){return T(T(super.names,this.from),this.to)}},S=class extends v{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}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=j(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},$=class extends h{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)}};$.kind="func";var w=class extends m{render(e){return"return "+super.render(e)}};w.kind="return";var R=class extends h{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,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},k=class extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};k.kind="catch";var x=class extends h{render(e){return"finally"+super.render(e)}};x.kind="finally";var P=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,a){let i=this._scope.toName(t);return void 0!==r&&a&&(this._constants[i.str]=r),this._leafNode(new o(e,i,r)),i}const(e,t,a){return this._def(r.varKinds.const,e,t,a)}let(e,t,a){return this._def(r.varKinds.let,e,t,a)}var(e,t,a){return this._def(r.varKinds.var,e,t,a)}assign(e,t,r){return this._leafNode(new s(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[a,i]of e)r.length>1&&r.push(","),r.push(a),(a!==i||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,i));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,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.let){let o=this._scope.toName(e);return this._for(new b(n,o,t,a),()=>i(o))}forOf(e,a,i,n=r.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=a instanceof t.Name?a:this.var("_arr",a);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(o,(0,t._)`${e}[${r}]`),i(o)})}return this._for(new S("of",n,o,a),()=>i(o))}forIn(e,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${a})`,i);let o=this._scope.toName(e);return this._for(new S("in",n,o,a),()=>i(o))}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 w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new R;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new k(e),t(e)}return r&&(this._currNode=a.finally=new x,this.code(r)),this._endBlockNode(k,x)}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,a,i){return this._blockNode(new $(e,r,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($)}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 E(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?E(e,r.names):e}function j(e,r,a){var i;if(e instanceof t.Name)return n(e);if(!((i=e)instanceof t._Code&&i._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==a[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=n(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function n(e){let t=a[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=P,e.not=C;let O=N(e.operators.AND);e.and=function(...e){return e.reduce(O)};let I=N(e.operators.OR);function N(e){return(r,a)=>r===t.nil?a:a===t.nil?r:(0,t._)`${q(r)} ${e} ${q(a)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(I)}}),cS=N(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 a=cb(),i=cv();function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=a.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function s(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:i}){return(n,o,s,l)=>{let c=void 0===s?o:s instanceof a.Name?(o instanceof a.Name?e(n,o,s):t(n,o,s),s):o instanceof a.Name?(t(n,s,o),o):r(o,s);return l!==a.Name||c instanceof a.Name?c:i(n,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.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||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,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,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(i)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,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,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${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 m(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 i._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,i){if(e instanceof a.Name){let n=r===t.Num;return i?n?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:n?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=m}),c$=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb();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")}}),cw=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=cb(),r=cS(),a=c$();function i(e,r){let i=e.const("err",r);e.if((0,t._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${a.default.vErrors}.push(${i})`),e.code((0,t._)`${a.default.errors}++`)}function n(e,r){let{gen:a,validateName:i,schemaEnv:n}=e;n.$async?a.throw((0,t._)`new ${e.ValidationError}(${r})`):(a.assign((0,t._)`${i}.errors`,r),a.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,a=e.keywordError,o,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,m=s(r,a,o);(null!=l?l:d||p)?i(u,m):n(c,(0,t._)`[${m}]`)},e.reportExtraError=function(t,r=e.keywordError,o){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;i(c,s(t,r,o)),u||d||n(l,a.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(a.default.errors,r),e.if((0,t._)`${a.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${a.default.vErrors}.length`,r),()=>e.assign(a.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:i,data:n,errsCount:o,it:s}){if(void 0===o)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",o,a.default.errors,o=>{e.const(l,(0,t._)`${a.default.vErrors}[${o}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(a.default.instancePath,s.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${r}`),s.opts.verbose&&(e.assign((0,t._)`${l}.schema`,i),e.assign((0,t._)`${l}.data`,n))})};let o={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 s(e,i,n){let{createErrors:s}=e.it;return!1===s?(0,t._)`{}`:function(e,i,n={}){let{gen:s,it:l}=e,c=[function({errorPath:e},{instancePath:i}){let n=i?(0,t.str)`${e}${(0,r.getErrorPath)(i,r.Type.Str)}`:e;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,n)]}(l,n),function({keyword:e,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:n}){let s=n?a:(0,t.str)`${a}/${e}`;return i&&(s=(0,t.str)`${s}${(0,r.getErrorPath)(i,r.Type.Str)}`),[o.schemaPath,s]}(e,n)];return function(e,{params:r,message:i},n){let{keyword:s,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:h}=u;n.push([o.keyword,s],[o.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&n.push([o.message,"function"==typeof i?i(e):i]),d.verbose&&n.push([o.schema,c],[o.parentSchema,(0,t._)`${m}${h}`],[a.default.data,l]),p&&n.push([o.propertyName,p])}(e,i,c),s.object(...c)}(e,i,n)}}),cR=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=cw(),r=cb(),a=c$(),i={message:"boolean schema is false"};function n(e,r){let{gen:a,data:n}=e;(0,t.reportError)({gen:a,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:i,validateName:o}=e;!1===i?n(e,!1):"object"==typeof i&&!0===i.$async?t.return(a.default.data):(t.assign((0,r._)`${o}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}}),ck=N(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:{}}}}),cx=N(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},a){let i=r.RULES.types[a];return i&&!0!==i&&t(e,i)},e.shouldUseGroup=t,e.shouldUseRule=r}),cP=N(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 a=ck(),i=cx(),n=cw(),o=cb(),s=cS();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.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 a,n;let{gen:s,data:l,opts:u}=e,p=(a=r,(n=u.coerceTypes)?a.filter(e=>c.has(e)||"array"===n&&"array"===e):[]),h=r.length>0&&!(0===p.length&&1===r.length&&(0,i.schemaHasRulesForType)(e,r[0]));if(h){let a=d(r,l,u.strictNumbers,t.Wrong);s.if(a,()=>{p.length?function(e,t,r){let{gen:a,data:i,opts:n}=e,s=a.let("dataType",(0,o._)`typeof ${i}`),l=a.let("coerced",(0,o._)`undefined`);for(let e of("array"===n.coerceTypes&&a.if((0,o._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,o._)`${i}[0]`).assign(s,(0,o._)`typeof ${i}`).if(d(t,i,n.strictNumbers),()=>a.assign(l,i))),a.if((0,o._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,o._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,o._)`"" + ${i}`).elseIf((0,o._)`${i} === null`).assign(l,(0,o._)`""`);return;case"number":a.elseIf((0,o._)`${s} == "boolean" || ${i} === null
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let a=r[1];if(t===r[0]){i(r);continue}if(e.external){let a=e.external.registry.get(r[0])?.id;if(t!==r[0]&&a){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||a.cycle||a.count>1&&"ref"===e.reused){i(r);continue}}}function rE(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,n={...i},o=r.ref;if(r.ref=null,o){a(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,n),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){a(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())a(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$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");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&i.id===n&&delete i.id;let o=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,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:rT(t,"input",e.processors),output:rT(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rT=(e,t,r={})=>a=>{let{libraryOptions:i,target:n}=a??{},o=rk({...i??{},target:n,io:t,processors:r});return rx(e,o),rP(o,e),rE(o,e)},rj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rC=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:n,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),o&&(r.format=rj[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];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}))])}},rO=(e,t,r,a)=>{let{minimum:i,maximum:n,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(i??-1/0),d="number"==typeof l&&l<=(n??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 i&&(r.minimum=i),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof s&&(r.multipleOf=s)},rI=(e,t,r,a)=>{r.type="boolean"},rN=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rq=(e,t,r,a)=>{r.not={}},rA=(e,t,r,a)=>{},rz=(e,t,r,a)=>{},rM=(e,t,r,a)=>{let i=e_(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},rL=(e,t,r,a)=>{let i=e._zod.def,n=[];for(let e of i.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 n.push(Number(e));else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},rZ=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rV=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rD=(e,t,r,a)=>{let i=e._zod.def,{minimum:n,maximum:o}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=rx(i.element,t,{...a,path:[...a.path,"items"]})},rU=(e,t,r,a)=>{let i=e._zod.def;r.type="object",r.properties={};let n=i.shape;for(let e in n)r.properties[e]=rx(n[e],t,{...a,path:[...a.path,"properties",e]});let o=new Set([...new Set(Object.keys(n))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=rx(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rF=(e,t,r,a)=>{let i=e._zod.def,n=!1===i.inclusive,o=i.options.map((e,r)=>rx(e,t,{...a,path:[...a.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=o:r.anyOf=o},rH=(e,t,r,a)=>{let i=e._zod.def,n=rx(i.left,t,{...a,path:[...a.path,"allOf",0]}),o=rx(i.right,t,{...a,path:[...a.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(n)?n.allOf:[n],...s(o)?o.allOf:[o]]},rJ=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let n=i.keyType,o=n._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=rx(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=rx(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=rx(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},rB=(e,t,r,a)=>{let i=e._zod.def,n=rx(i.innerType,t,a),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},rK=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},rG=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},rW=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rX=(e,t,r,a)=>{let i,n=e._zod.def;rx(n.innerType,t,a),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},rY=(e,t,r,a)=>{let i=e._zod.def,n=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?n?i.out:i.in:i.out;rx(o,t,a),t.seen.get(e).ref=o},rQ=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},r0=(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},r1=(e,t,r,a)=>{let i=e._zod.innerType;rx(i,t,a),t.seen.get(e).ref=i},r2={string:rC,number:rO,boolean:rI,bigint:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:rN,undefined:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:rq,any:rA,unknown:rz,date:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:rM,literal:rL,nan:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,a)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},file:(e,t,r,a)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:n,maximum:o,mime:s}=e._zod.bag;void 0!==n&&(i.minLength=n),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},success:(e,t,r,a)=>{r.type="boolean"},custom:rZ,function:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:rV,map:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:rD,object:rU,union:rF,intersection:rH,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>rx(e,t,{...a,path:[...a.path,n,r]})),l=i.rest?rx(i.rest,t,{...a,path:[...a.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,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:rJ,nullable:rB,nonoptional:rK,default:rG,prefault:rW,catch:rX,pipe:rY,readonly:rQ,promise:(e,t,r,a)=>{let i=e._zod.def;rx(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:r0,lazy:r1};function r9(e,t){if("_idmap"in e){let r=rk({...t,processors:r2}),a={};for(let t of e._idmap.entries()){let[e,a]=t;rx(a,r)}let i={};for(let n of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=n;rP(r,t),i[e]=rE(r,t)}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=rk({...t,processors:r2});return rx(e,r),rP(r,e),rE(r,e)}let r4=V("ZodISODateTime",(e,t)=>{t$.init(e,t),a_.init(e,t)});function r3(e){return new r4({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eA(e)})}let r6=V("ZodISODate",(e,t)=>{tw.init(e,t),a_.init(e,t)});function r5(e){return new r6({type:"string",format:"date",check:"string_format",...eA(e)})}let r8=V("ZodISOTime",(e,t)=>{tR.init(e,t),a_.init(e,t)}),r7=V("ZodISODuration",(e,t)=>{tk.init(e,t),a_.init(e,t)}),ae=V("ZodError",(e,t)=>{e7.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=(e,i=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>a({issues:e},[...i,...n.path]));else if("invalid_key"===n.code)a({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)a({issues:n.issues},[...i,...n.path]);else{let e=[...i,...n.path];if(0===e.length)r._errors.push(t(n));else{let a=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(a[r]=a[r]||{_errors:[]},a[r]._errors.push(t(n))):a[r]=a[r]||{_errors:[]},a=a[r],i++}}}};return a(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},a=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eb,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eb,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),at=tt(ae),ar=tr(ae),aa=ta(ae),ai=tn(ae),an=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tt(ae)(e,t,a)},ao=(e,t,r)=>tt(ae)(e,t,r),as=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tr(ae)(e,t,a)},al=async(e,t,r)=>tr(ae)(e,t,r),ac=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return ta(ae)(e,t,a)},au=(e,t,r)=>ta(ae)(e,t,r),ad=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tn(ae)(e,t,a)},ap=async(e,t,r)=>tn(ae)(e,t,r),am=new WeakMap;function ah(e,t,r){let a=Object.getPrototypeOf(e),i=am.get(a);if(i||(i=new Set,am.set(a,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(a,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 af=V("ZodType",(e,t)=>(tl.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rT(e,"input"),output:rT(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let a=rk({...r,processors:t});return rx(e,a),rP(a,e),rE(a,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>at(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>aa(e,t,r),e.parseAsync=async(t,r)=>ar(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ai(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>an(e,t,r),e.decode=(t,r)=>ao(e,t,r),e.encodeAsync=async(t,r)=>as(e,t,r),e.decodeAsync=async(t,r)=>al(e,t,r),e.safeEncode=(t,r)=>ac(e,t,r),e.safeDecode=(t,r)=>au(e,t,r),e.safeEncodeAsync=async(t,r)=>ad(e,t,r),e.safeDecodeAsync=async(t,r)=>ap(e,t,r),ah(e,"ZodType",{check(...e){let t=this.def;return this.clone(ex(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 eq(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 iw({type:"custom",check:"custom",fn:e,...eA(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let a,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eU(e,t.value,a._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=a),e.continue??(e.continue=!a._zod.def.abort),t.issues.push(eU(e)))},e(t.value,t)),(i=new eF({check:"custom",...eA(t)}))._zod.check=r,a=i}(e,t))},overwrite(e){return this.check(rR(e))},optional(){return il(this)},exactOptional(){var e;return e=this,new ic({type:"optional",innerType:e})},nullable(){return id(this)},nullish(){return il(id(this))},nonoptional(e){var t;return t=this,new ih({type:"nonoptional",innerType:t,...eA(e)})},array(){return aY(this)},or(e){return a9([this,e])},and(e){return a5(this,e)},transform(e){return iv(this,io(e))},default(e){var t,r;return t=this,r=e,new ip({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():eO(r)}})},prefault(e){var t,r;return t=this,r=e,new im({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():eO(r)}})},catch(e){var t,r;return t=this,new iy({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return iv(this,e)},readonly(){var e;return e=this,new ib({type:"readonly",innerType:e})},describe(e){let t=this.clone();return rp.add(t,{description:e}),t},meta(...e){if(0===e.length)return rp.get(this);let t=this.clone();return rp.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:()=>rp.get(e)?.description,configurable:!0}),e)),ay=V("_ZodString",(e,t)=>{tc.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rC(e,t,r,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,ah(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new e0({check:"string_format",format:"regex",...eA(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new e9({check:"string_format",format:"includes",...eA(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new e4({check:"string_format",format:"starts_with",...eA(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new e3({check:"string_format",format:"ends_with",...eA(t),suffix:e})}(...e))},min(...e){return this.check(r$(...e))},max(...e){return this.check(rS(...e))},length(...e){return this.check(rw(...e))},nonempty(...e){return this.check(r$(1,...e))},lowercase(e){return this.check(new e1({check:"string_format",format:"lowercase",...eA(e)}))},uppercase(e){return this.check(new e2({check:"string_format",format:"uppercase",...eA(e)}))},trim(){return this.check(rR(e=>e.trim()))},normalize(...e){return this.check(function(e){return rR(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(rR(e=>e.toLowerCase()))},toUpperCase(){return this.check(rR(e=>e.toUpperCase()))},slugify(){return this.check(rR(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),ag=V("ZodString",(e,t)=>{tc.init(e,t),ay.init(e,t),e.email=t=>e.check(rm(ab,t)),e.url=t=>e.check(rf(aw,t)),e.jwt=t=>e.check(new aM({type:"string",format:"jwt",check:"string_format",abort:!1,...eA(t)})),e.emoji=t=>e.check(new aR({type:"string",format:"emoji",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(rh(aS,t)),e.uuid=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,...eA(t)})),e.uuidv4=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eA(t)})),e.uuidv6=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eA(t)})),e.uuidv7=t=>e.check(new a$({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eA(t)})),e.nanoid=t=>e.check(new ak({type:"string",format:"nanoid",check:"string_format",abort:!1,...eA(t)})),e.guid=t=>e.check(rh(aS,t)),e.cuid=t=>e.check(new ax({type:"string",format:"cuid",check:"string_format",abort:!1,...eA(t)})),e.cuid2=t=>e.check(new aP({type:"string",format:"cuid2",check:"string_format",abort:!1,...eA(t)})),e.ulid=t=>e.check(new aE({type:"string",format:"ulid",check:"string_format",abort:!1,...eA(t)})),e.base64=t=>e.check(new aq({type:"string",format:"base64",check:"string_format",abort:!1,...eA(t)})),e.base64url=t=>e.check(new aA({type:"string",format:"base64url",check:"string_format",abort:!1,...eA(t)})),e.xid=t=>e.check(new aT({type:"string",format:"xid",check:"string_format",abort:!1,...eA(t)})),e.ksuid=t=>e.check(new aj({type:"string",format:"ksuid",check:"string_format",abort:!1,...eA(t)})),e.ipv4=t=>e.check(new aC({type:"string",format:"ipv4",check:"string_format",abort:!1,...eA(t)})),e.ipv6=t=>e.check(new aO({type:"string",format:"ipv6",check:"string_format",abort:!1,...eA(t)})),e.cidrv4=t=>e.check(new aI({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eA(t)})),e.cidrv6=t=>e.check(new aN({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eA(t)})),e.e164=t=>e.check(new az({type:"string",format:"e164",check:"string_format",abort:!1,...eA(t)})),e.datetime=t=>e.check(r3(t)),e.date=t=>e.check(r5(t)),e.time=t=>e.check(new r8({type:"string",format:"time",check:"string_format",precision:null,...eA(t)})),e.duration=t=>e.check(new r7({type:"string",format:"duration",check:"string_format",...eA(t)}))});function av(e){return new ag({type:"string",...eA(e)})}let a_=V("ZodStringFormat",(e,t)=>{tu.init(e,t),ay.init(e,t)}),ab=V("ZodEmail",(e,t)=>{tm.init(e,t),a_.init(e,t)}),aS=V("ZodGUID",(e,t)=>{td.init(e,t),a_.init(e,t)}),a$=V("ZodUUID",(e,t)=>{tp.init(e,t),a_.init(e,t)}),aw=V("ZodURL",(e,t)=>{th.init(e,t),a_.init(e,t)}),aR=V("ZodEmoji",(e,t)=>{tf.init(e,t),a_.init(e,t)}),ak=V("ZodNanoID",(e,t)=>{ty.init(e,t),a_.init(e,t)}),ax=V("ZodCUID",(e,t)=>{tg.init(e,t),a_.init(e,t)}),aP=V("ZodCUID2",(e,t)=>{tv.init(e,t),a_.init(e,t)}),aE=V("ZodULID",(e,t)=>{t_.init(e,t),a_.init(e,t)}),aT=V("ZodXID",(e,t)=>{tb.init(e,t),a_.init(e,t)}),aj=V("ZodKSUID",(e,t)=>{tS.init(e,t),a_.init(e,t)}),aC=V("ZodIPv4",(e,t)=>{tx.init(e,t),a_.init(e,t)}),aO=V("ZodIPv6",(e,t)=>{tP.init(e,t),a_.init(e,t)}),aI=V("ZodCIDRv4",(e,t)=>{tE.init(e,t),a_.init(e,t)}),aN=V("ZodCIDRv6",(e,t)=>{tT.init(e,t),a_.init(e,t)}),aq=V("ZodBase64",(e,t)=>{tC.init(e,t),a_.init(e,t)}),aA=V("ZodBase64URL",(e,t)=>{tO.init(e,t),a_.init(e,t)}),az=V("ZodE164",(e,t)=>{tI.init(e,t),a_.init(e,t)}),aM=V("ZodJWT",(e,t)=>{tN.init(e,t),a_.init(e,t)}),aL=V("ZodNumber",(e,t)=>{tq.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rO(e,t,r,a),ah(e,"ZodNumber",{gt(e,t){return this.check(rv(e,t))},gte(e,t){return this.check(r_(e,t))},min(e,t){return this.check(r_(e,t))},lt(e,t){return this.check(ry(e,t))},lte(e,t){return this.check(rg(e,t))},max(e,t){return this.check(rg(e,t))},int(e){return this.check(aD(e))},safe(e){return this.check(aD(e))},positive(e){return this.check(rv(0,e))},nonnegative(e){return this.check(r_(0,e))},negative(e){return this.check(ry(0,e))},nonpositive(e){return this.check(rg(0,e))},multipleOf(e,t){return this.check(rb(e,t))},step(e,t){return this.check(rb(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 aZ(e){return new aL({type:"number",checks:[],...eA(e)})}let aV=V("ZodNumberFormat",(e,t)=>{tA.init(e,t),aL.init(e,t)});function aD(e){return new aV({type:"number",check:"number_format",abort:!1,format:"safeint",...eA(e)})}let aU=V("ZodBoolean",(e,t)=>{tz.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rI(e,t,r,a)});function aF(e){return new aU({type:"boolean",...eA(e)})}let aH=V("ZodNull",(e,t)=>{tM.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rN(e,t,r,a)});function aJ(e){return new aH({type:"null",...eA(e)})}let aB=V("ZodAny",(e,t)=>{tL.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rA(e,t,r,a)}),aK=V("ZodUnknown",(e,t)=>{tZ.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rz(e,t,r,a)});function aG(){return new aK({type:"unknown"})}let aW=V("ZodNever",(e,t)=>{tV.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rq(e,t,r,a)}),aX=V("ZodArray",(e,t)=>{tU.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rD(e,t,r,a),e.element=t.element,ah(e,"ZodArray",{min(e,t){return this.check(r$(e,t))},nonempty(e){return this.check(r$(1,e))},max(e,t){return this.check(rS(e,t))},length(e,t){return this.check(rw(e,t))},unwrap(){return this.element}})});function aY(e,t){return new aX({type:"array",element:e,...eA(t)})}let aQ=V("ZodObject",(e,t)=>{tK.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rU(e,t,r,a),eR(e,"shape",()=>t.shape),ah(e,"ZodObject",{keyof(){return it(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:aG()})},loose(){return this.clone({...this._zod.def,catchall:aG()})},strict(){return this.clone({...this._zod.def,catchall:new aW({type:"never",...eA(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eC(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 a=ex(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ek(this,"shape",r),r}});return eq(e,a)}(this,e)},safeExtend(e){var t=this;if(!eC(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=ex(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return ek(this,"shape",r),r}});return eq(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ex(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ek(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return eq(t,r)},pick(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ex(e._zod.def,{get shape(){let e={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);t[a]&&(e[a]=r.shape[a])}return ek(this,"shape",e),e},checks:[]});return eq(e,i)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ex(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return ek(this,"shape",a),a},checks:[]});return eq(e,i)}(this,e)},partial(...e){return function(e,t,r){let a=t._zod.def.checks;if(a&&a.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ex(t._zod.def,{get shape(){let a=t._zod.def.shape,i={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)i[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return ek(this,"shape",i),i},checks:[]});return eq(t,i)}(is,this,e[0])},required(...e){var t,r;let a;return t=this,r=e[0],a=ex(t._zod.def,{get shape(){let e=t._zod.def.shape,a={...e};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new ih({type:"nonoptional",innerType:e[t]}))}else for(let t in e)a[t]=new ih({type:"nonoptional",innerType:e[t]});return ek(this,"shape",a),a}}),eq(t,a)}})});function a0(e,t){return new aQ({type:"object",shape:e??{},...eA(t)})}function a1(e,t){return new aQ({type:"object",shape:e,catchall:aG(),...eA(t)})}let a2=V("ZodUnion",(e,t)=>{tW.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rF(e,t,r,a),e.options=t.options});function a9(e,t){return new a2({type:"union",options:e,...eA(t)})}let a4=V("ZodDiscriminatedUnion",(e,t)=>{a2.init(e,t),tX.init(e,t)});function a3(e,t,r){return new a4({type:"union",options:t,discriminator:e,...eA(r)})}let a6=V("ZodIntersection",(e,t)=>{tY.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rH(e,t,r,a)});function a5(e,t){return new a6({type:"intersection",left:e,right:t})}let a8=V("ZodRecord",(e,t)=>{t0.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rJ(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function a7(e,t,r){return new a8(t&&t._zod?{type:"record",keyType:e,valueType:t,...eA(r)}:{type:"record",keyType:av(),valueType:e,...eA(t)})}let ie=V("ZodEnum",(e,t)=>{t1.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rM(e,t,r,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let i={};for(let a of e)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new ie({...t,checks:[],...eA(a),entries:i})},e.exclude=(e,a)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ie({...t,checks:[],...eA(a),entries:i})}});function it(e,t){return new ie({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eA(t)})}let ir=V("ZodLiteral",(e,t)=>{t2.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rL(e,t,r,a),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 ia(e,t){return new ir({type:"literal",values:Array.isArray(e)?e:[e],...eA(t)})}let ii=V("ZodTransform",(e,t)=>{t9.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rV(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new U(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(eU(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(eU(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function io(e){return new ii({type:"transform",transform:e})}let is=V("ZodOptional",(e,t)=>{t3.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r0(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function il(e){return new is({type:"optional",innerType:e})}let ic=V("ZodExactOptional",(e,t)=>{t6.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r0(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iu=V("ZodNullable",(e,t)=>{t5.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rB(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function id(e){return new iu({type:"nullable",innerType:e})}let ip=V("ZodDefault",(e,t)=>{t8.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rG(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),im=V("ZodPrefault",(e,t)=>{re.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rW(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),ih=V("ZodNonOptional",(e,t)=>{rt.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rK(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iy=V("ZodCatch",(e,t)=>{ra.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rX(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ig=V("ZodPipe",(e,t)=>{ri.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rY(e,t,r,a),e.in=t.in,e.out=t.out});function iv(e,t){return new ig({type:"pipe",in:e,out:t})}let i_=V("ZodPreprocess",(e,t)=>{ig.init(e,t),ro.init(e,t)}),ib=V("ZodReadonly",(e,t)=>{rs.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rQ(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iS=V("ZodLazy",(e,t)=>{rc.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>r1(e,t,r,a),e.unwrap=()=>e._zod.def.getter()});function i$(e){return new iS({type:"lazy",getter:e})}let iw=V("ZodCustom",(e,t)=>{ru.init(e,t),af.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rZ(e,t,r,a)});function iR(e,t){return new i_({type:"pipe",in:io(e),out:t})}w||(w={});let ik="2025-11-25",ix=[ik,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iP="io.modelcontextprotocol/protocolVersion",iE="io.modelcontextprotocol/clientInfo",iT="io.modelcontextprotocol/serverInfo",ij="io.modelcontextprotocol/clientCapabilities",iC="io.modelcontextprotocol/subscriptionId",iO="io.modelcontextprotocol/logLevel",iI=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),iI),aY(iI)])),iN=a7(av(),iI),iq=aY(iI),iA=a9([av(),aZ().int()]),iz=av(),iM=a0({ttl:aZ().optional()}),iL=a0({taskId:av()}),iZ=a1({progressToken:iA.optional(),"io.modelcontextprotocol/related-task":iL.optional()}),iV=a0({_meta:iZ.optional()}),iD=iV.extend({task:iM.optional()}),iU=a0({method:av(),params:iV.loose().optional()}),iF=a0({_meta:iZ.optional()}),iH=a0({method:av(),params:iF.loose().optional()}),iJ=a1({get[iT](){return i5.optional().catch(void 0)}}),iB=a1({_meta:iJ.optional()}),iK=a9([av(),aZ().int()]),iG=a0({jsonrpc:ia("2.0"),id:iK,...iU.shape}).strict(),iW=a0({jsonrpc:ia("2.0"),...iH.shape}).strict(),iX=a0({jsonrpc:ia("2.0"),id:iK,result:iB}).strict(),iY=a0({jsonrpc:ia("2.0"),id:iK.optional(),error:a0({code:aZ().int(),message:av(),data:aG().optional()})}).strict(),iQ=a9([iG,iW,iX,iY]),i0=a9([iX,iY]),i1=iB.strict(),i2=iF.extend({requestId:iK.optional(),reason:av().optional()}),i9=iH.extend({method:ia("notifications/cancelled"),params:i2}),i4=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),i3=a0({icons:aY(i4).optional()}),i6=a0({name:av(),title:av().optional()}),i5=i6.extend({...i6.shape,...i3.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),i8=a5(a0({applyDefaults:aF().optional()}),iN),i7=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:i8.optional(),url:iN.optional()}),iN.optional())),ne=a1({list:iN.optional(),cancel:iN.optional(),requests:a1({sampling:a1({createMessage:iN.optional()}).optional(),elicitation:a1({create:iN.optional()}).optional()}).optional()}),nt=a1({list:iN.optional(),cancel:iN.optional(),requests:a1({tools:a1({call:iN.optional()}).optional()}).optional()}),nr=a0({experimental:a7(av(),iN).optional(),sampling:a0({context:iN.optional(),tools:iN.optional()}).optional(),elicitation:i7.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:ne.optional(),extensions:a7(av(),iN).optional()}),na=iV.extend({protocolVersion:av(),capabilities:nr,clientInfo:i5}),ni=iU.extend({method:ia("initialize"),params:na}),nn=a0({experimental:a7(av(),iN).optional(),logging:iN.optional(),completions:iN.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:nt.optional(),extensions:a7(av(),iN).optional()}),no=iB.extend({protocolVersion:av(),capabilities:nn,serverInfo:i5,instructions:av().optional()}),ns=iH.extend({method:ia("notifications/initialized"),params:iF.optional()}),nl=iU.extend({method:ia("server/discover"),params:iV.optional()}),nc=iB.extend({supportedVersions:aY(av()),capabilities:nn,instructions:av().optional()}),nu=iU.extend({method:ia("ping"),params:iV.optional()}),nd=a0({progress:aZ(),total:il(aZ()),message:il(av())}),np=a0({...iF.shape,...nd.shape,progressToken:iA}),nm=iH.extend({method:ia("notifications/progress"),params:np}),nh=iV.extend({cursor:iz.optional()}),nf=iU.extend({params:nh.optional()}),ny=iB.extend({nextCursor:iz.optional()}),ng=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()}),nv=ng.extend({text:av()}),n_=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),nb=ng.extend({blob:n_}),nS=it(["user","assistant"]),n$=a0({audience:aY(nS).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),nw=a0({...i6.shape,...i3.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:n$.optional(),_meta:il(a1({}))}),nR=a0({...i6.shape,...i3.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:n$.optional(),_meta:il(a1({}))}),nk=nf.extend({method:ia("resources/list")}),nx=ny.extend({resources:aY(nw)}),nP=nf.extend({method:ia("resources/templates/list")}),nE=ny.extend({resourceTemplates:aY(nR)}),nT=iV.extend({uri:av()}),nj=iU.extend({method:ia("resources/read"),params:nT}),nC=iB.extend({contents:aY(a9([nv,nb]))}),nO=iH.extend({method:ia("notifications/resources/list_changed"),params:iF.optional()}),nI=iU.extend({method:ia("resources/subscribe"),params:nT}),nN=iU.extend({method:ia("resources/unsubscribe"),params:nT}),nq=a0({toolsListChanged:aF().optional(),promptsListChanged:aF().optional(),resourcesListChanged:aF().optional(),resourceSubscriptions:aY(av()).optional()}),nA=iV.extend({notifications:nq}),nz=iU.extend({method:ia("subscriptions/listen"),params:nA}),nM=iF.extend({notifications:nq}),nL=iH.extend({method:ia("notifications/subscriptions/acknowledged"),params:nM}),nZ=iJ.extend({[iC]:iK}),nV=iB.extend({_meta:nZ}),nD=iF.extend({uri:av()}),nU=iH.extend({method:ia("notifications/resources/updated"),params:nD}),nF=a0({name:av(),description:il(av()),required:il(aF())}),nH=a0({...i6.shape,...i3.shape,description:il(av()),arguments:il(aY(nF)),_meta:il(a1({}))}),nJ=nf.extend({method:ia("prompts/list")}),nB=ny.extend({prompts:aY(nH)}),nK=iV.extend({name:av(),arguments:a7(av(),av()).optional()}),nG=iU.extend({method:ia("prompts/get"),params:nK}),nW=a0({type:ia("text"),text:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nX=a0({type:ia("image"),data:n_,mimeType:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nY=a0({type:ia("audio"),data:n_,mimeType:av(),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),nQ=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),n0=a0({type:ia("resource"),resource:a9([nv,nb]),annotations:n$.optional(),_meta:a7(av(),aG()).optional()}),n1=nw.extend({type:ia("resource_link")}),n2=a9([nW,nX,nY,n1,n0]),n9=a0({role:nS,content:n2}),n4=iB.extend({description:av().optional(),messages:aY(n9)}),n3=iH.extend({method:ia("notifications/prompts/list_changed"),params:iF.optional()}),n6=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),n5=a0({taskSupport:it(["required","optional","forbidden"]).optional()}),n8=a0({...i6.shape,...i3.shape,description:av().optional(),inputSchema:a0({type:ia("object"),properties:a7(av(),iI).optional(),required:aY(av()).optional()}).catchall(aG()),outputSchema:a1({$schema:av().optional()}).optional(),annotations:n6.optional(),execution:n5.optional(),_meta:a7(av(),aG()).optional()}),n7=nf.extend({method:ia("tools/list")}),oe=ny.extend({tools:aY(n8)}),ot=iB.extend({content:aY(n2).default([]),structuredContent:aG().optional(),isError:aF().optional()}),or=ot.or(iB.extend({toolResult:aG()})),oa=iD.extend({name:av(),arguments:a7(av(),aG()).optional()}),oi=iU.extend({method:ia("tools/call"),params:oa}),on=iH.extend({method:ia("notifications/tools/list_changed"),params:iF.optional()}),oo=a0({autoRefresh:aF().default(!0),debounceMs:aZ().int().nonnegative().default(300)}),os=it(["debug","info","notice","warning","error","critical","alert","emergency"]),ol=iV.extend({level:os}),oc=iU.extend({method:ia("logging/setLevel"),params:ol}),ou=iF.extend({level:os,logger:av().optional(),data:aG()}),od=iH.extend({method:ia("notifications/message"),params:ou}),op=a0({name:av().optional()}),om=a0({hints:aY(op).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),oh=a0({mode:it(["auto","required","none"]).optional()}),of=a0({type:ia("tool_result"),toolUseId:av().describe("The unique identifier for the corresponding tool call."),content:aY(n2),structuredContent:aG().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),oy=a3("type",[nW,nX,nY]),og=a3("type",[nW,nX,nY,nQ,of]),ov=a0({role:nS,content:a9([og,aY(og)]),_meta:a7(av(),aG()).optional()}),o_=iD.extend({messages:aY(ov),modelPreferences:om.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:iN.optional(),tools:aY(n8).optional(),toolChoice:oh.optional()}),ob=iU.extend({method:ia("sampling/createMessage"),params:o_}),oS=iB.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens"]).or(av())),role:nS,content:oy}),o$=iB.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens","toolUse"]).or(av())),role:nS,content:a9([og,aY(og)])}),ow=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),oR=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),ok=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),ox=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),oP=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),oE=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),oT=a9([ox,oP]),oj=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),oC=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()}),oO=a9([oj,oC]),oI=a9([oE,oT,oO]),oN=a9([oI,ow,oR,ok]),oq=iD.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),oN),required:aY(av()).optional()}).catchall(aG())}),oA=iD.extend({mode:ia("url"),message:av(),elicitationId:av(),url:av().url()}),oz=a9([oq,oA]),oM=iU.extend({method:ia("elicitation/create"),params:oz}),oL=iF.extend({elicitationId:av()}),oZ=iH.extend({method:ia("notifications/elicitation/complete"),params:oL}),oV=iB.extend({action:it(["accept","decline","cancel"]),content:iR(e=>null===e?void 0:e,a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional())}),oD=a0({type:ia("ref/resource"),uri:av()}),oU=a0({type:ia("ref/prompt"),name:av()}),oF=iV.extend({ref:a9([oU,oD]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()}),oH=iU.extend({method:ia("completion/complete"),params:oF}),oJ=iB.extend({completion:a1({values:aY(av()).max(100),total:il(aZ().int()),hasMore:il(aF())})}),oB=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),oK=iU.extend({method:ia("roots/list"),params:iV.optional()}),oG=iB.extend({roots:aY(oB)}),oW=iH.extend({method:ia("notifications/roots/list_changed"),params:iF.optional()}),oX=a1({ttl:aZ().optional(),pollInterval:aZ().optional()}),oY=it(["working","input_required","completed","failed","cancelled"]),oQ=a0({taskId:av(),status:oY,ttl:a9([aZ(),aJ()]),createdAt:av(),lastUpdatedAt:av(),pollInterval:il(aZ()),statusMessage:il(av())}),o0=iB.extend({task:oQ}),o1=iF.merge(oQ),o2=iH.extend({method:ia("notifications/tasks/status"),params:o1}),o9=iU.extend({method:ia("tasks/get"),params:iV.extend({taskId:av()})}),o4=iB.merge(oQ),o3=iU.extend({method:ia("tasks/result"),params:iV.extend({taskId:av()})}),o6=iB.loose(),o5=nf.extend({method:ia("tasks/list")}),o8=ny.extend({tasks:aY(oQ)}),o7=iU.extend({method:ia("tasks/cancel"),params:iV.extend({taskId:av()})}),se=iB.merge(oQ),st=a9([nu,ni,nl,oH,oc,nG,nJ,nk,nP,nj,nI,nN,nz,oi,n7]),sr=a9([i9,nm,ns,oW]),sa=a9([i1,oS,o$,oV,oG]),si=a9([nu,ob,oM,oK]),sn=a9([i9,nm,od,nU,nO,on,n3,nL,oZ]),so=a9([i1,no,nc,oJ,n4,nB,nx,nE,nC,ot,oe,nV]),ss=rf(aw,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),Z}).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"}),sl=a1({resource:av().url(),authorization_servers:aY(ss).optional(),jwks_uri:av().url().optional(),scopes_supported:aY(av()).optional(),bearer_methods_supported:aY(av()).optional(),resource_signing_alg_values_supported:aY(av()).optional(),resource_name:av().optional(),resource_documentation:av().optional(),resource_policy_uri:av().url().optional(),resource_tos_uri:av().url().optional(),tls_client_certificate_bound_access_tokens:aF().optional(),authorization_details_types_supported:aY(av()).optional(),dpop_signing_alg_values_supported:aY(av()).optional(),dpop_bound_access_tokens_required:aF().optional()}),sc=a1({issuer:av(),authorization_endpoint:ss,token_endpoint:ss,registration_endpoint:ss.optional(),scopes_supported:aY(av()).optional(),response_types_supported:aY(av()),response_modes_supported:aY(av()).optional(),grant_types_supported:aY(av()).optional(),token_endpoint_auth_methods_supported:aY(av()).optional(),token_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),service_documentation:ss.optional(),revocation_endpoint:ss.optional(),revocation_endpoint_auth_methods_supported:aY(av()).optional(),revocation_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),introspection_endpoint:av().optional(),introspection_endpoint_auth_methods_supported:aY(av()).optional(),introspection_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),code_challenge_methods_supported:aY(av()).optional(),client_id_metadata_document_supported:aF().optional(),authorization_response_iss_parameter_supported:aF().optional().catch(void 0)}),su=a1({issuer:av(),authorization_endpoint:ss,token_endpoint:ss,userinfo_endpoint:ss.optional(),jwks_uri:ss,registration_endpoint:ss.optional(),scopes_supported:aY(av()).optional(),response_types_supported:aY(av()),response_modes_supported:aY(av()).optional(),grant_types_supported:aY(av()).optional(),acr_values_supported:aY(av()).optional(),subject_types_supported:aY(av()),id_token_signing_alg_values_supported:aY(av()),id_token_encryption_alg_values_supported:aY(av()).optional(),id_token_encryption_enc_values_supported:aY(av()).optional(),userinfo_signing_alg_values_supported:aY(av()).optional(),userinfo_encryption_alg_values_supported:aY(av()).optional(),userinfo_encryption_enc_values_supported:aY(av()).optional(),request_object_signing_alg_values_supported:aY(av()).optional(),request_object_encryption_alg_values_supported:aY(av()).optional(),request_object_encryption_enc_values_supported:aY(av()).optional(),token_endpoint_auth_methods_supported:aY(av()).optional(),token_endpoint_auth_signing_alg_values_supported:aY(av()).optional(),display_values_supported:aY(av()).optional(),claim_types_supported:aY(av()).optional(),claims_supported:aY(av()).optional(),service_documentation:av().optional(),claims_locales_supported:aY(av()).optional(),ui_locales_supported:aY(av()).optional(),claims_parameter_supported:aF().optional(),request_parameter_supported:aF().optional(),request_uri_parameter_supported:aF().optional(),require_request_uri_registration:aF().optional(),op_policy_uri:ss.optional(),op_tos_uri:ss.optional(),client_id_metadata_document_supported:aF().optional(),authorization_response_iss_parameter_supported:aF().optional().catch(void 0)}),sd=a0({...su.shape,...sc.pick({code_challenge_methods_supported:!0}).shape}),sp=a0({access_token:av(),id_token:av().optional(),token_type:av(),expires_in:new aL({type:"number",coerce:!0,checks:[],...eA(void 0)}).optional(),scope:av().optional(),refresh_token:av().optional()}).strip(),sm=a0({issued_token_type:ia("urn:ietf:params:oauth:token-type:id-jag"),access_token:av(),token_type:av().optional(),expires_in:aZ().optional(),scope:av().optional()}).strip(),sh=a0({error:av(),error_description:av().optional(),error_uri:av().optional()}),sf=ss.optional().or(ia("").transform(()=>void 0)),sy=a0({redirect_uris:aY(ss),token_endpoint_auth_method:av().optional(),grant_types:aY(av()).optional(),response_types:aY(av()).optional(),application_type:av().optional(),client_name:av().optional(),client_uri:ss.optional(),logo_uri:sf,scope:av().optional(),contacts:aY(av()).optional(),tos_uri:sf,policy_uri:av().optional(),jwks_uri:ss.optional(),jwks:new aB({type:"any"}).optional(),software_id:av().optional(),software_version:av().optional(),software_statement:av().optional()}).strip(),sg=a0({client_id:av(),client_secret:av().optional(),client_id_issued_at:aZ().optional(),client_secret_expires_at:aZ().optional()}).strip(),sv=sy.merge(sg),s_=a0({error:av(),error_description:av().optional()}).strip(),sb=a0({token:av(),token_type_hint:av().optional()}).strip(),sS=Symbol.for("mcp.sdk.errorBrands");function s$(e,t){let r=new Set,a=t;for(;"function"==typeof a;){let e=a.mcpBrand;Object.prototype.hasOwnProperty.call(a,"mcpBrand")&&"string"==typeof e&&r.add(e),a=Object.getPrototypeOf(a)}0!==r.size&&Object.defineProperty(e,sS,{value:r,enumerable:!1,configurable:!0})}function sw(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,sS)){let r=t[sS];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",s$(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 sR=((m={}).NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m);var sk=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",s$(this,new.target)}};(class extends sk{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 sx={};function sP(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sE(e,t){let r={};for(let[a,i]of Object.entries(e)){if(void 0===i)continue;let e=void 0===t?void 0:t[a];if(void 0===e){r[a]=i;continue}if(sP(i)&&sP(e)){let t={};for(let[r,n]of Object.entries(i))void 0!==n&&void 0===e[r]&&("elicitation"!==a||"form"!==r||void 0!==e.form||void 0!==e.url)&&(t[r]=n);Object.keys(t).length>0&&(r[a]=t)}}return Object.keys(r).length>0?r:void 0}let sT="2026-07-28",sj=[sT];function sC(e){return e.filter(e=>e>=sT)}function sO(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 sI=["task","inputRequests","requestState"];function sN(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||sI.some(t=>t in e)?e:{...e,content:[]}}function sq(){let t,r,a,i,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w,R,k,x,P,E,T,j,C,O,I,N,q,A,z,M,L,Z,V,D,U,F,H,J,B,K,G,W,X,Y,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,ey,eg,ev,e_,eb,eS,e$,ew,eR,ek,ex,eP,eE,eT,ej,eC,eO,eI,eN,eq,eA,ez,eM,eL,eZ,eV,eD,eU,eF,eH,eJ,eB,eK,eG,eW,eX,eY,eQ,e0,e1,e2,e9,e4,e3,e6,e5,e8,e7,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,ty,tg,tv,t_,tb,tS,t$;return e??=(t=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),t),aY(t)])),r=a7(av(),t),a=a9([av(),aZ().int()]),i=av(),n=a0({ttl:aZ().optional()}),o=a0({taskId:av()}),c=(l=a0({_meta:(s=a1({progressToken:a.optional(),"io.modelcontextprotocol/related-task":o.optional()})).optional()})).extend({task:n.optional()}),u=a0({method:av(),params:l.loose().optional()}),d=a0({_meta:s.optional()}),p=a0({method:av(),params:d.loose().optional()}),m=a1({_meta:s.optional()}),h=a9([av(),aZ().int()]),f=m.strict(),y=d.extend({requestId:h.optional(),reason:av().optional()}),g=p.extend({method:ia("notifications/cancelled"),params:y}),v=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),_=a0({icons:aY(v).optional()}),S=(b=a0({name:av(),title:av().optional()})).extend({...b.shape,..._.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),$=a5(a0({applyDefaults:aF().optional()}),r),w=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:$.optional(),url:r.optional()}),r.optional())),R=a1({list:r.optional(),cancel:r.optional(),requests:a1({sampling:a1({createMessage:r.optional()}).optional(),elicitation:a1({create:r.optional()}).optional()}).optional()}),k=a1({list:r.optional(),cancel:r.optional(),requests:a1({tools:a1({call:r.optional()}).optional()}).optional()}),x=a0({experimental:a7(av(),r).optional(),sampling:a0({context:r.optional(),tools:r.optional()}).optional(),elicitation:w.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:R.optional(),extensions:a7(av(),r).optional()}),P=l.extend({protocolVersion:av(),capabilities:x,clientInfo:S}),E=u.extend({method:ia("initialize"),params:P}),T=a0({experimental:a7(av(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:k.optional(),extensions:a7(av(),r).optional()}),j=m.extend({protocolVersion:av(),capabilities:T,serverInfo:S,instructions:av().optional()}),C=p.extend({method:ia("notifications/initialized"),params:d.optional()}),O=u.extend({method:ia("ping"),params:l.optional()}),I=a0({progress:aZ(),total:il(aZ()),message:il(av())}),N=a0({...d.shape,...I.shape,progressToken:a}),q=p.extend({method:ia("notifications/progress"),params:N}),A=l.extend({cursor:i.optional()}),z=u.extend({params:A.optional()}),M=m.extend({nextCursor:i.optional()}),Z=(L=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()})).extend({text:av()}),V=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D=L.extend({blob:V}),F=a0({audience:aY(U=it(["user","assistant"])).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),H=a0({...b.shape,..._.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:F.optional(),_meta:il(a1({}))}),J=a0({...b.shape,..._.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:F.optional(),_meta:il(a1({}))}),B=z.extend({method:ia("resources/list")}),K=M.extend({resources:aY(H)}),G=z.extend({method:ia("resources/templates/list")}),W=M.extend({resourceTemplates:aY(J)}),X=l.extend({uri:av()}),Y=u.extend({method:ia("resources/read"),params:X}),Q=m.extend({contents:aY(a9([Z,D]))}),ee=p.extend({method:ia("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:ia("resources/subscribe"),params:X}),er=u.extend({method:ia("resources/unsubscribe"),params:X}),ea=d.extend({uri:av()}),ei=p.extend({method:ia("notifications/resources/updated"),params:ea}),en=a0({name:av(),description:il(av()),required:il(aF())}),eo=a0({...b.shape,..._.shape,description:il(av()),arguments:il(aY(en)),_meta:il(a1({}))}),es=z.extend({method:ia("prompts/list")}),el=M.extend({prompts:aY(eo)}),ec=l.extend({name:av(),arguments:a7(av(),av()).optional()}),eu=u.extend({method:ia("prompts/get"),params:ec}),ed=a0({type:ia("text"),text:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),ep=a0({type:ia("image"),data:V,mimeType:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),em=a0({type:ia("audio"),data:V,mimeType:av(),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),eh=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),ef=a0({type:ia("resource"),resource:a9([Z,D]),annotations:F.optional(),_meta:a7(av(),aG()).optional()}),ev=a0({role:U,content:eg=a9([ed,ep,em,ey=H.extend({type:ia("resource_link")}),ef])}),e_=m.extend({description:av().optional(),messages:aY(ev)}),eb=p.extend({method:ia("notifications/prompts/list_changed"),params:d.optional()}),eS=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),e$=a0({taskSupport:it(["required","optional","forbidden"]).optional()}),ew=a0({...b.shape,..._.shape,description:av().optional(),inputSchema:a0({type:ia("object"),properties:a7(av(),t).optional(),required:aY(av()).optional()}).catchall(aG()),outputSchema:a0({type:ia("object"),properties:a7(av(),t).optional(),required:aY(av()).optional()}).catchall(aG()).optional(),annotations:eS.optional(),execution:e$.optional(),_meta:a7(av(),aG()).optional()}),eR=z.extend({method:ia("tools/list")}),ek=M.extend({tools:aY(ew)}),ex=m.extend({content:aY(eg),structuredContent:a7(av(),aG()).optional(),isError:aF().optional()}),eP=c.extend({name:av(),arguments:a7(av(),aG()).optional()}),eE=u.extend({method:ia("tools/call"),params:eP}),eT=p.extend({method:ia("notifications/tools/list_changed"),params:d.optional()}),ej=it(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=l.extend({level:ej}),eO=u.extend({method:ia("logging/setLevel"),params:eC}),eI=d.extend({level:ej,logger:av().optional(),data:aG()}),eN=p.extend({method:ia("notifications/message"),params:eI}),eq=a0({name:av().optional()}),eA=a0({hints:aY(eq).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),ez=a0({mode:it(["auto","required","none"]).optional()}),eM=a0({type:ia("tool_result"),toolUseId:av().describe("The unique identifier for the corresponding tool call."),content:aY(eg),structuredContent:a0({}).loose().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),eL=a3("type",[ed,ep,em]),eV=a0({role:U,content:a9([eZ=a3("type",[ed,ep,em,eh,eM]),aY(eZ)]),_meta:a7(av(),aG()).optional()}),eD=c.extend({messages:aY(eV),modelPreferences:eA.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:r.optional(),tools:aY(ew).optional(),toolChoice:ez.optional()}),eU=u.extend({method:ia("sampling/createMessage"),params:eD}),eF=m.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens"]).or(av())),role:U,content:eL}),eH=m.extend({model:av(),stopReason:il(it(["endTurn","stopSequence","maxTokens","toolUse"]).or(av())),role:U,content:a9([eZ,aY(eZ)])}),eJ=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),eB=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),eK=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),eG=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),eW=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),eX=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),eY=a9([eG,eW]),eQ=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),e1=a9([eQ,e0=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()})]),e2=a9([eX,eY,e1]),e9=a9([e2,eJ,eB,eK]),e4=c.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),e9),required:aY(av()).optional()}).catchall(aG())}),e6=a9([e4,e3=c.extend({mode:ia("url"),message:av(),elicitationId:av(),url:av().url()})]),e5=u.extend({method:ia("elicitation/create"),params:e6}),e8=d.extend({elicitationId:av()}),e7=p.extend({method:ia("notifications/elicitation/complete"),params:e8}),te=m.extend({action:it(["accept","decline","cancel"]),content:iR(e=>null===e?void 0:e,a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional())}),tt=a0({type:ia("ref/resource"),uri:av()}),tr=a0({type:ia("ref/prompt"),name:av()}),ta=l.extend({ref:a9([tr,tt]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()}),ti=u.extend({method:ia("completion/complete"),params:ta}),tn=m.extend({completion:a1({values:aY(av()).max(100),total:il(aZ().int()),hasMore:il(aF())})}),to=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),ts=u.extend({method:ia("roots/list"),params:l.optional()}),tl=m.extend({roots:aY(to)}),tc=p.extend({method:ia("notifications/roots/list_changed"),params:d.optional()}),tu=a1({ttl:aZ().optional(),pollInterval:aZ().optional()}),td=it(["working","input_required","completed","failed","cancelled"]),tp=a0({taskId:av(),status:td,ttl:a9([aZ(),aJ()]),createdAt:av(),lastUpdatedAt:av(),pollInterval:il(aZ()),statusMessage:il(av())}),tm=m.extend({task:tp}),th=d.merge(tp),tf=p.extend({method:ia("notifications/tasks/status"),params:th}),ty=u.extend({method:ia("tasks/get"),params:l.extend({taskId:av()})}),tg=m.merge(tp),tv=u.extend({method:ia("tasks/result"),params:l.extend({taskId:av()})}),t_=m.loose(),tb=z.extend({method:ia("tasks/list")}),tS=M.extend({tasks:aY(tp)}),t$=u.extend({method:ia("tasks/cancel"),params:l.extend({taskId:av()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,TaskMetadataSchema:n,RelatedTaskMetadataSchema:o,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:g,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:k,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:P,InitializeRequestSchema:E,ServerCapabilitiesSchema:T,InitializeResultSchema:j,InitializedNotificationSchema:C,PingRequestSchema:O,ProgressSchema:I,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:A,PaginatedRequestSchema:z,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:Z,BlobResourceContentsSchema:D,RoleSchema:U,AnnotationsSchema:F,ResourceSchema:H,ResourceTemplateSchema:J,ListResourcesRequestSchema:B,ListResourcesResultSchema:K,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:W,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Y,ReadResourceResultSchema:Q,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:eo,ListPromptsRequestSchema:es,ListPromptsResultSchema:el,GetPromptRequestParamsSchema:ec,GetPromptRequestSchema:eu,TextContentSchema:ed,ImageContentSchema:ep,AudioContentSchema:em,ToolUseContentSchema:eh,EmbeddedResourceSchema:ef,ResourceLinkSchema:ey,ContentBlockSchema:eg,PromptMessageSchema:ev,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eb,ToolAnnotationsSchema:eS,ToolExecutionSchema:e$,ToolSchema:ew,ListToolsRequestSchema:eR,ListToolsResultSchema:ek,CallToolResultSchema:ex,CallToolRequestParamsSchema:eP,CallToolRequestSchema:eE,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eO,LoggingMessageNotificationParamsSchema:eI,LoggingMessageNotificationSchema:eN,ModelHintSchema:eq,ModelPreferencesSchema:eA,ToolChoiceSchema:ez,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eD,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eJ,StringSchemaSchema:eB,NumberSchemaSchema:eK,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eW,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eY,UntitledMultiSelectEnumSchemaSchema:eQ,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e3,ElicitRequestParamsSchema:e6,ElicitRequestSchema:e5,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:e7,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:to,ListRootsRequestSchema:ts,ListRootsResultSchema:tl,RootsListChangedNotificationSchema:tc,TaskCreationParamsSchema:tu,TaskStatusSchema:td,TaskSchema:tp,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:th,TaskStatusNotificationSchema:tf,GetTaskRequestSchema:ty,GetTaskResultSchema:tg,GetTaskPayloadRequestSchema:tv,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tb,ListTasksResultSchema:tS,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(tp),ClientRequestSchema:a9([O,E,ti,eO,eu,es,B,G,Y,et,er,eE,eR,ty,tv,tb,t$]),ClientNotificationSchema:a9([g,q,C,tc,tf]),ClientResultSchema:a9([f,eF,eH,te,tl,tg,tS,tm]),ServerRequestSchema:a9([O,eU,e5,ts,ty,tv,tb,t$]),ServerNotificationSchema:a9([g,q,eN,ei,ee,eT,eb,tf,e7]),ServerResultSchema:a9([f,j,tn,e_,el,K,W,Q,ex,ek,tg,tS,tm]),CallToolResultWireSchema:aG().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of sI)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(sN).pipe(ex)})}function sA(e){return"object"!==e.type}let sz=new Set(["const","enum","default","examples"]),sM=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function sL(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let sZ={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},sV={"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},sD={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 sU(){if(t)return t;let e=sq();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 sF(e){return Object.prototype.hasOwnProperty.call(sZ,e)}function sH(e){return Object.prototype.hasOwnProperty.call(sV,e)}function sJ(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sB(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(sZ),Object.keys(sV);let sK={ok:!1,reason:"not-in-era"};function sG(e){return sJ(e)&&sJ(e.outputSchema)&&sA(e.outputSchema)}let sW={era:"2025-11-25",hasRequestMethod:sF,hasNotificationMethod:sH,validateRequest:(e,t)=>sB(sF(e)?sU().requestSchemas[e]:void 0,t),validateResult:(e,t)=>sB(Object.prototype.hasOwnProperty.call(sD,e)?sU().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>sB(sH(e)?sU().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>sK,validateInputResponse:()=>sK,samplingResultVariant:(e,t)=>{let r=sq();return sB(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=sO(e),a=r.structuredContent;if(void 0===a)return r;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==t&&sA(t);return i||n?{...r,structuredContent:{result:a}}:r},decodeResult(e,t){if(sJ(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=>sG(e))?{...t,tools:r.map(e=>sG(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(sL(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let a="string"==typeof(t=e.$schema)&&z.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,i=(e,t)=>{if(Array.isArray(e))return e.map(e=>i(e,!1));if(null===e||"object"!=typeof e||!t&&sL(e.$id))return e;let r={},n=!1;for(let[o,s]of Object.entries(e))t?r[o]=i(s,!1):("$ref"===o||"$dynamicRef"===o)&&"string"==typeof s?r[o]="#"===s?"#/properties/result":s.startsWith("#/")?`#/properties/result${s.slice(1)}`:s:"$recursiveRef"===o&&"#"===s&&a?n=!0:sz.has(o)?r[o]=s:sM.has(o)?r[o]=i(s,!0):r[o]=i(s,!1);return n&&("$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:i(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function sX(){return i??=function(){let e=i$(()=>a9([av(),aZ(),aF(),aJ(),a7(av(),e),aY(e)])),t=a7(av(),e),r=a9([av(),aZ().int()]),a=av(),i=a9([av(),aZ().int()]),n=it(["user","assistant"]),o=it(["debug","info","notice","warning","error","critical","alert","emergency"]),s=av().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=a0({ttl:aZ().optional()}),c=a0({taskId:av()}),u=a1({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=a0({_meta:u.optional()}),p=d.extend({task:l.optional()}),m=a0({_meta:u.optional()}),h=a0({method:av(),params:m.loose().optional()}),f=a0({src:av(),mimeType:av().optional(),sizes:aY(av()).optional(),theme:it(["light","dark"]).optional()}),y=a0({icons:aY(f).optional()}),g=a0({name:av(),title:av().optional()}),v=g.extend({...g.shape,...y.shape,version:av(),websiteUrl:av().optional(),description:av().optional()}),_=a5(a0({applyDefaults:aF().optional()}),t),b=iR(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a5(a0({form:_.optional(),url:t.optional()}),t.optional())),S=a1({list:t.optional(),cancel:t.optional(),requests:a1({sampling:a1({createMessage:t.optional()}).optional(),elicitation:a1({create:t.optional()}).optional()}).optional()}),$=a1({list:t.optional(),cancel:t.optional(),requests:a1({tools:a1({call:t.optional()}).optional()}).optional()}),w=a0({experimental:a7(av(),t).optional(),sampling:a0({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:a0({listChanged:aF().optional()}).optional(),tasks:S.optional(),extensions:a7(av(),t).optional()}),R=a0({experimental:a7(av(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:a0({listChanged:aF().optional()}).optional(),resources:a0({subscribe:aF().optional(),listChanged:aF().optional()}).optional(),tools:a0({listChanged:aF().optional()}).optional(),tasks:$.optional(),extensions:a7(av(),t).optional()}),k=a0({progress:aZ(),total:il(aZ()),message:il(av())}),x=a0({...m.shape,...k.shape,progressToken:r}),P=h.extend({method:ia("notifications/progress"),params:x}),E=m.extend({level:o,logger:av().optional(),data:aG()}),T=h.extend({method:ia("notifications/message"),params:E}),j=a0({uri:av(),mimeType:il(av()),_meta:a7(av(),aG()).optional()}),C=j.extend({text:av()}),O=j.extend({blob:s}),I=a0({audience:aY(n).optional(),priority:aZ().min(0).max(1).optional(),lastModified:r3({offset:!0}).optional()}),N=a0({...g.shape,...y.shape,uri:av(),description:il(av()),mimeType:il(av()),size:il(aZ()),annotations:I.optional(),_meta:il(a1({}))}),q=a0({...g.shape,...y.shape,uriTemplate:av(),description:il(av()),mimeType:il(av()),annotations:I.optional(),_meta:il(a1({}))}),A=h.extend({method:ia("notifications/resources/list_changed"),params:m.optional()}),z=m.extend({uri:av()}),M=h.extend({method:ia("notifications/resources/updated"),params:z}),L=a0({name:av(),description:il(av()),required:il(aF())}),Z=a0({...g.shape,...y.shape,description:il(av()),arguments:il(aY(L)),_meta:il(a1({}))}),V=h.extend({method:ia("notifications/prompts/list_changed"),params:m.optional()}),D=a0({type:ia("text"),text:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),U=a0({type:ia("image"),data:s,mimeType:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),F=a0({type:ia("audio"),data:s,mimeType:av(),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),H=a0({type:ia("tool_use"),name:av(),id:av(),input:a7(av(),aG()),_meta:a7(av(),aG()).optional()}),J=a0({type:ia("resource"),resource:a9([C,O]),annotations:I.optional(),_meta:a7(av(),aG()).optional()}),B=N.extend({type:ia("resource_link")}),K=a9([D,U,F,B,J]),G=a0({role:n,content:K}),W=a0({title:av().optional(),readOnlyHint:aF().optional(),destructiveHint:aF().optional(),idempotentHint:aF().optional(),openWorldHint:aF().optional()}),X=h.extend({method:ia("notifications/tools/list_changed"),params:m.optional()}),Y=a0({name:av().optional()}),Q=a0({hints:aY(Y).optional(),costPriority:aZ().min(0).max(1).optional(),speedPriority:aZ().min(0).max(1).optional(),intelligencePriority:aZ().min(0).max(1).optional()}),ee=a0({mode:it(["auto","required","none"]).optional()}),et=a0({type:ia("boolean"),title:av().optional(),description:av().optional(),default:aF().optional()}),er=a0({type:ia("string"),title:av().optional(),description:av().optional(),minLength:aZ().optional(),maxLength:aZ().optional(),format:it(["email","uri","date","date-time"]).optional(),default:av().optional()}),ea=a0({type:it(["number","integer"]),title:av().optional(),description:av().optional(),minimum:aZ().optional(),maximum:aZ().optional(),default:aZ().optional()}),ei=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),default:av().optional()}),en=a0({type:ia("string"),title:av().optional(),description:av().optional(),oneOf:aY(a0({const:av(),title:av()})),default:av().optional()}),eo=a0({type:ia("string"),title:av().optional(),description:av().optional(),enum:aY(av()),enumNames:aY(av()).optional(),default:av().optional()}),es=a9([ei,en]),el=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({type:ia("string"),enum:aY(av())}),default:aY(av()).optional()}),ec=a0({type:ia("array"),title:av().optional(),description:av().optional(),minItems:aZ().optional(),maxItems:aZ().optional(),items:a0({anyOf:aY(a0({const:av(),title:av()}))}),default:aY(av()).optional()}),eu=a9([el,ec]),ed=a9([eo,es,eu]),ep=a9([ed,et,er,ea]),em=p.extend({mode:ia("form").optional(),message:av(),requestedSchema:a0({type:ia("object"),properties:a7(av(),ep),required:aY(av()).optional()}).catchall(aG())}),eh=a0({type:ia("ref/resource"),uri:av()}),ef=a0({type:ia("ref/prompt"),name:av()}),ey=a0({uri:av().startsWith("file://"),name:av().optional(),_meta:a7(av(),aG()).optional()}),eg=w.shape,ev=a0({experimental:eg.experimental,sampling:eg.sampling,elicitation:eg.elicitation,roots:eg.roots,extensions:eg.extensions}),e_=R.shape,eb=a0({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=a1({progressToken:r.optional(),[iP]:av(),[iE]:v.optional(),[ij]:ev,[iO]:o.optional()}),e$=a0({...g.shape,...y.shape,description:av().optional(),inputSchema:a1({$schema:av().optional(),type:ia("object")}),outputSchema:a1({$schema:av().optional()}).optional(),annotations:W.optional(),_meta:a7(av(),aG()).optional()}),ew=a0({type:ia("tool_result"),toolUseId:av(),content:aY(K),structuredContent:aG().optional(),isError:aF().optional(),_meta:a7(av(),aG()).optional()}),eR=a9([D,U,F,H,ew]),ek=a0({role:n,content:a9([eR,aY(eR)]),_meta:a7(av(),aG()).optional()}),ex=av(),eP=a1({[iT]:v.optional().catch(void 0)}),eE=eP.optional();function eT(e){return a1({_meta:eE,resultType:ex.default("complete"),...e})}let ej=eT({}),eC=eT({nextCursor:a.optional()}),eO=eT({content:aY(K),structuredContent:aG().optional(),isError:aF().optional()}),eI=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),tools:aY(e$),nextCursor:a.optional()}),eN=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),prompts:aY(Z),nextCursor:a.optional()}),eq=eT({description:av().optional(),messages:aY(G)}),eA=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resources:aY(N),nextCursor:a.optional()}),ez=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resourceTemplates:aY(q),nextCursor:a.optional()}),eM=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),contents:aY(a9([C,O]))}),eL=eT({completion:a0({values:aY(av()).max(100),total:aZ().int().optional(),hasMore:aF().optional()}).loose()}),eZ=eT({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"])}),eV=eT({ttlMs:aZ().int().min(0).catch(0),cacheScope:it(["public","private"]).catch("private"),supportedVersions:aY(av()),capabilities:eb,instructions:av().optional()}),eD=a0({messages:aY(ek),modelPreferences:Q.optional(),systemPrompt:av().optional(),includeContext:it(["none","thisServer","allServers"]).optional(),temperature:aZ().optional(),maxTokens:aZ().int(),stopSequences:aY(av()).optional(),metadata:t.optional(),tools:aY(e$).optional(),toolChoice:ee.optional()}),eU=a0({method:ia("sampling/createMessage"),params:eD}),eF=a0({method:ia("roots/list"),params:a0({_meta:a7(av(),aG()).optional()}).optional()}),eH=a0({...ek.shape,model:av(),stopReason:av().optional()}),eJ=a0({roots:aY(ey)}),eB=a0({action:it(["accept","decline","cancel"]),content:a7(av(),a9([av(),aZ(),aF(),aY(av())])).optional()}),eK=a0({mode:ia("url"),message:av(),url:av().url()}),eG=a9([em,eK]),eW=a0({method:ia("elicitation/create"),params:eG}),eX=a9([eU,eF,eW]),eY=a9([eH,eJ,eB]),eQ=a7(av(),eX),e0=a7(av(),eY),e1=eT({inputRequests:eQ.optional(),requestState:av().optional()}),e2={inputResponses:e0.optional(),requestState:av().optional()},e9=a0({_meta:eS,...e2}),e4=a1({progressToken:r.optional()});function e3(e,t){return a0({method:ia(e),params:a0({_meta:eS,...t})})}function e6(e,t){return a0({method:ia(e),params:a0({_meta:e4.optional(),...t}).optional()})}let e5={name:av(),arguments:a7(av(),aG()).optional(),...e2},e8={cursor:a.optional()},e7=e3("tools/call",e5),te=e3("tools/list",e8),tt=e3("prompts/list",e8),tr=e3("prompts/get",{name:av(),arguments:a7(av(),av()).optional(),...e2}),ta=e3("resources/list",e8),ti=e3("resources/templates/list",e8),tn=e3("resources/read",{uri:av(),...e2}),to={ref:a9([ef,eh]),argument:a0({name:av(),value:av()}),context:a0({arguments:a7(av(),av()).optional()}).optional()},ts=e3("completion/complete",to),tl=e3("server/discover",{}),tc=a0({toolsListChanged:aF().optional(),promptsListChanged:aF().optional(),resourcesListChanged:aF().optional(),resourceSubscriptions:aY(av()).optional()}),tu={notifications:tc},td=e3("subscriptions/listen",tu),tp=eP.extend({"io.modelcontextprotocol/subscriptionId":i}),tm=a1({_meta:tp,resultType:ex.default("complete")}),th={"tools/call":e6("tools/call",e5),"tools/list":e6("tools/list",e8),"prompts/get":e6("prompts/get",{name:av(),arguments:a7(av(),av()).optional()}),"prompts/list":e6("prompts/list",e8),"resources/list":e6("resources/list",e8),"resources/templates/list":e6("resources/templates/list",e8),"resources/read":e6("resources/read",{uri:av()}),"completion/complete":e6("completion/complete",to),"server/discover":e6("server/discover",{}),"subscriptions/listen":e6("subscriptions/listen",tu)};function tf(e){return a1({_meta:eE,...e})}let ty={"tools/call":tf({content:aY(K),structuredContent:aG().optional(),isError:aF().optional()}),"tools/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),tools:aY(e$),nextCursor:a.optional()}),"prompts/get":tf({description:av().optional(),messages:aY(G)}),"prompts/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),prompts:aY(Z),nextCursor:a.optional()}),"resources/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resources:aY(N),nextCursor:a.optional()}),"resources/templates/list":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),resourceTemplates:aY(q),nextCursor:a.optional()}),"resources/read":tf({ttlMs:aZ().int().min(0),cacheScope:it(["public","private"]),contents:aY(a9([C,O]))}),"completion/complete":tf({completion:a0({values:aY(av()).max(100),total:aZ().int().optional(),hasMore:aF().optional()}).loose()}),"server/discover":tf({ttlMs:aZ().int().min(0).catch(0),cacheScope:it(["public","private"]).catch("private"),supportedVersions:aY(av()),capabilities:eb,instructions:av().optional()}),"subscriptions/listen":tf({})},tg=a1({"io.modelcontextprotocol/subscriptionId":i.optional()}),tv=a0({method:ia("notifications/subscriptions/acknowledged"),params:a0({_meta:tg.optional(),notifications:tc})}),t_=a0({_meta:tg.optional(),requestId:i,reason:av().optional()}),tb=a0({method:ia("notifications/cancelled"),params:t_}),tS=e=>a0({jsonrpc:ia("2.0"),id:a9([av(),aZ().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:o,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:f,IconsSchema:y,BaseMetadataSchema:g,ImplementationSchema:v,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:R,ProgressSchema:k,ProgressNotificationParamsSchema:x,ProgressNotificationSchema:P,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:T,ResourceContentsSchema:j,TextResourceContentsSchema:C,BlobResourceContentsSchema:O,AnnotationsSchema:I,ResourceSchema:N,ResourceTemplateSchema:q,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:Z,PromptListChangedNotificationSchema:V,TextContentSchema:D,ImageContentSchema:U,AudioContentSchema:F,ToolUseContentSchema:H,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:K,PromptMessageSchema:G,ToolAnnotationsSchema:W,ToolListChangedNotificationSchema:X,ModelHintSchema:Y,ModelPreferencesSchema:Q,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:eo,SingleSelectEnumSchemaSchema:es,UntitledMultiSelectEnumSchemaSchema:el,TitledMultiSelectEnumSchemaSchema:ec,MultiSelectEnumSchemaSchema:eu,EnumSchemaSchema:ed,PrimitiveSchemaDefinitionSchema:ep,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:eh,PromptReferenceSchema:ef,RootSchema:ey,ClientCapabilities2026Schema:ev,ServerCapabilities2026Schema:eb,RequestMetaEnvelopeSchema:eS,ToolSchema:e$,ToolResultContentSchema:ew,SamplingMessageContentBlockSchema:eR,SamplingMessageSchema:ek,ResultTypeSchema:ex,ResultMetaSchema:eP,ResultSchema:ej,PaginatedResultSchema:eC,CallToolResultSchema:eO,ListToolsResultSchema:eI,ListPromptsResultSchema:eN,GetPromptResultSchema:eq,ListResourcesResultSchema:eA,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eZ,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eD,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eF,CreateMessageResultSchema:eH,ListRootsResultSchema:eJ,ElicitResultSchema:eB,ElicitRequestURLParamsSchema:eK,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eW,InputRequestSchema:eX,InputResponseSchema:eY,InputRequestsSchema:eQ,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e7,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:ts,DiscoverRequestSchema:tl,SubscriptionFilterSchema:tc,SubscriptionsListenRequestSchema:td,SubscriptionsListenResultMetaSchema:tp,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:th,dispatchResultSchemas:ty,NotificationMetaSchema:tg,SubscriptionsAcknowledgedNotificationSchema:tv,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tb,notificationSchemas2026:{"notifications/cancelled":tb,"notifications/progress":P,"notifications/message":T,"notifications/resources/updated":M,"notifications/resources/list_changed":A,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":tv},JSONRPCResultResponseSchema:tS(ej),CallToolResultResponseSchema:tS(a9([eO,e1])),ListToolsResultResponseSchema:tS(eI),ListPromptsResultResponseSchema:tS(eN),GetPromptResultResponseSchema:tS(a9([eq,e1])),ListResourcesResultResponseSchema:tS(eA),ListResourceTemplatesResultResponseSchema:tS(ez),ReadResourceResultResponseSchema:tS(a9([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eV)}}()}let sY=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],sQ=Symbol("modelcontextprotocol.resultCacheHintFallback");function s0(e,t){if(void 0===t)return e;let r=e[sQ];if(void 0===r)return{...e,[sQ]:t};let a={},i=r.ttlMs??t.ttlMs;void 0!==i&&(a.ttlMs=i);let n=r.cacheScope??t.cacheScope;return void 0!==n&&(a.cacheScope=n),{...e,[sQ]:a}}function s1(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function s2(e){return"public"===e||"private"===e}function s9(e,t){if(void 0!==e.ttlMs&&!s1(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(void 0!==e.cacheScope&&!s2(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let s4=((h={})[h.ParseError=-32700]="ParseError",h[h.InvalidRequest=-32600]="InvalidRequest",h[h.MethodNotFound=-32601]="MethodNotFound",h[h.InvalidParams=-32602]="InvalidParams",h[h.InternalError=-32603]="InternalError",h[h.ResourceNotFound=-32002]="ResourceNotFound",h[h.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",h[h.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",h[h.UrlElicitationRequired=-32042]="UrlElicitationRequired",h);var s3=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return sw(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 sw(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",s$(this,new.target)}static fromError(t,r,a){return t===s4.UrlElicitationRequired&&a&&a.elicitations?new s5(a.elicitations,r):t===s4.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new s8({supported:a.supported,requested:a.requested},r):(t===s4.InvalidParams||t===s4.ResourceNotFound)&&"string"==typeof a?.uri&&(t===s4.ResourceNotFound||1===Object.keys(a).length)?new s6(a.uri,r):t===s4.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new s7({requiredCapabilities:a.requiredCapabilities},r):new e(t,r,a)}},s6=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(s4.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},s5=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(s4.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},s8=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(s4.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},s7=class extends s3{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(s4.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let le=["tools/call","prompts/get","resources/read"],lt=["elicitation/create","sampling/createMessage","roots/list"];function lr(){if(n)return n;let e=sX();return n={request:{"elicitation/create":a0({method:ia("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":a0({method:ia("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":a0({method:ia("roots/list"),params:a1({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function la(e){return lt.includes(e)}function li(e){return la(e)?lr().request[e]:void 0}let ln={"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},lo={"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 ls(e){return Object.prototype.hasOwnProperty.call(ln,e)}function ll(e){return Object.prototype.hasOwnProperty.call(lo,e)}function lc(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lu(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(ln),Object.keys(lo);let ld={ok:!1,reason:"not-in-era"},lp=[iP,ij],lm={era:"2026-07-28",hasRequestMethod:ls,hasNotificationMethod:ll,hasInputRequestMethod:e=>void 0!==li(e),validateRequest:(e,t)=>lu(ls(e)?sX().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>lu(Object.prototype.hasOwnProperty.call(ln,e)?sX().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>lu(ll(e)?sX().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>lu(li(e),t),validateInputResponse:(e,t)=>lu(la(e)?lr().response[e]:void 0,t),samplingResultVariant:()=>ld,outboundEnvelope:e=>({[iP]:e.protocolVersion,[iE]:e.clientInfo,[ij]:e.clientCapabilities,...void 0!==e.logLevel&&{[iO]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of lp)r in e||t.push({key:r,problem:"missing"});let r=sX().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),a=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===a&&"missing"===e.problem)||t.push({key:a,problem:e.message})}return t},projectCallToolResult:e=>sO(e),inputRequestSchema:li,decodeResult(e,t){if(!lc(t))return{kind:"invalid",error:new sk(sR.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new sk(sR.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 sk(sR.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,a=lc(r)?r:{},i=t.requestState;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new sk(sR.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:a,..."string"==typeof i&&{requestState:i}}}if("complete"!==r)return{kind:"invalid",error:new sk(sR.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let a=function(){if(o)return o;let e=sX();return o={"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}}(),i=Object.hasOwn(a,e)?a[e]:void 0;if(void 0!==i){let r=i.safeParse(t);if(!r.success)return{kind:"invalid",error:new sk(sR.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[iT]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[iT]?e:{...e,_meta:{...r,[iT]:t}}})(function(e,t){var r,a;let i=t[sQ];if("complete"!==t.resultType||!sY.includes(e)){let e;return void 0===i?t:(e={...t},delete e[sQ],e)}let n=s1(t.ttlMs)?t.ttlMs:void 0!==(r=i)&&s1(r.ttlMs)?r.ttlMs:0,o=s2(t.cacheScope)?t.cacheScope:void 0!==(a=i)&&s2(a.cacheScope)?a.cacheScope:"private",s={...t,ttlMs:n,cacheScope:o};return delete s[sQ],s}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||le.includes(e))return t;throw new s3(s4.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,a=!1,i=()=>(a||(r={...r},a=!0),r),n=t.tools;"tools/list"===e&&Array.isArray(n)&&n.some(e=>lc(e)&&"execution"in e)&&(i().tools=n.map(e=>{if(!lc(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(lc(o)&&"tasks"in o){let e={...o};delete e.tasks,i().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=sX().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("; ")}`}},lh="2026-07-28";function lf(e){return void 0!==e&&e>=sT?lm:sW}function ly(e){return void 0!==e.revision?lf(e.revision).era:"modern"===e.era?lm.era:sW.era}function lg(e){return l_.some(t=>t.hasRequestMethod(e))}function lv(e){return l_.some(t=>t.hasNotificationMethod(e))}let l_=[sW,lm];function lb(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lS(e){if(!lb(e))return;let t=e._meta;return lb(t)?t:void 0}function l$(e){let t=lS(e);return void 0!==t&&iP in t}function lw(e){let t=lS(e)?.[iP];return"string"==typeof t?t:void 0}function lR(e){return lf(lh).validateEnvelopeMeta(e)}var lk=((e,t)=>{let r={};for(var a in e)T(r,a,{get:e[a],enumerable:!0});return t&&T(r,Symbol.toStringTag,{value:"Module"}),r})({AnnotationsSchema:()=>n$,AudioContentSchema:()=>nY,BaseMetadataSchema:()=>i6,BaseRequestParamsSchema:()=>iV,BlobResourceContentsSchema:()=>nb,BooleanSchemaSchema:()=>ow,CallToolRequestParamsSchema:()=>oa,CallToolRequestSchema:()=>oi,CallToolResultSchema:()=>ot,CancelTaskRequestSchema:()=>o7,CancelTaskResultSchema:()=>se,CancelledNotificationParamsSchema:()=>i2,CancelledNotificationSchema:()=>i9,ClientCapabilitiesSchema:()=>nr,ClientNotificationSchema:()=>sr,ClientRequestSchema:()=>st,ClientResultSchema:()=>sa,ClientTasksCapabilitySchema:()=>ne,CompatibilityCallToolResultSchema:()=>or,CompleteRequestParamsSchema:()=>oF,CompleteRequestSchema:()=>oH,CompleteResultSchema:()=>oJ,ContentBlockSchema:()=>n2,CreateMessageRequestParamsSchema:()=>o_,CreateMessageRequestSchema:()=>ob,CreateMessageResultSchema:()=>oS,CreateMessageResultWithToolsSchema:()=>o$,CreateTaskResultSchema:()=>o0,CursorSchema:()=>iz,DiscoverRequestSchema:()=>nl,DiscoverResultSchema:()=>nc,ElicitRequestFormParamsSchema:()=>oq,ElicitRequestParamsSchema:()=>oz,ElicitRequestSchema:()=>oM,ElicitRequestURLParamsSchema:()=>oA,ElicitResultSchema:()=>oV,ElicitationCompleteNotificationParamsSchema:()=>oL,ElicitationCompleteNotificationSchema:()=>oZ,EmbeddedResourceSchema:()=>n0,EmptyResultSchema:()=>i1,EnumSchemaSchema:()=>oI,GetPromptRequestParamsSchema:()=>nK,GetPromptRequestSchema:()=>nG,GetPromptResultSchema:()=>n4,GetTaskPayloadRequestSchema:()=>o3,GetTaskPayloadResultSchema:()=>o6,GetTaskRequestSchema:()=>o9,GetTaskResultSchema:()=>o4,IconSchema:()=>i4,IconsSchema:()=>i3,ImageContentSchema:()=>nX,ImplementationSchema:()=>i5,InitializeRequestParamsSchema:()=>na,InitializeRequestSchema:()=>ni,InitializeResultSchema:()=>no,InitializedNotificationSchema:()=>ns,JSONArraySchema:()=>iq,JSONObjectSchema:()=>iN,JSONRPCErrorResponseSchema:()=>iY,JSONRPCMessageSchema:()=>iQ,JSONRPCNotificationSchema:()=>iW,JSONRPCRequestSchema:()=>iG,JSONRPCResponseSchema:()=>i0,JSONRPCResultResponseSchema:()=>iX,JSONValueSchema:()=>iI,LegacyTitledEnumSchemaSchema:()=>oE,ListChangedOptionsBaseSchema:()=>oo,ListPromptsRequestSchema:()=>nJ,ListPromptsResultSchema:()=>nB,ListResourceTemplatesRequestSchema:()=>nP,ListResourceTemplatesResultSchema:()=>nE,ListResourcesRequestSchema:()=>nk,ListResourcesResultSchema:()=>nx,ListRootsRequestSchema:()=>oK,ListRootsResultSchema:()=>oG,ListTasksRequestSchema:()=>o5,ListTasksResultSchema:()=>o8,ListToolsRequestSchema:()=>n7,ListToolsResultSchema:()=>oe,LoggingLevelSchema:()=>os,LoggingMessageNotificationParamsSchema:()=>ou,LoggingMessageNotificationSchema:()=>od,ModelHintSchema:()=>op,ModelPreferencesSchema:()=>om,MultiSelectEnumSchemaSchema:()=>oO,NotificationSchema:()=>iH,NotificationsParamsSchema:()=>iF,NumberSchemaSchema:()=>ok,PaginatedRequestParamsSchema:()=>nh,PaginatedRequestSchema:()=>nf,PaginatedResultSchema:()=>ny,PingRequestSchema:()=>nu,PrimitiveSchemaDefinitionSchema:()=>oN,ProgressNotificationParamsSchema:()=>np,ProgressNotificationSchema:()=>nm,ProgressSchema:()=>nd,ProgressTokenSchema:()=>iA,PromptArgumentSchema:()=>nF,PromptListChangedNotificationSchema:()=>n3,PromptMessageSchema:()=>n9,PromptReferenceSchema:()=>oU,PromptSchema:()=>nH,ReadResourceRequestParamsSchema:()=>nT,ReadResourceRequestSchema:()=>nj,ReadResourceResultSchema:()=>nC,RelatedTaskMetadataSchema:()=>iL,RequestIdSchema:()=>iK,RequestMetaSchema:()=>iZ,RequestSchema:()=>iU,ResourceContentsSchema:()=>ng,ResourceLinkSchema:()=>n1,ResourceListChangedNotificationSchema:()=>nO,ResourceRequestParamsSchema:()=>nT,ResourceSchema:()=>nw,ResourceTemplateReferenceSchema:()=>oD,ResourceTemplateSchema:()=>nR,ResourceUpdatedNotificationParamsSchema:()=>nD,ResourceUpdatedNotificationSchema:()=>nU,ResultMetaObjectSchema:()=>iJ,ResultSchema:()=>iB,RoleSchema:()=>nS,RootSchema:()=>oB,RootsListChangedNotificationSchema:()=>oW,SamplingContentSchema:()=>oy,SamplingMessageContentBlockSchema:()=>og,SamplingMessageSchema:()=>ov,ServerCapabilitiesSchema:()=>nn,ServerNotificationSchema:()=>sn,ServerRequestSchema:()=>si,ServerResultSchema:()=>so,ServerTasksCapabilitySchema:()=>nt,SetLevelRequestParamsSchema:()=>ol,SetLevelRequestSchema:()=>oc,SingleSelectEnumSchemaSchema:()=>oT,StringSchemaSchema:()=>oR,SubscribeRequestParamsSchema:()=>nT,SubscribeRequestSchema:()=>nI,SubscriptionFilterSchema:()=>nq,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nM,SubscriptionsAcknowledgedNotificationSchema:()=>nL,SubscriptionsListenRequestParamsSchema:()=>nA,SubscriptionsListenRequestSchema:()=>nz,SubscriptionsListenResultMetaSchema:()=>nZ,SubscriptionsListenResultSchema:()=>nV,TaskAugmentedRequestParamsSchema:()=>iD,TaskCreationParamsSchema:()=>oX,TaskMetadataSchema:()=>iM,TaskSchema:()=>oQ,TaskStatusNotificationParamsSchema:()=>o1,TaskStatusNotificationSchema:()=>o2,TaskStatusSchema:()=>oY,TextContentSchema:()=>nW,TextResourceContentsSchema:()=>nv,TitledMultiSelectEnumSchemaSchema:()=>oC,TitledSingleSelectEnumSchemaSchema:()=>oP,ToolAnnotationsSchema:()=>n6,ToolChoiceSchema:()=>oh,ToolExecutionSchema:()=>n5,ToolListChangedNotificationSchema:()=>on,ToolResultContentSchema:()=>of,ToolSchema:()=>n8,ToolUseContentSchema:()=>nQ,UnsubscribeRequestParamsSchema:()=>nT,UnsubscribeRequestSchema:()=>nN,UntitledMultiSelectEnumSchemaSchema:()=>oj,UntitledSingleSelectEnumSchemaSchema:()=>ox});let lx=e=>iG.safeParse(e).success,lP=e=>iW.safeParse(e).success,lE=e=>iX.safeParse(e).success,lT=e=>iY.safeParse(e).success,lj=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,lC="x-mcp-header",lO=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lI=new Set(["string","integer","boolean","number"]);function lN(e){let t=[],r=new Map,a=(e,i,n)=>{if(null===e||"object"!=typeof e)return;if(lC in e){if(!n||0===i.length)return`${lz(i)}: 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 a=e[lC];if("string"!=typeof a||0===a.length)return`${lz(i)}: x-mcp-header MUST be a non-empty string`;if(!lO.test(a))return`${lz(i)}: x-mcp-header '${a}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let o="string"==typeof e.type?e.type:void 0;if(void 0===o||!lI.has(o))return`${lz(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${o??"<none>"}`;let s=a.toLowerCase(),l=r.get(s);if(void 0!==l)return`x-mcp-header '${a}' is not case-insensitively unique (also declared as '${l}')`;r.set(s,a),t.push({path:i,headerName:a,type:o})}let o=e.properties;if(null!==o&&"object"==typeof o)for(let[e,t]of Object.entries(o)){let r=a(t,[...i,e],n);if(void 0!==r)return r}for(let t of lq){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&lA.has(t)?Object.values(r):[r]){let r=a(e,[...i,`<${t}>`],!1);if(void 0!==r)return r}}},i=a(e,[],!0);return void 0===i?{valid:!0,declarations:t}:{valid:!1,reason:i}}let lq=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],lA=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function lz(e){return 0===e.length?"<root>":e.join(".")}let lM=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,lL=/^-?\d+(\.\d+)?$/;function lZ(e){if(!(e.startsWith("=?base64?")&&e.endsWith("?=")))return e;let t=e.slice(9,e.length-2);if(lM.test(t))try{let e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.codePointAt(t);return new TextDecoder("utf-8",{fatal:!0}).decode(r)}catch{return}}function lV(e,t,r){return{kind:"reject",rung:"param-header-validation",cell:e,httpStatus:400,code:lD,message:`Bad Request: the request headers and body disagree: ${r}`,data:{mismatch:{header:t,body:r}},settled:!0}}let lD=-32020;s4.InvalidRequest,s4.UnsupportedProtocolVersion,s4.InvalidParams,s4.MethodNotFound,s4.InvalidParams,s4.MissingRequiredClientCapability;let lU={[s4.ParseError]:400,[s4.InvalidRequest]:400,[s4.MethodNotFound]:404,[s4.UnsupportedProtocolVersion]:400,[s4.MissingRequiredClientCapability]:400,[lD]:400};function lF(e,t,r,a,i){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:a.code,message:a.message,...void 0!==a.data&&{data:a.data},settled:i}}function lH(e,t,r,a="era-classification"){return lF(a,e,400,new s3(lD,`Bad Request: the request headers and body disagree: ${r}`,{mismatch:{header:t,body:r}}),!0)}let lJ={"tools/call":"name","prompts/get":"name","resources/read":"uri"};function lB(e){let t=0;for(;t<e.length;){let r=e.codePointAt(t);if(9!==r&&32!==r)break;t+=1}let r=e.length;for(;r>t;){let t=e.codePointAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}function lK(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lG(e){return void 0===e?{era:"modern"}:{era:e>=sT?"modern":"legacy",revision:e}}function lW(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function lX(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}let lY=!1,lQ="draft-2020-12";function l0(e,t="input"){let r,a=e["~standard"];if(a.jsonSchema)r=a.jsonSchema[t]({target:lQ});else if("zod"===a.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().");lY||(lY=!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=r9(e,{target:lQ,io:t})}else throw Error(`Schema library "${a.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 a=t[r];if(Array.isArray(a)&&a.length>0)return a.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}}async function l1(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let l2=/\\\.\\d\{(\d+)\}/;function l9(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let l4=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function l3(e){return l4.has(e)||e.startsWith("x-")}let l6=new Set(["$schema",...Object.keys(oq.shape.requestedSchema.shape)]),l5={string:lW([oR,ox,oP,oE]),number:lW([ok]),integer:lW([ok]),boolean:lW([ow]),array:lW([oj,oC])},l8=new Set(oR.shape.format.unwrap().options);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(!lX(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,a=function(e,t){let r={},a=[];for(let[i,n]of Object.entries(e))"properties"===i&&l9(n)?r[i]=Object.fromEntries(Object.entries(n).map(([e,r])=>[e,function(e,t,r,a){if(!l9(e))return e;let i="string"==typeof e.type&&Object.hasOwn(l5,e.type)?l5[e.type]:void 0;if(void 0===i)return e;let n={};for(let[s,l]of Object.entries(e))if(i.has(s)||l3(s))n[s]=l;else if("pattern"===s&&"string"===e.type&&"string"==typeof e.format)if(l8.has(e.format)){var o;"string"==typeof l&&(o=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[rm(ab,void 0)];break;case"uri":r=[rf(aw,void 0)];break;case"date":r=[r5()];break;case"date-time":let a,i;a=l2.exec(t),i=[void 0,-1,0],a&&i.push(Number(a[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>i.map(r=>r3({local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=r9(e,{target:lQ,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(o,l).has(l))||a.push(`${t}.${s}`)}else n[s]=l;else a.push(`${t}.${s}`);return n}(r,`properties.${e}`,t,a)])):l6.has(i)?r[i]=n:l3(i)||a.push(i);if(a.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return r}(function(e){try{return l0(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new s3(s4.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),i=(t=oq.shape.requestedSchema,aa(t,a));if(!i.success)throw new s3(s4.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!l9(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!aa(oN,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(a,i.error.message)}`);let n=function e(t,r,a=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,i)=>e(t,r[i],`${a}[${i}]`)):l9(t)&&l9(r)?Object.entries(t).flatMap(([t,i])=>{let n=a?`${a}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(i,r[t],n):l3(t)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let o=(i.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(i.data.properties,e));if(o.length>0)throw new s3(s4.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${o.join(", ")}`);return{...e,mode:"form",requestedSchema:i.data}}(e)}}catch(e){throw e instanceof s3?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 l7={},ce={};function ct(e,t){let r=e.slice(0,-6);l7[r]=t,ce[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"])ct(e,lk[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:sm,OAuthClientInformationFullSchema:sv,OAuthClientInformationSchema:sg,OAuthClientMetadataSchema:sy,OAuthClientRegistrationErrorSchema:s_,OAuthErrorResponseSchema:sh,OAuthMetadataSchema:sc,OAuthProtectedResourceMetadataSchema:sl,OAuthTokenRevocationRequestSchema:sb,OAuthTokensSchema:sp,OpenIdProviderDiscoveryMetadataSchema:sd,OpenIdProviderMetadataSchema:su}))ct(e,t);let cr=Object.freeze(l7);Object.freeze(ce);let ca=[iP,iE,ij,iO],ci=["inputResponses","requestState"];function cn(e,t){let r=e.params;if(!cu(r))return{message:e,lifted:{}};let a=r._meta,i=cu(a)?ca.filter(e=>e in a):[],n="request"===t?ci.filter(e=>e in r):[];if(0===i.length&&0===n.length)return{message:e,lifted:{}};let o={},s={...r};if(i.length>0&&cu(a)){let e={},t={...a};for(let r of i)e[r]=a[r],delete t[r];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of n)"inputResponses"===e&&(o.inputResponses=s[e]),"requestState"===e&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function co(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 a=e.validateResult(t,r);return a.ok?{value:a.value}:{issues:[{message:"invalid"===a.reason?a.message:`not-in-era: ${t}`}]}}}}}let cs=(f=void 0,()=>f);function cl(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:()=>t}}}var cc=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;static{s=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ix,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 sk(sR.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,a,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_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 sk(sR.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 a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{a?.(e,t),lE(e)||lT(e)?this._onresponse(e):lx(e)?this._onrequest(e,t):lP(e)?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 sk(sR.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}=cn(e,"notification"),a=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=ly(t.classification);if(e!==a.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${a.era}`))}if(lv(r.method)&&!a.hasNotificationMethod(r.method))return;let i=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(r):i(r,a)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:a,lifted:i}=cn(e,"request"),n=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 o=this._transport,s=(e,t,r)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};o?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=ly(t.classification);if(e!==n.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${e} but this instance serves ${n.era}`));let r=t.classification.revision??e;s(s4.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(lg(a.method)&&!n.hasRequestMethod(a.method))return void s(s4.MethodNotFound,"Method not found");let l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===l)return void s(s4.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(i);if(void 0!==c)return void s(s4.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:a.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);let m=void 0===i.inputResponses?void 0:function(e){let t={},r=[];if(!cd(e))return{accepted:t,droppedKeys:r};for(let[a,i]of Object.entries(e)){if(!cd(i)||"method"in i||"result"in i){r.push(a);continue}t[a]=i}return{accepted:t,droppedKeys:r}}(i.inputResponses),h={sessionId:o?.sessionId,mcpReq:{id:a.id,method:a.method,_meta:a.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===i.requestState?cs:(r=i.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lX(t))return d(e,t,r);let i=co(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,i,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=n.encodeResult(a.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${a.method}: ${e}`)),s(s4.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:a.id};await o?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:s4.InternalError,r={jsonrpc:"2.0",id:a.id,error:{code:n.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await o?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),n(e);return}i(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(lE(e)?e:s3.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 a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lX(t))return this._requestWithSchemaViaCodec(a,e,t,r);let i=co(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(a,e,i,t)}_negotiatedWireCodec(){return lf(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 lf(void 0);case"server/discover":return lf(lh);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(lg(t)&&!e.hasRequestMethod(t))throw new sk(sR.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 a=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r)}_requestWithSchemaViaCodec(e,t,r,a){let i,n,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c}=a??{},u=Date.now();return new Promise((d,p)=>{let m=e=>{p(e)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){m(e);return}if(a?.signal?.aborted){let e=a.signal.reason;throw e instanceof sk?e:new sk(sR.RequestTimeout,String(e))}let h=e.era===lh&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;n=f;let y={...t,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.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===h?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):h.abort(),p(e instanceof sk?e:new sk(sR.RequestTimeout,String(e))))};this._responseHandlers.set(f,i=>{let n;if(!a?.signal?.aborted){if(v=!0,i instanceof Error)return p(i);try{n=e.decodeResult(t.method,i.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===n.kind)return p(n.error);if("input_required"===n.kind){var o;return a?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(o=n).inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}}):d(this._resolveNonCompleteResult(n,{codec:e,request:t,resultSchema:r,options:a,flowStartedAt:u,retry:(a,i)=>this._requestWithSchemaViaCodec(e,void 0===a?{method:t.method}:{method:t.method,params:a},r,i)}))}l1(r,n.result).then(e=>{e.success?d(e.data):p(new sk(sR.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),i=()=>_(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let b=a?.timeout??6e4;this._setupTimeout(f,b,a?.maxTotalTimeout,()=>_(new sk(sR.RequestTimeout,"Request timed out",{timeout:b})),a?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c,requestSignal:h?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{i&&a?.signal?.removeEventListener("abort",i),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new sk(sR.NotConnected,"Not connected");if(lv(t.method)&&!e.hasNotificationMethod(t.method))throw new sk(sR.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 a=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(a,r).catch(e=>this._onerror(e))});return}await this._transport.send(a,r)}setRequestHandler(e,t,r){let a;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!lg(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);a=(r,a)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(e,r);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(e,r)),!n.ok){if("not-in-era"===n.reason)throw new s3(s4.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value,a))}}else if(r)a=async(a,i)=>{let n=await l1(t.params,{...a.params});if(!n.success)throw new s3(s4.InvalidParams,`Invalid params for ${e}: ${n.error}`);return r(n.data,i)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,a))}_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(!lv(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,a)=>{let i=a.validateNotification(e,r);if(!i.ok){if("not-in-era"===i.reason)throw new s3(s4.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async a=>{let i=await l1(t.params,{...a.params});if(!i.success)throw new s3(s4.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await r(i.data,a)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function cu(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function cd(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var cp=q(N(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,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var n,o,s,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(!a.test(u))throw TypeError("invalid media type");var d=new i(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;o=t.exec(l);){if(o.index!==c)throw TypeError("invalid parameter format");c+=o[0].length,n=o[1].toLowerCase(),34===(s=o[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(r,"$1")),d.parameters[n]=s}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})(),1);function cm(e){if(e)try{return cp.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}function ch(e){return"application/json"===e||"application/json"===cm(e)}let cf=/^[A-Za-z0-9._-]{1,128}$/;function cy(e){let t=function(e){let t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!cf.test(e)){let r=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return t.isValid}var cg=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(t){e.validateLength(t,1e6,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let r=[],a="",i=0,n=0;for(;i<t.length;)if("{"===t[i]){a&&(r.push(a),a="");let o=t.indexOf("}",i);if(-1===o)throw Error("Unclosed template expression");if(++n>1e4)throw Error("Template contains too many expressions (max 10000)");let s=t.slice(i+1,o),l=this.getOperator(s),c=s.includes("*"),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,1e6,"Variable name");r.push({name:d,operator:l,names:u,exploded:c}),i=o+1}else a+=t[i],i++;return a&&r.push(a),r}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(t,r){return(e.validateLength(t,1e6,"Variable value"),"+"===r||"#"===r)?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];return void 0===a?"":`${r}=${Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator)}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let i=this.expandPart(a,e);i&&(t+=("?"===a.operator||"&"===a.operator)&&r?i.replace("?","&"):i,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let r,a=[];for(let r of t.names)e.validateLength(r,1e6,"Variable name");if("?"===t.operator||"&"===t.operator){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=0===e?"\\"+t.operator:"&";a.push({pattern:i+this.escapeRegExp(r)+"=([^&]+)",name:r})}return a}let i=t.name;switch(t.operator){case"":r=t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r=String.raw`\.([^/,]+)`;break;case"/":r="/"+(t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return a.push({pattern:r,name:i}),a}match(t){e.validateLength(t,1e6,"URI");let r="^",a=[];for(let e of this.parts)if("string"==typeof e)r+=this.escapeRegExp(e);else for(let{pattern:t,name:i}of this.partToRegExp(e))r+=t,a.push({name:i,exploded:e.exploded});r+="$",e.validateLength(r,1e6,"Generated regex pattern");let i=new RegExp(r),n=t.match(i);if(!n)return null;let o={};for(let[e,t]of a.entries()){let{name:r,exploded:a}=t,i=n[e+1];o[r.replace("*","")]=a&&i.includes(",")?i.split(","):i}return o}};function cv(e){if(void 0!==e){if(function(e){if("object"!=typeof e||null===e||lX(e))return!1;let t=Object.getPrototypeOf(e);return(t===Object.prototype||null===t)&&Object.values(e).every(e=>"object"==typeof e&&null!==e&&"_zod"in e)}(e))return a0(e);if("object"==typeof e&&null!==e&&!lX(e)&&Object.values(e).some(e=>"object"==typeof e&&null!==e&&!("_zod"in e)&&"_def"in e&&"string"==typeof e._def?.typeName))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!lX(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var c_=N(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 a=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 i(e,...t){let r=[e[0]],n=0;for(;n<t.length;)s(r,t[n]),r.push(e[++n]);return new a(r)}e._Code=a,e.nil=new a(""),e._=i;let n=new a("+");function o(e,...t){let i=[l(e[0])],c=0;for(;c<t.length;)i.push(n),s(i,t[c]),i.push(n,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var a,i;let n=(a=e[t-1],'""'===(i=e[t+1])?a:'""'===a?i:"string"==typeof a?i instanceof r||'"'!==a[a.length-1]?void 0:"string"!=typeof i?`${a.slice(0,-1)}${i}"`:'"'===i[0]?a.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||a instanceof r?void 0:`"${a}${i.slice(1)}`);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(i),new a(i)}function s(e,t){var i;t instanceof a?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(i=t)||"boolean"==typeof i||null===i?i:l(Array.isArray(i)?i.join(","):i))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=o,e.addCodeArg=s,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},e.stringify=function(e){return new a(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new a(`.${t}`):i`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new a(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new a(e.toString())}}),cb=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=c_();var r,a,i=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=a||(e.UsedValueState=a={}))[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 n=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=n;var o=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:a}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${a}]`}};e.ValueScopeName=o;let s=(0,t._)`\n`;var l=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:i}=a,n=null!=(r=t.key)?r:t.ref,o=this._values[i];if(o){let e=o.get(n);if(e)return e}else o=this._values[i]=new Map;o.set(n,a);let s=this._scope[i]||(this._scope[i]=[]),l=s.length;return s[l]=t.ref,a.setValue(t,{property:i,itemIndex:l}),a}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,n,o={},s){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=o[c]=o[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,a.Started);let o=n(r);if(o){let a=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${a} ${r} = ${o};${this.opts._n}`}else if(o=null==s?void 0:s(r))l=(0,t._)`${l}${o}${this.opts._n}`;else throw new i(r);d.set(r,a.Completed)})}return l}};e.ValueScope=l}),cS=N(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=c_(),r=cb();var a=c_();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var i=cb();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.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 n=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let a=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends n{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=j(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends s{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},p=class extends n{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=j(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends n{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,a=r.length;for(;a--;){let i=r[a];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},h=class extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends m{},y=class extends h{};y.kind="else";var g=class e extends h{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(C(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=j(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&E(e,this.else.names),e}};g.kind="if";var v=class extends h{};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=j(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:a,from:i,to:n}=this;return`for(${t} ${a}=${i}; ${a}<${n}; ${a}++)`+super.render(e)}get names(){return T(T(super.names,this.from),this.to)}},S=class extends v{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}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=j(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},$=class extends h{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)}};$.kind="func";var w=class extends m{render(e){return"return "+super.render(e)}};w.kind="return";var R=class extends h{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,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},k=class extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};k.kind="catch";var x=class extends h{render(e){return"finally"+super.render(e)}};x.kind="finally";var P=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,a){let i=this._scope.toName(t);return void 0!==r&&a&&(this._constants[i.str]=r),this._leafNode(new o(e,i,r)),i}const(e,t,a){return this._def(r.varKinds.const,e,t,a)}let(e,t,a){return this._def(r.varKinds.let,e,t,a)}var(e,t,a){return this._def(r.varKinds.var,e,t,a)}assign(e,t,r){return this._leafNode(new s(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[a,i]of e)r.length>1&&r.push(","),r.push(a),(a!==i||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,i));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,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.let){let o=this._scope.toName(e);return this._for(new b(n,o,t,a),()=>i(o))}forOf(e,a,i,n=r.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=a instanceof t.Name?a:this.var("_arr",a);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(o,(0,t._)`${e}[${r}]`),i(o)})}return this._for(new S("of",n,o,a),()=>i(o))}forIn(e,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${a})`,i);let o=this._scope.toName(e);return this._for(new S("in",n,o,a),()=>i(o))}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 w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new R;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new k(e),t(e)}return r&&(this._currNode=a.finally=new x,this.code(r)),this._endBlockNode(k,x)}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,a,i){return this._blockNode(new $(e,r,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($)}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 E(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?E(e,r.names):e}function j(e,r,a){var i;if(e instanceof t.Name)return n(e);if(!((i=e)instanceof t._Code&&i._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==a[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=n(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function n(e){let t=a[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=P,e.not=C;let O=N(e.operators.AND);e.and=function(...e){return e.reduce(O)};let I=N(e.operators.OR);function N(e){return(r,a)=>r===t.nil?a:a===t.nil?r:(0,t._)`${q(r)} ${e} ${q(a)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(I)}}),c$=N(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 a=cS(),i=c_();function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=a.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function s(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:i}){return(n,o,s,l)=>{let c=void 0===s?o:s instanceof a.Name?(o instanceof a.Name?e(n,o,s):t(n,o,s),s):o instanceof a.Name?(t(n,s,o),o):r(o,s);return l!==a.Name||c instanceof a.Name?c:i(n,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.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||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,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,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(i)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,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,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${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 m(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 i._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,i){if(e instanceof a.Name){let n=r===t.Num;return i?n?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:n?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=m}),cw=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();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")}}),cR=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=cS(),r=c$(),a=cw();function i(e,r){let i=e.const("err",r);e.if((0,t._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${a.default.vErrors}.push(${i})`),e.code((0,t._)`${a.default.errors}++`)}function n(e,r){let{gen:a,validateName:i,schemaEnv:n}=e;n.$async?a.throw((0,t._)`new ${e.ValidationError}(${r})`):(a.assign((0,t._)`${i}.errors`,r),a.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,a=e.keywordError,o,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,m=s(r,a,o);(null!=l?l:d||p)?i(u,m):n(c,(0,t._)`[${m}]`)},e.reportExtraError=function(t,r=e.keywordError,o){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;i(c,s(t,r,o)),u||d||n(l,a.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(a.default.errors,r),e.if((0,t._)`${a.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${a.default.vErrors}.length`,r),()=>e.assign(a.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:i,data:n,errsCount:o,it:s}){if(void 0===o)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",o,a.default.errors,o=>{e.const(l,(0,t._)`${a.default.vErrors}[${o}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(a.default.instancePath,s.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${r}`),s.opts.verbose&&(e.assign((0,t._)`${l}.schema`,i),e.assign((0,t._)`${l}.data`,n))})};let o={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 s(e,i,n){let{createErrors:s}=e.it;return!1===s?(0,t._)`{}`:function(e,i,n={}){let{gen:s,it:l}=e,c=[function({errorPath:e},{instancePath:i}){let n=i?(0,t.str)`${e}${(0,r.getErrorPath)(i,r.Type.Str)}`:e;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,n)]}(l,n),function({keyword:e,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:n}){let s=n?a:(0,t.str)`${a}/${e}`;return i&&(s=(0,t.str)`${s}${(0,r.getErrorPath)(i,r.Type.Str)}`),[o.schemaPath,s]}(e,n)];return function(e,{params:r,message:i},n){let{keyword:s,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:h}=u;n.push([o.keyword,s],[o.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&n.push([o.message,"function"==typeof i?i(e):i]),d.verbose&&n.push([o.schema,c],[o.parentSchema,(0,t._)`${m}${h}`],[a.default.data,l]),p&&n.push([o.propertyName,p])}(e,i,c),s.object(...c)}(e,i,n)}}),ck=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=cR(),r=cS(),a=cw(),i={message:"boolean schema is false"};function n(e,r){let{gen:a,data:n}=e;(0,t.reportError)({gen:a,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:i,validateName:o}=e;!1===i?n(e,!1):"object"==typeof i&&!0===i.$async?t.return(a.default.data):(t.assign((0,r._)`${o}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}}),cx=N(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:{}}}}),cP=N(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},a){let i=r.RULES.types[a];return i&&!0!==i&&t(e,i)},e.shouldUseGroup=t,e.shouldUseRule=r}),cE=N(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 a=cx(),i=cP(),n=cR(),o=cS(),s=c$();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.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 a,n;let{gen:s,data:l,opts:u}=e,p=(a=r,(n=u.coerceTypes)?a.filter(e=>c.has(e)||"array"===n&&"array"===e):[]),h=r.length>0&&!(0===p.length&&1===r.length&&(0,i.schemaHasRulesForType)(e,r[0]));if(h){let a=d(r,l,u.strictNumbers,t.Wrong);s.if(a,()=>{p.length?function(e,t,r){let{gen:a,data:i,opts:n}=e,s=a.let("dataType",(0,o._)`typeof ${i}`),l=a.let("coerced",(0,o._)`undefined`);for(let e of("array"===n.coerceTypes&&a.if((0,o._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,o._)`${i}[0]`).assign(s,(0,o._)`typeof ${i}`).if(d(t,i,n.strictNumbers),()=>a.assign(l,i))),a.if((0,o._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,o._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,o._)`"" + ${i}`).elseIf((0,o._)`${i} === null`).assign(l,(0,o._)`""`);return;case"number":a.elseIf((0,o._)`${s} == "boolean" || ${i} === null
|
|
63
63
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,o._)`+${i}`);return;case"integer":a.elseIf((0,o._)`${s} === "boolean" || ${i} === null
|
|
64
64
|
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,o._)`+${i}`);return;case"boolean":a.elseIf((0,o._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,o._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":a.elseIf((0,o._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(l,null);return;case"array":a.elseIf((0,o._)`${s} === "string" || ${s} === "number"
|
|
65
|
-
|| ${s} === "boolean" || ${i} === null`).assign(l,(0,o._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,o._)`${l} !== undefined`,()=>{a.assign(i,l),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,o._)`${t} !== undefined`,()=>e.assign((0,o._)`${t}[${r}]`,a))}(e,l)})}(e,r,p):m(e)})}return h};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,a,i=t.Correct){let n,s=i===t.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${r} ${s} null`;case"array":n=(0,o._)`Array.isArray(${r})`;break;case"object":n=(0,o._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":n=l((0,o._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":n=l();break;default:return(0,o._)`typeof ${r} ${s} ${e}`}return i===t.Correct?n:(0,o.not)(n);function l(e=o.nil){return(0,o.and)((0,o._)`typeof ${r} == "number"`,e,a?(0,o._)`isFinite(${r})`:o.nil)}}function d(e,t,r,a){let i;if(1===e.length)return u(e[0],t,r,a);let n=(0,s.toHash)(e);if(n.array&&n.object){let e=(0,o._)`typeof ${t} != "object"`;i=n.null?e:(0,o._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=o.nil;for(let e in n.number&&delete n.integer,n)i=(0,o.and)(i,u(e,t,r,a));return i}e.checkDataType=u,e.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,s.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:e}}(e);(0,n.reportError)(t,p)}e.reportTypeError=m}),cE=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=cb(),r=cS();function a(e,a,i){let{gen:n,compositeRule:o,data:s,opts:l}=e;if(void 0===i)return;let c=(0,t._)`${s}${(0,t.getProperty)(a)}`;if(o)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} === ""`),n.if(u,(0,t._)`${c} = ${(0,t.stringify)(i)}`)}e.assignDefaults=function(e,t){let{properties:r,items:i}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(i)&&i.forEach((t,r)=>a(e,r,t.default))}}),cT=N(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=cb(),r=cS(),a=c$(),i=cS();function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function o(e,r,a){return(0,t._)`${n(e)}.call(${r}, ${a})`}function s(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} === undefined`;return i?(0,t.or)(n,(0,t.not)(o(e,r,a))):n}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:a,data:i,it:n}=e;a.if(s(a,i,r,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:a}},i,n){return(0,t.or)(...i.map(i=>(0,t.and)(s(e,r,i,a.ownProperties),(0,t._)`${n} = ${i}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=n,e.isOwnProperty=o,e.propertyInData=function(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} !== undefined`;return i?(0,t._)`${n} && ${o(e,r,a)}`:n},e.noPropertyInData=s,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(a=>!(0,r.alwaysValidSchema)(e,t[a]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:i,topSchemaRef:n,schemaPath:o,errorPath:s},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${n}${o}`:r,m=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,s)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&m.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,t._)`${p}, ${i.object(...m)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${h})`:(0,t._)`${c}(${h})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},a){let n=r.unicodeRegExp?"u":"",{regExp:o}=r.code,s=o(a,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,t._)`${"new RegExp"===o.code?c:(0,i.useFunc)(e,o)}(${a}, ${n})`})},e.validateArray=function(e){let{gen:a,data:i,keyword:n,it:o}=e,s=a.name("valid");if(o.allErrors){let e=a.let("valid",!0);return l(()=>a.assign(e,!1)),e}return a.var(s,!0),l(()=>a.break()),s;function l(o){let l=a.const("len",(0,t._)`${i}.length`);a.forRange("i",0,l,i=>{e.subschema({keyword:n,dataProp:i,dataPropType:r.Type.Num},s),a.if((0,t.not)(s),o)})}},e.validateUnion=function(e){let{gen:a,schema:i,keyword:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(e=>(0,r.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=a.let("valid",!1),l=a.name("_valid");a.block(()=>i.forEach((r,i)=>{let o=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);a.assign(s,(0,t._)`${s} || ${l}`),e.mergeValidEvaluated(o,l)||a.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}}),cj=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=cb(),r=c$(),a=cT(),i=cw();function n(e){let{gen:r,data:a,it:i}=e;r.if(i.parentData,()=>r.assign(a,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function o(e,r,a){if(void 0===a)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,t.stringify)(a)})}e.macroKeywordCode=function(e,r){let{gen:a,keyword:i,schema:n,parentSchema:s,it:l}=e,c=r.macro.call(l.self,n,s,l),u=o(a,i,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=a.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,s){var l;let{gen:c,keyword:u,schema:d,parentSchema:p,$data:m,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,s);let f=o(c,u,!m&&s.compile?s.compile.call(h.self,d,p,h):s.validate),y=c.let("valid");function g(i=s.async?(0,t._)`await `:t.nil){let n=h.opts.passContext?r.default.this:r.default.self,o=!("compile"in s&&!m||!1===s.schema);c.assign(y,(0,t._)`${i}${(0,a.callValidateCode)(e,f,n,o)}`,s.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=s.valid)?r:y),e)}e.block$data(y,function(){if(!1===s.errors)g(),s.modifying&&n(e),v(()=>e.error());else{let a,o,l=s.async?(a=c.let("ruleErrs",null),c.try(()=>g((0,t._)`await `),e=>c.assign(y,!1).if((0,t._)`${e} instanceof ${h.ValidationError}`,()=>c.assign(a,(0,t._)`${e}.errors`),()=>c.throw(e))),a):(o=(0,t._)`${f}.errors`,c.assign(o,null),g(t.nil),o);s.modifying&&n(e),v(()=>(function(e,a){let{gen:n}=e;n.if((0,t._)`Array.isArray(${a})`,()=>{n.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${a} : ${r.default.vErrors}.concat(${a})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=s.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:a},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let o=i.dependencies;if(null==o?void 0:o.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[n])){let e=`keyword "${n}" value is invalid at path "${a}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),cC=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=cb(),r=cS();e.getSubschema=function(e,{keyword:a,schemaProp:i,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:l}){if(void 0!==a&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let n=e.schema[a];return void 0===i?{schema:n,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:n[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,r.escapeFragment)(i)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:l,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,a,{dataProp:i,dataPropType:n,data:o,dataTypes:s,propertyName:l}){if(void 0!==o&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=a;if(void 0!==i){let{errorPath:o,dataPathArr:s,opts:l}=a;u(c.let("data",(0,t._)`${a.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,r.getErrorPath)(i,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,t]}void 0!==o&&(u(o instanceof t.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),s&&(e.dataTypes=s)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:i,allErrors:n}){void 0!==a&&(e.compositeRule=a),void 0!==i&&(e.createErrors=i),void 0!==n&&(e.allErrors=n),e.jtdDiscriminator=t,e.jtdMetadata=r}}),cO=N((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((a=t.length)!=r.length)return!1;for(i=a;0!=i--;)if(!e(t[i],r[i]))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((a=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=a;0!=i--;){var a,i,n,o=n[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}}),cI=N((e,t)=>{var r=t.exports=function(e,t,a){"function"==typeof t&&(a=t,t={});var i="function"==typeof(a=t.cb||a)?a:a.pre||function(){};!function e(t,a,i,n,o,s,l,c,u,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in a(n,o,s,l,c,u,d),n){var m=n[p];if(Array.isArray(m)){if(p in r.arrayKeywords)for(var h=0;h<m.length;h++)e(t,a,i,m[h],o+"/"+p+"/"+h,s,o,p,n,h)}else if(p in r.propsKeywords){if(m&&"object"==typeof m)for(var f in m)e(t,a,i,m[f],o+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),s,o,p,n,f)}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,a,i,m,o+"/"+p,s,o,p,n)}i(n,o,s,l,c,u,d)}}(t,i,a.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}}),cN=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=cS(),r=cO(),a=cI(),i=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(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!r&&function e(r){let a=0;for(let n in r)if("$ref"===n||(a++,!i.has(n)&&("object"==typeof r[n]&&(0,t.eachItem)(r[n],t=>a+=e(t)),a===1/0)))return 1/0;return a}(e)<=r)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function o(e,t="",r){return!1!==r&&(t=c(t)),s(e,e.parse(t))}function s(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=o,e._getFullPath=s;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:i,uriResolver:n}=this.opts,s=c(e[i]||t),l={"":s},d=o(n,s,!1),p={},m=new Set;return a(e,{allKeys:!0},(e,t,r,a)=>{if(void 0===a)return;let n=d+t,o=l[a];function s(t){let r=this.opts.uriResolver.resolve;if(t=c(o?r(o,t):t),m.has(t))throw f(t);m.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?h(e,a.schema,t):t!==c(n)&&("#"===t[0]?(h(e,p[t],t),p[t]=e):this.refs[t]=n),t}function y(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[i]&&(o=s.call(this,e[i])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),l[t]=o}),p;function h(e,t,a){if(void 0!==t&&!r(e,t))throw f(a)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),cq=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=cR(),r=cP(),a=cx(),i=cP(),n=cE(),o=cj(),s=cC(),l=cb(),c=c$(),u=cN(),d=cS(),p=cw();function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},n){var o;i.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,l._)`"use strict"; ${h(r,i)}`),t=e,a=i,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}`),a.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),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(n)}):e.func(t,(0,l._)`${c.default.data}, ${(o=i,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${o.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,a.$async,()=>e.code(h(r,i)).code(n))}function h(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:a,self:i}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.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 a=(0,r.getSchemaTypes)(e.schema);b(e,a,!(0,r.coerceAndCheckDataType)(e,a),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:i}){let n=r.$comment;if(!0===i.$comment)e.code((0,l._)`${c.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let r=(0,l.str)`${a}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${n}, ${r}, ${i}.schema)`)}}function b(e,t,r,n){var o,s,u,p;let{gen:m,schema:h,data:f,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(h,_)))return void m.block(()=>k(e,"$ref",_.all.$ref.definition));function b(o){(0,a.shouldUseGroup)(h,o)&&(o.type?(m.if((0,i.checkDataType)(o.type,f,g.strictNumbers)),S(e,o),1===t.length&&t[0]===o.type&&r&&(m.else(),(0,i.reportTypeError)(e)),m.endIf()):S(e,o),y||m.if((0,l._)`${c.default.errors} === ${n||0}`))}g.jtd||(o=e,s=t,!o.schemaEnv.meta&&o.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)$(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(o,s),o.opts.allowUnionTypes||(u=o,(p=s).length>1&&!(2===p.length&&p.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if("object"==typeof n&&(0,a.shouldUseRule)(e.schema,n)){let{type:r}=n.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(o,o.dataTypes))),m.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function S(e,t){let{gen:r,schema:i,opts:{useDefaults:o}}=e;o&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(i,r)&&k(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(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:a}=e;m(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),a.let(c.default.vErrors,null),a.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:a,ValidationError:i,opts:n}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${i}(${c.default.vErrors})`)):(t.assign((0,l._)`${a}.errors`,c.default.vErrors),n.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),a instanceof l.Name&&e.assign((0,l._)`${t}.items`,a)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,o.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",E(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.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:a,schemaType:i,def:n}=this;r.if((0,l.or)((0,l._)`${a} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||n.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:a,it:n}=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,i.checkDataTypes)(e,t,n.opts.strictNumbers,i.DataType.Wrong)}`}return l.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let a=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(a,this.it,e),(0,s.extendSubschemaMode)(a,e);let i={...this.it,...a,items:void 0,props:void 0};return!function(e,r){if(y(e)&&(g(e),f(e)))return function(e,t){var r;let a,{schema:i,gen:n,opts:o}=e;o.$comment&&i.$comment&&_(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let s=n.const("_errs",c.default.errors);v(e,s),n.var(t,(0,l._)`${s} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(i,r),i}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function k(e,t,r,a){let i=new R(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,o.funcKeywordCode)(i,r):"macro"in r?(0,o.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,o.funcKeywordCode)(i,r)}e.KeywordCxt=R;let x=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let i,n;if(""===e)return c.default.rootData;if("/"===e[0]){if(!x.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=c.default.rootData}else{let o=P.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let l=+o[1];if("#"===(i=o[2])){if(l>=t)throw Error(s("property/index",l));return a[t-l]}if(l>t)throw Error(s("data",l));if(n=r[t-l],!i)return n}let o=n;for(let e of i.split("/"))e&&(n=(0,l._)`${n}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,l._)`${o} && ${n}`);return o;function s(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=E}),cA=N(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}}}),cz=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cN();e.default=class extends Error{constructor(e,r,a,i){super(i||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),cM=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=cb(),r=cA(),a=c$(),i=cN(),n=cS(),o=cq();var s=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,i.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 n,s,l=u.call(this,e);if(l)return l;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:p}=this.opts.code,{ownProperties:m}=this.opts,h=new t.CodeGen(this.scope,{es5:d,lines:p,ownProperties:m});e.$async&&(n=h.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=h.scopeName("validate");e.validateName=f;let y={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,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,o.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let r=h.toString();s=`${h.scopeRefs(a.default.scope)}return ${r}`,this.opts.code.process&&(s=this.opts.code.process(s,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,s)(this,this.scope.get());if(this.scope.value(f,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:f,validateCode:r,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:r}=y;i.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},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,s&&this.logger.error("Error compiling schema, function code:",s),t}finally{this._compilations.delete(e)}}function c(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}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),a=(0,i._getFullPath)(this.opts.uriResolver,r),n=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return h.call(this,r,e);let o=(0,i.normalizeId)(a),c=this.refs[o]||this.schemas[o];if("string"==typeof c){let t=p.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),o===(0,i.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,a=t[r];return a&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,a)),new s({schema:t,schemaId:r,root:e,baseId:n})}return h.call(this,r,c)}}e.SchemaEnv=s,e.compileSchema=l,e.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=d.call(this,e,r);if(void 0===o){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(o=new s({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=c.call(this,o)},e.getCompilingSchema=u,e.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:a}){var o;let l;if((null==(o=e.fragment)?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let o="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=p.call(this,a,e)}let{schemaId:c}=this.opts;if((l=l||new s({schema:r,schemaId:c,root:a,baseId:t})).schema!==l.root.schema)return l}}),cL=N((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}}),cZ=N((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),a=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 i(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}function n(e){return e.length=0,!0}function o(e,t,r){if(e.length){let a=i(e);if(""===a)return r.error=!0,!1;t.push(a),e.length=0}return!0}function s(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:""},a=[],s=[],l=!1,c=!1,u=o;for(let i=0;i<e.length;i++){let o=e[i];if("["!==o&&"]"!==o)if(":"===o){if(!0===l&&(c=!0),!u(s,a,r))break;if(++t>7){r.error=!0;break}i>0&&":"===e[i-1]&&(l=!0),a.push(":");continue}else if("%"===o){if(!u(s,a,r))break;u=n}else{s.push(o);continue}}return s.length&&(u===n?r.zone=s.join(""):c?a.push(s.join("")):a.push(i(s))),r.address=a.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:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),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(!a(r)){let t=s(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=[],a=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){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===i&&"/.."===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===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:a,isUUID:r,normalizeIPv6:s,stringArrayToHexStripped:i}}),cV=N((e,t)=>{let{isUUID:r}=cZ(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(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 o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(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:o,serialize:s},c={scheme:"https",domainHost:l.domainHost,parse:o,serialize:s},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(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(a);if(r){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=m(`${a}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.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",a=e.nid.toLowerCase(),i=m(`${r}:${t.nid||a}`);i&&(e=i.serialize(e,t));let n=e,o=e.nss;return n.path=`${a||t.nid}:${o}`,t.skipEscape=!0,n},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 m(e){return e&&(p[e]||p[e.toLowerCase()])||void 0}Object.setPrototypeOf(p,null),t.exports={wsIsSecure:n,SCHEMES:p,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:m}}),cD=N((e,t)=>{let{normalizeIPv6:r,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:s}=cZ(),{SCHEMES:l,getSchemeHandler:c}=cV();function u(e,t,r,i){let n={};return i||(e=m(d(e,r),r),t=m(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(t.path?("/"===t.path[0]?n.path=a(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=a(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}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:""},n=Object.assign({},t),o=[],s=c(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),void 0!==r.path&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==n.reference&&r.scheme&&o.push(r.scheme,":");let l=i(r);if(void 0!==l&&("suffix"!==n.reference&&o.push("//"),o.push(l),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;n.absolutePath||s&&s.absolutePath||(e=a(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}let p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(e,t){let a=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===a.reference&&(e=a.scheme?a.scheme+":"+e:"//"+e);let l=e.match(p);if(l){if(i.scheme=l[1],i.userinfo=l[3],i.host=l[4],i.port=parseInt(l[5],10),i.path=l[6]||"",i.query=l[7],i.fragment=l[8],isNaN(i.port)&&(i.port=l[5]),i.host)if(!1===o(i.host)){let e=r(i.host);i.host=e.host.toLowerCase(),n=e.isIPV6}else n=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==i.reference&&(i.error=i.error||"URI is not a "+a.reference+" reference.");let t=c(a.scheme||i.scheme);if(!a.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(a.domainHost||t&&t.domainHost)&&!1===n&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),t&&t.parse&&t.parse(i,a)}else i.error=i.error||"URI can not be parsed.";return i}let h={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(m(e,t),t):"object"==typeof e&&(e=m(d(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=u(m(e,a),m(t,a),a,!0);return a.skipEscape=!0,d(i,a)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(n(m(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(n(m(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:m};t.exports=h,t.exports.default=h,t.exports.fastUri=h}),cU=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cD();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),cF=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=cq();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=cb();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 a=cA(),i=cz(),n=ck(),o=cM(),s=cb(),l=cN(),c=cP(),u=cS(),d=cL(),p=cU(),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let h=["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,a,i,n,o,s,l,c,u,d,h,f,y,g,v,_,b,S,$,w,R,k,x,P;let E=e.strict,T=null==(t=e.code)?void 0:t.optimize,j=!0===T||void 0===T?1:T||0,C=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:m,O=null!=(i=e.uriResolver)?i:p.default;return{strictSchema:null==(o=null!=(n=e.strictSchema)?n:E)||o,strictNumbers:null==(l=null!=(s=e.strictNumbers)?s:E)||l,strictTypes:null!=(u=null!=(c=e.strictTypes)?c:E)?u:"log",strictTuples:null!=(h=null!=(d=e.strictTuples)?d:E)?h:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:E)&&y,code:e.code?{...e.code,optimize:j,regExp:C}:{optimize:j,regExp:C},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!=($=e.schemaId)?$:"$id",addUsedSchema:null==(w=e.addUsedSchema)||w,validateSchema:null==(R=e.validateSchema)||R,validateFormats:null==(k=e.validateFormats)||k,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(P=e.int32range)||P,uriResolver:O}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:f,es5:t,lines:r}),this.logger=function(e){if(!1===e)return k;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 a=e.validateFormats;e.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,y,e,"NOT SUPPORTED"),_.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=d;"id"===r&&((a={...d}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[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 a=r(t);return"$async"in r||(this.errors=r.errors),a}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 a.call(this,e,t);async function a(e,t){await n.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await l.call(this,t.missingSchema),o.call(this,e)}}function s({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 n.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,a=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!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 a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:r});if(!(t=o.resolveSchema.call(this,a,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(P.call(this,r,t),!t)return(0,u.eachItem)(r,e=>E.call(this,e)),this;j.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===a.type.length?e=>E.call(this,e,a):e=>a.type.forEach(t=>E.call(this,e,a,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 a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,n=i[e];a&&n&&(i[e]=O(n))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let n,{schemaId:s}=this.opts;if("object"==typeof e)n=e[s];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)(n||r);let u=l.getSchemaRefs.call(this,e,r);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),a&&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):o.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{o.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}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 $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(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 h)delete e[t];return e}v.ValidationError=a.default,v.MissingRefError=i.default,e.default=v;let k={log(){},warn(){},error(){}},x=/^[a-z_$][a-z0-9_$:-]*$/i;function P(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!x.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 E(e,t,r){var a;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,o=i?n.post:n.rules.find(({type:e})=>e===r);if(o||(o={type:r,rules:[]},n.rules.push(o)),n.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?T.call(this,o,s,t.before):o.rules.push(s),n.all[e]=s,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function T(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,C]}}}),cH=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cJ=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=cz(),r=cT(),a=cb(),i=c$(),n=cM(),o=cS();function s(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,n,s){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:p}=c,m=p.passContext?i.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;l.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),l.assign(i.default.errors,(0,a._)`${i.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==n?void 0:n.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=o.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,a._)`${e}.evaluated.props`);c.props=o.mergeEvaluated.props(l,t,c.props,a.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=o.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,a._)`${e}.evaluated.items`);c.items=o.mergeEvaluated.items(l,t,c.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let i=l.let("valid");l.try(()=>{l.code((0,a._)`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||l.assign(i,!0)},e=>{l.if((0,a._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),h(e),u||l.assign(i,!1)}),e.ok(i)}():e.result((0,r.callValidateCode)(e,t,m),()=>f(t),()=>h(t))}e.getValidate=s,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,i;let o,c,u,{gen:d,schema:p,it:m}=e,{baseId:h,schemaEnv:f,validateName:y,opts:g,self:v}=m,{root:_}=f;if(("#"===p||"#/"===p)&&h===_.baseId){if(f===_)return l(e,y,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,a._)`${t}.validate`,_,_.$async)}let b=n.resolveRef.call(v,_,h,p);if(void 0===b)throw new t.default(m.opts.uriResolver,h,p);return b instanceof n.SchemaEnv?void l(e,s(e,r=b),r,r.$async):(i=b,o=d.scopeValue("schema",!0===g.code.source?{ref:i,code:(0,a.stringify)(i)}:{ref:i}),c=d.name("valid"),u=e.subschema({schema:i,dataTypes:[],schemaPath:a.nil,topSchemaRef:o,errSchemaPath:p},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),cB=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cH(),r=cJ();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),cK=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=t.operators,a={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(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${a[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${a[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:i,schemaCode:n}=e;e.fail$data((0,t._)`${i} ${a[r].fail} ${n} || isNaN(${i})`)}}}),cG=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb();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:a,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=r.let("res"),l=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${a}/${i}, ${l}))`)}}}),cW=N(e=>{function t(e){let t,r=e.length,a=0,i=0;for(;i<r;)a++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),cX=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS(),a=cW();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:i,data:n,schemaCode:o,it:s}=e,l="maxLength"===i?t.operators.GT:t.operators.LT,c=!1===s.opts.unicode?(0,t._)`${n}.length`:(0,t._)`${(0,r.useFunc)(e.gen,a.default)}(${n})`;e.fail$data((0,t._)`${c} ${l} ${o}`)}}}),cY=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cT(),r=cS(),a=cb();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`},code(e){let{gen:i,data:n,$data:o,schema:s,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(o){let{regExp:t}=c.opts.code,o="new RegExp"===t.code?(0,a._)`new RegExp`:(0,r.useFunc)(i,t),s=i.let("valid");i.try(()=>i.assign(s,(0,a._)`${o}(${l}, ${u}).test(${n})`),()=>i.assign(s,!1)),e.fail$data((0,a._)`!${s}`)}else{let r=(0,t.usePattern)(e,s);e.fail$data((0,a._)`!${r}.test(${n})`)}}}}),cQ=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb();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:a,schemaCode:i}=e,n="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${a}).length ${n} ${i}`)}}}),c0=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cT(),r=cb(),a=cS();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:i,schema:n,schemaCode:o,data:s,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;let d=n.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,p);else for(let r of n)(0,t.checkReportMissingProp)(e,r)}():function(){let a=i.let("missing");if(d||l){let n=i.let("valid",!0);e.block$data(n,()=>{var l,c;return l=a,c=n,void(e.setParams({missingProperty:l}),i.forOf(l,o,()=>{i.assign(c,(0,t.propertyInData)(i,s,l,u.ownProperties)),i.if((0,r.not)(c),()=>{e.error(),i.break()})},r.nil))}),e.ok(n)}else i.if((0,t.checkMissingProp)(e,n,a)),(0,t.reportMissingProp)(e,a),i.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of n)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,a.checkStrictMode)(c,t,c.opts.strictRequired)}}function p(){i.forOf("prop",o,r=>{e.setParams({missingProperty:r}),i.if((0,t.noPropertyInData)(i,s,r,u.ownProperties),()=>e.error())})}}}}),c1=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb();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:a,schemaCode:i}=e,n="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${a}.length ${n} ${i}`)}}}),c2=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cO();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),c9=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cP(),r=cb(),a=cS(),i=c2();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:n,data:o,$data:s,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!s&&!l)return;let p=n.let("valid"),m=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let s=n.let("i",(0,r._)`${o}.length`),l=n.let("j");e.setParams({i:s,j:l}),n.assign(p,!0),n.if((0,r._)`${s} > 1`,()=>(m.length>0&&!m.some(e=>"object"===e||"array"===e)?function(a,i){let s=n.name("item"),l=(0,t.checkDataTypes)(m,s,d.opts.strictNumbers,t.DataType.Wrong),c=n.const("indices",(0,r._)`{}`);n.for((0,r._)`;${a}--;`,()=>{n.let(s,(0,r._)`${o}[${a}]`),n.if(l,(0,r._)`continue`),m.length>1&&n.if((0,r._)`typeof ${s} == "string"`,(0,r._)`${s} += "_"`),n.if((0,r._)`typeof ${c}[${s}] == "number"`,()=>{n.assign(i,(0,r._)`${c}[${s}]`),e.error(),n.assign(p,!1).break()}).code((0,r._)`${c}[${s}] = ${a}`)})}:function(t,s){let l=(0,a.useFunc)(n,i.default),c=n.name("outer");n.label(c).for((0,r._)`;${t}--;`,()=>n.for((0,r._)`${s} = ${t}; ${s}--;`,()=>n.if((0,r._)`${l}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),n.assign(p,!1).break(c)})))})(s,l))},(0,r._)`${u} === false`),e.ok(p)}}}),c4=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS(),a=c2();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:n,$data:o,schemaCode:s,schema:l}=e;o||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(i,a.default)}(${n}, ${s})`):e.fail((0,t._)`${l} !== ${n}`)}}}),c3=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS(),a=c2();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 i,n,{gen:o,data:s,$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,m=()=>null!=i?i:i=(0,r.useFunc)(o,a.default);if(p||l)n=o.let("valid"),e.block$data(n,function(){o.assign(n,!1),o.forOf("v",u,e=>o.if((0,t._)`${m()}(${s}, ${e})`,()=>o.assign(n,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=o.const("vSchema",u);n=(0,t.or)(...c.map((r,a)=>{var i,n;let o;return i=e,"object"==typeof(o=c[n=a])&&null!==o?(0,t._)`${m()}(${s}, ${i}[${n}])`:(0,t._)`${s} === ${o}`}))}e.pass(n)}}}),c6=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cK(),r=cG(),a=cX(),i=cY(),n=cQ(),o=c0(),s=c1(),l=c9(),c=c4(),u=c3();e.default=[t.default,r.default,a.default,i.default,n.default,o.default,s.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),c5=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=cb(),r=cS();function a(e,a){let{gen:i,schema:n,data:o,keyword:s,it:l}=e;l.items=!0;let c=i.const("len",(0,t._)`${o}.length`);if(!1===n)e.setParams({len:a.length}),e.pass((0,t._)`${c} <= ${a.length}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(l,n)){let n=i.var("valid",(0,t._)`${c} <= ${a.length}`);i.if((0,t.not)(n),()=>{var o;return o=n,void i.forRange("i",a.length,c,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},o),l.allErrors||i.if((0,t.not)(o),()=>i.break())})}),e.ok(n)}}e.validateAdditionalItems=a,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:i}=e,{items:n}=t;Array.isArray(n)?a(e,n):(0,r.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),c8=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=cb(),r=cS(),a=cT();function i(e,a,n=e.schema){let{gen:o,parentSchema:s,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:i}=u,o=n.length,s=o===e.minItems&&(o===e.maxItems||!1===e[a]);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(s),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(o,n.length,u.items));let d=o.name("valid"),p=o.const("len",(0,t._)`${l}.length`);n.forEach((a,i)=>{(0,r.alwaysValidSchema)(u,a)||(o.if((0,t._)`${p} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},d)),e.ok(d))})}e.validateTuple=i,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return i(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,a.validateArray)(e))}}}),c7=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c8();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),ue=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS(),a=cT(),i=c5();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:n,it:o}=e,{prefixItems:s}=n;o.items=!0,(0,r.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,a.validateArray)(e)))}}}),ut=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS();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 a,i,{gen:n,schema:o,parentSchema:s,data:l,it:c}=e,{minContains:u,maxContains:d}=s;c.opts.next?(a=void 0===u?1:u,i=d):a=1;let p=n.const("len",(0,t._)`${l}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,o)){let r=(0,t._)`${p} >= ${a}`;void 0!==i&&(r=(0,t._)`${r} && ${p} <= ${i}`),e.pass(r);return}c.items=!0;let m=n.name("valid");function h(){let e=n.name("_valid"),r=n.let("count",0);f(e,()=>n.if(e,()=>{var e;return e=r,void(n.code((0,t._)`${e}++`),void 0===i?n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0).break()):(n.if((0,t._)`${e} > ${i}`,()=>n.assign(m,!1).break()),1===a?n.assign(m,!0):n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0))))}))}function f(t,a){n.forRange("i",0,p,i=>{e.subschema({keyword:"contains",dataProp:i,dataPropType:r.Type.Num,compositeRule:!0},t),a()})}void 0===i&&1===a?f(m,()=>n.if(m,()=>n.break())):0===a?(n.let(m,!0),void 0!==i&&n.if((0,t._)`${l}.length > 0`,h)):(n.let(m,!1),h()),e.result(m,()=>e.reset())}}}),ur=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=cb(),r=cS(),a=cT();e.error={message:({params:{property:e,depsCount:r,deps:a}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${a} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:a,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
65
|
+
|| ${s} === "boolean" || ${i} === null`).assign(l,(0,o._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,o._)`${l} !== undefined`,()=>{a.assign(i,l),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,o._)`${t} !== undefined`,()=>e.assign((0,o._)`${t}[${r}]`,a))}(e,l)})}(e,r,p):m(e)})}return h};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,a,i=t.Correct){let n,s=i===t.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${r} ${s} null`;case"array":n=(0,o._)`Array.isArray(${r})`;break;case"object":n=(0,o._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":n=l((0,o._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":n=l();break;default:return(0,o._)`typeof ${r} ${s} ${e}`}return i===t.Correct?n:(0,o.not)(n);function l(e=o.nil){return(0,o.and)((0,o._)`typeof ${r} == "number"`,e,a?(0,o._)`isFinite(${r})`:o.nil)}}function d(e,t,r,a){let i;if(1===e.length)return u(e[0],t,r,a);let n=(0,s.toHash)(e);if(n.array&&n.object){let e=(0,o._)`typeof ${t} != "object"`;i=n.null?e:(0,o._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=o.nil;for(let e in n.number&&delete n.integer,n)i=(0,o.and)(i,u(e,t,r,a));return i}e.checkDataType=u,e.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,s.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:e}}(e);(0,n.reportError)(t,p)}e.reportTypeError=m}),cT=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=cS(),r=c$();function a(e,a,i){let{gen:n,compositeRule:o,data:s,opts:l}=e;if(void 0===i)return;let c=(0,t._)`${s}${(0,t.getProperty)(a)}`;if(o)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} === ""`),n.if(u,(0,t._)`${c} = ${(0,t.stringify)(i)}`)}e.assignDefaults=function(e,t){let{properties:r,items:i}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(i)&&i.forEach((t,r)=>a(e,r,t.default))}}),cj=N(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=cS(),r=c$(),a=cw(),i=c$();function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function o(e,r,a){return(0,t._)`${n(e)}.call(${r}, ${a})`}function s(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} === undefined`;return i?(0,t.or)(n,(0,t.not)(o(e,r,a))):n}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:a,data:i,it:n}=e;a.if(s(a,i,r,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:a}},i,n){return(0,t.or)(...i.map(i=>(0,t.and)(s(e,r,i,a.ownProperties),(0,t._)`${n} = ${i}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=n,e.isOwnProperty=o,e.propertyInData=function(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} !== undefined`;return i?(0,t._)`${n} && ${o(e,r,a)}`:n},e.noPropertyInData=s,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(a=>!(0,r.alwaysValidSchema)(e,t[a]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:i,topSchemaRef:n,schemaPath:o,errorPath:s},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${n}${o}`:r,m=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,s)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&m.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,t._)`${p}, ${i.object(...m)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${h})`:(0,t._)`${c}(${h})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},a){let n=r.unicodeRegExp?"u":"",{regExp:o}=r.code,s=o(a,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,t._)`${"new RegExp"===o.code?c:(0,i.useFunc)(e,o)}(${a}, ${n})`})},e.validateArray=function(e){let{gen:a,data:i,keyword:n,it:o}=e,s=a.name("valid");if(o.allErrors){let e=a.let("valid",!0);return l(()=>a.assign(e,!1)),e}return a.var(s,!0),l(()=>a.break()),s;function l(o){let l=a.const("len",(0,t._)`${i}.length`);a.forRange("i",0,l,i=>{e.subschema({keyword:n,dataProp:i,dataPropType:r.Type.Num},s),a.if((0,t.not)(s),o)})}},e.validateUnion=function(e){let{gen:a,schema:i,keyword:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(e=>(0,r.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=a.let("valid",!1),l=a.name("_valid");a.block(()=>i.forEach((r,i)=>{let o=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);a.assign(s,(0,t._)`${s} || ${l}`),e.mergeValidEvaluated(o,l)||a.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}}),cC=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=cS(),r=cw(),a=cj(),i=cR();function n(e){let{gen:r,data:a,it:i}=e;r.if(i.parentData,()=>r.assign(a,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function o(e,r,a){if(void 0===a)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,t.stringify)(a)})}e.macroKeywordCode=function(e,r){let{gen:a,keyword:i,schema:n,parentSchema:s,it:l}=e,c=r.macro.call(l.self,n,s,l),u=o(a,i,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=a.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,s){var l;let{gen:c,keyword:u,schema:d,parentSchema:p,$data:m,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,s);let f=o(c,u,!m&&s.compile?s.compile.call(h.self,d,p,h):s.validate),y=c.let("valid");function g(i=s.async?(0,t._)`await `:t.nil){let n=h.opts.passContext?r.default.this:r.default.self,o=!("compile"in s&&!m||!1===s.schema);c.assign(y,(0,t._)`${i}${(0,a.callValidateCode)(e,f,n,o)}`,s.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=s.valid)?r:y),e)}e.block$data(y,function(){if(!1===s.errors)g(),s.modifying&&n(e),v(()=>e.error());else{let a,o,l=s.async?(a=c.let("ruleErrs",null),c.try(()=>g((0,t._)`await `),e=>c.assign(y,!1).if((0,t._)`${e} instanceof ${h.ValidationError}`,()=>c.assign(a,(0,t._)`${e}.errors`),()=>c.throw(e))),a):(o=(0,t._)`${f}.errors`,c.assign(o,null),g(t.nil),o);s.modifying&&n(e),v(()=>(function(e,a){let{gen:n}=e;n.if((0,t._)`Array.isArray(${a})`,()=>{n.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${a} : ${r.default.vErrors}.concat(${a})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=s.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:a},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let o=i.dependencies;if(null==o?void 0:o.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[n])){let e=`keyword "${n}" value is invalid at path "${a}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),cO=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=cS(),r=c$();e.getSubschema=function(e,{keyword:a,schemaProp:i,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:l}){if(void 0!==a&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let n=e.schema[a];return void 0===i?{schema:n,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:n[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,r.escapeFragment)(i)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:l,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,a,{dataProp:i,dataPropType:n,data:o,dataTypes:s,propertyName:l}){if(void 0!==o&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=a;if(void 0!==i){let{errorPath:o,dataPathArr:s,opts:l}=a;u(c.let("data",(0,t._)`${a.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,r.getErrorPath)(i,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,t]}void 0!==o&&(u(o instanceof t.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),s&&(e.dataTypes=s)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:i,allErrors:n}){void 0!==a&&(e.compositeRule=a),void 0!==i&&(e.createErrors=i),void 0!==n&&(e.allErrors=n),e.jtdDiscriminator=t,e.jtdMetadata=r}}),cI=N((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((a=t.length)!=r.length)return!1;for(i=a;0!=i--;)if(!e(t[i],r[i]))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((a=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=a;0!=i--;){var a,i,n,o=n[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}}),cN=N((e,t)=>{var r=t.exports=function(e,t,a){"function"==typeof t&&(a=t,t={});var i="function"==typeof(a=t.cb||a)?a:a.pre||function(){};!function e(t,a,i,n,o,s,l,c,u,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in a(n,o,s,l,c,u,d),n){var m=n[p];if(Array.isArray(m)){if(p in r.arrayKeywords)for(var h=0;h<m.length;h++)e(t,a,i,m[h],o+"/"+p+"/"+h,s,o,p,n,h)}else if(p in r.propsKeywords){if(m&&"object"==typeof m)for(var f in m)e(t,a,i,m[f],o+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),s,o,p,n,f)}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,a,i,m,o+"/"+p,s,o,p,n)}i(n,o,s,l,c,u,d)}}(t,i,a.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}}),cq=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=c$(),r=cI(),a=cN(),i=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(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!r&&function e(r){let a=0;for(let n in r)if("$ref"===n||(a++,!i.has(n)&&("object"==typeof r[n]&&(0,t.eachItem)(r[n],t=>a+=e(t)),a===1/0)))return 1/0;return a}(e)<=r)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function o(e,t="",r){return!1!==r&&(t=c(t)),s(e,e.parse(t))}function s(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=o,e._getFullPath=s;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:i,uriResolver:n}=this.opts,s=c(e[i]||t),l={"":s},d=o(n,s,!1),p={},m=new Set;return a(e,{allKeys:!0},(e,t,r,a)=>{if(void 0===a)return;let n=d+t,o=l[a];function s(t){let r=this.opts.uriResolver.resolve;if(t=c(o?r(o,t):t),m.has(t))throw f(t);m.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?h(e,a.schema,t):t!==c(n)&&("#"===t[0]?(h(e,p[t],t),p[t]=e):this.refs[t]=n),t}function y(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[i]&&(o=s.call(this,e[i])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),l[t]=o}),p;function h(e,t,a){if(void 0!==t&&!r(e,t))throw f(a)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),cA=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=ck(),r=cE(),a=cP(),i=cE(),n=cT(),o=cC(),s=cO(),l=cS(),c=cw(),u=cq(),d=c$(),p=cR();function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},n){var o;i.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,l._)`"use strict"; ${h(r,i)}`),t=e,a=i,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}`),a.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),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(n)}):e.func(t,(0,l._)`${c.default.data}, ${(o=i,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${o.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,a.$async,()=>e.code(h(r,i)).code(n))}function h(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:a,self:i}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.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 a=(0,r.getSchemaTypes)(e.schema);b(e,a,!(0,r.coerceAndCheckDataType)(e,a),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:i}){let n=r.$comment;if(!0===i.$comment)e.code((0,l._)`${c.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let r=(0,l.str)`${a}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${n}, ${r}, ${i}.schema)`)}}function b(e,t,r,n){var o,s,u,p;let{gen:m,schema:h,data:f,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(h,_)))return void m.block(()=>k(e,"$ref",_.all.$ref.definition));function b(o){(0,a.shouldUseGroup)(h,o)&&(o.type?(m.if((0,i.checkDataType)(o.type,f,g.strictNumbers)),S(e,o),1===t.length&&t[0]===o.type&&r&&(m.else(),(0,i.reportTypeError)(e)),m.endIf()):S(e,o),y||m.if((0,l._)`${c.default.errors} === ${n||0}`))}g.jtd||(o=e,s=t,!o.schemaEnv.meta&&o.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)$(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(o,s),o.opts.allowUnionTypes||(u=o,(p=s).length>1&&!(2===p.length&&p.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if("object"==typeof n&&(0,a.shouldUseRule)(e.schema,n)){let{type:r}=n.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(o,o.dataTypes))),m.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function S(e,t){let{gen:r,schema:i,opts:{useDefaults:o}}=e;o&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(i,r)&&k(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(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:a}=e;m(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),a.let(c.default.vErrors,null),a.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:a,ValidationError:i,opts:n}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${i}(${c.default.vErrors})`)):(t.assign((0,l._)`${a}.errors`,c.default.vErrors),n.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),a instanceof l.Name&&e.assign((0,l._)`${t}.items`,a)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,o.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",E(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.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:a,schemaType:i,def:n}=this;r.if((0,l.or)((0,l._)`${a} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||n.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:a,it:n}=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,i.checkDataTypes)(e,t,n.opts.strictNumbers,i.DataType.Wrong)}`}return l.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let a=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(a,this.it,e),(0,s.extendSubschemaMode)(a,e);let i={...this.it,...a,items:void 0,props:void 0};return!function(e,r){if(y(e)&&(g(e),f(e)))return function(e,t){var r;let a,{schema:i,gen:n,opts:o}=e;o.$comment&&i.$comment&&_(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let s=n.const("_errs",c.default.errors);v(e,s),n.var(t,(0,l._)`${s} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(i,r),i}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function k(e,t,r,a){let i=new R(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,o.funcKeywordCode)(i,r):"macro"in r?(0,o.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,o.funcKeywordCode)(i,r)}e.KeywordCxt=R;let x=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let i,n;if(""===e)return c.default.rootData;if("/"===e[0]){if(!x.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=c.default.rootData}else{let o=P.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let l=+o[1];if("#"===(i=o[2])){if(l>=t)throw Error(s("property/index",l));return a[t-l]}if(l>t)throw Error(s("data",l));if(n=r[t-l],!i)return n}let o=n;for(let e of i.split("/"))e&&(n=(0,l._)`${n}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,l._)`${o} && ${n}`);return o;function s(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=E}),cz=N(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=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cq();e.default=class extends Error{constructor(e,r,a,i){super(i||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),cL=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=cS(),r=cz(),a=cw(),i=cq(),n=c$(),o=cA();var s=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,i.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 n,s,l=u.call(this,e);if(l)return l;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:p}=this.opts.code,{ownProperties:m}=this.opts,h=new t.CodeGen(this.scope,{es5:d,lines:p,ownProperties:m});e.$async&&(n=h.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=h.scopeName("validate");e.validateName=f;let y={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,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,o.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let r=h.toString();s=`${h.scopeRefs(a.default.scope)}return ${r}`,this.opts.code.process&&(s=this.opts.code.process(s,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,s)(this,this.scope.get());if(this.scope.value(f,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:f,validateCode:r,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:r}=y;i.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},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,s&&this.logger.error("Error compiling schema, function code:",s),t}finally{this._compilations.delete(e)}}function c(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}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),a=(0,i._getFullPath)(this.opts.uriResolver,r),n=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return h.call(this,r,e);let o=(0,i.normalizeId)(a),c=this.refs[o]||this.schemas[o];if("string"==typeof c){let t=p.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),o===(0,i.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,a=t[r];return a&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,a)),new s({schema:t,schemaId:r,root:e,baseId:n})}return h.call(this,r,c)}}e.SchemaEnv=s,e.compileSchema=l,e.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=d.call(this,e,r);if(void 0===o){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(o=new s({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=c.call(this,o)},e.getCompilingSchema=u,e.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:a}){var o;let l;if((null==(o=e.fragment)?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let o="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=p.call(this,a,e)}let{schemaId:c}=this.opts;if((l=l||new s({schema:r,schemaId:c,root:a,baseId:t})).schema!==l.root.schema)return l}}),cZ=N((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}}),cV=N((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),a=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 i(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}function n(e){return e.length=0,!0}function o(e,t,r){if(e.length){let a=i(e);if(""===a)return r.error=!0,!1;t.push(a),e.length=0}return!0}function s(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:""},a=[],s=[],l=!1,c=!1,u=o;for(let i=0;i<e.length;i++){let o=e[i];if("["!==o&&"]"!==o)if(":"===o){if(!0===l&&(c=!0),!u(s,a,r))break;if(++t>7){r.error=!0;break}i>0&&":"===e[i-1]&&(l=!0),a.push(":");continue}else if("%"===o){if(!u(s,a,r))break;u=n}else{s.push(o);continue}}return s.length&&(u===n?r.zone=s.join(""):c?a.push(s.join("")):a.push(i(s))),r.address=a.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:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),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(!a(r)){let t=s(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=[],a=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){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===i&&"/.."===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===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:a,isUUID:r,normalizeIPv6:s,stringArrayToHexStripped:i}}),cD=N((e,t)=>{let{isUUID:r}=cV(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(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 o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(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:o,serialize:s},c={scheme:"https",domainHost:l.domainHost,parse:o,serialize:s},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(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(a);if(r){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=m(`${a}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.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",a=e.nid.toLowerCase(),i=m(`${r}:${t.nid||a}`);i&&(e=i.serialize(e,t));let n=e,o=e.nss;return n.path=`${a||t.nid}:${o}`,t.skipEscape=!0,n},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 m(e){return e&&(p[e]||p[e.toLowerCase()])||void 0}Object.setPrototypeOf(p,null),t.exports={wsIsSecure:n,SCHEMES:p,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:m}}),cU=N((e,t)=>{let{normalizeIPv6:r,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:s}=cV(),{SCHEMES:l,getSchemeHandler:c}=cD();function u(e,t,r,i){let n={};return i||(e=m(d(e,r),r),t=m(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(t.path?("/"===t.path[0]?n.path=a(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=a(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}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:""},n=Object.assign({},t),o=[],s=c(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),void 0!==r.path&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==n.reference&&r.scheme&&o.push(r.scheme,":");let l=i(r);if(void 0!==l&&("suffix"!==n.reference&&o.push("//"),o.push(l),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;n.absolutePath||s&&s.absolutePath||(e=a(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}let p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(e,t){let a=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===a.reference&&(e=a.scheme?a.scheme+":"+e:"//"+e);let l=e.match(p);if(l){if(i.scheme=l[1],i.userinfo=l[3],i.host=l[4],i.port=parseInt(l[5],10),i.path=l[6]||"",i.query=l[7],i.fragment=l[8],isNaN(i.port)&&(i.port=l[5]),i.host)if(!1===o(i.host)){let e=r(i.host);i.host=e.host.toLowerCase(),n=e.isIPV6}else n=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==i.reference&&(i.error=i.error||"URI is not a "+a.reference+" reference.");let t=c(a.scheme||i.scheme);if(!a.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(a.domainHost||t&&t.domainHost)&&!1===n&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),t&&t.parse&&t.parse(i,a)}else i.error=i.error||"URI can not be parsed.";return i}let h={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(m(e,t),t):"object"==typeof e&&(e=m(d(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=u(m(e,a),m(t,a),a,!0);return a.skipEscape=!0,d(i,a)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(n(m(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(n(m(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:m};t.exports=h,t.exports.default=h,t.exports.fastUri=h}),cF=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cU();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),cH=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=cA();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=cS();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 a=cz(),i=cM(),n=cx(),o=cL(),s=cS(),l=cq(),c=cE(),u=c$(),d=cZ(),p=cF(),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let h=["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,a,i,n,o,s,l,c,u,d,h,f,y,g,v,_,b,S,$,w,R,k,x,P;let E=e.strict,T=null==(t=e.code)?void 0:t.optimize,j=!0===T||void 0===T?1:T||0,C=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:m,O=null!=(i=e.uriResolver)?i:p.default;return{strictSchema:null==(o=null!=(n=e.strictSchema)?n:E)||o,strictNumbers:null==(l=null!=(s=e.strictNumbers)?s:E)||l,strictTypes:null!=(u=null!=(c=e.strictTypes)?c:E)?u:"log",strictTuples:null!=(h=null!=(d=e.strictTuples)?d:E)?h:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:E)&&y,code:e.code?{...e.code,optimize:j,regExp:C}:{optimize:j,regExp:C},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!=($=e.schemaId)?$:"$id",addUsedSchema:null==(w=e.addUsedSchema)||w,validateSchema:null==(R=e.validateSchema)||R,validateFormats:null==(k=e.validateFormats)||k,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(P=e.int32range)||P,uriResolver:O}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:f,es5:t,lines:r}),this.logger=function(e){if(!1===e)return k;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 a=e.validateFormats;e.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,y,e,"NOT SUPPORTED"),_.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=d;"id"===r&&((a={...d}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[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 a=r(t);return"$async"in r||(this.errors=r.errors),a}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 a.call(this,e,t);async function a(e,t){await n.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await l.call(this,t.missingSchema),o.call(this,e)}}function s({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 n.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,a=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!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 a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:r});if(!(t=o.resolveSchema.call(this,a,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(P.call(this,r,t),!t)return(0,u.eachItem)(r,e=>E.call(this,e)),this;j.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===a.type.length?e=>E.call(this,e,a):e=>a.type.forEach(t=>E.call(this,e,a,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 a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,n=i[e];a&&n&&(i[e]=O(n))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let n,{schemaId:s}=this.opts;if("object"==typeof e)n=e[s];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)(n||r);let u=l.getSchemaRefs.call(this,e,r);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),a&&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):o.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{o.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}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 $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(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 h)delete e[t];return e}v.ValidationError=a.default,v.MissingRefError=i.default,e.default=v;let k={log(){},warn(){},error(){}},x=/^[a-z_$][a-z0-9_$:-]*$/i;function P(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!x.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 E(e,t,r){var a;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,o=i?n.post:n.rules.find(({type:e})=>e===r);if(o||(o={type:r,rules:[]},n.rules.push(o)),n.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?T.call(this,o,s,t.before):o.rules.push(s),n.all[e]=s,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function T(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,C]}}}),cJ=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cB=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=cM(),r=cj(),a=cS(),i=cw(),n=cL(),o=c$();function s(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,n,s){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:p}=c,m=p.passContext?i.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;l.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),l.assign(i.default.errors,(0,a._)`${i.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==n?void 0:n.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=o.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,a._)`${e}.evaluated.props`);c.props=o.mergeEvaluated.props(l,t,c.props,a.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=o.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,a._)`${e}.evaluated.items`);c.items=o.mergeEvaluated.items(l,t,c.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let i=l.let("valid");l.try(()=>{l.code((0,a._)`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||l.assign(i,!0)},e=>{l.if((0,a._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),h(e),u||l.assign(i,!1)}),e.ok(i)}():e.result((0,r.callValidateCode)(e,t,m),()=>f(t),()=>h(t))}e.getValidate=s,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,i;let o,c,u,{gen:d,schema:p,it:m}=e,{baseId:h,schemaEnv:f,validateName:y,opts:g,self:v}=m,{root:_}=f;if(("#"===p||"#/"===p)&&h===_.baseId){if(f===_)return l(e,y,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,a._)`${t}.validate`,_,_.$async)}let b=n.resolveRef.call(v,_,h,p);if(void 0===b)throw new t.default(m.opts.uriResolver,h,p);return b instanceof n.SchemaEnv?void l(e,s(e,r=b),r,r.$async):(i=b,o=d.scopeValue("schema",!0===g.code.source?{ref:i,code:(0,a.stringify)(i)}:{ref:i}),c=d.name("valid"),u=e.subschema({schema:i,dataTypes:[],schemaPath:a.nil,topSchemaRef:o,errSchemaPath:p},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),cK=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cJ(),r=cB();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),cG=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=t.operators,a={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(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${a[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${a[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:i,schemaCode:n}=e;e.fail$data((0,t._)`${i} ${a[r].fail} ${n} || isNaN(${i})`)}}}),cW=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();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:a,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=r.let("res"),l=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${a}/${i}, ${l}))`)}}}),cX=N(e=>{function t(e){let t,r=e.length,a=0,i=0;for(;i<r;)a++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),cY=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$(),a=cX();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:i,data:n,schemaCode:o,it:s}=e,l="maxLength"===i?t.operators.GT:t.operators.LT,c=!1===s.opts.unicode?(0,t._)`${n}.length`:(0,t._)`${(0,r.useFunc)(e.gen,a.default)}(${n})`;e.fail$data((0,t._)`${c} ${l} ${o}`)}}}),cQ=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cj(),r=c$(),a=cS();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`},code(e){let{gen:i,data:n,$data:o,schema:s,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(o){let{regExp:t}=c.opts.code,o="new RegExp"===t.code?(0,a._)`new RegExp`:(0,r.useFunc)(i,t),s=i.let("valid");i.try(()=>i.assign(s,(0,a._)`${o}(${l}, ${u}).test(${n})`),()=>i.assign(s,!1)),e.fail$data((0,a._)`!${s}`)}else{let r=(0,t.usePattern)(e,s);e.fail$data((0,a._)`!${r}.test(${n})`)}}}}),c0=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();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:a,schemaCode:i}=e,n="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${a}).length ${n} ${i}`)}}}),c1=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cj(),r=cS(),a=c$();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:i,schema:n,schemaCode:o,data:s,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;let d=n.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,p);else for(let r of n)(0,t.checkReportMissingProp)(e,r)}():function(){let a=i.let("missing");if(d||l){let n=i.let("valid",!0);e.block$data(n,()=>{var l,c;return l=a,c=n,void(e.setParams({missingProperty:l}),i.forOf(l,o,()=>{i.assign(c,(0,t.propertyInData)(i,s,l,u.ownProperties)),i.if((0,r.not)(c),()=>{e.error(),i.break()})},r.nil))}),e.ok(n)}else i.if((0,t.checkMissingProp)(e,n,a)),(0,t.reportMissingProp)(e,a),i.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of n)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,a.checkStrictMode)(c,t,c.opts.strictRequired)}}function p(){i.forOf("prop",o,r=>{e.setParams({missingProperty:r}),i.if((0,t.noPropertyInData)(i,s,r,u.ownProperties),()=>e.error())})}}}}),c2=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();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:a,schemaCode:i}=e,n="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${a}.length ${n} ${i}`)}}}),c9=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cI();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),c4=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cE(),r=cS(),a=c$(),i=c9();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:n,data:o,$data:s,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!s&&!l)return;let p=n.let("valid"),m=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let s=n.let("i",(0,r._)`${o}.length`),l=n.let("j");e.setParams({i:s,j:l}),n.assign(p,!0),n.if((0,r._)`${s} > 1`,()=>(m.length>0&&!m.some(e=>"object"===e||"array"===e)?function(a,i){let s=n.name("item"),l=(0,t.checkDataTypes)(m,s,d.opts.strictNumbers,t.DataType.Wrong),c=n.const("indices",(0,r._)`{}`);n.for((0,r._)`;${a}--;`,()=>{n.let(s,(0,r._)`${o}[${a}]`),n.if(l,(0,r._)`continue`),m.length>1&&n.if((0,r._)`typeof ${s} == "string"`,(0,r._)`${s} += "_"`),n.if((0,r._)`typeof ${c}[${s}] == "number"`,()=>{n.assign(i,(0,r._)`${c}[${s}]`),e.error(),n.assign(p,!1).break()}).code((0,r._)`${c}[${s}] = ${a}`)})}:function(t,s){let l=(0,a.useFunc)(n,i.default),c=n.name("outer");n.label(c).for((0,r._)`;${t}--;`,()=>n.for((0,r._)`${s} = ${t}; ${s}--;`,()=>n.if((0,r._)`${l}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),n.assign(p,!1).break(c)})))})(s,l))},(0,r._)`${u} === false`),e.ok(p)}}}),c3=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$(),a=c9();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:n,$data:o,schemaCode:s,schema:l}=e;o||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(i,a.default)}(${n}, ${s})`):e.fail((0,t._)`${l} !== ${n}`)}}}),c6=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$(),a=c9();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 i,n,{gen:o,data:s,$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,m=()=>null!=i?i:i=(0,r.useFunc)(o,a.default);if(p||l)n=o.let("valid"),e.block$data(n,function(){o.assign(n,!1),o.forOf("v",u,e=>o.if((0,t._)`${m()}(${s}, ${e})`,()=>o.assign(n,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=o.const("vSchema",u);n=(0,t.or)(...c.map((r,a)=>{var i,n;let o;return i=e,"object"==typeof(o=c[n=a])&&null!==o?(0,t._)`${m()}(${s}, ${i}[${n}])`:(0,t._)`${s} === ${o}`}))}e.pass(n)}}}),c5=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cG(),r=cW(),a=cY(),i=cQ(),n=c0(),o=c1(),s=c2(),l=c4(),c=c3(),u=c6();e.default=[t.default,r.default,a.default,i.default,n.default,o.default,s.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),c8=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=cS(),r=c$();function a(e,a){let{gen:i,schema:n,data:o,keyword:s,it:l}=e;l.items=!0;let c=i.const("len",(0,t._)`${o}.length`);if(!1===n)e.setParams({len:a.length}),e.pass((0,t._)`${c} <= ${a.length}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(l,n)){let n=i.var("valid",(0,t._)`${c} <= ${a.length}`);i.if((0,t.not)(n),()=>{var o;return o=n,void i.forRange("i",a.length,c,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},o),l.allErrors||i.if((0,t.not)(o),()=>i.break())})}),e.ok(n)}}e.validateAdditionalItems=a,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:i}=e,{items:n}=t;Array.isArray(n)?a(e,n):(0,r.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),c7=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=cS(),r=c$(),a=cj();function i(e,a,n=e.schema){let{gen:o,parentSchema:s,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:i}=u,o=n.length,s=o===e.minItems&&(o===e.maxItems||!1===e[a]);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(s),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(o,n.length,u.items));let d=o.name("valid"),p=o.const("len",(0,t._)`${l}.length`);n.forEach((a,i)=>{(0,r.alwaysValidSchema)(u,a)||(o.if((0,t._)`${p} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},d)),e.ok(d))})}e.validateTuple=i,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return i(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,a.validateArray)(e))}}}),ue=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c7();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),ut=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$(),a=cj(),i=c8();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:n,it:o}=e,{prefixItems:s}=n;o.items=!0,(0,r.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,a.validateArray)(e)))}}}),ur=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$();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 a,i,{gen:n,schema:o,parentSchema:s,data:l,it:c}=e,{minContains:u,maxContains:d}=s;c.opts.next?(a=void 0===u?1:u,i=d):a=1;let p=n.const("len",(0,t._)`${l}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,o)){let r=(0,t._)`${p} >= ${a}`;void 0!==i&&(r=(0,t._)`${r} && ${p} <= ${i}`),e.pass(r);return}c.items=!0;let m=n.name("valid");function h(){let e=n.name("_valid"),r=n.let("count",0);f(e,()=>n.if(e,()=>{var e;return e=r,void(n.code((0,t._)`${e}++`),void 0===i?n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0).break()):(n.if((0,t._)`${e} > ${i}`,()=>n.assign(m,!1).break()),1===a?n.assign(m,!0):n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0))))}))}function f(t,a){n.forRange("i",0,p,i=>{e.subschema({keyword:"contains",dataProp:i,dataPropType:r.Type.Num,compositeRule:!0},t),a()})}void 0===i&&1===a?f(m,()=>n.if(m,()=>n.break())):0===a?(n.let(m,!0),void 0!==i&&n.if((0,t._)`${l}.length > 0`,h)):(n.let(m,!1),h()),e.result(m,()=>e.reset())}}}),ua=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=cS(),r=c$(),a=cj();e.error={message:({params:{property:e,depsCount:r,deps:a}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${a} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:a,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
66
66
|
missingProperty: ${i},
|
|
67
67
|
depsCount: ${r},
|
|
68
|
-
deps: ${a}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);n(e,t),o(e,r)}};function n(e,r=e.schema){let{gen:i,data:o,it:s}=e;if(0===Object.keys(r).length)return;let l=i.let("missing");for(let n in r){let c=r[n];if(0===c.length)continue;let u=(0,a.propertyInData)(i,o,n,s.opts.ownProperties);e.setParams({property:n,depsCount:c.length,deps:c.join(", ")}),s.allErrors?i.if(u,()=>{for(let t of c)(0,a.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,a.checkMissingProp)(e,c,l)})`),(0,a.reportMissingProp)(e,l),i.else())}}function o(e,t=e.schema){let{gen:i,data:n,keyword:s,it:l}=e,c=i.name("valid");for(let o in t)(0,r.alwaysValidSchema)(l,t[o])||(i.if((0,a.propertyInData)(i,n,o,l.opts.ownProperties),()=>{let t=e.subschema({keyword:s,schemaProp:o},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validatePropertyDeps=n,e.validateSchemaDeps=o,e.default=i}),ua=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS();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:a,schema:i,data:n,it:o}=e;if((0,r.alwaysValidSchema)(o,i))return;let s=a.name("valid");a.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),a.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||a.break()})}),e.ok(s)}}}),ui=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cT(),r=cb(),a=c$(),i=cS();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:n,schema:o,parentSchema:s,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,i.alwaysValidSchema)(u,o))return;let m=(0,t.allSchemaProperties)(s.properties),h=(0,t.allSchemaProperties)(s.patternProperties);function f(e){n.code((0,r._)`delete ${l}[${e}]`)}function y(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===o)return void f(t);if(!1===o){e.setParams({additionalProperty:t}),e.error(),d||n.break();return}if("object"==typeof o&&!(0,i.alwaysValidSchema)(u,o)){let a=n.name("valid");"failing"===p.removeAdditional?(g(t,a,!1),n.if((0,r.not)(a),()=>{e.reset(),f(t)})):(g(t,a),d||n.if((0,r.not)(a),()=>n.break()))}}function g(t,r,a){let n={keyword:"additionalProperties",dataProp:t,dataPropType:i.Type.Str};!1===a&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}n.forIn("key",l,a=>{m.length||h.length?n.if(function(a){let o;if(m.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,"properties");o=(0,t.isOwnProperty)(n,e,a)}else o=m.length?(0,r.or)(...m.map(e=>(0,r._)`${a} === ${e}`)):r.nil;return h.length&&(o=(0,r.or)(o,...h.map(i=>(0,r._)`${(0,t.usePattern)(e,i)}.test(${a})`))),(0,r.not)(o)}(a),()=>y(a)):y(a)}),e.ok((0,r._)`${c} === ${a.default.errors}`)}}}),un=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cq(),r=cT(),a=cS(),i=ui();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,parentSchema:s,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===s.additionalProperties&&i.default.code(new t.KeywordCxt(c,i.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(o);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=a.mergeEvaluated.props(n,(0,a.toHash)(u),c.props));let d=u.filter(e=>!(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length)return;let p=n.name("valid");for(let t of d){var m;(m=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==o[m].default)?h(t):(n.if((0,r.propertyInData)(n,l,t,c.opts.ownProperties)),h(t),c.allErrors||n.else().var(p,!0),n.endIf()),e.it.definedProperties.add(t),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),uo=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cT(),r=cb(),a=cS(),i=cS();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,data:s,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(o),p=d.filter(e=>(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length||p.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let m=u.strictSchema&&!u.allowMatchingProperties&&l.properties,h=n.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,i.evaluatedPropsToName)(n,c.props));let{props:f}=c;for(let e of d)m&&function(e){for(let t in m)new RegExp(e).test(t)&&(0,a.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?y(e):(n.var(h,!0),y(e),n.if(h));function y(a){n.forIn("key",s,o=>{n.if((0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`,()=>{let t=p.includes(a);t||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:o,dataPropType:i.Type.Str},h),c.opts.unevaluated&&!0!==f?n.assign((0,r._)`${f}[${o}]`,!0):t||c.allErrors||n.if((0,r.not)(h),()=>n.break())})})}}}}),us=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:a,it:i}=e;if((0,t.alwaysValidSchema)(i,a))return void e.fail();let n=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),ul=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cT().validateUnion,error:{message:"must match a schema in anyOf"}}}),uc=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS();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:a,schema:i,parentSchema:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=a.let("valid",!1),l=a.let("passing",null),c=a.name("_valid");e.setParams({passing:l}),a.block(function(){i.forEach((i,n)=>{let u;(0,r.alwaysValidSchema)(o,i)?a.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&a.if((0,t._)`${c} && ${s}`).assign(s,!1).assign(l,(0,t._)`[${l}, ${n}]`).else(),a.if(c,()=>{a.assign(s,!0),a.assign(l,n),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(s,()=>e.reset(),()=>e.error(!0))}}}),uu=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:a,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");let n=r.name("valid");a.forEach((r,a)=>{if((0,t.alwaysValidSchema)(i,r))return;let o=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(o)})}}}),ud=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS();function a(e,t){let a=e.schema[t];return void 0!==a&&!(0,r.alwaysValidSchema)(e,a)}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 i,{gen:n,parentSchema:o,it:s}=e;void 0===o.then&&void 0===o.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=a(s,"then"),c=a(s,"else");if(!l&&!c)return;let u=n.let("valid",!0),d=n.name("_valid");if(i=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(i),e.reset(),l&&c){let t=n.let("ifClause");e.setParams({ifClause:t}),n.if(d,p("then",t),p("else",t))}else l?n.if(d,p("then")):n.if((0,t.not)(d),p("else"));function p(r,a){return()=>{let i=e.subschema({keyword:r},d);n.assign(u,d),e.mergeValidEvaluated(i,u),a?n.assign(a,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),up=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:a}){void 0===r.if&&(0,t.checkStrictMode)(a,`"${e}" without "if" is ignored`)}}}),um=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c5(),r=c7(),a=c8(),i=ue(),n=ut(),o=ur(),s=ua(),l=ui(),c=un(),u=uo(),d=us(),p=ul(),m=uc(),h=uu(),f=ud(),y=up();e.default=function(e=!1){let g=[d.default,p.default,m.default,h.default,f.default,y.default,s.default,l.default,o.default,c.default,u.default];return e?g.push(r.default,i.default):g.push(t.default,a.default),g.push(n.default),g}}),uh=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb();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 a,i,n,o,s,l,{gen:c,data:u,$data:d,schema:p,schemaCode:m,it:h}=e,{opts:f,errSchemaPath:y,schemaEnv:g,self:v}=h;f.validateFormats&&(d?(a=c.scopeValue("formats",{ref:v.formats,code:f.code.formats}),i=c.const("fDef",(0,t._)`${a}[${m}]`),n=c.let("fType"),o=c.let("format"),c.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>c.assign(n,(0,t._)`${i}.type || "string"`).assign(o,(0,t._)`${i}.validate`),()=>c.assign(n,(0,t._)`"string"`).assign(o,i)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${m} && !${o}`,(s=g.$async?(0,t._)`(${i}.async ? await ${o}(${u}) : ${o}(${u}))`:(0,t._)`${o}(${u})`,l=(0,t._)`(typeof ${o} == "function" ? ${s} : ${o}.test(${u}))`,(0,t._)`${o} && ${o} !== true && ${n} === ${r} && !${l}`)))):function(){var a;let i,n,o=v.formats[p];if(!o){if(!1===f.strictSchema)return v.logger.warn(s());throw Error(s());function s(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===o)return;let[l,d,m]=(i=(a=o)instanceof RegExp?(0,t.regexpCode)(a):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,n=c.scopeValue("formats",{key:p,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,n]:[a.type||"string",a.validate,(0,t._)`${n}.validate`]);l===r&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!g.$async)throw Error("async format in sync schema");return(0,t._)`await ${m}(${u})`}return"function"==typeof d?(0,t._)`${m}(${u})`:(0,t._)`${m}.test(${u})`}())}())}}}),uf=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[uh().default]}),uy=N(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"]}),ug=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cB(),r=c6(),a=um(),i=uf(),n=uy();e.default=[t.default,r.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),uv=N(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),u_=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=uv(),a=cM(),i=cz(),n=cS();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:a}})=>(0,t._)`{error: ${e}, tag: ${a}, tagValue: ${r}}`},code(e){let{gen:o,data:s,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 m=o.let("valid",!1),h=o.const("tag",(0,t._)`${s}${(0,t.getProperty)(p)}`);o.if((0,t._)`typeof ${h} == "string"`,()=>(function(){let s=function(){var e;let t={},r=s(c),o=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,n.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=a.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof a.SchemaEnv&&(c=c.schema),void 0===c)throw new i.default(u.opts.uriResolver,u.baseId,e)}let m=null==(e=null==c?void 0:c.properties)?void 0:e[p];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);o=o&&(r||s(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"`)}(m,t)}if(!o)throw Error(`discriminator: "${p}" must be required`);return t;function s({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 o.if(!1),s)o.elseIf((0,t._)`${h} === ${r}`),o.assign(m,function(r){let a=o.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},a);return e.mergeEvaluated(i,t.Name),a}(s[r]));o.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:p}),o.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:p})),e.ok(m)}}}),ub=N((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}}),uS=N((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=cF(),a=ug(),i=u_(),n=ub(),o=["/properties"],s="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=cq();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=cb();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=cA();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=cz();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),u$=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=cb(),r=c$(),a=cM(),i=cJ();function n(e,n){let{gen:o,it:s}=e;s.schemaEnv.root.dynamicAnchors[n]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(n)}`,c="#"===s.errSchemaPath?s.validateName:function(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:o,baseId:s,localRefs:l,meta:c}=t.root,{schemaId:u}=n.opts,d=new a.SchemaEnv({schema:r,schemaId:u,root:o,baseId:s,localRefs:l,meta:c});return a.compileSchema.call(n,d),(0,i.getValidate)(e,d)}(e);o.if((0,t._)`!${l}`,()=>o.assign(l,c))}e.dynamicAnchor=n,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>n(e,e.schema)}}),uw=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=cb(),r=c$(),a=cJ();function i(e,i){let{gen:n,keyword:o,it:s}=e;if("#"!==i[0])throw Error(`"${o}" only supports hash fragment reference`);let l=i.slice(1);if(s.allErrors)c();else{let t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(s.schemaEnv.root.dynamicAnchors[l]){let a=n.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);n.if(a,u(a,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,r){return r?()=>n.block(()=>{(0,a.callRef)(e,t),n.let(r,!0)}):()=>(0,a.callRef)(e,t)}}e.dynamicRef=i,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>i(e,e.schema)}}),uR=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u$(),r=cS();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),uk=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),ux=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u$(),r=uw(),a=uR(),i=uk();e.default=[t.default,r.default,a.default,i.default]}),uP=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ur();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),uE=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ur();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),uT=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:a}){void 0===r.contains&&(0,t.checkStrictMode)(a,`"${e}" without "contains" is ignored`)}}}),uj=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uP(),r=uE(),a=uT();e.default=[t.default,r.default,a.default]}),uC=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS(),a=c$();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:i,schema:n,data:o,errsCount:s,it:l}=e;if(!s)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(a){if(!1===n){e.setParams({unevaluatedProperty:a}),e.error(),c||i.break();return}if(!(0,r.alwaysValidSchema)(l,n)){let n=i.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:r.Type.Str},n),c||i.if((0,t.not)(n),()=>i.break())}}u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn("key",o,e=>{var r,a;return i.if((r=u,a=e,(0,t._)`!${r} || !${r}[${a}]`),()=>d(e))})):!0!==u&&i.forIn("key",o,e=>void 0===u?d(e):i.if(function(e,r){let a=[];for(let i in e)!0===e[i]&&a.push((0,t._)`${r} !== ${i}`);return(0,t.and)(...a)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${s} === ${a.default.errors}`)}}}),uO=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cb(),r=cS();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:a,schema:i,data:n,it:o}=e,s=o.items||0;if(!0===s)return;let l=a.const("len",(0,t._)`${n}.length`);if(!1===i)e.setParams({len:s}),e.fail((0,t._)`${l} > ${s}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(o,i)){let i=a.var("valid",(0,t._)`${l} <= ${s}`);a.if((0,t.not)(i),()=>{var n,c;return n=i,c=s,void a.forRange("i",c,l,i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||a.if((0,t.not)(n),()=>a.break())})}),e.ok(i)}o.items=!0}}}),uI=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uC(),r=uO();e.default=[t.default,r.default]}),uN=N((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"}]}}}}}),uq=N((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:"#"}}}}}),uA=N((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:"#"}}}}),uz=N((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:{}}}}}),uM=N((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"}}}}),uL=N((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}}}}),uZ=N((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=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uN(),r=uq(),a=uA(),i=uz(),n=uM(),o=uL(),s=uZ(),l=["/properties"];e.default=function(e){return[t,r,a,i,c(this,n),o,c(this,s)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),uD=N((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=cF(),a=ug(),i=ux(),n=uj(),o=uI(),s=u_(),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(i.default),a.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(n.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.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=cq();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=cb();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 m=cA();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=cz();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),uU=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cB(),r=c6(),a=um(),i=ux(),n=uj(),o=uI(),s=uf(),l=uy();e.default=[i.default,t.default,r.default,(0,a.default)(!0),s.default,l.metadataVocabulary,l.contentVocabulary,n.default,o.default]}),uF=N((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}}}}),uH=N((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"}}}}}),uJ=N((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"}}}}),uB=N((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"}}}}),uK=N((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"}}}}),uG=N((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"}}}}),uW=N((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=N((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:[]}}}}),uY=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uF(),r=uH(),a=uJ(),i=uB(),n=uK(),o=uG(),s=uW(),l=uX(),c=["/properties"];e.default=function(e){return[t,r,a,i,n,u(this,o),s,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),uQ=N((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=cF(),a=uU(),i=u_(),n=uY(),o="https://json-schema.org/draft/2020-12/schema";var s=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(n.default.call(this,e),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=cq();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=cb();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=cA();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=cz();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),u0=N(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(i,n),time:t(s(!0),l),"date-time":t(d(!0),p),"iso-time":t(s(),c),"iso-date-time":t(d(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.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$/,n),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,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},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let i=r.exec(e);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:a[o])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function s(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],n=+r[3],s=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!s)return!1;if(a<=23&&i<=59&&n<60)return!0;let d=i-u*l,p=a-c*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&n<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function c(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=s(e);return function(e){let r=e.split(u);return 2===r.length&&i(r[0])&&t(r[1])}}function p(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(u),[i,o]=t.split(u),s=n(r,i);if(void 0!==s)return s||l(a,o)}let h=/\/|:/,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/}),u1=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=uS(),r=cb(),a=r.operators,i={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let a,n,{gen:o,data:s,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:p}=u;if(!d.validateFormats)return;let m=new t.KeywordCxt(u,p.RULES.all.format.definition,"format");function h(e){return(0,r._)`${e}.compare(${s}, ${l}) ${i[c].fail} 0`}m.$data?(a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),n=o.const("fmt",(0,r._)`${a}[${m.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${n} != "object"`,(0,r._)`${n} instanceof RegExp`,(0,r._)`typeof ${n}.compare != "function"`,h(n)))):function(){let t=m.schema,a=p.formats[t];if(!a||!0===a)return;if("object"!=typeof a||a instanceof RegExp||"function"!=typeof a.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let i=o.scopeValue("formats",{key:t,ref:a,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(h(i))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),u2=N((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=u0(),a=u1(),i=cb(),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,n),e;let[i,s]="fast"===t.mode?[r.fastFormats,o]:[r.fullFormats,n];return l(e,t.formats||r.formatNames,i,s),t.keywords&&(0,a.default)(e),e};function l(e,t,r,a){var n;for(let o of(null!=(n=e.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(o,r[o])}s.get=(e,t="full")=>{let a=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!a)throw Error(`Unknown format "${e}"`);return a},t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),u9=uS(),u4=uD(),u3=uQ();let u6=q(u2(),1).default;function u5(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return u6(t),t}var u8=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=u5(u3.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(A.has(r))return"2020-12";if(z.has(r))return"2019-09";if(M.has(r)||L.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??=u5(u4.Ajv2019):this._ajvDraft7??=u5(u9.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)}}};u9.Ajv,require("node:process");let u7=Symbol.for("mcp.completable");function de(e){return!!e&&"object"==typeof e&&u7 in e}let dt=0x80000000-1;function dr(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,dt));return r.unref?.(),r}var da=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function di(e,t,r){return Response.json({jsonrpc:"2.0",error:{code:t,message:r},id:e},{status:200})}function dn(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[iC]:t}}}}function ds(e,t,r){if(null===r||"object"!=typeof r||"string"!=typeof r.method)throw new s3(s4.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let a=function(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(void 0!==t&&(void 0!==t.tools||void 0!==t.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(r);if(void 0===a)throw new s3(s4.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:a}}function dl(e,t){if("tools/call"===e)return{content:[{type:"text",text:t}],isError:!0};throw new s3(s4.InternalError,t)}var dc=class{constructor(e){this._host=e}async fulfill(e,t,r,a,i){let{maxRounds:n,roundTimeoutMs:o}=this._host,s=a.mcpReq.signal,l=i,c=0;for(;;){let i;if((c+=1)>n)return dl(e,`Multi-round-trip request '${e}' still required input after ${n} rounds (inputRequired.maxRounds)`);let u=l.inputRequests,d=null!=u&&Object.keys(u).length>0,p="string"==typeof l.requestState?l.requestState:void 0;if(!d&&void 0===p)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(d){let t=this._host.resolvedClientCapabilities(a),r=[];for(let[a,i]of Object.entries(u)){let{embedded:n,required:o}=ds(e,a,i);if("roots/list"!==n.method&&void 0===n.params)throw new s3(s4.InternalError,`Handler for ${e} returned an input request '${a}' of kind '${n.method}' without params`);if(void 0!==sE(o,t))return dl(e,`Cannot request input '${a}' (${n.method}): the client on this 2025-era connection did not declare the required capability${void 0===t?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);r.push([a,n])}let n=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 e={relatedRequestId:a.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:n.signal},t=await Promise.all(r.map(async([t,r])=>{try{return[t,await this._dispatchLeg(r,e)]}catch(e){throw n.abort(e),e}}));i=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return dl(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{n.dispose()}}else await function(e,t){return new Promise((e,r)=>{if(t?.aborted)return void r(t.reason instanceof sk?t.reason:new sk(sR.RequestTimeout,String(t.reason)));let a=setTimeout(()=>{t?.removeEventListener("abort",i),e()},250),i=()=>{clearTimeout(a),r(t?.reason instanceof sk?t.reason:new sk(sR.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}(0,s);let m={...a,mcpReq:{...a.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(e){return()=>e}(p)}};if(void 0!==p){let t=await this._host.verifyRequestState(p,m,e);void 0!==t&&(m=cs(m,t))}let h=await t(r,m);if(!lj(h))return h;l=h}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return"url"===r.mode&&void 0===r.elicitationId&&(r={...r,elicitationId:function(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;let r=[...t].map(e=>e.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}};let du=new Set(["tools/call","prompts/get","resources/read"]);var dd=class extends cl{_clientCapabilities;_clientVersion;static{l=(e,t)=>{void 0!==t.clientCapabilities&&(e._clientCapabilities=t.clientCapabilities),void 0!==t.clientInfo&&(e._clientVersion=t.clientInfo)},c=(e,t)=>{let r=t.filter(t=>!e._supportedProtocolVersions.includes(t));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},u=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new dc({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new u8,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=function(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??8,roundTimeoutMs:e?.roundTimeoutMs??6e5,legacyShim:e?.legacyShim??!0}}(t?.inputRequired),t?.cacheHints!==void 0){for(const[e,r]of Object.entries(t.cacheHints))void 0!==r&&s9(r,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",e=>this._oninitialize(e)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),sC(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:a}=e.params,i=aa(os,a);return i.success&&this._loggingLevels.set(r,i.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,r,a)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=e.mcpReq.envelope?.[iO]))return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:t,data:r,logger:a}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(os.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)};registerCapabilities(e){if(this.transport)throw new sk(sR.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let i=r[e];r[e]=cc(i)&&cc(a)?{...i,...a}:a}return r}(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if("tools/call"!==e){let r=this._cacheHints?.[e],a=du.has(e);return void 0!==r||a?async(i,n)=>{let o=a?await this._invokeInputRequiredCapableHandler(e,t,i,n):await t(i,n);if(lj(o)){if(!a)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return o}return void 0===r?o:s0(o,r)}:async(r,a)=>{let i=await t(r,a);if(lj(i))throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}}return async(e,r)=>{let a=lf(this._negotiatedProtocolVersion),i=a.validateRequest("tools/call",e);if(!i.ok)throw new s3("not-in-era"===i.reason?s4.InternalError:s4.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let n=await this._invokeInputRequiredCapableHandler("tools/call",t,e,r);if(lj(n))return n;let o=sN(n),s=a.validateResult("tools/call",o);if(!s.ok)throw new s3("not-in-era"===s.reason?s4.InternalError:s4.InvalidParams,"not-in-era"===s.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=sT}async _invokeInputRequiredCapableHandler(e,t,r,a){let i,n=this._servedModernEra(),o=a.mcpReq.requestState();if(void 0!==o&&"string"!=typeof o)throw new s3(s4.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let s=a;if("string"==typeof o){let t=await this._verifyRequestState(o,a,e);void 0!==t&&(s=cs(a,t))}try{i=await t(r,s)}catch(e){if(e instanceof s3&&e.code===s4.UrlElicitationRequired){if(!n)throw e;throw new s3(s4.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw e}if(!lj(i))return i;if(!n){if(!this._inputRequiredServing.legacyShim)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??ik}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,s,i)}let l=i.inputRequests,c=null!=l&&Object.keys(l).length>0,u="string"==typeof i.requestState;if(!c&&!u)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(c){let t=this._inputRequestCapabilityView(a);for(let[r,a]of Object.entries(l)){let{embedded:i,required:n}=ds(e,r,a),o=sE(n,t);if(void 0!==o)throw new s7({requiredCapabilities:o},`Cannot request input '${r}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(e,t,r){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${e instanceof Error?e.message:String(e)}`)),new s3(s4.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[ij]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new sk(sR.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new sk(sR.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new sk(sR.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new sk(sR.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new sk(sR.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new sk(sR.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new sk(sR.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new sk(sR.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new sk(sR.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new sk(sR.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=this._supportedProtocolVersions.filter(e=>!(e>=sT)),a=r.includes(t)?t:r[0]??ik;return this._negotiatedProtocolVersion=a,this.transport?.setProtocolVersion?.(a),{protocolVersion:a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:sC(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new sk(sR.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages.at(-1),r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages.at(-2):void 0,n=i?Array.isArray(i.content)?i.content:[i.content]:[],o=n.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw new s3(s4.InvalidParams,"The last message must contain only tool_result content if any is present");if(!o)throw new s3(s4.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(o){let e=new Set(n.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new s3(s4.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),a=await this.request({method:"sampling/createMessage",params:e},t),i=this._wireCodec().samplingResultVariant(r,a);if(!i.ok)throw new sk(sR.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new sk(sR.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let a=e.mode??"form",i=r?.validateAcceptedContent??!0;switch(a){case"url":return this.request({method:"elicitation/create",params:e},t);case"form":{let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},t);if(i&&"accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new s3(s4.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof s3)throw e;throw new s3(s4.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},dp=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(void 0!==t&&t.enabled){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(void 0===t.inputSchema)return df;try{let r=l0(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new dd(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?l0(t.inputSchema,"input"):df,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=l0(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new s3(s4.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Tool ${e.params.name} disabled`);try{let a=await this.validateToolInput(r,e.params.arguments,e.params.name),i=await this.executeToolHandler(r,a,t);if(await this.validateToolOutput(r,i,e.params.name),lj(i))return i;return this.server.projectCallToolResult(i,r.outputSchemaJson)}catch(e){if(e instanceof s3&&e.code===s4.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=await l1(e.inputSchema,t??{});if(!a.success)throw new s3(s4.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a.error}`);return a.data}async validateToolOutput(e,t,r){if(!e.outputSchema||lj(t)||t.isError)return;if(void 0===t.structuredContent)throw new s3(s4.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=await l1(e.outputSchema,t.structuredContent);if(!a.success)throw new s3(s4.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new s3(s4.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new s3(s4.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return d_;let a=dS(db(r.argsSchema)?.[e.params.argument.name]);if(!de(a))return d_;let i=a[u7]?.complete;return i?dv(await i(e.params.argument.value,e.params.context)):d_}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return d_;throw new s3(s4.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?dv(await a(e.params.argument.value,e.params.context)):d_}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new s3(s4.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new s3(s4.InvalidParams,`Resource ${r} disabled`);return s0(await a.readCallback(r,t),a.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return s0(await e.readCallback(r,a,t),e.cacheHint)}throw new s6(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{let r,a,i;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(a=(r=l0(t.argsSchema,"input")).properties||{},i=r.required||[],Object.entries(a).map(([e,t])=>({name:e,description:t?.description,required:i.includes(e)}))):void 0,icons:t.icons,_meta:t._meta}})})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new s3(s4.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,a){let i=r.cacheHint,n=r;if(void 0!==i){s9(i,`resource ${e}`);let t={...r};delete t.cacheHint,n=t}if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,a,i){let n={name:e,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=n)),void 0!==e.name&&(n.name=e.name),void 0!==e.title&&(n.title=e.title),void 0!==e.metadata&&(n.metadata=e.metadata),void 0!==e.callback&&(n.readCallback=e.callback),void 0!==e.enabled&&(n.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=n,n}_createRegisteredResourceTemplate(e,t,r,a,i){let n={resourceTemplate:r,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=n)),void 0!==t.title&&(n.title=t.title),void 0!==t.template&&(n.resourceTemplate=t.template),void 0!==t.metadata&&(n.metadata=t.metadata),void 0!==t.callback&&(n.readCallback=t.callback),void 0!==t.enabled&&(n.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=n;let o=r.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),n}_createRegisteredPrompt(e,t,r,a,i,n,o){let s=a,l=i,c={title:t,description:r,argsSchema:a,icons:n,_meta:o,handler:dg(e,a,i),enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=c)),void 0!==t.title&&(c.title=t.title),void 0!==t.description&&(c.description=t.description),void 0!==t.icons&&(c.icons=t.icons),void 0!==t._meta&&(c._meta=t._meta);let r=!1;void 0!==t.argsSchema&&(c.argsSchema=t.argsSchema,s=t.argsSchema,r=!0),void 0!==t.callback&&(l=t.callback,r=!0),r&&(c.handler=dg(e,s,l)),void 0!==t.enabled&&(c.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=c,a){let e=db(a);e&&Object.values(e).some(e=>de(dS(e)))&&this.setCompletionRequestHandler()}return c}_createRegisteredTool(e,t,r,a,i,n,o,s,l,c){if(cf(e),void 0!==a)try{let t=l0(a,"input");this._toolInputSchemaJson[e]=t;let r=lN(t);r.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${r.reason}`)}catch{}let u=c,d={title:t,description:r,inputSchema:a,outputSchema:i,outputSchemaJson:dy(i),annotations:n,icons:o,execution:s,_meta:l,handler:c,executor:dh(a,c),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&cf(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=d,e=t.name)),void 0!==t.title&&(d.title=t.title),void 0!==t.description&&(d.description=t.description);let r=!1;void 0!==t.paramsSchema&&(d.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],r=!0),void 0!==t.callback&&(d.handler=t.callback,u=t.callback,r=!0),r&&(d.executor=dh(d.inputSchema,u)),void 0!==t.outputSchema&&(d.outputSchema=t.outputSchema,d.outputSchemaJson=dy(t.outputSchema)),void 0!==t.annotations&&(d.annotations=t.annotations),void 0!==t.icons&&(d.icons=t.icons),void 0!==t._meta&&(d._meta=t._meta),void 0!==t.enabled&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:i,inputSchema:n,outputSchema:o,annotations:s,icons:l,_meta:c}=t;return this._createRegisteredTool(e,a,i,cg(n),cg(o),s,l,void 0,c,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:i,argsSchema:n,icons:o,_meta:s}=t,l=this._createRegisteredPrompt(e,a,i,cg(n),r,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},dm=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new cy(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function dh(e,t){return e?async(e,r)=>t(e,r):async(e,r)=>t(r)}let df={type:"object",properties:{}};function dy(e){if(void 0!==e)try{return l0(e,"output")}catch{return}}function dg(e,t,r){return t?async(a,i)=>{let n=await l1(t,a);if(!n.success)throw new s3(s4.InvalidParams,`Invalid arguments for prompt ${e}: ${n.error}`);return r(n.data,i)}:async(e,t)=>r(t)}function dv(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}let d_={completion:{values:[],hasMore:!1}};function db(e){if(e.shape&&"object"==typeof e.shape)return e.shape}function dS(e){return e?.type!=="optional"?e:e.def?.innerType??e}var d$=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(e){this._classification=e.classification,this._responseMode=e.responseMode??"auto",this._keepAliveMs=e.keepAliveMs??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(e,t){if(this._used)throw Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||void 0===this.onmessage)throw Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw Error("PerRequestHTTPServerTransport is closed");this._used=!0;let r=t?.request?.signal;if(r?.aborted)throw await this.close(),new sk(sR.ConnectionClosed,"The request was aborted before it could be handled");let a={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(lx(e)){let t,i;this._requestId=e.id;let n=new Promise((e,r)=>{t=e,i=r});if(this._deferredResponse={promise:n,resolve:t,reject:i,settled:!1},void 0!==r){let e=()=>void this.close();r.addEventListener("abort",e,{once:!0}),this._abortCleanup=()=>r.removeEventListener("abort",e)}this._dispatchWindowOpen=!0;try{this.onmessage(e,a)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),n}return this.onmessage(e,a),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let r=lE(e)||lT(e),a=r?e.id:t?.relatedRequestId;if(void 0===this._requestId||void 0===a||a!==this._requestId){r&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(r){if(this._terminalDelivered)return;this._terminalDelivered=!0;let t=lT(e)?e.error.code:void 0,r=void 0!==t&&(this._dispatchWindowOpen||t===s4.MissingRequiredClientCapability)?lU[t]:void 0;if(void 0!==r&&void 0===this._sse){this.settleResponse(Response.json(e,{status:r,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(void 0!==this._sse||"sse"===this._responseMode){void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(e),this.finalizeStream();return}this.settleResponse(Response.json(e,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||void 0===this._sse||this._sse.closed)return;let t=e.split("\n").map(e=>`: ${e}`).join("\n");this.writeFrame(`${t}
|
|
68
|
+
deps: ${a}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);n(e,t),o(e,r)}};function n(e,r=e.schema){let{gen:i,data:o,it:s}=e;if(0===Object.keys(r).length)return;let l=i.let("missing");for(let n in r){let c=r[n];if(0===c.length)continue;let u=(0,a.propertyInData)(i,o,n,s.opts.ownProperties);e.setParams({property:n,depsCount:c.length,deps:c.join(", ")}),s.allErrors?i.if(u,()=>{for(let t of c)(0,a.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,a.checkMissingProp)(e,c,l)})`),(0,a.reportMissingProp)(e,l),i.else())}}function o(e,t=e.schema){let{gen:i,data:n,keyword:s,it:l}=e,c=i.name("valid");for(let o in t)(0,r.alwaysValidSchema)(l,t[o])||(i.if((0,a.propertyInData)(i,n,o,l.opts.ownProperties),()=>{let t=e.subschema({keyword:s,schemaProp:o},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validatePropertyDeps=n,e.validateSchemaDeps=o,e.default=i}),ui=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$();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:a,schema:i,data:n,it:o}=e;if((0,r.alwaysValidSchema)(o,i))return;let s=a.name("valid");a.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),a.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||a.break()})}),e.ok(s)}}}),un=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cj(),r=cS(),a=cw(),i=c$();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:n,schema:o,parentSchema:s,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,i.alwaysValidSchema)(u,o))return;let m=(0,t.allSchemaProperties)(s.properties),h=(0,t.allSchemaProperties)(s.patternProperties);function f(e){n.code((0,r._)`delete ${l}[${e}]`)}function y(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===o)return void f(t);if(!1===o){e.setParams({additionalProperty:t}),e.error(),d||n.break();return}if("object"==typeof o&&!(0,i.alwaysValidSchema)(u,o)){let a=n.name("valid");"failing"===p.removeAdditional?(g(t,a,!1),n.if((0,r.not)(a),()=>{e.reset(),f(t)})):(g(t,a),d||n.if((0,r.not)(a),()=>n.break()))}}function g(t,r,a){let n={keyword:"additionalProperties",dataProp:t,dataPropType:i.Type.Str};!1===a&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}n.forIn("key",l,a=>{m.length||h.length?n.if(function(a){let o;if(m.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,"properties");o=(0,t.isOwnProperty)(n,e,a)}else o=m.length?(0,r.or)(...m.map(e=>(0,r._)`${a} === ${e}`)):r.nil;return h.length&&(o=(0,r.or)(o,...h.map(i=>(0,r._)`${(0,t.usePattern)(e,i)}.test(${a})`))),(0,r.not)(o)}(a),()=>y(a)):y(a)}),e.ok((0,r._)`${c} === ${a.default.errors}`)}}}),uo=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cA(),r=cj(),a=c$(),i=un();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,parentSchema:s,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===s.additionalProperties&&i.default.code(new t.KeywordCxt(c,i.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(o);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=a.mergeEvaluated.props(n,(0,a.toHash)(u),c.props));let d=u.filter(e=>!(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length)return;let p=n.name("valid");for(let t of d){var m;(m=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==o[m].default)?h(t):(n.if((0,r.propertyInData)(n,l,t,c.opts.ownProperties)),h(t),c.allErrors||n.else().var(p,!0),n.endIf()),e.it.definedProperties.add(t),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),us=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cj(),r=cS(),a=c$(),i=c$();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,data:s,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(o),p=d.filter(e=>(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length||p.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let m=u.strictSchema&&!u.allowMatchingProperties&&l.properties,h=n.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,i.evaluatedPropsToName)(n,c.props));let{props:f}=c;for(let e of d)m&&function(e){for(let t in m)new RegExp(e).test(t)&&(0,a.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?y(e):(n.var(h,!0),y(e),n.if(h));function y(a){n.forIn("key",s,o=>{n.if((0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`,()=>{let t=p.includes(a);t||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:o,dataPropType:i.Type.Str},h),c.opts.unevaluated&&!0!==f?n.assign((0,r._)`${f}[${o}]`,!0):t||c.allErrors||n.if((0,r.not)(h),()=>n.break())})})}}}}),ul=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c$();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:a,it:i}=e;if((0,t.alwaysValidSchema)(i,a))return void e.fail();let n=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),uc=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cj().validateUnion,error:{message:"must match a schema in anyOf"}}}),uu=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$();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:a,schema:i,parentSchema:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=a.let("valid",!1),l=a.let("passing",null),c=a.name("_valid");e.setParams({passing:l}),a.block(function(){i.forEach((i,n)=>{let u;(0,r.alwaysValidSchema)(o,i)?a.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&a.if((0,t._)`${c} && ${s}`).assign(s,!1).assign(l,(0,t._)`[${l}, ${n}]`).else(),a.if(c,()=>{a.assign(s,!0),a.assign(l,n),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(s,()=>e.reset(),()=>e.error(!0))}}}),ud=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c$();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:a,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");let n=r.name("valid");a.forEach((r,a)=>{if((0,t.alwaysValidSchema)(i,r))return;let o=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(o)})}}}),up=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$();function a(e,t){let a=e.schema[t];return void 0!==a&&!(0,r.alwaysValidSchema)(e,a)}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 i,{gen:n,parentSchema:o,it:s}=e;void 0===o.then&&void 0===o.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=a(s,"then"),c=a(s,"else");if(!l&&!c)return;let u=n.let("valid",!0),d=n.name("_valid");if(i=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(i),e.reset(),l&&c){let t=n.let("ifClause");e.setParams({ifClause:t}),n.if(d,p("then",t),p("else",t))}else l?n.if(d,p("then")):n.if((0,t.not)(d),p("else"));function p(r,a){return()=>{let i=e.subschema({keyword:r},d);n.assign(u,d),e.mergeValidEvaluated(i,u),a?n.assign(a,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),um=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c$();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:a}){void 0===r.if&&(0,t.checkStrictMode)(a,`"${e}" without "if" is ignored`)}}}),uh=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c8(),r=ue(),a=c7(),i=ut(),n=ur(),o=ua(),s=ui(),l=un(),c=uo(),u=us(),d=ul(),p=uc(),m=uu(),h=ud(),f=up(),y=um();e.default=function(e=!1){let g=[d.default,p.default,m.default,h.default,f.default,y.default,s.default,l.default,o.default,c.default,u.default];return e?g.push(r.default,i.default):g.push(t.default,a.default),g.push(n.default),g}}),uf=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();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 a,i,n,o,s,l,{gen:c,data:u,$data:d,schema:p,schemaCode:m,it:h}=e,{opts:f,errSchemaPath:y,schemaEnv:g,self:v}=h;f.validateFormats&&(d?(a=c.scopeValue("formats",{ref:v.formats,code:f.code.formats}),i=c.const("fDef",(0,t._)`${a}[${m}]`),n=c.let("fType"),o=c.let("format"),c.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>c.assign(n,(0,t._)`${i}.type || "string"`).assign(o,(0,t._)`${i}.validate`),()=>c.assign(n,(0,t._)`"string"`).assign(o,i)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${m} && !${o}`,(s=g.$async?(0,t._)`(${i}.async ? await ${o}(${u}) : ${o}(${u}))`:(0,t._)`${o}(${u})`,l=(0,t._)`(typeof ${o} == "function" ? ${s} : ${o}.test(${u}))`,(0,t._)`${o} && ${o} !== true && ${n} === ${r} && !${l}`)))):function(){var a;let i,n,o=v.formats[p];if(!o){if(!1===f.strictSchema)return v.logger.warn(s());throw Error(s());function s(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===o)return;let[l,d,m]=(i=(a=o)instanceof RegExp?(0,t.regexpCode)(a):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,n=c.scopeValue("formats",{key:p,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,n]:[a.type||"string",a.validate,(0,t._)`${n}.validate`]);l===r&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!g.$async)throw Error("async format in sync schema");return(0,t._)`await ${m}(${u})`}return"function"==typeof d?(0,t._)`${m}(${u})`:(0,t._)`${m}.test(${u})`}())}())}}}),uy=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[uf().default]}),ug=N(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"]}),uv=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cK(),r=c5(),a=uh(),i=uy(),n=ug();e.default=[t.default,r.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),u_=N(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),ub=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=u_(),a=cL(),i=cM(),n=c$();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:a}})=>(0,t._)`{error: ${e}, tag: ${a}, tagValue: ${r}}`},code(e){let{gen:o,data:s,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 m=o.let("valid",!1),h=o.const("tag",(0,t._)`${s}${(0,t.getProperty)(p)}`);o.if((0,t._)`typeof ${h} == "string"`,()=>(function(){let s=function(){var e;let t={},r=s(c),o=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,n.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=a.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof a.SchemaEnv&&(c=c.schema),void 0===c)throw new i.default(u.opts.uriResolver,u.baseId,e)}let m=null==(e=null==c?void 0:c.properties)?void 0:e[p];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);o=o&&(r||s(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"`)}(m,t)}if(!o)throw Error(`discriminator: "${p}" must be required`);return t;function s({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 o.if(!1),s)o.elseIf((0,t._)`${h} === ${r}`),o.assign(m,function(r){let a=o.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},a);return e.mergeEvaluated(i,t.Name),a}(s[r]));o.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:p}),o.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:p})),e.ok(m)}}}),uS=N((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}}),u$=N((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=cH(),a=uv(),i=ub(),n=uS(),o=["/properties"],s="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=cA();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=cS();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=cz();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}})}),uw=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=cS(),r=cw(),a=cL(),i=cB();function n(e,n){let{gen:o,it:s}=e;s.schemaEnv.root.dynamicAnchors[n]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(n)}`,c="#"===s.errSchemaPath?s.validateName:function(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:o,baseId:s,localRefs:l,meta:c}=t.root,{schemaId:u}=n.opts,d=new a.SchemaEnv({schema:r,schemaId:u,root:o,baseId:s,localRefs:l,meta:c});return a.compileSchema.call(n,d),(0,i.getValidate)(e,d)}(e);o.if((0,t._)`!${l}`,()=>o.assign(l,c))}e.dynamicAnchor=n,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>n(e,e.schema)}}),uR=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=cS(),r=cw(),a=cB();function i(e,i){let{gen:n,keyword:o,it:s}=e;if("#"!==i[0])throw Error(`"${o}" only supports hash fragment reference`);let l=i.slice(1);if(s.allErrors)c();else{let t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(s.schemaEnv.root.dynamicAnchors[l]){let a=n.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);n.if(a,u(a,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,r){return r?()=>n.block(()=>{(0,a.callRef)(e,t),n.let(r,!0)}):()=>(0,a.callRef)(e,t)}}e.dynamicRef=i,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>i(e,e.schema)}}),uk=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=c$();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),ux=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uR();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),uP=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uR(),a=uk(),i=ux();e.default=[t.default,r.default,a.default,i.default]}),uE=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ua();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),uT=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ua();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),uj=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c$();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:a}){void 0===r.contains&&(0,t.checkStrictMode)(a,`"${e}" without "contains" is ignored`)}}}),uC=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uE(),r=uT(),a=uj();e.default=[t.default,r.default,a.default]}),uO=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$(),a=cw();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:i,schema:n,data:o,errsCount:s,it:l}=e;if(!s)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(a){if(!1===n){e.setParams({unevaluatedProperty:a}),e.error(),c||i.break();return}if(!(0,r.alwaysValidSchema)(l,n)){let n=i.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:r.Type.Str},n),c||i.if((0,t.not)(n),()=>i.break())}}u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn("key",o,e=>{var r,a;return i.if((r=u,a=e,(0,t._)`!${r} || !${r}[${a}]`),()=>d(e))})):!0!==u&&i.forIn("key",o,e=>void 0===u?d(e):i.if(function(e,r){let a=[];for(let i in e)!0===e[i]&&a.push((0,t._)`${r} !== ${i}`);return(0,t.and)(...a)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${s} === ${a.default.errors}`)}}}),uI=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS(),r=c$();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:a,schema:i,data:n,it:o}=e,s=o.items||0;if(!0===s)return;let l=a.const("len",(0,t._)`${n}.length`);if(!1===i)e.setParams({len:s}),e.fail((0,t._)`${l} > ${s}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(o,i)){let i=a.var("valid",(0,t._)`${l} <= ${s}`);a.if((0,t.not)(i),()=>{var n,c;return n=i,c=s,void a.forRange("i",c,l,i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||a.if((0,t.not)(n),()=>a.break())})}),e.ok(i)}o.items=!0}}}),uN=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uO(),r=uI();e.default=[t.default,r.default]}),uq=N((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"}]}}}}}),uA=N((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:"#"}}}}}),uz=N((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=N((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:{}}}}}),uL=N((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"}}}}),uZ=N((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}}}}),uV=N((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:[]}}}}),uD=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uq(),r=uA(),a=uz(),i=uM(),n=uL(),o=uZ(),s=uV(),l=["/properties"];e.default=function(e){return[t,r,a,i,c(this,n),o,c(this,s)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),uU=N((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=cH(),a=uv(),i=uP(),n=uC(),o=uN(),s=ub(),l=uD(),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(i.default),a.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(n.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.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=cA();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=cS();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 m=cz();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=cM();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),uF=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cK(),r=c5(),a=uh(),i=uP(),n=uC(),o=uN(),s=uy(),l=ug();e.default=[i.default,t.default,r.default,(0,a.default)(!0),s.default,l.metadataVocabulary,l.contentVocabulary,n.default,o.default]}),uH=N((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}}}}),uJ=N((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"}}}}}),uB=N((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"}}}}),uK=N((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"}}}}),uG=N((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"}}}}),uW=N((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"}}}}),uX=N((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}}}}),uY=N((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:[]}}}}),uQ=N(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uH(),r=uJ(),a=uB(),i=uK(),n=uG(),o=uW(),s=uX(),l=uY(),c=["/properties"];e.default=function(e){return[t,r,a,i,n,u(this,o),s,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),u0=N((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=cH(),a=uF(),i=ub(),n=uQ(),o="https://json-schema.org/draft/2020-12/schema";var s=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(n.default.call(this,e),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=cA();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=cS();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=cz();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}})}),u1=N(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(i,n),time:t(s(!0),l),"date-time":t(d(!0),p),"iso-time":t(s(),c),"iso-date-time":t(d(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.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$/,n),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,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},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let i=r.exec(e);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:a[o])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function s(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],n=+r[3],s=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!s)return!1;if(a<=23&&i<=59&&n<60)return!0;let d=i-u*l,p=a-c*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&n<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function c(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=s(e);return function(e){let r=e.split(u);return 2===r.length&&i(r[0])&&t(r[1])}}function p(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(u),[i,o]=t.split(u),s=n(r,i);if(void 0!==s)return s||l(a,o)}let h=/\/|:/,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/}),u2=N(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=u$(),r=cS(),a=r.operators,i={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let a,n,{gen:o,data:s,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:p}=u;if(!d.validateFormats)return;let m=new t.KeywordCxt(u,p.RULES.all.format.definition,"format");function h(e){return(0,r._)`${e}.compare(${s}, ${l}) ${i[c].fail} 0`}m.$data?(a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),n=o.const("fmt",(0,r._)`${a}[${m.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${n} != "object"`,(0,r._)`${n} instanceof RegExp`,(0,r._)`typeof ${n}.compare != "function"`,h(n)))):function(){let t=m.schema,a=p.formats[t];if(!a||!0===a)return;if("object"!=typeof a||a instanceof RegExp||"function"!=typeof a.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let i=o.scopeValue("formats",{key:t,ref:a,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(h(i))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),u9=N((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=u1(),a=u2(),i=cS(),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,n),e;let[i,s]="fast"===t.mode?[r.fastFormats,o]:[r.fullFormats,n];return l(e,t.formats||r.formatNames,i,s),t.keywords&&(0,a.default)(e),e};function l(e,t,r,a){var n;for(let o of(null!=(n=e.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(o,r[o])}s.get=(e,t="full")=>{let a=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!a)throw Error(`Unknown format "${e}"`);return a},t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),u4=u$(),u3=uU(),u6=u0();let u5=q(u9(),1).default;function u8(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return u5(t),t}var u7=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=u8(u6.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(A.has(r))return"2020-12";if(z.has(r))return"2019-09";if(M.has(r)||L.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??=u8(u3.Ajv2019):this._ajvDraft7??=u8(u4.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)}}};u4.Ajv,require("node:process");let de=Symbol.for("mcp.completable");function dt(e){return!!e&&"object"==typeof e&&de in e}let dr=0x80000000-1;function da(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,dr));return r.unref?.(),r}var di=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function dn(e,t,r){return Response.json({jsonrpc:"2.0",error:{code:t,message:r},id:e},{status:200})}function ds(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[iC]:t}}}}function dl(e,t,r){if(null===r||"object"!=typeof r||"string"!=typeof r.method)throw new s3(s4.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let a=function(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(void 0!==t&&(void 0!==t.tools||void 0!==t.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(r);if(void 0===a)throw new s3(s4.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:a}}function dc(e,t){if("tools/call"===e)return{content:[{type:"text",text:t}],isError:!0};throw new s3(s4.InternalError,t)}var du=class{constructor(e){this._host=e}async fulfill(e,t,r,a,i){let{maxRounds:n,roundTimeoutMs:o}=this._host,s=a.mcpReq.signal,l=i,c=0;for(;;){let i;if((c+=1)>n)return dc(e,`Multi-round-trip request '${e}' still required input after ${n} rounds (inputRequired.maxRounds)`);let u=l.inputRequests,d=null!=u&&Object.keys(u).length>0,p="string"==typeof l.requestState?l.requestState:void 0;if(!d&&void 0===p)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(d){let t=this._host.resolvedClientCapabilities(a),r=[];for(let[a,i]of Object.entries(u)){let{embedded:n,required:o}=dl(e,a,i);if("roots/list"!==n.method&&void 0===n.params)throw new s3(s4.InternalError,`Handler for ${e} returned an input request '${a}' of kind '${n.method}' without params`);if(void 0!==sE(o,t))return dc(e,`Cannot request input '${a}' (${n.method}): the client on this 2025-era connection did not declare the required capability${void 0===t?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);r.push([a,n])}let n=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 e={relatedRequestId:a.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:n.signal},t=await Promise.all(r.map(async([t,r])=>{try{return[t,await this._dispatchLeg(r,e)]}catch(e){throw n.abort(e),e}}));i=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return dc(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{n.dispose()}}else await function(e,t){return new Promise((e,r)=>{if(t?.aborted)return void r(t.reason instanceof sk?t.reason:new sk(sR.RequestTimeout,String(t.reason)));let a=setTimeout(()=>{t?.removeEventListener("abort",i),e()},250),i=()=>{clearTimeout(a),r(t?.reason instanceof sk?t.reason:new sk(sR.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}(0,s);let m={...a,mcpReq:{...a.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(e){return()=>e}(p)}};if(void 0!==p){let t=await this._host.verifyRequestState(p,m,e);void 0!==t&&(m=cl(m,t))}let h=await t(r,m);if(!lj(h))return h;l=h}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return"url"===r.mode&&void 0===r.elicitationId&&(r={...r,elicitationId:function(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;let r=[...t].map(e=>e.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}};let dd=new Set(["tools/call","prompts/get","resources/read"]);var dp=class extends cc{_clientCapabilities;_clientVersion;static{l=(e,t)=>{void 0!==t.clientCapabilities&&(e._clientCapabilities=t.clientCapabilities),void 0!==t.clientInfo&&(e._clientVersion=t.clientInfo)},c=(e,t)=>{let r=t.filter(t=>!e._supportedProtocolVersions.includes(t));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},u=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new du({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new u7,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=function(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??8,roundTimeoutMs:e?.roundTimeoutMs??6e5,legacyShim:e?.legacyShim??!0}}(t?.inputRequired),t?.cacheHints!==void 0){for(const[e,r]of Object.entries(t.cacheHints))void 0!==r&&s9(r,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",e=>this._oninitialize(e)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),sC(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:a}=e.params,i=aa(os,a);return i.success&&this._loggingLevels.set(r,i.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,r,a)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=e.mcpReq.envelope?.[iO]))return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:t,data:r,logger:a}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(os.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)};registerCapabilities(e){if(this.transport)throw new sk(sR.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let i=r[e];r[e]=cu(i)&&cu(a)?{...i,...a}:a}return r}(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if("tools/call"!==e){let r=this._cacheHints?.[e],a=dd.has(e);return void 0!==r||a?async(i,n)=>{let o=a?await this._invokeInputRequiredCapableHandler(e,t,i,n):await t(i,n);if(lj(o)){if(!a)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return o}return void 0===r?o:s0(o,r)}:async(r,a)=>{let i=await t(r,a);if(lj(i))throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}}return async(e,r)=>{let a=lf(this._negotiatedProtocolVersion),i=a.validateRequest("tools/call",e);if(!i.ok)throw new s3("not-in-era"===i.reason?s4.InternalError:s4.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let n=await this._invokeInputRequiredCapableHandler("tools/call",t,e,r);if(lj(n))return n;let o=sN(n),s=a.validateResult("tools/call",o);if(!s.ok)throw new s3("not-in-era"===s.reason?s4.InternalError:s4.InvalidParams,"not-in-era"===s.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=sT}async _invokeInputRequiredCapableHandler(e,t,r,a){let i,n=this._servedModernEra(),o=a.mcpReq.requestState();if(void 0!==o&&"string"!=typeof o)throw new s3(s4.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let s=a;if("string"==typeof o){let t=await this._verifyRequestState(o,a,e);void 0!==t&&(s=cl(a,t))}try{i=await t(r,s)}catch(e){if(e instanceof s3&&e.code===s4.UrlElicitationRequired){if(!n)throw e;throw new s3(s4.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw e}if(!lj(i))return i;if(!n){if(!this._inputRequiredServing.legacyShim)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??ik}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,s,i)}let l=i.inputRequests,c=null!=l&&Object.keys(l).length>0,u="string"==typeof i.requestState;if(!c&&!u)throw new s3(s4.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(c){let t=this._inputRequestCapabilityView(a);for(let[r,a]of Object.entries(l)){let{embedded:i,required:n}=dl(e,r,a),o=sE(n,t);if(void 0!==o)throw new s7({requiredCapabilities:o},`Cannot request input '${r}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(e,t,r){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${e instanceof Error?e.message:String(e)}`)),new s3(s4.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[ij]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new sk(sR.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new sk(sR.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new sk(sR.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new sk(sR.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new sk(sR.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new sk(sR.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new sk(sR.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new sk(sR.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new sk(sR.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new sk(sR.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new sk(sR.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=this._supportedProtocolVersions.filter(e=>!(e>=sT)),a=r.includes(t)?t:r[0]??ik;return this._negotiatedProtocolVersion=a,this.transport?.setProtocolVersion?.(a),{protocolVersion:a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:sC(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new sk(sR.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages.at(-1),r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages.at(-2):void 0,n=i?Array.isArray(i.content)?i.content:[i.content]:[],o=n.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw new s3(s4.InvalidParams,"The last message must contain only tool_result content if any is present");if(!o)throw new s3(s4.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(o){let e=new Set(n.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new s3(s4.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),a=await this.request({method:"sampling/createMessage",params:e},t),i=this._wireCodec().samplingResultVariant(r,a);if(!i.ok)throw new sk(sR.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new sk(sR.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let a=e.mode??"form",i=r?.validateAcceptedContent??!0;switch(a){case"url":return this.request({method:"elicitation/create",params:e},t);case"form":{let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},t);if(i&&"accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new s3(s4.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof s3)throw e;throw new s3(s4.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new sk(sR.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},dm=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(void 0!==t&&t.enabled){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(void 0===t.inputSchema)return dy;try{let r=l0(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new dp(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?l0(t.inputSchema,"input"):dy,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=l0(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new s3(s4.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Tool ${e.params.name} disabled`);try{let a=await this.validateToolInput(r,e.params.arguments,e.params.name),i=await this.executeToolHandler(r,a,t);if(await this.validateToolOutput(r,i,e.params.name),lj(i))return i;return this.server.projectCallToolResult(i,r.outputSchemaJson)}catch(e){if(e instanceof s3&&e.code===s4.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=await l1(e.inputSchema,t??{});if(!a.success)throw new s3(s4.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a.error}`);return a.data}async validateToolOutput(e,t,r){if(!e.outputSchema||lj(t)||t.isError)return;if(void 0===t.structuredContent)throw new s3(s4.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=await l1(e.outputSchema,t.structuredContent);if(!a.success)throw new s3(s4.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new s3(s4.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new s3(s4.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return db;let a=d$(dS(r.argsSchema)?.[e.params.argument.name]);if(!dt(a))return db;let i=a[de]?.complete;return i?d_(await i(e.params.argument.value,e.params.context)):db}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return db;throw new s3(s4.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?d_(await a(e.params.argument.value,e.params.context)):db}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new s3(s4.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new s3(s4.InvalidParams,`Resource ${r} disabled`);return s0(await a.readCallback(r,t),a.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return s0(await e.readCallback(r,a,t),e.cacheHint)}throw new s6(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{let r,a,i;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(a=(r=l0(t.argsSchema,"input")).properties||{},i=r.required||[],Object.entries(a).map(([e,t])=>({name:e,description:t?.description,required:i.includes(e)}))):void 0,icons:t.icons,_meta:t._meta}})})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new s3(s4.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new s3(s4.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,a){let i=r.cacheHint,n=r;if(void 0!==i){s9(i,`resource ${e}`);let t={...r};delete t.cacheHint,n=t}if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,a,i){let n={name:e,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=n)),void 0!==e.name&&(n.name=e.name),void 0!==e.title&&(n.title=e.title),void 0!==e.metadata&&(n.metadata=e.metadata),void 0!==e.callback&&(n.readCallback=e.callback),void 0!==e.enabled&&(n.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=n,n}_createRegisteredResourceTemplate(e,t,r,a,i){let n={resourceTemplate:r,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=n)),void 0!==t.title&&(n.title=t.title),void 0!==t.template&&(n.resourceTemplate=t.template),void 0!==t.metadata&&(n.metadata=t.metadata),void 0!==t.callback&&(n.readCallback=t.callback),void 0!==t.enabled&&(n.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=n;let o=r.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),n}_createRegisteredPrompt(e,t,r,a,i,n,o){let s=a,l=i,c={title:t,description:r,argsSchema:a,icons:n,_meta:o,handler:dv(e,a,i),enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=c)),void 0!==t.title&&(c.title=t.title),void 0!==t.description&&(c.description=t.description),void 0!==t.icons&&(c.icons=t.icons),void 0!==t._meta&&(c._meta=t._meta);let r=!1;void 0!==t.argsSchema&&(c.argsSchema=t.argsSchema,s=t.argsSchema,r=!0),void 0!==t.callback&&(l=t.callback,r=!0),r&&(c.handler=dv(e,s,l)),void 0!==t.enabled&&(c.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=c,a){let e=dS(a);e&&Object.values(e).some(e=>dt(d$(e)))&&this.setCompletionRequestHandler()}return c}_createRegisteredTool(e,t,r,a,i,n,o,s,l,c){if(cy(e),void 0!==a)try{let t=l0(a,"input");this._toolInputSchemaJson[e]=t;let r=lN(t);r.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${r.reason}`)}catch{}let u=c,d={title:t,description:r,inputSchema:a,outputSchema:i,outputSchemaJson:dg(i),annotations:n,icons:o,execution:s,_meta:l,handler:c,executor:df(a,c),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&cy(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=d,e=t.name)),void 0!==t.title&&(d.title=t.title),void 0!==t.description&&(d.description=t.description);let r=!1;void 0!==t.paramsSchema&&(d.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],r=!0),void 0!==t.callback&&(d.handler=t.callback,u=t.callback,r=!0),r&&(d.executor=df(d.inputSchema,u)),void 0!==t.outputSchema&&(d.outputSchema=t.outputSchema,d.outputSchemaJson=dg(t.outputSchema)),void 0!==t.annotations&&(d.annotations=t.annotations),void 0!==t.icons&&(d.icons=t.icons),void 0!==t._meta&&(d._meta=t._meta),void 0!==t.enabled&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:i,inputSchema:n,outputSchema:o,annotations:s,icons:l,_meta:c}=t;return this._createRegisteredTool(e,a,i,cv(n),cv(o),s,l,void 0,c,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:i,argsSchema:n,icons:o,_meta:s}=t,l=this._createRegisteredPrompt(e,a,i,cv(n),r,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},dh=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new cg(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function df(e,t){return e?async(e,r)=>t(e,r):async(e,r)=>t(r)}let dy={type:"object",properties:{}};function dg(e){if(void 0!==e)try{return l0(e,"output")}catch{return}}function dv(e,t,r){return t?async(a,i)=>{let n=await l1(t,a);if(!n.success)throw new s3(s4.InvalidParams,`Invalid arguments for prompt ${e}: ${n.error}`);return r(n.data,i)}:async(e,t)=>r(t)}function d_(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}let db={completion:{values:[],hasMore:!1}};function dS(e){if(e.shape&&"object"==typeof e.shape)return e.shape}function d$(e){return e?.type!=="optional"?e:e.def?.innerType??e}var dw=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(e){this._classification=e.classification,this._responseMode=e.responseMode??"auto",this._keepAliveMs=e.keepAliveMs??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(e,t){if(this._used)throw Error("PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request");if(!this._started||void 0===this.onmessage)throw Error("PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message");if(this._closed)throw Error("PerRequestHTTPServerTransport is closed");this._used=!0;let r=t?.request?.signal;if(r?.aborted)throw await this.close(),new sk(sR.ConnectionClosed,"The request was aborted before it could be handled");let a={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(lx(e)){let t,i;this._requestId=e.id;let n=new Promise((e,r)=>{t=e,i=r});if(this._deferredResponse={promise:n,resolve:t,reject:i,settled:!1},void 0!==r){let e=()=>void this.close();r.addEventListener("abort",e,{once:!0}),this._abortCleanup=()=>r.removeEventListener("abort",e)}this._dispatchWindowOpen=!0;try{this.onmessage(e,a)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),n}return this.onmessage(e,a),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let r=lE(e)||lT(e),a=r?e.id:t?.relatedRequestId;if(void 0===this._requestId||void 0===a||a!==this._requestId){r&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(r){if(this._terminalDelivered)return;this._terminalDelivered=!0;let t=lT(e)?e.error.code:void 0,r=void 0!==t&&(this._dispatchWindowOpen||t===s4.MissingRequiredClientCapability)?lU[t]:void 0;if(void 0!==r&&void 0===this._sse){this.settleResponse(Response.json(e,{status:r,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}if(void 0!==this._sse||"sse"===this._responseMode){void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(e),this.finalizeStream();return}this.settleResponse(Response.json(e,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||void 0===this._sse||this._sse.closed)return;let t=e.split("\n").map(e=>`: ${e}`).join("\n");this.writeFrame(`${t}
|
|
69
69
|
|
|
70
|
-
`)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.reject(new sk(sR.ConnectionClosed,"Connection closed before a response was produced"))),this.onclose?.()}}settleResponse(e){void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(e))}upgradeToSse(){let e,t=new ReadableStream({start:t=>{e=t},cancel:()=>{this.close()}});this._sse={controller:e,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=
|
|
70
|
+
`)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.reject(new sk(sR.ConnectionClosed,"Connection closed before a response was produced"))),this.onclose?.()}}settleResponse(e){void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(e))}upgradeToSse(){let e,t=new ReadableStream({start:t=>{e=t},cancel:()=>{this.close()}});this._sse={controller:e,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=da(this._keepAliveMs,()=>this.writeCommentFrame("keepalive")),this.settleResponse(new Response(t,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}}))}finalizeStream(){if(this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),void 0!==this._sse&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}queueMicrotask(()=>void this.close())}writeMessageFrame(e){this.writeFrame(`event: message
|
|
71
71
|
data: ${JSON.stringify(e)}
|
|
72
72
|
|
|
73
|
-
`)}writeFrame(e){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(e){this.onerror?.(Error(`Failed to write to the response stream: ${e}`))}}};async function
|
|
73
|
+
`)}writeFrame(e){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(e){this.onerror?.(Error(`Failed to write to the response stream: ${e}`))}}};async function dR(e,t,r){let a=new dw({classification:r.classification,...void 0!==r.responseMode&&{responseMode:r.responseMode},...void 0!==r.keepAliveMs&&{keepAliveMs:r.keepAliveMs}});return await e.connect(a),a.handleMessage(t,{...void 0!==r.request&&{request:r.request},...void 0!==r.authInfo&&{authInfo:r.authInfo}})}var dk=class{sessionIdGenerator;_started=!1;_closed=!1;_streamMapping=new Map;_requestToStreamMapping=new Map;_requestResponseMap=new Map;_initialized=!1;_enableJsonResponse=!1;_standaloneSseStreamId="_GET_stream";_eventStore;_onsessioninitialized;_onsessionclosed;_allowedHosts;_allowedOrigins;_enableDnsRebindingProtection;_retryInterval;_supportedProtocolVersions;_keepAliveMs;sessionId;onclose;onerror;onmessage;constructor(e={}){this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval,this._supportedProtocolVersions=e.supportedProtocolVersions??ix,this._keepAliveMs=e.keepAliveMs??15e3}startKeepAlive(e,t){if(this._closed)return;let r=da(this._keepAliveMs,()=>{try{e.enqueue(t.encode(": keepalive\n\n"))}catch{void 0!==r&&clearInterval(r)}});return r}async start(){if(this._started)throw Error("Transport already started");this._started=!0}setSupportedProtocolVersions(e){this._supportedProtocolVersions=e}createJsonErrorResponse(e,t,r,a){let i={code:t,message:r};return a?.data!==void 0&&(i.data=a.data),Response.json({jsonrpc:"2.0",error:i,id:null},{status:e,headers:{"Content-Type":"application/json",...a?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.get("host");if(!t||!this._allowedHosts.includes(t)){let e=`Invalid Host header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.get("origin");if(t&&!this._allowedOrigins.includes(t)){let e=`Invalid Origin header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}}}async handleRequest(e,t){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let r=this.validateRequestHeaders(e);if(r)return r;switch(e.method){case"POST":return this.handlePostRequest(e,t);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}supportsEmptySSEData(e){return this._supportedProtocolVersions.includes(e)&&e>="2025-11-25"}async writePrimingEvent(e,t,r,a){if(!this._eventStore||!this.supportsEmptySSEData(a))return;let i=await this._eventStore.storeEvent(r,{}),n=`id: ${i}
|
|
74
74
|
data:
|
|
75
75
|
|
|
76
76
|
`;void 0!==this._retryInterval&&(n=`id: ${i}
|
|
@@ -81,17 +81,17 @@ data:
|
|
|
81
81
|
`;return a&&(i+=`id: ${a}
|
|
82
82
|
`),i+=`data: ${JSON.stringify(r)}
|
|
83
83
|
|
|
84
|
-
`,e.enqueue(t.encode(i)),!0}catch(e){return this.onerror?.(e),!1}}handleUnsupportedRequest(){return this.onerror?.(Error("Method not allowed.")),Response.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,t){try{let r,a,i,n,o=e.headers.get("accept");if(!o?.includes("application/json")||!o.includes("text/event-stream"))return this.onerror?.(Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");if(!cm(e.headers.get("content-type")))return this.onerror?.(Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");if(t?.parsedBody===void 0)try{r=await e.json()}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else r=t.parsedBody;try{a=Array.isArray(r)?r.map(e=>iQ.parse(e)):[iQ.parse(r)]}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let s=a.some(e=>ni.safeParse(e).success);if(s){if(this._initialized&&void 0!==this.sessionId)return this.onerror?.(Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.onerror?.(Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!s){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!a.some(e=>lx(e))){for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e});return new Response(null,{status:202})}let l=crypto.randomUUID(),c=a.find(e=>ni.safeParse(e).success),u=c?c.params.protocolVersion:e.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(r=>{for(let e of(this._streamMapping.set(l,{resolveJson:r,cleanup:()=>{this._streamMapping.delete(l)}}),a))lx(e)&&this._requestToStreamMapping.set(e.id,l);for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e})});let d=new TextEncoder,p=new ReadableStream({start:e=>{i=e},cancel:()=>{void 0!==n&&clearInterval(n),this._streamMapping.get(l)?.controller===i&&this._streamMapping.delete(l)}}),m={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let e of(void 0!==this.sessionId&&(m["mcp-session-id"]=this.sessionId),a))lx(e)&&(this._streamMapping.set(l,{controller:i,encoder:d,cleanup:()=>{void 0!==n&&clearInterval(n),this._streamMapping.delete(l);try{i.close()}catch{}}}),this._requestToStreamMapping.set(e.id,l));for(let r of(await this.writePrimingEvent(i,d,l,u),a)){let a,i;lx(r)&&this._eventStore&&this.supportsEmptySSEData(u)&&(a=()=>{this.closeSSEStream(r.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(r,{authInfo:t?.authInfo,request:e,closeSSEStream:a,closeStandaloneSSEStream:i})}return this._streamMapping.get(l)?.controller===i&&(n=this.startKeepAlive(i,d)),new Response(p,{status:200,headers:m})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(e)})}}async handleDeleteRequest(e){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(e){if(void 0===this.sessionIdGenerator)return;if(!this._initialized)return this.onerror?.(Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let t=e.headers.get("mcp-session-id");return t?t!==this.sessionId?(this.onerror?.(Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")):void 0:(this.onerror?.(Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required"))}validateProtocolVersion(e){let t=e.headers.get("mcp-protocol-version");if(null!==t&&!this._supportedProtocolVersions.includes(t)){let e=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(400,-32e3,e)}}async close(){if(!this._closed){for(let{cleanup:e}of(this._closed=!0,this._streamMapping.values()))e();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(e){let t=this._requestToStreamMapping.get(e);if(!t)return;let r=this._streamMapping.get(t);r&&r.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let r=t?.relatedRequestId;if((lE(e)||lT(e))&&(r=e.id),void 0===r){let t;if(lE(e)||lT(e))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(t=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let r=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===r)return;r.controller&&r.encoder&&(void 0===t||!r.replayedEventIds?.has(t))&&this.writeSSEEvent(r.controller,r.encoder,e,t);return}let a=this._requestToStreamMapping.get(r);if(!a)throw Error(`No connection established for request ID: ${String(r)}`);let i=this._streamMapping.get(a);if(!this._enableJsonResponse){let t;this._eventStore&&(t=await this._eventStore.storeEvent(a,e),i=this._streamMapping.get(a)),i?.controller&&i?.encoder&&(void 0===t||!i.replayedEventIds?.has(t))&&this.writeSSEEvent(i.controller,i.encoder,e,t)}if(lE(e)||lT(e)){this._requestResponseMap.set(r,e);let t=[...this._requestToStreamMapping.entries()].filter(([e,t])=>t===a).map(([e])=>e);if(t.every(e=>this._requestResponseMap.has(e))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(r)}`);if(!this._eventStore){for(let e of(this.onerror?.(Error(`Response for request ID ${String(r)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),t))this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}if(this._enableJsonResponse&&i.resolveJson){let e={"Content-Type":"application/json"};void 0!==this.sessionId&&(e["mcp-session-id"]=this.sessionId);let r=t.map(e=>this._requestResponseMap.get(e));1===r.length?i.resolveJson(Response.json(r[0],{status:200,headers:e})):i.resolveJson(Response.json(r,{status:200,headers:e})),i.cleanup()}else i.cleanup();for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e)}}}};function dk(e){if(null===e||"object"!=typeof e||Array.isArray(e))return null;let{method:t,id:r}=e;return"string"!=typeof t?null:"string"==typeof r||"number"==typeof r?r:null}function dx(e,t,r,a,i=null){return Response.json({jsonrpc:"2.0",error:{code:t,message:r,...void 0!==a&&{data:a}},id:i},{status:e})}function dP(e,t=null){return dx(e.httpStatus,e.code,e.message,e.data,t)}function dE(e){return e instanceof Error?e:Error(String(e))}function dT(e=null){return dx(500,-32603,"Internal server error",void 0,e)}async function dj(e,t,r=!0){let a,i=e.method.toUpperCase(),n=t,o=e,s=!1;if("POST"===i){if(void 0===n){let t;r&&(o=e.clone());try{t=await e.text()}catch{return{step:"unreadable-body"}}try{a=0===t.length?void 0:JSON.parse(t)}catch{s=!0}s||void 0===a||(n=a)}else a=n;if(s||void 0===a)return{step:"no-json-body",forwardRequest:o}}return{step:"classified",outcome:function(e){if("POST"!==(e={...e,...void 0!==e.protocolVersionHeader&&{protocolVersionHeader:lB(e.protocolVersionHeader)},...void 0!==e.mcpMethodHeader&&{mcpMethodHeader:lB(e.mcpMethodHeader)},...void 0!==e.mcpNameHeader&&{mcpNameHeader:lB(e.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let t=e.body;if(Array.isArray(t)){if(0===t.length)return lF("jsonrpc-shape","empty-batch",400,new s3(s4.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let e of t){if(l$(lK(e)?e.params:void 0))return lF("jsonrpc-shape","batch-with-modern-element",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(lx(e)||lP(e)||lE(e)||lT(e)))return lF("jsonrpc-shape","batch-with-invalid-element",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return lE(t)||lT(t)?{kind:"legacy",reason:"response"}:lK(t)&&lx(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=sT;if("initialize"===a&&!function(e){if(!l$(e))return!1;let t=lw(e);if(void 0===t||!(t>=sT))return!1;let r=lS(e);return void 0!==r&&0===lR(r).length}(r)){if(n)return lH("initialize-with-modern-header",i,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let e=lK(r)&&"string"==typeof r.protocolVersion?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==e&&{requestedVersion:e}}}if(l$(r)){let n=lS(r),o=(void 0===n?[]:lR(n))[0];if(void 0!==o)return lF("envelope","envelope-invalid",400,new s3(s4.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${o.key}: ${o.problem}`,{envelope:o}),!0);let s=lw(r);return void 0!==i&&void 0!==s&&i!==s?lH("header-body-version-mismatch",i,`the body envelope names protocol version ${s} but the MCP-Protocol-Version header names ${i}`):void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("method-header-mismatch",e.mcpMethodHeader,`the body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:t,classification:lG(s)}}if(n){let e=lS(r),t=lR(e??{}).filter(e=>"missing"===e.problem).map(e=>e.key),a=void 0===e?["_meta"]:t.length>0?t:[iP];return lF("envelope","modern-header-without-claim",400,new s3(s4.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${a.join(", ")}`,{envelope:{missing:a}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==i&&{requestedVersion:i}}}(e,t):lK(t)&&lP(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=sT;if(l$(r)){let n=lw(r);if(void 0===n){let e=lS(r),t=(void 0===e?[]:lR(e)).find(e=>e.key===iP)??{key:iP,problem:"expected a protocol version string"};return lF("envelope","notification-envelope-invalid",400,new s3(s4.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${t.key}: ${t.problem}`,{envelope:t}),!0)}if(void 0!==i&&i!==n)return lH("notification-header-body-version-mismatch",i,`the notification envelope names protocol version ${n} but the MCP-Protocol-Version header names ${i}`);let o=lG(n);return"modern"===o.era&&void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:o}}return n?void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:{era:"modern",revision:i}}:{kind:"legacy",reason:"notification",...void 0!==i&&{requestedVersion:i}}}(e,t):lF("jsonrpc-shape","invalid-json-rpc-body",400,new s3(s4.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:i,protocolVersionHeader:e.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:e.headers.get("mcp-method")??void 0,mcpNameHeader:e.headers.get("mcp-name")??void 0,...void 0!==a&&{body:a}}),body:a,parsedBody:n,forwardRequest:o}}require("http"),require("http2");let dC=require("stream");var dO=r(6982),dI=global.Request,dN=class extends dI{constructor(e,t){"object"==typeof e&&dA in e&&(e=e[dA]()),void 0!==t?.body?.getReader&&(t.duplex??="half"),super(e,t)}},dq=Symbol("wrapBodyStream"),dA=Symbol("getRequestCache"),dz=Symbol("requestCache"),dM=Symbol("incomingKey"),dL=Symbol("urlKey"),dZ=Symbol("headersKey"),dV=Symbol("abortControllerKey"),dD=Symbol("getAbortController"),dU={get method(){return this[dM].method||"GET"},get url(){return this[dL]},get headers(){return this[dZ]||=(e=>{let t=[],r=e.rawHeaders;for(let e=0;e<r.length;e+=2){let{[e]:a,[e+1]:i}=r;58!==a.charCodeAt(0)&&t.push([a,i])}return new Headers(t)})(this[dM])},[dD](){return this[dA](),this[dV]},[dA](){return this[dV]||=new AbortController,this[dz]||=((e,t,r,a,i)=>{let n={method:e,headers:r,signal:i.signal};if("TRACE"===e){n.method="GET";let e=new dN(t,n);return Object.defineProperty(e,"method",{get:()=>"TRACE"}),e}if("GET"!==e&&"HEAD"!==e)if("rawBody"in a&&a.rawBody instanceof Buffer)n.body=new ReadableStream({start(e){e.enqueue(a.rawBody),e.close()}});else if(a[dq]){let e;n.body=new ReadableStream({async pull(t){try{e||=dC.Readable.toWeb(a).getReader();let{done:r,value:i}=await e.read();r?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else n.body=dC.Readable.toWeb(a);return new dN(t,n)})(this.method,this[dL],this.headers,this[dM],this[dV])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(dU,e,{get(){return this[dA]()[e]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(dU,e,{value:function(){return this[dA]()[e]()}})}),Object.defineProperty(dU,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){let a={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[dz]};return`Request (lightweight) ${r(a,{...t,depth:null==e?null:e-1})}`}}),Object.setPrototypeOf(dU,dN.prototype);var dF=Symbol("responseCache"),dH=Symbol("getResponseCache"),dJ=Symbol("cache"),dB=global.Response,dK=class e{#e;#t;[dH](){return delete this[dJ],this[dF]||=new dB(this.#e,this.#t)}constructor(t,r){let a;if(this.#e=t,r instanceof e){const e=r[dF];if(e){this.#t=e,this[dH]();return}this.#t=r.#t,a=new Headers(r.#t.headers)}else this.#t=r;("string"==typeof t||void 0!==t?.getReader||t instanceof Blob||t instanceof Uint8Array)&&(this[dJ]=[r?.status||200,t,a||r?.headers])}get headers(){let e=this[dJ];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[dH]().headers}get status(){return this[dJ]?.[0]??this[dH]().status}get ok(){let e=this.status;return e>=200&&e<300}};function dG(e){return Array.isArray(e)?e[0]:e}async function dW(e,t,r){let a,i=(e.method??"GET").toUpperCase(),n=`http://${dG(e.headers.host)??dG(e.headers[":authority"])??"localhost"}${e.url??"/"}`,o=new Headers;for(let[t,r]of Object.entries(e.headers))if(!(void 0===r||t.startsWith(":")))if(Array.isArray(r))for(let e of r)o.append(t,e);else o.set(t,r);if("GET"!==i&&"HEAD"!==i)if(void 0===t){let t=new TextDecoder,r="";for await(let a of e)r+="string"==typeof a?a:t.decode(a,{stream:!0});(r+=t.decode()).length>0&&(a=r)}else{let e=JSON.stringify(t);o.delete("content-encoding"),o.delete("transfer-encoding"),void 0===e?o.delete("content-length"):(a=e,o.set("content-length",String(new TextEncoder().encode(e).byteLength)))}return new Request(n,{method:i,headers:o,...r?.signal!==void 0&&{signal:r.signal},...void 0!==a&&{body:a}})}["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(dK.prototype,e,{get(){return this[dH]()[e]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(dK.prototype,e,{value:function(){return this[dH]()[e]()}})}),Object.defineProperty(dK.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){let a={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[dF]};return`Response (lightweight) ${r(a,{...t,depth:null==e?null:e-1})}`}}),Object.setPrototypeOf(dK,dB),Object.setPrototypeOf(dK.prototype,dB.prototype),void 0===global.crypto&&(global.crypto=dO),Symbol("outgoingEnded"),Symbol("incomingDraining");let dX=Symbol("Let zodToJsonSchema decide on which parser to use"),dY={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};(y=R||(R={})).assertEqual=e=>{},y.assertIs=function(e){},y.assertNever=function(e){throw Error()},y.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},y.getValidEnumValues=e=>{let t=y.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return y.objectValues(r)},y.objectValues=e=>y.objectKeys(e).map(function(t){return e[t]}),y.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},y.find=(e,t)=>{for(let r of e)if(t(r))return r},y.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,y.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},y.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(k||(k={})).mergeShapes=(e,t)=>({...e,...t});let dQ=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d0=e=>{switch(typeof e){case"undefined":return dQ.undefined;case"string":return dQ.string;case"number":return Number.isNaN(e)?dQ.nan:dQ.number;case"boolean":return dQ.boolean;case"function":return dQ.function;case"bigint":return dQ.bigint;case"symbol":return dQ.symbol;case"object":if(Array.isArray(e))return dQ.array;if(null===e)return dQ.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return dQ.promise;if("undefined"!=typeof Map&&e instanceof Map)return dQ.map;if("undefined"!=typeof Set&&e instanceof Set)return dQ.set;if("undefined"!=typeof Date&&e instanceof Date)return dQ.date;return dQ.object;default:return dQ.unknown}},d1=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class d2 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a];a===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof d2))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}d2.create=e=>new d2(e);let d9=(e,t)=>{let r;switch(e.code){case d1.invalid_type:r=e.received===dQ.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case d1.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,R.jsonStringifyReplacer)}`;break;case d1.unrecognized_keys:r=`Unrecognized key(s) in object: ${R.joinValues(e.keys,", ")}`;break;case d1.invalid_union:r="Invalid input";break;case d1.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${R.joinValues(e.options)}`;break;case d1.invalid_enum_value:r=`Invalid enum value. Expected ${R.joinValues(e.options)}, received '${e.received}'`;break;case d1.invalid_arguments:r="Invalid function arguments";break;case d1.invalid_return_type:r="Invalid function return type";break;case d1.invalid_date:r="Invalid date";break;case d1.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:R.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case d1.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case d1.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case d1.custom:r="Invalid input";break;case d1.invalid_intersection_types:r="Intersection results could not be merged";break;case d1.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case d1.not_finite:r="Number must be finite";break;default:r=t.defaultError,R.assertNever(e)}return{message:r}};(g=x||(x={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},g.toString=e=>"string"==typeof e?e:e?.message;let d4=e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],o={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let s="";for(let e of a.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:n,message:s}};function d3(e,t){let r=d4({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d9,void 0].filter(e=>!!e)});e.common.issues.push(r)}class d6{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return d5;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return d6.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return d5;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let d5=Object.freeze({status:"aborted"}),d8=e=>({status:"dirty",value:e}),d7=e=>({status:"valid",value:e}),pe=e=>"undefined"!=typeof Promise&&e instanceof Promise;class pt{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let pr=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new d2(e.common.issues);return this._error=t,this._error}}};function pa(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:n}=e;return"invalid_enum_value"===t.code?{message:n??i.defaultError}:void 0===i.data?{message:n??a??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:n??r??i.defaultError}},description:i}}class pi{get description(){return this._def.description}_getType(e){return d0(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d6,ctx:{common:e.parent.common,data:e.data,parsedType:d0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(pe(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d0(e)},a=this._parseSync({data:e,path:r.path,parent:r});return pr(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d0(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d0(e)},a=this._parse({data:e,path:r.path,parent:r});return pr(r,await (pe(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),n=()=>a.addIssue({code:d1.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new pX({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return pY.create(this,this._def)}nullable(){return pQ.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pN.create(this)}promise(){return pW.create(this,this._def)}or(e){return pA.create([this,e],this._def)}and(e){return pL.create(this,e,this._def)}transform(e){return new pX({...pa(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new p0({...pa(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:P.ZodDefault})}brand(){return new p9({typeName:P.ZodBranded,type:this,...pa(this._def)})}catch(e){return new p1({...pa(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:P.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return p4.create(this,e)}readonly(){return p3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let pn=/^c[^\s-]{8,}$/i,po=/^[0-9a-z]+$/,ps=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pc=/^[a-z0-9_-]{21}$/i,pu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pd=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pm=/^(?:(?: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])$/,ph=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,pf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,py=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pg=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,p_="((\\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])))",pb=RegExp(`^${p_}$`);function pS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class p$ extends pi{_parse(e){var t,r,a,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dQ.string){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.string,received:t.parsedType}),d5}let o=new d6;for(let s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(d3(n=this._getOrReturnCtx(e,n),{code:d1.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("max"===s.kind)e.data.length>s.value&&(d3(n=this._getOrReturnCtx(e,n),{code:d1.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("length"===s.kind){let t=e.data.length>s.value,r=e.data.length<s.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?d3(n,{code:d1.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&d3(n,{code:d1.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if("email"===s.kind)pp.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"email",code:d1.invalid_string,message:s.message}),o.dirty());else if("emoji"===s.kind)d||(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:d1.invalid_string,message:s.message}),o.dirty());else if("uuid"===s.kind)pl.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:d1.invalid_string,message:s.message}),o.dirty());else if("nanoid"===s.kind)pc.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:d1.invalid_string,message:s.message}),o.dirty());else if("cuid"===s.kind)pn.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:d1.invalid_string,message:s.message}),o.dirty());else if("cuid2"===s.kind)po.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:d1.invalid_string,message:s.message}),o.dirty());else if("ulid"===s.kind)ps.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:d1.invalid_string,message:s.message}),o.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{d3(n=this._getOrReturnCtx(e,n),{validation:"url",code:d1.invalid_string,message:s.message}),o.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"regex",code:d1.invalid_string,message:s.message}),o.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):"datetime"===s.kind?(function(e){let t=`${p_}T${pS(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(s).test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:"datetime",message:s.message}),o.dirty()):"date"===s.kind?pb.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:"date",message:s.message}),o.dirty()):"time"===s.kind?RegExp(`^${pS(s)}$`).test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{code:d1.invalid_string,validation:"time",message:s.message}),o.dirty()):"duration"===s.kind?pd.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"duration",code:d1.invalid_string,message:s.message}),o.dirty()):"ip"===s.kind?(t=e.data,!(("v4"===(r=s.version)||!r)&&pm.test(t)||("v6"===r||!r)&&pf.test(t))&&1&&(d3(n=this._getOrReturnCtx(e,n),{validation:"ip",code:d1.invalid_string,message:s.message}),o.dirty())):"jwt"===s.kind?!function(e,t){if(!pu.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,s.alg)&&(d3(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:d1.invalid_string,message:s.message}),o.dirty()):"cidr"===s.kind?(a=e.data,!(("v4"===(i=s.version)||!i)&&ph.test(a)||("v6"===i||!i)&&py.test(a))&&1&&(d3(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:d1.invalid_string,message:s.message}),o.dirty())):"base64"===s.kind?pg.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"base64",code:d1.invalid_string,message:s.message}),o.dirty()):"base64url"===s.kind?pv.test(e.data)||(d3(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:d1.invalid_string,message:s.message}),o.dirty()):R.assertNever(s);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:d1.invalid_string,...x.errToObj(r)})}_addCheck(e){return new p$({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...x.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...x.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...x.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new p$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new p$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new p$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}p$.create=e=>new p$({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...pa(e)});class pw extends pi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==dQ.number){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.number,received:t.parsedType}),d5}let r=new d6;for(let a of this._def.checks)"int"===a.kind?R.isInteger(e.data)||(d3(t=this._getOrReturnCtx(e,t),{code:d1.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,a.value)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(d3(t=this._getOrReturnCtx(e,t),{code:d1.not_finite,message:a.message}),r.dirty()):R.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,r,a){return new pw({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:x.toString(a)}]})}_addCheck(e){return new pw({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}pw.create=e=>new pw({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...pa(e)});class pR extends pi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==dQ.bigint)return this._getInvalidInput(e);let r=new d6;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):R.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.bigint,received:t.parsedType}),d5}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,r,a){return new pR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:x.toString(a)}]})}_addCheck(e){return new pR({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}pR.create=e=>new pR({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...pa(e)});class pk extends pi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dQ.boolean){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.boolean,received:t.parsedType}),d5}return d7(e.data)}}pk.create=e=>new pk({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...pa(e)});class px extends pi{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dQ.date){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.date,received:t.parsedType}),d5}if(Number.isNaN(e.data.getTime()))return d3(this._getOrReturnCtx(e),{code:d1.invalid_date}),d5;let r=new d6;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(d3(t=this._getOrReturnCtx(e,t),{code:d1.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):R.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new px({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}px.create=e=>new px({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...pa(e)});class pP extends pi{_parse(e){if(this._getType(e)!==dQ.symbol){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.symbol,received:t.parsedType}),d5}return d7(e.data)}}pP.create=e=>new pP({typeName:P.ZodSymbol,...pa(e)});class pE extends pi{_parse(e){if(this._getType(e)!==dQ.undefined){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.undefined,received:t.parsedType}),d5}return d7(e.data)}}pE.create=e=>new pE({typeName:P.ZodUndefined,...pa(e)});class pT extends pi{_parse(e){if(this._getType(e)!==dQ.null){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.null,received:t.parsedType}),d5}return d7(e.data)}}pT.create=e=>new pT({typeName:P.ZodNull,...pa(e)});class pj extends pi{constructor(){super(...arguments),this._any=!0}_parse(e){return d7(e.data)}}pj.create=e=>new pj({typeName:P.ZodAny,...pa(e)});class pC extends pi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return d7(e.data)}}pC.create=e=>new pC({typeName:P.ZodUnknown,...pa(e)});class pO extends pi{_parse(e){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.never,received:t.parsedType}),d5}}pO.create=e=>new pO({typeName:P.ZodNever,...pa(e)});class pI extends pi{_parse(e){if(this._getType(e)!==dQ.undefined){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.void,received:t.parsedType}),d5}return d7(e.data)}}pI.create=e=>new pI({typeName:P.ZodVoid,...pa(e)});class pN extends pi{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==dQ.array)return d3(t,{code:d1.invalid_type,expected:dQ.array,received:t.parsedType}),d5;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(d3(t,{code:e?d1.too_big:d1.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(d3(t,{code:d1.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(d3(t,{code:d1.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new pt(t,e,t.path,r)))).then(e=>d6.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new pt(t,e,t.path,r)));return d6.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new pN({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new pN({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new pN({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}pN.create=(e,t)=>new pN({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...pa(t)});class pq extends pi{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==dQ.object){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.object,received:t.parsedType}),d5}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof pO&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let o=[];for(let e of i){let t=a[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new pt(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof pO){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(d3(r,{code:d1.unrecognized_keys,keys:n}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of n){let a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new pt(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>d6.mergeObjectSync(t,e)):d6.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new pq({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:x.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new pq({...this._def,unknownKeys:"strip"})}passthrough(){return new pq({...this._def,unknownKeys:"passthrough"})}extend(e){return new pq({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new pq({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new pq({...this._def,catchall:e})}pick(e){let t={};for(let r of R.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new pq({...this._def,shape:()=>t})}omit(e){let t={};for(let r of R.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new pq({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof pq){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=pY.create(e(i))}return new pq({...t._def,shape:()=>r})}if(t instanceof pN)return new pN({...t._def,type:e(t.element)});if(t instanceof pY)return pY.create(e(t.unwrap()));if(t instanceof pQ)return pQ.create(e(t.unwrap()));if(t instanceof pZ)return pZ.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of R.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new pq({...this._def,shape:()=>t})}required(e){let t={};for(let r of R.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof pY;)e=e._def.innerType;t[r]=e}return new pq({...this._def,shape:()=>t})}keyof(){return pB(R.objectKeys(this.shape))}}pq.create=(e,t)=>new pq({shape:()=>e,unknownKeys:"strip",catchall:pO.create(),typeName:P.ZodObject,...pa(t)}),pq.strictCreate=(e,t)=>new pq({shape:()=>e,unknownKeys:"strict",catchall:pO.create(),typeName:P.ZodObject,...pa(t)}),pq.lazycreate=(e,t)=>new pq({shape:e,unknownKeys:"strip",catchall:pO.create(),typeName:P.ZodObject,...pa(t)});class pA extends pi{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new d2(e.ctx.common.issues));return d3(t,{code:d1.invalid_union,unionErrors:r}),d5});{let e,a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new d2(e));return d3(t,{code:d1.invalid_union,unionErrors:i}),d5}}get options(){return this._def.options}}pA.create=(e,t)=>new pA({options:e,typeName:P.ZodUnion,...pa(t)});let pz=e=>{if(e instanceof pH)return pz(e.schema);if(e instanceof pX)return pz(e.innerType());if(e instanceof pJ)return[e.value];if(e instanceof pK)return e.options;if(e instanceof pG)return R.objectValues(e.enum);else if(e instanceof p0)return pz(e._def.innerType);else if(e instanceof pE)return[void 0];else if(e instanceof pT)return[null];else if(e instanceof pY)return[void 0,...pz(e.unwrap())];else if(e instanceof pQ)return[null,...pz(e.unwrap())];else if(e instanceof p9)return pz(e.unwrap());else if(e instanceof p3)return pz(e.unwrap());else if(e instanceof p1)return pz(e._def.innerType);else return[]};class pM extends pi{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dQ.object)return d3(t,{code:d1.invalid_type,expected:dQ.object,received:t.parsedType}),d5;let r=this.discriminator,a=t.data[r],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(d3(t,{code:d1.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),d5)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=pz(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(a.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,r)}}return new pM({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...pa(r)})}}class pL extends pi{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return d5;let i=function e(t,r){let a=d0(t),i=d0(r);if(t===r)return{valid:!0,data:t};if(a===dQ.object&&i===dQ.object){let a=R.objectKeys(r),i=R.objectKeys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};n[a]=i.data}return{valid:!0,data:n}}if(a===dQ.array&&i===dQ.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}if(a===dQ.date&&i===dQ.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(d3(r,{code:d1.invalid_intersection_types}),d5)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}pL.create=(e,t,r)=>new pL({left:e,right:t,typeName:P.ZodIntersection,...pa(r)});class pZ extends pi{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dQ.array)return d3(r,{code:d1.invalid_type,expected:dQ.array,received:r.parsedType}),d5;if(r.data.length<this._def.items.length)return d3(r,{code:d1.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d5;!this._def.rest&&r.data.length>this._def.items.length&&(d3(r,{code:d1.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new pt(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>d6.mergeArray(t,e)):d6.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new pZ({...this._def,rest:e})}}pZ.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new pZ({items:e,typeName:P.ZodTuple,rest:null,...pa(t)})};class pV extends pi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dQ.object)return d3(r,{code:d1.invalid_type,expected:dQ.object,received:r.parsedType}),d5;let a=[],i=this._def.keyType,n=this._def.valueType;for(let e in r.data)a.push({key:i._parse(new pt(r,e,r.path,e)),value:n._parse(new pt(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?d6.mergeObjectAsync(t,a):d6.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new pV(t instanceof pi?{keyType:e,valueType:t,typeName:P.ZodRecord,...pa(r)}:{keyType:p$.create(),valueType:e,typeName:P.ZodRecord,...pa(t)})}}class pD extends pi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dQ.map)return d3(r,{code:d1.invalid_type,expected:dQ.map,received:r.parsedType}),d5;let a=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new pt(r,e,r.path,[n,"key"])),value:i._parse(new pt(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return d5;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return d5;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}pD.create=(e,t,r)=>new pD({valueType:t,keyType:e,typeName:P.ZodMap,...pa(r)});class pU extends pi{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dQ.set)return d3(r,{code:d1.invalid_type,expected:dQ.set,received:r.parsedType}),d5;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(d3(r,{code:d1.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(d3(r,{code:d1.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let a of e){if("aborted"===a.status)return d5;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new pt(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>n(e)):n(o)}min(e,t){return new pU({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new pU({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}pU.create=(e,t)=>new pU({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...pa(t)});class pF extends pi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dQ.function)return d3(t,{code:d1.invalid_type,expected:dQ.function,received:t.parsedType}),d5;function r(e,r){return d4({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d9,d9].filter(e=>!!e),issueData:{code:d1.invalid_arguments,argumentsError:r}})}function a(e,r){return d4({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d9,d9].filter(e=>!!e),issueData:{code:d1.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},n=t.data;if(this._def.returns instanceof pW){let e=this;return d7(async function(...t){let o=new d2([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(n,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(a(l,e)),o})})}{let e=this;return d7(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new d2([r(t,o.error)]);let s=Reflect.apply(n,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new d2([a(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pF({...this._def,args:pZ.create(e).rest(pC.create())})}returns(e){return new pF({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new pF({args:e||pZ.create([]).rest(pC.create()),returns:t||pC.create(),typeName:P.ZodFunction,...pa(r)})}}class pH extends pi{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pH.create=(e,t)=>new pH({getter:e,typeName:P.ZodLazy,...pa(t)});class pJ extends pi{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d3(t,{received:t.data,code:d1.invalid_literal,expected:this._def.value}),d5}return{status:"valid",value:e.data}}get value(){return this._def.value}}function pB(e,t){return new pK({values:e,typeName:P.ZodEnum,...pa(t)})}pJ.create=(e,t)=>new pJ({value:e,typeName:P.ZodLiteral,...pa(t)});class pK extends pi{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return d3(t,{expected:R.joinValues(r),received:t.parsedType,code:d1.invalid_type}),d5}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return d3(t,{received:t.data,code:d1.invalid_enum_value,options:r}),d5}return d7(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return pK.create(e,{...this._def,...t})}exclude(e,t=this._def){return pK.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}pK.create=pB;class pG extends pi{_parse(e){let t=R.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==dQ.string&&r.parsedType!==dQ.number){let e=R.objectValues(t);return d3(r,{expected:R.joinValues(e),received:r.parsedType,code:d1.invalid_type}),d5}if(this._cache||(this._cache=new Set(R.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=R.objectValues(t);return d3(r,{received:r.data,code:d1.invalid_enum_value,options:e}),d5}return d7(e.data)}get enum(){return this._def.values}}pG.create=(e,t)=>new pG({values:e,typeName:P.ZodNativeEnum,...pa(t)});class pW extends pi{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==dQ.promise&&!1===t.common.async?(d3(t,{code:d1.invalid_type,expected:dQ.promise,received:t.parsedType}),d5):d7((t.parsedType===dQ.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}pW.create=(e,t)=>new pW({type:e,typeName:P.ZodPromise,...pa(t)});class pX extends pi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{d3(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return d5;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?d5:"dirty"===a.status||"dirty"===t.value?d8(a.value):a});{if("aborted"===t.value)return d5;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?d5:"dirty"===a.status||"dirty"===t.value?d8(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?d5:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?d5:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?d5:Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return d5;let n=a.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}R.assertNever(a)}}pX.create=(e,t,r)=>new pX({schema:e,typeName:P.ZodEffects,effect:t,...pa(r)}),pX.createWithPreprocess=(e,t,r)=>new pX({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...pa(r)});class pY extends pi{_parse(e){return this._getType(e)===dQ.undefined?d7(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pY.create=(e,t)=>new pY({innerType:e,typeName:P.ZodOptional,...pa(t)});class pQ extends pi{_parse(e){return this._getType(e)===dQ.null?d7(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pQ.create=(e,t)=>new pQ({innerType:e,typeName:P.ZodNullable,...pa(t)});class p0 extends pi{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===dQ.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}p0.create=(e,t)=>new p0({innerType:e,typeName:P.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pa(t)});class p1 extends pi{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return pe(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d2(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new d2(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}p1.create=(e,t)=>new p1({innerType:e,typeName:P.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pa(t)});class p2 extends pi{_parse(e){if(this._getType(e)!==dQ.nan){let t=this._getOrReturnCtx(e);return d3(t,{code:d1.invalid_type,expected:dQ.nan,received:t.parsedType}),d5}return{status:"valid",value:e.data}}}p2.create=e=>new p2({typeName:P.ZodNaN,...pa(e)}),Symbol("zod_brand");class p9 extends pi{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class p4 extends pi{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?d5:"dirty"===e.status?(t.dirty(),d8(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?d5:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new p4({in:e,out:t,typeName:P.ZodPipeline})}}class p3 extends pi{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return pe(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}p3.create=(e,t)=>new p3({innerType:e,typeName:P.ZodReadonly,...pa(t)}),pq.lazycreate,(v=P||(P={})).ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly",p$.create,pw.create,p2.create,pR.create,pk.create,px.create,pP.create,pE.create,pT.create,pj.create,pC.create,pO.create,pI.create,pN.create,pq.create,pq.strictCreate,pA.create,pM.create,pL.create,pZ.create,pV.create,pD.create,pU.create,pF.create,pH.create,pJ.create,pK.create,pG.create,pW.create,pX.create,pY.create,pQ.create,pX.createWithPreprocess,p4.create;let p6=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function p5(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?p6(t,e.currentPath):t.join("/")}}function p8(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function p7(e,t,r,a,i){e[t]=r,p8(e,t,a,i)}function me(e,t){return mS(e.type._def,t)}let mt=/^[cC][^\s-]{8,}$/,mr=/^[0-9a-z]+$/,ma=/^[0-9A-HJKMNP-TV-Z]{26}$/,mi=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,mn=()=>(void 0===p&&(p=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),p),mo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ms=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ml=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mu=/^[a-zA-Z0-9_-]{21}$/,md=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function mp(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":p7(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":p7(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":mf(r,"email",a.message,t);break;case"format:idn-email":mf(r,"idn-email",a.message,t);break;case"pattern:zod":my(r,mi,a.message,t)}break;case"url":mf(r,"uri",a.message,t);break;case"uuid":mf(r,"uuid",a.message,t);break;case"regex":my(r,a.regex,a.message,t);break;case"cuid":my(r,mt,a.message,t);break;case"cuid2":my(r,mr,a.message,t);break;case"startsWith":my(r,RegExp(`^${mm(a.value,t)}`),a.message,t);break;case"endsWith":my(r,RegExp(`${mm(a.value,t)}$`),a.message,t);break;case"datetime":mf(r,"date-time",a.message,t);break;case"date":mf(r,"date",a.message,t);break;case"time":mf(r,"time",a.message,t);break;case"duration":mf(r,"duration",a.message,t);break;case"length":p7(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),p7(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":my(r,RegExp(mm(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&mf(r,"ipv4",a.message,t),"v4"!==a.version&&mf(r,"ipv6",a.message,t);break;case"base64url":my(r,mc,a.message,t);break;case"jwt":my(r,md,a.message,t);break;case"cidr":"v6"!==a.version&&my(r,mo,a.message,t),"v4"!==a.version&&my(r,ms,a.message,t);break;case"emoji":my(r,mn(),a.message,t);break;case"ulid":my(r,ma,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":mf(r,"binary",a.message,t);break;case"contentEncoding:base64":p7(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":my(r,ml,a.message,t)}break;case"nanoid":my(r,mu,a.message,t)}return r}function mm(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)mh.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let mh=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function mf(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):p7(e,"format",t,r,a)}function my(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:mg(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):p7(e,"pattern",mg(t,a),r,a)}function mg(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,i="",n=!1,o=!1,s=!1;for(let e=0;e<a.length;e++){if(n){i+=a[e],n=!1;continue}if(r.i){if(o){if(a[e].match(/[a-z]/)){s?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),s=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],s=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){i+=`(^|(?<=[\r
|
|
84
|
+
`,e.enqueue(t.encode(i)),!0}catch(e){return this.onerror?.(e),!1}}handleUnsupportedRequest(){return this.onerror?.(Error("Method not allowed.")),Response.json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null},{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,t){try{let r,a,i,n,o=e.headers.get("accept");if(!o?.includes("application/json")||!o.includes("text/event-stream"))return this.onerror?.(Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");if(!ch(e.headers.get("content-type")))return this.onerror?.(Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");if(t?.parsedBody===void 0)try{r=await e.json()}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else r=t.parsedBody;try{a=Array.isArray(r)?r.map(e=>iQ.parse(e)):[iQ.parse(r)]}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let s=a.some(e=>ni.safeParse(e).success);if(s){if(this._initialized&&void 0!==this.sessionId)return this.onerror?.(Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.onerror?.(Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!s){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!a.some(e=>lx(e))){for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e});return new Response(null,{status:202})}let l=crypto.randomUUID(),c=a.find(e=>ni.safeParse(e).success),u=c?c.params.protocolVersion:e.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(r=>{for(let e of(this._streamMapping.set(l,{resolveJson:r,cleanup:()=>{this._streamMapping.delete(l)}}),a))lx(e)&&this._requestToStreamMapping.set(e.id,l);for(let r of a)this.onmessage?.(r,{authInfo:t?.authInfo,request:e})});let d=new TextEncoder,p=new ReadableStream({start:e=>{i=e},cancel:()=>{void 0!==n&&clearInterval(n),this._streamMapping.get(l)?.controller===i&&this._streamMapping.delete(l)}}),m={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let e of(void 0!==this.sessionId&&(m["mcp-session-id"]=this.sessionId),a))lx(e)&&(this._streamMapping.set(l,{controller:i,encoder:d,cleanup:()=>{void 0!==n&&clearInterval(n),this._streamMapping.delete(l);try{i.close()}catch{}}}),this._requestToStreamMapping.set(e.id,l));for(let r of(await this.writePrimingEvent(i,d,l,u),a)){let a,i;lx(r)&&this._eventStore&&this.supportsEmptySSEData(u)&&(a=()=>{this.closeSSEStream(r.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(r,{authInfo:t?.authInfo,request:e,closeSSEStream:a,closeStandaloneSSEStream:i})}return this._streamMapping.get(l)?.controller===i&&(n=this.startKeepAlive(i,d)),new Response(p,{status:200,headers:m})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(e)})}}async handleDeleteRequest(e){let t=this.validateSession(e);if(t)return t;let r=this.validateProtocolVersion(e);if(r)return r;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(e){if(void 0===this.sessionIdGenerator)return;if(!this._initialized)return this.onerror?.(Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let t=e.headers.get("mcp-session-id");return t?t!==this.sessionId?(this.onerror?.(Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")):void 0:(this.onerror?.(Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required"))}validateProtocolVersion(e){let t=e.headers.get("mcp-protocol-version");if(null!==t&&!this._supportedProtocolVersions.includes(t)){let e=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(400,-32e3,e)}}async close(){if(!this._closed){for(let{cleanup:e}of(this._closed=!0,this._streamMapping.values()))e();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(e){let t=this._requestToStreamMapping.get(e);if(!t)return;let r=this._streamMapping.get(t);r&&r.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let r=t?.relatedRequestId;if((lE(e)||lT(e))&&(r=e.id),void 0===r){let t;if(lE(e)||lT(e))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(t=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let r=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===r)return;r.controller&&r.encoder&&(void 0===t||!r.replayedEventIds?.has(t))&&this.writeSSEEvent(r.controller,r.encoder,e,t);return}let a=this._requestToStreamMapping.get(r);if(!a)throw Error(`No connection established for request ID: ${String(r)}`);let i=this._streamMapping.get(a);if(!this._enableJsonResponse){let t;this._eventStore&&(t=await this._eventStore.storeEvent(a,e),i=this._streamMapping.get(a)),i?.controller&&i?.encoder&&(void 0===t||!i.replayedEventIds?.has(t))&&this.writeSSEEvent(i.controller,i.encoder,e,t)}if(lE(e)||lT(e)){this._requestResponseMap.set(r,e);let t=[...this._requestToStreamMapping.entries()].filter(([e,t])=>t===a).map(([e])=>e);if(t.every(e=>this._requestResponseMap.has(e))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(r)}`);if(!this._eventStore){for(let e of(this.onerror?.(Error(`Response for request ID ${String(r)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),t))this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}if(this._enableJsonResponse&&i.resolveJson){let e={"Content-Type":"application/json"};void 0!==this.sessionId&&(e["mcp-session-id"]=this.sessionId);let r=t.map(e=>this._requestResponseMap.get(e));1===r.length?i.resolveJson(Response.json(r[0],{status:200,headers:e})):i.resolveJson(Response.json(r,{status:200,headers:e})),i.cleanup()}else i.cleanup();for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e)}}}};function dx(e){if(null===e||"object"!=typeof e||Array.isArray(e))return null;let{method:t,id:r}=e;return"string"!=typeof t?null:"string"==typeof r||"number"==typeof r?r:null}function dP(e,t,r,a,i=null){return Response.json({jsonrpc:"2.0",error:{code:t,message:r,...void 0!==a&&{data:a}},id:i},{status:e})}function dE(e,t=null){return dP(e.httpStatus,e.code,e.message,e.data,t)}function dT(e){return e instanceof Error?e:Error(String(e))}function dj(e=null){return dP(500,-32603,"Internal server error",void 0,e)}async function dC(e,t,r=!0){let a,i=e.method.toUpperCase(),n=t,o=e,s=!1;if("POST"===i){if(void 0===n){let t;r&&(o=e.clone());try{t=await e.text()}catch{return{step:"unreadable-body"}}try{a=0===t.length?void 0:JSON.parse(t)}catch{s=!0}s||void 0===a||(n=a)}else a=n;if(s||void 0===a)return{step:"no-json-body",forwardRequest:o}}return{step:"classified",outcome:function(e){if("POST"!==(e={...e,...void 0!==e.protocolVersionHeader&&{protocolVersionHeader:lB(e.protocolVersionHeader)},...void 0!==e.mcpMethodHeader&&{mcpMethodHeader:lB(e.mcpMethodHeader)},...void 0!==e.mcpNameHeader&&{mcpNameHeader:lB(e.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let t=e.body;if(Array.isArray(t)){if(0===t.length)return lF("jsonrpc-shape","empty-batch",400,new s3(s4.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let e of t){if(l$(lK(e)?e.params:void 0))return lF("jsonrpc-shape","batch-with-modern-element",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(lx(e)||lP(e)||lE(e)||lT(e)))return lF("jsonrpc-shape","batch-with-invalid-element",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return lE(t)||lT(t)?{kind:"legacy",reason:"response"}:lK(t)&&lx(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=sT;if("initialize"===a&&!function(e){if(!l$(e))return!1;let t=lw(e);if(void 0===t||!(t>=sT))return!1;let r=lS(e);return void 0!==r&&0===lR(r).length}(r)){if(n)return lH("initialize-with-modern-header",i,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let e=lK(r)&&"string"==typeof r.protocolVersion?r.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==e&&{requestedVersion:e}}}if(l$(r)){let n=lS(r),o=(void 0===n?[]:lR(n))[0];if(void 0!==o)return lF("envelope","envelope-invalid",400,new s3(s4.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${o.key}: ${o.problem}`,{envelope:o}),!0);let s=lw(r);return void 0!==i&&void 0!==s&&i!==s?lH("header-body-version-mismatch",i,`the body envelope names protocol version ${s} but the MCP-Protocol-Version header names ${i}`):void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("method-header-mismatch",e.mcpMethodHeader,`the body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:t,classification:lG(s)}}if(n){let e=lS(r),t=lR(e??{}).filter(e=>"missing"===e.problem).map(e=>e.key),a=void 0===e?["_meta"]:t.length>0?t:[iP];return lF("envelope","modern-header-without-claim",400,new s3(s4.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${a.join(", ")}`,{envelope:{missing:a}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==i&&{requestedVersion:i}}}(e,t):lK(t)&&lP(t)?function(e,t){let r=t.params,a=t.method,i=e.protocolVersionHeader,n=void 0!==i&&i>=sT;if(l$(r)){let n=lw(r);if(void 0===n){let e=lS(r),t=(void 0===e?[]:lR(e)).find(e=>e.key===iP)??{key:iP,problem:"expected a protocol version string"};return lF("envelope","notification-envelope-invalid",400,new s3(s4.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${t.key}: ${t.problem}`,{envelope:t}),!0)}if(void 0!==i&&i!==n)return lH("notification-header-body-version-mismatch",i,`the notification envelope names protocol version ${n} but the MCP-Protocol-Version header names ${i}`);let o=lG(n);return"modern"===o.era&&void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:o}}return n?void 0!==e.mcpMethodHeader&&e.mcpMethodHeader!==a?lH("notification-method-header-mismatch",e.mcpMethodHeader,`the notification body names method ${a} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:t,classification:{era:"modern",revision:i}}:{kind:"legacy",reason:"notification",...void 0!==i&&{requestedVersion:i}}}(e,t):lF("jsonrpc-shape","invalid-json-rpc-body",400,new s3(s4.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:i,protocolVersionHeader:e.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:e.headers.get("mcp-method")??void 0,mcpNameHeader:e.headers.get("mcp-name")??void 0,...void 0!==a&&{body:a}}),body:a,parsedBody:n,forwardRequest:o}}require("http"),require("http2");let dO=require("stream");var dI=r(6982),dN=global.Request,dq=class extends dN{constructor(e,t){"object"==typeof e&&dz in e&&(e=e[dz]()),void 0!==t?.body?.getReader&&(t.duplex??="half"),super(e,t)}},dA=Symbol("wrapBodyStream"),dz=Symbol("getRequestCache"),dM=Symbol("requestCache"),dL=Symbol("incomingKey"),dZ=Symbol("urlKey"),dV=Symbol("headersKey"),dD=Symbol("abortControllerKey"),dU=Symbol("getAbortController"),dF={get method(){return this[dL].method||"GET"},get url(){return this[dZ]},get headers(){return this[dV]||=(e=>{let t=[],r=e.rawHeaders;for(let e=0;e<r.length;e+=2){let{[e]:a,[e+1]:i}=r;58!==a.charCodeAt(0)&&t.push([a,i])}return new Headers(t)})(this[dL])},[dU](){return this[dz](),this[dD]},[dz](){return this[dD]||=new AbortController,this[dM]||=((e,t,r,a,i)=>{let n={method:e,headers:r,signal:i.signal};if("TRACE"===e){n.method="GET";let e=new dq(t,n);return Object.defineProperty(e,"method",{get:()=>"TRACE"}),e}if("GET"!==e&&"HEAD"!==e)if("rawBody"in a&&a.rawBody instanceof Buffer)n.body=new ReadableStream({start(e){e.enqueue(a.rawBody),e.close()}});else if(a[dA]){let e;n.body=new ReadableStream({async pull(t){try{e||=dO.Readable.toWeb(a).getReader();let{done:r,value:i}=await e.read();r?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else n.body=dO.Readable.toWeb(a);return new dq(t,n)})(this.method,this[dZ],this.headers,this[dL],this[dD])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(dF,e,{get(){return this[dz]()[e]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(dF,e,{value:function(){return this[dz]()[e]()}})}),Object.defineProperty(dF,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){let a={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[dM]};return`Request (lightweight) ${r(a,{...t,depth:null==e?null:e-1})}`}}),Object.setPrototypeOf(dF,dq.prototype);var dH=Symbol("responseCache"),dJ=Symbol("getResponseCache"),dB=Symbol("cache"),dK=global.Response,dG=class e{#e;#t;[dJ](){return delete this[dB],this[dH]||=new dK(this.#e,this.#t)}constructor(t,r){let a;if(this.#e=t,r instanceof e){const e=r[dH];if(e){this.#t=e,this[dJ]();return}this.#t=r.#t,a=new Headers(r.#t.headers)}else this.#t=r;("string"==typeof t||void 0!==t?.getReader||t instanceof Blob||t instanceof Uint8Array)&&(this[dB]=[r?.status||200,t,a||r?.headers])}get headers(){let e=this[dB];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[dJ]().headers}get status(){return this[dB]?.[0]??this[dJ]().status}get ok(){let e=this.status;return e>=200&&e<300}};function dW(e){return Array.isArray(e)?e[0]:e}async function dX(e,t,r){let a,i=(e.method??"GET").toUpperCase(),n=`http://${dW(e.headers.host)??dW(e.headers[":authority"])??"localhost"}${e.url??"/"}`,o=new Headers;for(let[t,r]of Object.entries(e.headers))if(!(void 0===r||t.startsWith(":")))if(Array.isArray(r))for(let e of r)o.append(t,e);else o.set(t,r);if("GET"!==i&&"HEAD"!==i)if(void 0===t){let t=new TextDecoder,r="";for await(let a of e)r+="string"==typeof a?a:t.decode(a,{stream:!0});(r+=t.decode()).length>0&&(a=r)}else{let e=JSON.stringify(t);o.delete("content-encoding"),o.delete("transfer-encoding"),void 0===e?o.delete("content-length"):(a=e,o.set("content-length",String(new TextEncoder().encode(e).byteLength)))}return new Request(n,{method:i,headers:o,...r?.signal!==void 0&&{signal:r.signal},...void 0!==a&&{body:a}})}["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(dG.prototype,e,{get(){return this[dJ]()[e]}})}),["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(dG.prototype,e,{value:function(){return this[dJ]()[e]()}})}),Object.defineProperty(dG.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){let a={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[dH]};return`Response (lightweight) ${r(a,{...t,depth:null==e?null:e-1})}`}}),Object.setPrototypeOf(dG,dK),Object.setPrototypeOf(dG.prototype,dK.prototype),void 0===global.crypto&&(global.crypto=dI),Symbol("outgoingEnded"),Symbol("incomingDraining");let dY=Symbol("Let zodToJsonSchema decide on which parser to use"),dQ={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};(y=R||(R={})).assertEqual=e=>{},y.assertIs=function(e){},y.assertNever=function(e){throw Error()},y.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},y.getValidEnumValues=e=>{let t=y.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return y.objectValues(r)},y.objectValues=e=>y.objectKeys(e).map(function(t){return e[t]}),y.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},y.find=(e,t)=>{for(let r of e)if(t(r))return r},y.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,y.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},y.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(k||(k={})).mergeShapes=(e,t)=>({...e,...t});let d0=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d1=e=>{switch(typeof e){case"undefined":return d0.undefined;case"string":return d0.string;case"number":return Number.isNaN(e)?d0.nan:d0.number;case"boolean":return d0.boolean;case"function":return d0.function;case"bigint":return d0.bigint;case"symbol":return d0.symbol;case"object":if(Array.isArray(e))return d0.array;if(null===e)return d0.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return d0.promise;if("undefined"!=typeof Map&&e instanceof Map)return d0.map;if("undefined"!=typeof Set&&e instanceof Set)return d0.set;if("undefined"!=typeof Date&&e instanceof Date)return d0.date;return d0.object;default:return d0.unknown}},d2=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class d9 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a];a===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof d9))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}d9.create=e=>new d9(e);let d4=(e,t)=>{let r;switch(e.code){case d2.invalid_type:r=e.received===d0.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case d2.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,R.jsonStringifyReplacer)}`;break;case d2.unrecognized_keys:r=`Unrecognized key(s) in object: ${R.joinValues(e.keys,", ")}`;break;case d2.invalid_union:r="Invalid input";break;case d2.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${R.joinValues(e.options)}`;break;case d2.invalid_enum_value:r=`Invalid enum value. Expected ${R.joinValues(e.options)}, received '${e.received}'`;break;case d2.invalid_arguments:r="Invalid function arguments";break;case d2.invalid_return_type:r="Invalid function return type";break;case d2.invalid_date:r="Invalid date";break;case d2.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:R.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case d2.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case d2.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case d2.custom:r="Invalid input";break;case d2.invalid_intersection_types:r="Intersection results could not be merged";break;case d2.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case d2.not_finite:r="Number must be finite";break;default:r=t.defaultError,R.assertNever(e)}return{message:r}};(g=x||(x={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},g.toString=e=>"string"==typeof e?e:e?.message;let d3=e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],o={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let s="";for(let e of a.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:n,message:s}};function d6(e,t){let r=d3({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d4,void 0].filter(e=>!!e)});e.common.issues.push(r)}class d5{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return d8;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return d5.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return d8;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let d8=Object.freeze({status:"aborted"}),d7=e=>({status:"dirty",value:e}),pe=e=>({status:"valid",value:e}),pt=e=>"undefined"!=typeof Promise&&e instanceof Promise;class pr{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let pa=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new d9(e.common.issues);return this._error=t,this._error}}};function pi(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:n}=e;return"invalid_enum_value"===t.code?{message:n??i.defaultError}:void 0===i.data?{message:n??a??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:n??r??i.defaultError}},description:i}}class pn{get description(){return this._def.description}_getType(e){return d1(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d5,ctx:{common:e.parent.common,data:e.data,parsedType:d1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(pt(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d1(e)},a=this._parseSync({data:e,path:r.path,parent:r});return pa(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d1(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d1(e)},a=this._parse({data:e,path:r.path,parent:r});return pa(r,await (pt(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),n=()=>a.addIssue({code:d2.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new pY({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return pQ.create(this,this._def)}nullable(){return p0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pq.create(this)}promise(){return pX.create(this,this._def)}or(e){return pz.create([this,e],this._def)}and(e){return pZ.create(this,e,this._def)}transform(e){return new pY({...pi(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new p1({...pi(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:P.ZodDefault})}brand(){return new p4({typeName:P.ZodBranded,type:this,...pi(this._def)})}catch(e){return new p2({...pi(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:P.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return p3.create(this,e)}readonly(){return p6.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let po=/^c[^\s-]{8,}$/i,ps=/^[0-9a-z]+$/,pl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pu=/^[a-z0-9_-]{21}$/i,pd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pp=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pm=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ph=/^(?:(?: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])$/,pf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,py=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,pg=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,p_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pb="((\\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])))",pS=RegExp(`^${pb}$`);function p$(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class pw extends pn{_parse(e){var t,r,a,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==d0.string){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.string,received:t.parsedType}),d8}let o=new d5;for(let s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(d6(n=this._getOrReturnCtx(e,n),{code:d2.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("max"===s.kind)e.data.length>s.value&&(d6(n=this._getOrReturnCtx(e,n),{code:d2.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("length"===s.kind){let t=e.data.length>s.value,r=e.data.length<s.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?d6(n,{code:d2.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&d6(n,{code:d2.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if("email"===s.kind)pm.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"email",code:d2.invalid_string,message:s.message}),o.dirty());else if("emoji"===s.kind)d||(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:d2.invalid_string,message:s.message}),o.dirty());else if("uuid"===s.kind)pc.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:d2.invalid_string,message:s.message}),o.dirty());else if("nanoid"===s.kind)pu.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:d2.invalid_string,message:s.message}),o.dirty());else if("cuid"===s.kind)po.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:d2.invalid_string,message:s.message}),o.dirty());else if("cuid2"===s.kind)ps.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:d2.invalid_string,message:s.message}),o.dirty());else if("ulid"===s.kind)pl.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:d2.invalid_string,message:s.message}),o.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{d6(n=this._getOrReturnCtx(e,n),{validation:"url",code:d2.invalid_string,message:s.message}),o.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"regex",code:d2.invalid_string,message:s.message}),o.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):"datetime"===s.kind?(function(e){let t=`${pb}T${p$(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(s).test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:"datetime",message:s.message}),o.dirty()):"date"===s.kind?pS.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:"date",message:s.message}),o.dirty()):"time"===s.kind?RegExp(`^${p$(s)}$`).test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{code:d2.invalid_string,validation:"time",message:s.message}),o.dirty()):"duration"===s.kind?pp.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"duration",code:d2.invalid_string,message:s.message}),o.dirty()):"ip"===s.kind?(t=e.data,!(("v4"===(r=s.version)||!r)&&ph.test(t)||("v6"===r||!r)&&py.test(t))&&1&&(d6(n=this._getOrReturnCtx(e,n),{validation:"ip",code:d2.invalid_string,message:s.message}),o.dirty())):"jwt"===s.kind?!function(e,t){if(!pd.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,s.alg)&&(d6(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:d2.invalid_string,message:s.message}),o.dirty()):"cidr"===s.kind?(a=e.data,!(("v4"===(i=s.version)||!i)&&pf.test(a)||("v6"===i||!i)&&pg.test(a))&&1&&(d6(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:d2.invalid_string,message:s.message}),o.dirty())):"base64"===s.kind?pv.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"base64",code:d2.invalid_string,message:s.message}),o.dirty()):"base64url"===s.kind?p_.test(e.data)||(d6(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:d2.invalid_string,message:s.message}),o.dirty()):R.assertNever(s);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:d2.invalid_string,...x.errToObj(r)})}_addCheck(e){return new pw({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...x.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...x.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...x.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new pw({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pw({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pw({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}pw.create=e=>new pw({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...pi(e)});class pR extends pn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==d0.number){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.number,received:t.parsedType}),d8}let r=new d5;for(let a of this._def.checks)"int"===a.kind?R.isInteger(e.data)||(d6(t=this._getOrReturnCtx(e,t),{code:d2.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,a.value)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(d6(t=this._getOrReturnCtx(e,t),{code:d2.not_finite,message:a.message}),r.dirty()):R.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,r,a){return new pR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:x.toString(a)}]})}_addCheck(e){return new pR({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}pR.create=e=>new pR({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...pi(e)});class pk extends pn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==d0.bigint)return this._getInvalidInput(e);let r=new d5;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):R.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.bigint,received:t.parsedType}),d8}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,r,a){return new pk({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:x.toString(a)}]})}_addCheck(e){return new pk({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}pk.create=e=>new pk({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...pi(e)});class px extends pn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==d0.boolean){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.boolean,received:t.parsedType}),d8}return pe(e.data)}}px.create=e=>new px({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...pi(e)});class pP extends pn{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==d0.date){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.date,received:t.parsedType}),d8}if(Number.isNaN(e.data.getTime()))return d6(this._getOrReturnCtx(e),{code:d2.invalid_date}),d8;let r=new d5;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(d6(t=this._getOrReturnCtx(e,t),{code:d2.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):R.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pP({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pP.create=e=>new pP({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...pi(e)});class pE extends pn{_parse(e){if(this._getType(e)!==d0.symbol){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.symbol,received:t.parsedType}),d8}return pe(e.data)}}pE.create=e=>new pE({typeName:P.ZodSymbol,...pi(e)});class pT extends pn{_parse(e){if(this._getType(e)!==d0.undefined){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.undefined,received:t.parsedType}),d8}return pe(e.data)}}pT.create=e=>new pT({typeName:P.ZodUndefined,...pi(e)});class pj extends pn{_parse(e){if(this._getType(e)!==d0.null){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.null,received:t.parsedType}),d8}return pe(e.data)}}pj.create=e=>new pj({typeName:P.ZodNull,...pi(e)});class pC extends pn{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}}pC.create=e=>new pC({typeName:P.ZodAny,...pi(e)});class pO extends pn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}}pO.create=e=>new pO({typeName:P.ZodUnknown,...pi(e)});class pI extends pn{_parse(e){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.never,received:t.parsedType}),d8}}pI.create=e=>new pI({typeName:P.ZodNever,...pi(e)});class pN extends pn{_parse(e){if(this._getType(e)!==d0.undefined){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.void,received:t.parsedType}),d8}return pe(e.data)}}pN.create=e=>new pN({typeName:P.ZodVoid,...pi(e)});class pq extends pn{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==d0.array)return d6(t,{code:d2.invalid_type,expected:d0.array,received:t.parsedType}),d8;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(d6(t,{code:e?d2.too_big:d2.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(d6(t,{code:d2.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(d6(t,{code:d2.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new pr(t,e,t.path,r)))).then(e=>d5.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new pr(t,e,t.path,r)));return d5.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new pq({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new pq({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new pq({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}pq.create=(e,t)=>new pq({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...pi(t)});class pA extends pn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==d0.object){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.object,received:t.parsedType}),d8}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof pI&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let o=[];for(let e of i){let t=a[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new pr(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof pI){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(d6(r,{code:d2.unrecognized_keys,keys:n}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of n){let a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new pr(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>d5.mergeObjectSync(t,e)):d5.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new pA({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:x.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new pA({...this._def,unknownKeys:"strip"})}passthrough(){return new pA({...this._def,unknownKeys:"passthrough"})}extend(e){return new pA({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new pA({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new pA({...this._def,catchall:e})}pick(e){let t={};for(let r of R.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new pA({...this._def,shape:()=>t})}omit(e){let t={};for(let r of R.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new pA({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof pA){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=pQ.create(e(i))}return new pA({...t._def,shape:()=>r})}if(t instanceof pq)return new pq({...t._def,type:e(t.element)});if(t instanceof pQ)return pQ.create(e(t.unwrap()));if(t instanceof p0)return p0.create(e(t.unwrap()));if(t instanceof pV)return pV.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of R.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new pA({...this._def,shape:()=>t})}required(e){let t={};for(let r of R.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof pQ;)e=e._def.innerType;t[r]=e}return new pA({...this._def,shape:()=>t})}keyof(){return pK(R.objectKeys(this.shape))}}pA.create=(e,t)=>new pA({shape:()=>e,unknownKeys:"strip",catchall:pI.create(),typeName:P.ZodObject,...pi(t)}),pA.strictCreate=(e,t)=>new pA({shape:()=>e,unknownKeys:"strict",catchall:pI.create(),typeName:P.ZodObject,...pi(t)}),pA.lazycreate=(e,t)=>new pA({shape:e,unknownKeys:"strip",catchall:pI.create(),typeName:P.ZodObject,...pi(t)});class pz extends pn{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new d9(e.ctx.common.issues));return d6(t,{code:d2.invalid_union,unionErrors:r}),d8});{let e,a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new d9(e));return d6(t,{code:d2.invalid_union,unionErrors:i}),d8}}get options(){return this._def.options}}pz.create=(e,t)=>new pz({options:e,typeName:P.ZodUnion,...pi(t)});let pM=e=>{if(e instanceof pJ)return pM(e.schema);if(e instanceof pY)return pM(e.innerType());if(e instanceof pB)return[e.value];if(e instanceof pG)return e.options;if(e instanceof pW)return R.objectValues(e.enum);else if(e instanceof p1)return pM(e._def.innerType);else if(e instanceof pT)return[void 0];else if(e instanceof pj)return[null];else if(e instanceof pQ)return[void 0,...pM(e.unwrap())];else if(e instanceof p0)return[null,...pM(e.unwrap())];else if(e instanceof p4)return pM(e.unwrap());else if(e instanceof p6)return pM(e.unwrap());else if(e instanceof p2)return pM(e._def.innerType);else return[]};class pL extends pn{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d0.object)return d6(t,{code:d2.invalid_type,expected:d0.object,received:t.parsedType}),d8;let r=this.discriminator,a=t.data[r],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(d6(t,{code:d2.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),d8)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=pM(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(a.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,r)}}return new pL({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...pi(r)})}}class pZ extends pn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return d8;let i=function e(t,r){let a=d1(t),i=d1(r);if(t===r)return{valid:!0,data:t};if(a===d0.object&&i===d0.object){let a=R.objectKeys(r),i=R.objectKeys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};n[a]=i.data}return{valid:!0,data:n}}if(a===d0.array&&i===d0.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}if(a===d0.date&&i===d0.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(d6(r,{code:d2.invalid_intersection_types}),d8)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}pZ.create=(e,t,r)=>new pZ({left:e,right:t,typeName:P.ZodIntersection,...pi(r)});class pV extends pn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d0.array)return d6(r,{code:d2.invalid_type,expected:d0.array,received:r.parsedType}),d8;if(r.data.length<this._def.items.length)return d6(r,{code:d2.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d8;!this._def.rest&&r.data.length>this._def.items.length&&(d6(r,{code:d2.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new pr(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>d5.mergeArray(t,e)):d5.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new pV({...this._def,rest:e})}}pV.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new pV({items:e,typeName:P.ZodTuple,rest:null,...pi(t)})};class pD extends pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d0.object)return d6(r,{code:d2.invalid_type,expected:d0.object,received:r.parsedType}),d8;let a=[],i=this._def.keyType,n=this._def.valueType;for(let e in r.data)a.push({key:i._parse(new pr(r,e,r.path,e)),value:n._parse(new pr(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?d5.mergeObjectAsync(t,a):d5.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new pD(t instanceof pn?{keyType:e,valueType:t,typeName:P.ZodRecord,...pi(r)}:{keyType:pw.create(),valueType:e,typeName:P.ZodRecord,...pi(t)})}}class pU extends pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d0.map)return d6(r,{code:d2.invalid_type,expected:d0.map,received:r.parsedType}),d8;let a=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new pr(r,e,r.path,[n,"key"])),value:i._parse(new pr(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return d8;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return d8;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}pU.create=(e,t,r)=>new pU({valueType:t,keyType:e,typeName:P.ZodMap,...pi(r)});class pF extends pn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d0.set)return d6(r,{code:d2.invalid_type,expected:d0.set,received:r.parsedType}),d8;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(d6(r,{code:d2.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(d6(r,{code:d2.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let a of e){if("aborted"===a.status)return d8;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new pr(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>n(e)):n(o)}min(e,t){return new pF({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new pF({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}pF.create=(e,t)=>new pF({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...pi(t)});class pH extends pn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d0.function)return d6(t,{code:d2.invalid_type,expected:d0.function,received:t.parsedType}),d8;function r(e,r){return d3({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d4,d4].filter(e=>!!e),issueData:{code:d2.invalid_arguments,argumentsError:r}})}function a(e,r){return d3({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d4,d4].filter(e=>!!e),issueData:{code:d2.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},n=t.data;if(this._def.returns instanceof pX){let e=this;return pe(async function(...t){let o=new d9([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(n,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(a(l,e)),o})})}{let e=this;return pe(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new d9([r(t,o.error)]);let s=Reflect.apply(n,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new d9([a(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pH({...this._def,args:pV.create(e).rest(pO.create())})}returns(e){return new pH({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new pH({args:e||pV.create([]).rest(pO.create()),returns:t||pO.create(),typeName:P.ZodFunction,...pi(r)})}}class pJ extends pn{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pJ.create=(e,t)=>new pJ({getter:e,typeName:P.ZodLazy,...pi(t)});class pB extends pn{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d6(t,{received:t.data,code:d2.invalid_literal,expected:this._def.value}),d8}return{status:"valid",value:e.data}}get value(){return this._def.value}}function pK(e,t){return new pG({values:e,typeName:P.ZodEnum,...pi(t)})}pB.create=(e,t)=>new pB({value:e,typeName:P.ZodLiteral,...pi(t)});class pG extends pn{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return d6(t,{expected:R.joinValues(r),received:t.parsedType,code:d2.invalid_type}),d8}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return d6(t,{received:t.data,code:d2.invalid_enum_value,options:r}),d8}return pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return pG.create(e,{...this._def,...t})}exclude(e,t=this._def){return pG.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}pG.create=pK;class pW extends pn{_parse(e){let t=R.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==d0.string&&r.parsedType!==d0.number){let e=R.objectValues(t);return d6(r,{expected:R.joinValues(e),received:r.parsedType,code:d2.invalid_type}),d8}if(this._cache||(this._cache=new Set(R.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=R.objectValues(t);return d6(r,{received:r.data,code:d2.invalid_enum_value,options:e}),d8}return pe(e.data)}get enum(){return this._def.values}}pW.create=(e,t)=>new pW({values:e,typeName:P.ZodNativeEnum,...pi(t)});class pX extends pn{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==d0.promise&&!1===t.common.async?(d6(t,{code:d2.invalid_type,expected:d0.promise,received:t.parsedType}),d8):pe((t.parsedType===d0.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}pX.create=(e,t)=>new pX({type:e,typeName:P.ZodPromise,...pi(t)});class pY extends pn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{d6(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return d8;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?d8:"dirty"===a.status||"dirty"===t.value?d7(a.value):a});{if("aborted"===t.value)return d8;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?d8:"dirty"===a.status||"dirty"===t.value?d7(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?d8:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?d8:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?d8:Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return d8;let n=a.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}R.assertNever(a)}}pY.create=(e,t,r)=>new pY({schema:e,typeName:P.ZodEffects,effect:t,...pi(r)}),pY.createWithPreprocess=(e,t,r)=>new pY({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...pi(r)});class pQ extends pn{_parse(e){return this._getType(e)===d0.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pQ.create=(e,t)=>new pQ({innerType:e,typeName:P.ZodOptional,...pi(t)});class p0 extends pn{_parse(e){return this._getType(e)===d0.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}p0.create=(e,t)=>new p0({innerType:e,typeName:P.ZodNullable,...pi(t)});class p1 extends pn{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===d0.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}p1.create=(e,t)=>new p1({innerType:e,typeName:P.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pi(t)});class p2 extends pn{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return pt(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d9(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new d9(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}p2.create=(e,t)=>new p2({innerType:e,typeName:P.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pi(t)});class p9 extends pn{_parse(e){if(this._getType(e)!==d0.nan){let t=this._getOrReturnCtx(e);return d6(t,{code:d2.invalid_type,expected:d0.nan,received:t.parsedType}),d8}return{status:"valid",value:e.data}}}p9.create=e=>new p9({typeName:P.ZodNaN,...pi(e)}),Symbol("zod_brand");class p4 extends pn{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class p3 extends pn{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?d8:"dirty"===e.status?(t.dirty(),d7(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?d8:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new p3({in:e,out:t,typeName:P.ZodPipeline})}}class p6 extends pn{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return pt(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}p6.create=(e,t)=>new p6({innerType:e,typeName:P.ZodReadonly,...pi(t)}),pA.lazycreate,(v=P||(P={})).ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly",pw.create,pR.create,p9.create,pk.create,px.create,pP.create,pE.create,pT.create,pj.create,pC.create,pO.create,pI.create,pN.create,pq.create,pA.create,pA.strictCreate,pz.create,pL.create,pZ.create,pV.create,pD.create,pU.create,pF.create,pH.create,pJ.create,pB.create,pG.create,pW.create,pX.create,pY.create,pQ.create,p0.create,pY.createWithPreprocess,p3.create;let p5=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function p8(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?p5(t,e.currentPath):t.join("/")}}function p7(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function me(e,t,r,a,i){e[t]=r,p7(e,t,a,i)}function mt(e,t){return m$(e.type._def,t)}let mr=/^[cC][^\s-]{8,}$/,ma=/^[0-9a-z]+$/,mi=/^[0-9A-HJKMNP-TV-Z]{26}$/,mn=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,mo=()=>(void 0===p&&(p=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),p),ms=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ml=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,md=/^[a-zA-Z0-9_-]{21}$/,mp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function mm(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":me(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":me(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":my(r,"email",a.message,t);break;case"format:idn-email":my(r,"idn-email",a.message,t);break;case"pattern:zod":mg(r,mn,a.message,t)}break;case"url":my(r,"uri",a.message,t);break;case"uuid":my(r,"uuid",a.message,t);break;case"regex":mg(r,a.regex,a.message,t);break;case"cuid":mg(r,mr,a.message,t);break;case"cuid2":mg(r,ma,a.message,t);break;case"startsWith":mg(r,RegExp(`^${mh(a.value,t)}`),a.message,t);break;case"endsWith":mg(r,RegExp(`${mh(a.value,t)}$`),a.message,t);break;case"datetime":my(r,"date-time",a.message,t);break;case"date":my(r,"date",a.message,t);break;case"time":my(r,"time",a.message,t);break;case"duration":my(r,"duration",a.message,t);break;case"length":me(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),me(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":mg(r,RegExp(mh(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&my(r,"ipv4",a.message,t),"v4"!==a.version&&my(r,"ipv6",a.message,t);break;case"base64url":mg(r,mu,a.message,t);break;case"jwt":mg(r,mp,a.message,t);break;case"cidr":"v6"!==a.version&&mg(r,ms,a.message,t),"v4"!==a.version&&mg(r,ml,a.message,t);break;case"emoji":mg(r,mo(),a.message,t);break;case"ulid":mg(r,mi,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":my(r,"binary",a.message,t);break;case"contentEncoding:base64":me(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":mg(r,mc,a.message,t)}break;case"nanoid":mg(r,md,a.message,t)}return r}function mh(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)mf.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let mf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function my(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):me(e,"format",t,r,a)}function mg(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:mv(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):me(e,"pattern",mv(t,a),r,a)}function mv(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,i="",n=!1,o=!1,s=!1;for(let e=0;e<a.length;e++){if(n){i+=a[e],n=!1;continue}if(r.i){if(o){if(a[e].match(/[a-z]/)){s?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),s=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],s=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){i+=`(^|(?<=[\r
|
|
85
85
|
]))`;continue}else if("$"===a[e]){i+=`($|(?=[\r
|
|
86
86
|
]))`;continue}}if(r.s&&"."===a[e]){i+=o?`${a[e]}\r
|
|
87
87
|
`:`[${a[e]}\r
|
|
88
|
-
]`;continue}i+=a[e],"\\"===a[e]?n=!0:o&&"]"===a[e]?o=!1:o||"["!==a[e]||(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function mv(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===P.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:mS(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??p5(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:mS(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===P.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=mp(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===P.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===P.ZodBranded&&e.keyType._def.type._def.typeName===P.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=me(e.keyType._def,t);return{...r,propertyNames:i}}return r}let m_={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},mb=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>mS(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function mS(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==dX)return i}if(a&&!r){let e=m$(a,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let n=((e,t,r)=>{switch(t){case P.ZodString:return mp(e,r);case P.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",p8(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?p7(a,"minimum",t.value,t.message,r):p7(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),p7(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?p7(a,"maximum",t.value,t.message,r):p7(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),p7(a,"maximum",t.value,t.message,r));break;case"multipleOf":p7(a,"multipleOf",t.value,t.message,r)}return a;case P.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],n=e.shape();for(let e in n){let o=n[e];if(void 0===o||void 0===o._def)continue;let s=function(e){try{return e.isOptional()}catch{return!0}}(o);s&&r&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let l=mS(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,s||i.push(e))}i.length&&(a.required=i);let o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return mS(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(a.additionalProperties=o),a}(e,r);case P.ZodBigInt:let i={type:"integer",format:"int64"};if(!e.checks)return i;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?p7(i,"minimum",t.value,t.message,r):p7(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),p7(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?p7(i,"maximum",t.value,t.message,r):p7(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),p7(i,"maximum",t.value,t.message,r));break;case"multipleOf":p7(i,"multipleOf",t.value,t.message,r)}return i;case P.ZodBoolean:return{type:"boolean"};case P.ZodDate:return function e(t,r,a){let i=a??r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((a,i)=>e(t,r,a))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var n=t,o=r;let s={type:"integer",format:"unix-time"};if("openApi3"===o.target)return s;for(let e of n.checks)switch(e.kind){case"min":p7(s,"minimum",e.value,e.message,o);break;case"max":p7(s,"maximum",e.value,e.message,o)}return s}}(e,r);case P.ZodUndefined:return{not:p5(r)};case P.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case P.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==P.ZodAny&&(n.items=mS(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&p7(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&p7(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(p7(n,"minItems",e.exactLength.value,e.exactLength.message,r),p7(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case P.ZodUnion:case P.ZodDiscriminatedUnion:if("openApi3"===r.target)return mb(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in m_&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=m_[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return mb(e,r);case P.ZodIntersection:let s,l,c;return s=[mS(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),mS(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,c=[],s.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)c.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;c.push(t)}}),c.length?{allOf:c,...l}:void 0;case P.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>mS(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:mS(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>mS(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case P.ZodRecord:return mv(e,r);case P.ZodLiteral:let u;return"bigint"!=(u=typeof e.value)&&"number"!==u&&"boolean"!==u&&"string"!==u?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===u?"integer":u,enum:[e.value]}:{type:"bigint"===u?"integer":u,const:e.value};case P.ZodEnum:return{type:"string",enum:Array.from(e.values)};case P.ZodNativeEnum:let d,p,m;return d=e.values,{type:1===(m=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof d[d[e]]).map(e=>d[e])).map(e=>typeof e)))).length?"string"===m[0]?"string":"number":["string","number"],enum:p};case P.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:m_[e.innerType._def.typeName],nullable:!0}:{type:[m_[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=mS(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=mS(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case P.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return mS(e.innerType._def,r);let f=mS(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:p5(r)},f]}:p5(r);case P.ZodMap:if("record"===r.mapStrategy)return mv(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[mS(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||p5(r),mS(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||p5(r)],minItems:2,maxItems:2}};case P.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:mS(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&p7(y,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&p7(y,"maxItems",e.maxSize.value,e.maxSize.message,r),y;case P.ZodLazy:return()=>e.getter()._def;case P.ZodPromise:return mS(e.type._def,r);case P.ZodNaN:case P.ZodNever:return"openAi"===r.target?void 0:{not:p5({...r,currentPath:[...r.currentPath,"not"]})};case P.ZodEffects:return"input"===r.effectStrategy?mS(e.schema._def,r):p5(r);case P.ZodAny:case P.ZodUnknown:return p5(r);case P.ZodDefault:return{...mS(e.innerType._def,r),default:e.defaultValue()};case P.ZodBranded:return me(e,r);case P.ZodReadonly:case P.ZodCatch:return mS(e.innerType._def,r);case P.ZodPipeline:if("input"===r.pipeStrategy)return mS(e.in._def,r);if("output"===r.pipeStrategy)return mS(e.out._def,r);let g=mS(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=mS(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",g?"1":"0"]});return{allOf:[g,v].filter(e=>void 0!==e)};case P.ZodFunction:case P.ZodVoid:case P.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?mS(n(),t):n;if(o&&mw(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}let m$=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:p6(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),p5(t);return"seen"===t.$refStrategy?p5(t):void 0}},mw=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function mR(e,t={}){let{strict:r=!1}=t,a=Object.entries(e),i=e=>({target:t})=>{let i={},n=[];for(let[r,o]of a)i[r]=function(e,t,r){let a=e["~standard"];if(a.jsonSchema)return a.jsonSchema[r]({target:t});if("zod"===e["~standard"].vendor&&!("_zod"in e)&&"_def"in e){let r=((e,t)=>{let r,a,i=(a=void 0!==(r="string"==typeof t?{...dY,name:t}:{...dY,...t}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,{...r,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(r.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...r.basePath,r.definitionPath,e],jsonSchema:void 0}]))}),n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:mS(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??p5(i)}),{}):void 0,o="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,s=mS(e._def,void 0===o?i:{...i,currentPath:[...i.basePath,i.definitionPath,o]},!1)??p5(i),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(s.title=l),i.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[i.openAiAnyTypeName]||(n[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let c=void 0===o?n?{...s,[i.definitionPath]:n}:s:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,o].join("/"),[i.definitionPath]:{...n,[o]:s}};return"jsonSchema7"===i.target?c.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c})(e,{$refStrategy:"none",target:"openapi-3.0"===t?"openApi3":"jsonSchema7"});return delete r.$schema,r}if("zod"===a.vendor&&"_zod"in e)try{let t=r9(e);return delete t.$schema,t}catch(e){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${e instanceof Error?e.message:String(e)}`)}throw Error(`Schema library "${a.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(o,t,e),!function(e,t){if("function"!=typeof e.safeParse)return!1;try{let r=e.safeParse(void 0);return r.success&&("input"===t||void 0===r.data)}catch{return!1}}(o,e)&&n.push(r);let o={type:"object",properties:i};return n.length>0&&(o.required=n),r&&(o.additionalProperties=!1),o},n=async t=>{if("object"!=typeof t||null===t||Array.isArray(t))return{issues:[{message:"Expected an object."}]};let i={},n=[];for(let[e,r]of a){let a=await r["~standard"].validate(t[e]);if(a.issues)for(let t of a.issues)n.push({message:t.message,path:[e,...t.path??[]]});else(e in t||void 0!==a.value)&&(i[e]=a.value)}if(r)for(let r of Object.keys(t))r in e||n.push({message:`Unrecognized key: "${r}"`,path:[r]});return n.length>0?{issues:n}:{value:i}};return{shape:e,"~standard":{version:1,vendor:"xmcp",validate:n,jsonSchema:{input:i("input"),output:i("output")}}}}let mk=require("async_hooks"),mx=(e,t)=>{globalThis[e]=t},mP=e=>globalThis[e];function mE({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(mP(t))return mP(t);let a=new mk.AsyncLocalStorage,i=globalThis[r]??{current:null};mx(r,i);let n={provider:(e,t)=>(i.current=e,a.run(e,t)),getContext:()=>{let t=a.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=a.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return mx(t,n),n}let mT=mE({name:"http-request-context"});mT.setContext;let mj=mT.getContext,mC=mT.provider,mO=mE({name:"client-info-context"});mO.setContext;let mI=mO.getContext;mO.provider;let mN=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),mq=e=>{if(!mN(e)||"string"!=typeof e.name||"string"!=typeof e.version)return;let t={name:e.name,version:e.version};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.websiteUrl&&(t.websiteUrl=e.websiteUrl),"string"==typeof e.description&&(t.description=e.description),t},mA=e=>{if(e&&"initialize"===e.method&&mN(e.params))return mq(e.params.clientInfo)},mz=(e,t)=>{let r=t.toLowerCase();for(let[t,a]of Object.entries(e)){if(t.toLowerCase()!==r)continue;let e=Array.isArray(a)?a[0]:a;if("string"!=typeof e)break;let i=e.trim();return i.length>0?i:void 0}},mM=new Set(["message","mode","requestedSchema"]),mL=new Set(["elicitationId","message","mode","url"]),mZ=new Set(["properties","required","type"]),mV=new Set(["default","description","format","maxLength","minLength","title","type"]),mD=new Set(["default","description","enum","enumNames","title","type"]),mU=new Set(["default","description","title","type"]),mF=new Set(["default","description","maximum","minimum","title","type"]),mH=new Set(["date","date-time","email","uri"]);async function mJ(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;mK(e,"Elicitation request must be a plain object."),mB(e,mL,"URL elicitation"),mG(e.message,"URL elicitation requires a string message."),mW(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),mW(e.url,"URL elicitation requires a non-empty URL.");try{t=new URL(e.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(e),e;if("form"!==t)throw Error(`Unsupported elicitation mode "${String(e.mode)}". Expected "form" or "url".`);return function(e){mK(e,"Elicitation request must be a plain object."),mB(e,mM,"Form elicitation"),mG(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(mK(t,"Form elicitation requires a flat object schema."),mB(t,mZ,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(mK(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(mK(t,`Form elicitation field "${e}" must be a plain object.`),mX(t.title,`Form elicitation field "${e}" title must be a string.`),mX(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(mB(t,mD,`Form elicitation field "${e}"`),mQ(t.enum,`Form elicitation field "${e}" enum values must be strings.`),r=t.enumNames,a=`Form elicitation field "${e}" enumNames must be strings.`,void 0!==r&&mQ(r,a),void 0!==t.enumNames&&t.enumNames.length!==t.enum.length)throw Error(`Form elicitation field "${e}" enumNames length must match enum length.`);if(mX(t.default,`Form elicitation field "${e}" default must be a string.`),void 0!==t.default&&!t.enum.includes(t.default))throw Error(`Form elicitation field "${e}" default must be one of its enum values.`);return}if("string"===t.type&&!("enum"in t)){mB(t,mV,`Form elicitation field "${e}"`),mY(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),mY(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),mX(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(mX(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!mH.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(mH).join(", ")}.`);return}if("boolean"===t.type){if(mB(t,mU,`Form elicitation field "${e}"`),void 0!==t.default&&"boolean"!=typeof t.default)throw Error(`Form elicitation field "${e}" default must be a boolean.`);return}if("number"===t.type||"integer"===t.type){mB(t,mF,`Form elicitation field "${e}"`),mY(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),mY(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),mY(t.default,`Form elicitation field "${e}" default must be a number.`);return}throw Error(`Form elicitation field "${e}" uses unsupported type "${String(t.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(e,r);if(void 0!==t.required){if(!Array.isArray(t.required)||t.required.some(e=>"string"!=typeof e))throw Error("Form elicitation schema required fields must be a string array.");for(let e of t.required)if(!(e in t.properties))throw Error(`Form elicitation schema required field "${e}" is not defined in properties.`)}}(e),{...e,mode:"form"}}(t);try{let t=await e.mcpReq.elicitInput(a,r);return{...t,content:t.content??void 0}}catch(e){if(e instanceof sk&&e.code===sR.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function mB(e,t,r){let a=Object.keys(e).filter(e=>!t.has(e));if(0!==a.length)throw Error(`${r} includes unsupported key(s): ${a.join(", ")}.`)}function mK(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function mG(e,t){if("string"!=typeof e)throw Error(t)}function mW(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function mX(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function mY(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function mQ(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let m0=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),m1=new Set(["task","toolChoice","tools"]),m2=new Set(["text","image","audio"]);async function m9(e,t,r){let a=function(e){m4(e,"Sampling request must be a plain object.");let t=Object.keys(e),r=t.filter(e=>m1.has(e));if(r.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${r.join(", ")}.`);let a=t.filter(e=>!m0.has(e));if(a.length>0)throw Error(`Sampling request includes unsupported key(s): ${a.join(", ")}.`);if(!Array.isArray(e.messages)||0===e.messages.length)throw Error("Sampling requires at least one message.");for(let[t,r]of e.messages.entries())!function(e,t){if(m4(t,`Sampling message at index ${e} must be a plain object.`),"user"!==t.role&&"assistant"!==t.role)throw Error(`Sampling message at index ${e} requires role "user" or "assistant".`);let r=t.content;m4(r,`Sampling message at index ${e} requires a content object.`);let a=r.type;if("string"!=typeof a||!m2.has(a))throw Error(`Sampling message at index ${e} uses unsupported content type "${String(a)}". Supported types are text, image, and audio.`);if("text"===a&&"string"!=typeof r.text)throw Error(`Sampling message at index ${e} requires string text content.`);if(("image"===a||"audio"===a)&&("string"!=typeof r.data||"string"!=typeof r.mimeType))throw Error(`Sampling message at index ${e} requires base64 data and a mimeType.`)}(t,r);if("number"!=typeof e.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return e}(t);try{return await e.mcpReq.requestSampling(a,r)}catch(e){if(e instanceof sk&&e.code===sR.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function m4(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}let m3={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function m6(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=m3[e.type];return t?t(e):{valid:!0}}function m5(e,t,r,a){if(null===e||"object"!=typeof e||Array.isArray(e))throw Error(`Tool "${r}" ${a}: expected a plain object.`);let i=new Set(Object.keys(t)),n=Object.keys(e).filter(e=>!i.has(e));if(n.length>0)throw Error(`Tool "${r}" ${a}: unrecognized key(s): ${n.join(", ")}`);for(let[i,n]of Object.entries(t))try{n.parse(e[i])}catch(e){throw Error(`Tool "${r}" ${a}: ${e?.message??`invalid field "${i}"`}`)}}function m8(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function m7(e){return e.endsWith(".tsx")}let he=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}};function ht(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[i,n]of Object.entries(r)){let r=a?`${a}/${i}`:i;!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp?t[r]=n:e(n,r)}}(e),t}let hr=["ui/resourceUri","resourceUri","visibility"],ha=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function hi(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function hn(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function ho(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let i=t[r].slice(1,-1),n=t.slice(r+1),o=n[n.length-1];if(o&&o.includes(".")){let e=o.split(".")[0];"index"!==e?n[n.length-1]=e:n.pop()}let s=[],l=[],c=n.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return s.push(t),`{${t}}`}}),u=`${i}://${c.join("/")}`,d=s.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:i,parameters:s,pathSegments:l,type:d}}function hs(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}function hl(e){return Error(`[xmcp] Invalid prompt file: ${e}
|
|
89
|
-
-> Default export must be a prompt handler function.`)}async function
|
|
90
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function
|
|
91
|
-
-> Default export must be a resource handler function.`)}async function
|
|
92
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function
|
|
93
|
-
-> Default export must be a tool handler function.`)}async function
|
|
94
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),
|
|
88
|
+
]`;continue}i+=a[e],"\\"===a[e]?n=!0:o&&"]"===a[e]?o=!1:o||"["!==a[e]||(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function m_(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===P.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:m$(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??p8(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:m$(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===P.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=mm(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===P.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===P.ZodBranded&&e.keyType._def.type._def.typeName===P.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=mt(e.keyType._def,t);return{...r,propertyNames:i}}return r}let mb={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},mS=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>m$(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function m$(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==dY)return i}if(a&&!r){let e=mw(a,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let n=((e,t,r)=>{switch(t){case P.ZodString:return mm(e,r);case P.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",p7(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?me(a,"minimum",t.value,t.message,r):me(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),me(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?me(a,"maximum",t.value,t.message,r):me(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),me(a,"maximum",t.value,t.message,r));break;case"multipleOf":me(a,"multipleOf",t.value,t.message,r)}return a;case P.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],n=e.shape();for(let e in n){let o=n[e];if(void 0===o||void 0===o._def)continue;let s=function(e){try{return e.isOptional()}catch{return!0}}(o);s&&r&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let l=m$(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,s||i.push(e))}i.length&&(a.required=i);let o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return m$(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(a.additionalProperties=o),a}(e,r);case P.ZodBigInt:let i={type:"integer",format:"int64"};if(!e.checks)return i;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?me(i,"minimum",t.value,t.message,r):me(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),me(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?me(i,"maximum",t.value,t.message,r):me(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),me(i,"maximum",t.value,t.message,r));break;case"multipleOf":me(i,"multipleOf",t.value,t.message,r)}return i;case P.ZodBoolean:return{type:"boolean"};case P.ZodDate:return function e(t,r,a){let i=a??r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((a,i)=>e(t,r,a))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var n=t,o=r;let s={type:"integer",format:"unix-time"};if("openApi3"===o.target)return s;for(let e of n.checks)switch(e.kind){case"min":me(s,"minimum",e.value,e.message,o);break;case"max":me(s,"maximum",e.value,e.message,o)}return s}}(e,r);case P.ZodUndefined:return{not:p8(r)};case P.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case P.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==P.ZodAny&&(n.items=m$(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&me(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&me(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(me(n,"minItems",e.exactLength.value,e.exactLength.message,r),me(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case P.ZodUnion:case P.ZodDiscriminatedUnion:if("openApi3"===r.target)return mS(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in mb&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=mb[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return mS(e,r);case P.ZodIntersection:let s,l,c;return s=[m$(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),m$(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,c=[],s.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)c.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;c.push(t)}}),c.length?{allOf:c,...l}:void 0;case P.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>m$(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:m$(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>m$(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case P.ZodRecord:return m_(e,r);case P.ZodLiteral:let u;return"bigint"!=(u=typeof e.value)&&"number"!==u&&"boolean"!==u&&"string"!==u?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===u?"integer":u,enum:[e.value]}:{type:"bigint"===u?"integer":u,const:e.value};case P.ZodEnum:return{type:"string",enum:Array.from(e.values)};case P.ZodNativeEnum:let d,p,m;return d=e.values,{type:1===(m=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof d[d[e]]).map(e=>d[e])).map(e=>typeof e)))).length?"string"===m[0]?"string":"number":["string","number"],enum:p};case P.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:mb[e.innerType._def.typeName],nullable:!0}:{type:[mb[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=m$(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=m$(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case P.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return m$(e.innerType._def,r);let f=m$(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:p8(r)},f]}:p8(r);case P.ZodMap:if("record"===r.mapStrategy)return m_(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[m$(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||p8(r),m$(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||p8(r)],minItems:2,maxItems:2}};case P.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:m$(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&me(y,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&me(y,"maxItems",e.maxSize.value,e.maxSize.message,r),y;case P.ZodLazy:return()=>e.getter()._def;case P.ZodPromise:return m$(e.type._def,r);case P.ZodNaN:case P.ZodNever:return"openAi"===r.target?void 0:{not:p8({...r,currentPath:[...r.currentPath,"not"]})};case P.ZodEffects:return"input"===r.effectStrategy?m$(e.schema._def,r):p8(r);case P.ZodAny:case P.ZodUnknown:return p8(r);case P.ZodDefault:return{...m$(e.innerType._def,r),default:e.defaultValue()};case P.ZodBranded:return mt(e,r);case P.ZodReadonly:case P.ZodCatch:return m$(e.innerType._def,r);case P.ZodPipeline:if("input"===r.pipeStrategy)return m$(e.in._def,r);if("output"===r.pipeStrategy)return m$(e.out._def,r);let g=m$(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=m$(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",g?"1":"0"]});return{allOf:[g,v].filter(e=>void 0!==e)};case P.ZodFunction:case P.ZodVoid:case P.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?m$(n(),t):n;if(o&&mR(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}let mw=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:p5(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),p8(t);return"seen"===t.$refStrategy?p8(t):void 0}},mR=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function mk(e,t={}){let{strict:r=!1}=t,a=Object.entries(e),i=e=>({target:t})=>{let i={},n=[];for(let[r,o]of a)i[r]=function(e,t,r){let a=e["~standard"];if(a.jsonSchema)return a.jsonSchema[r]({target:t});if("zod"===e["~standard"].vendor&&!("_zod"in e)&&"_def"in e){let r=((e,t)=>{let r,a,i=(a=void 0!==(r="string"==typeof t?{...dQ,name:t}:{...dQ,...t}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,{...r,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(r.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...r.basePath,r.definitionPath,e],jsonSchema:void 0}]))}),n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:m$(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??p8(i)}),{}):void 0,o="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,s=m$(e._def,void 0===o?i:{...i,currentPath:[...i.basePath,i.definitionPath,o]},!1)??p8(i),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(s.title=l),i.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[i.openAiAnyTypeName]||(n[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let c=void 0===o?n?{...s,[i.definitionPath]:n}:s:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,o].join("/"),[i.definitionPath]:{...n,[o]:s}};return"jsonSchema7"===i.target?c.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c})(e,{$refStrategy:"none",target:"openapi-3.0"===t?"openApi3":"jsonSchema7"});return delete r.$schema,r}if("zod"===a.vendor&&"_zod"in e)try{let t=r9(e);return delete t.$schema,t}catch(e){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${e instanceof Error?e.message:String(e)}`)}throw Error(`Schema library "${a.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(o,t,e),!function(e,t){if("function"!=typeof e.safeParse)return!1;try{let r=e.safeParse(void 0);return r.success&&("input"===t||void 0===r.data)}catch{return!1}}(o,e)&&n.push(r);let o={type:"object",properties:i};return n.length>0&&(o.required=n),r&&(o.additionalProperties=!1),o},n=async t=>{if("object"!=typeof t||null===t||Array.isArray(t))return{issues:[{message:"Expected an object."}]};let i={},n=[];for(let[e,r]of a){let a=await r["~standard"].validate(t[e]);if(a.issues)for(let t of a.issues)n.push({message:t.message,path:[e,...t.path??[]]});else(e in t||void 0!==a.value)&&(i[e]=a.value)}if(r)for(let r of Object.keys(t))r in e||n.push({message:`Unrecognized key: "${r}"`,path:[r]});return n.length>0?{issues:n}:{value:i}};return{shape:e,"~standard":{version:1,vendor:"xmcp",validate:n,jsonSchema:{input:i("input"),output:i("output")}}}}let mx=require("async_hooks"),mP=(e,t)=>{globalThis[e]=t},mE=e=>globalThis[e];function mT({name:e,fallback:t=!0}){let r=Symbol.for(`xmcp-context-${e}`),a=Symbol.for(`xmcp-context-${e}-fallback-store`);if(mE(r))return mE(r);let i=new mx.AsyncLocalStorage,n=globalThis[a]??{current:null};mP(a,n);let o={provider:(e,r)=>(t&&(n.current=e),i.run(e,r)),getContext:()=>{let r=i.getStore();if(r)return r;if(t&&n.current)return n.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:r=>{let a=i.getStore()??(t?n.current:null);if(!a)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(a,r)}};return mP(r,o),o}let mj=mT({name:"http-request-context"});mj.setContext;let mC=mj.getContext,mO=mj.provider,mI=mT({name:"client-info-context"});mI.setContext;let mN=mI.getContext;mI.provider;let mq=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),mA=e=>{if(!mq(e)||"string"!=typeof e.name||"string"!=typeof e.version)return;let t={name:e.name,version:e.version};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.websiteUrl&&(t.websiteUrl=e.websiteUrl),"string"==typeof e.description&&(t.description=e.description),t},mz=e=>{if(e&&"initialize"===e.method&&mq(e.params))return mA(e.params.clientInfo)},mM=(e,t)=>{let r=t.toLowerCase();for(let[t,a]of Object.entries(e)){if(t.toLowerCase()!==r)continue;let e=Array.isArray(a)?a[0]:a;if("string"!=typeof e)break;let i=e.trim();return i.length>0?i:void 0}},mL=new Set(["message","mode","requestedSchema"]),mZ=new Set(["elicitationId","message","mode","url"]),mV=new Set(["properties","required","type"]),mD=new Set(["default","description","format","maxLength","minLength","title","type"]),mU=new Set(["default","description","enum","enumNames","title","type"]),mF=new Set(["default","description","title","type"]),mH=new Set(["default","description","maximum","minimum","title","type"]),mJ=new Set(["date","date-time","email","uri"]);async function mB(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;mG(e,"Elicitation request must be a plain object."),mK(e,mZ,"URL elicitation"),mW(e.message,"URL elicitation requires a string message."),mX(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),mX(e.url,"URL elicitation requires a non-empty URL.");try{t=new URL(e.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(e),e;if("form"!==t)throw Error(`Unsupported elicitation mode "${String(e.mode)}". Expected "form" or "url".`);return function(e){mG(e,"Elicitation request must be a plain object."),mK(e,mL,"Form elicitation"),mW(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(mG(t,"Form elicitation requires a flat object schema."),mK(t,mV,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(mG(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(mG(t,`Form elicitation field "${e}" must be a plain object.`),mY(t.title,`Form elicitation field "${e}" title must be a string.`),mY(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(mK(t,mU,`Form elicitation field "${e}"`),m0(t.enum,`Form elicitation field "${e}" enum values must be strings.`),r=t.enumNames,a=`Form elicitation field "${e}" enumNames must be strings.`,void 0!==r&&m0(r,a),void 0!==t.enumNames&&t.enumNames.length!==t.enum.length)throw Error(`Form elicitation field "${e}" enumNames length must match enum length.`);if(mY(t.default,`Form elicitation field "${e}" default must be a string.`),void 0!==t.default&&!t.enum.includes(t.default))throw Error(`Form elicitation field "${e}" default must be one of its enum values.`);return}if("string"===t.type&&!("enum"in t)){mK(t,mD,`Form elicitation field "${e}"`),mQ(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),mQ(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),mY(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(mY(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!mJ.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(mJ).join(", ")}.`);return}if("boolean"===t.type){if(mK(t,mF,`Form elicitation field "${e}"`),void 0!==t.default&&"boolean"!=typeof t.default)throw Error(`Form elicitation field "${e}" default must be a boolean.`);return}if("number"===t.type||"integer"===t.type){mK(t,mH,`Form elicitation field "${e}"`),mQ(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),mQ(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),mQ(t.default,`Form elicitation field "${e}" default must be a number.`);return}throw Error(`Form elicitation field "${e}" uses unsupported type "${String(t.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(e,r);if(void 0!==t.required){if(!Array.isArray(t.required)||t.required.some(e=>"string"!=typeof e))throw Error("Form elicitation schema required fields must be a string array.");for(let e of t.required)if(!(e in t.properties))throw Error(`Form elicitation schema required field "${e}" is not defined in properties.`)}}(e),{...e,mode:"form"}}(t);try{let t=await e.mcpReq.elicitInput(a,r);return{...t,content:t.content??void 0}}catch(e){if(e instanceof sk&&e.code===sR.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function mK(e,t,r){let a=Object.keys(e).filter(e=>!t.has(e));if(0!==a.length)throw Error(`${r} includes unsupported key(s): ${a.join(", ")}.`)}function mG(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function mW(e,t){if("string"!=typeof e)throw Error(t)}function mX(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function mY(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function mQ(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function m0(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let m1=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),m2=new Set(["task","toolChoice","tools"]),m9=new Set(["text","image","audio"]);async function m4(e,t,r){let a=function(e){m3(e,"Sampling request must be a plain object.");let t=Object.keys(e),r=t.filter(e=>m2.has(e));if(r.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${r.join(", ")}.`);let a=t.filter(e=>!m1.has(e));if(a.length>0)throw Error(`Sampling request includes unsupported key(s): ${a.join(", ")}.`);if(!Array.isArray(e.messages)||0===e.messages.length)throw Error("Sampling requires at least one message.");for(let[t,r]of e.messages.entries())!function(e,t){if(m3(t,`Sampling message at index ${e} must be a plain object.`),"user"!==t.role&&"assistant"!==t.role)throw Error(`Sampling message at index ${e} requires role "user" or "assistant".`);let r=t.content;m3(r,`Sampling message at index ${e} requires a content object.`);let a=r.type;if("string"!=typeof a||!m9.has(a))throw Error(`Sampling message at index ${e} uses unsupported content type "${String(a)}". Supported types are text, image, and audio.`);if("text"===a&&"string"!=typeof r.text)throw Error(`Sampling message at index ${e} requires string text content.`);if(("image"===a||"audio"===a)&&("string"!=typeof r.data||"string"!=typeof r.mimeType))throw Error(`Sampling message at index ${e} requires base64 data and a mimeType.`)}(t,r);if("number"!=typeof e.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return e}(t);try{return await e.mcpReq.requestSampling(a,r)}catch(e){if(e instanceof sk&&e.code===sR.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function m3(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}let m6={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function m5(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=m6[e.type];return t?t(e):{valid:!0}}function m8(e,t,r,a){if(null===e||"object"!=typeof e||Array.isArray(e))throw Error(`Tool "${r}" ${a}: expected a plain object.`);let i=new Set(Object.keys(t)),n=Object.keys(e).filter(e=>!i.has(e));if(n.length>0)throw Error(`Tool "${r}" ${a}: unrecognized key(s): ${n.join(", ")}`);for(let[i,n]of Object.entries(t))try{n.parse(e[i])}catch(e){throw Error(`Tool "${r}" ${a}: ${e?.message??`invalid field "${i}"`}`)}}function m7(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function he(e){let t=e.mcpReq.envelope,r=mA(t?.[iE]);if(!r)try{let e,t=mC();r=t.clientInfo??(e=t.headers,mA({name:mM(e,"x-mcp-client-name"),version:mM(e,"x-mcp-client-version"),title:mM(e,"x-mcp-client-title"),websiteUrl:mM(e,"x-mcp-client-website-url"),description:mM(e,"x-mcp-client-description")}))}catch{}if(!r)try{r=mN().clientInfo}catch{}return r}function ht(e){return e.endsWith(".tsx")}let hr=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}};function ha(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[i,n]of Object.entries(r)){let r=a?`${a}/${i}`:i;!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp?t[r]=n:e(n,r)}}(e),t}let hi=["ui/resourceUri","resourceUri","visibility"],hn=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"],ho=mT({name:"request-context",fallback:!1});function hs(e){let t=[...e];return(e,r,a)=>(function(e,t,r){let a,i=new Map;if(e.http){let e=mC(),t=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,Array.isArray(t)?Object.freeze([...t]):t]));a=Object.freeze({id:e.id,headers:Object.freeze(t)})}return ho.provider(Object.freeze({clientInfo:t?Object.freeze({...t}):void 0,http:a,signal:e.mcpReq.signal,set(e,t){i.set(e,t)},get:e=>i.get(e),async progress(t,r){let a=e.mcpReq._meta?.progressToken;void 0!==a&&await e.mcpReq.notify({method:"notifications/progress",params:{progressToken:a,progress:t,...void 0===r?{}:{total:r}}})},log:(t,r)=>e.mcpReq.log(t,r)}),r)})(r,he(r),async()=>{if(0===t.length)return a();let r=Object.freeze({...function(){try{return ho.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),method:e.method,params:Object.freeze({...e.params})}),i=-1,n=async e=>{if(e<=i)throw Error("MCP middleware next() can only be called once");i=e;let o=t[e];return o?o(r,()=>n(e+1)):a()};return n(0)})}let hl=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function hc(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function hu(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function hd(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let i=t[r].slice(1,-1),n=t.slice(r+1),o=n[n.length-1];if(o&&o.includes(".")){let e=o.split(".")[0];"index"!==e?n[n.length-1]=e:n.pop()}let s=[],l=[],c=n.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return s.push(t),`{${t}}`}}),u=`${i}://${c.join("/")}`,d=s.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:i,parameters:s,pathSegments:l,type:d}}function hp(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}function hm(e){return Error(`[xmcp] Invalid prompt file: ${e}
|
|
89
|
+
-> Default export must be a prompt handler function.`)}async function hh(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw hm(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw hm(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default prompt handler."}}:{skipped:!1,path:e,promptModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.promptModule)}return{promptModules:t,skippedPrompts:r}}let hf=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load prompt file: ${t}
|
|
90
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function hy(e){return Error(`[xmcp] Invalid resource file: ${e}
|
|
91
|
+
-> Default export must be a resource handler function.`)}async function hg(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw hy(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw hy(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default resource handler."}}:{skipped:!1,path:e,resourceModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.resourceModule)}return{resourceModules:t,skippedResources:r}}let hv=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load resource file: ${t}
|
|
92
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function h_(e){return Error(`[xmcp] Invalid tool file: ${e}
|
|
93
|
+
-> Default export must be a tool handler function.`)}async function hb(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw h_(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw h_(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default tool handler."}}:{skipped:!1,path:e,toolModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.toolModule)}return{toolModules:t,skippedTools:r}}let hS=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load tool file: ${t}
|
|
94
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),h$=INJECTED_TOOLS,hw=INJECTED_PROMPTS,hR=INJECTED_RESOURCES,hk=SERVER_INFO;async function hx(e,t,a,i){let n=await INJECTED_MIDDLEWARE?.(),o=function(e){if(void 0===e)return[];let t=Array.isArray(e)?[...e]:[e];if(!t.every(e=>"function"==typeof e))throw Error("src/middleware.ts must export mcp as a function or an array of functions");return t}(n?.mcp);return hr.clear(),!function(e,t,r){let a=e.server,i=a.setRequestHandler,n=hs(t);a.setRequestHandler=(e,...t)=>{if(hl.has(e)&&1===t.length&&"function"==typeof t[0]){let e=t[0];t[0]=(t,r)=>n({method:t.method,params:t.params??{}},r,()=>e(t,r))}Reflect.apply(i,a,[e,...t])};try{r()}finally{a.setRequestHandler=i}}(e,o,()=>{!function(e,t,r=[]){t.forEach((t,a)=>{var i,n;let o,s,l,c={name:hu(a),description:"No description provided"},{default:u,metadata:d,schema:p,outputSchema:m}=t;if("object"==typeof d&&null!==d&&Object.assign(c,d),"function"==typeof u&&"__x402"in u){let e=global.__XMCP_X402_REGISTRY;e&&e.set(c.name,u.__x402)}let h={};if(hc(p)?h=p:null!=p&&console.warn(`Invalid schema for tool "${c.name}" at ${a}. Expected Record<string, z.ZodType>`),null!=m)if(hc(m))o=m;else throw Error(`Invalid outputSchema for tool "${c.name}" at ${a}. Expected Record<string, z.ZodType>`);c.annotations={...c.annotations??{}},void 0===c.annotations.title&&(c.annotations.title=c.name),void 0===c._meta&&(c._meta={});let f=ht(a),y=!!(i=c._meta)&&"object"==typeof i&&"ui"in i&&"object"==typeof i.ui||f,g=c._meta;if(y){let e=`ui://app/${c.name}.html`;c._meta.ui||(c._meta.ui={}),c._meta.ui.resourceUri||(c._meta.ui.resourceUri=e);let t=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,i={},n={};for(let[e,t]of Object.entries(a))hi.includes(e)?i[e]=t:hn.includes(e)?n[e]=t:i[e]=t;Object.keys(i).length>0&&(t.ui=i),Object.keys(n).length>0&&(r.ui=n)}for(let[r,a]of Object.entries(e))"ui"!==r&&(t[r]=a);return{toolMeta:t,resourceMeta:r}}(g);g=t.toolMeta;let r=t.resourceMeta;r.ui=r.ui||{},r.ui.csp=r.ui.csp||{},r.ui.csp.resourceDomains=r.ui.csp.resourceDomains||[],r.ui.csp.resourceDomains.includes("https://esm.sh")||r.ui.csp.resourceDomains.push("https://esm.sh"),hr.add(c.name,{name:c.name,uri:e,handler:u,mimeType:"text/html;profile=mcp-app",_meta:r,toolPath:f?a:void 0})}let v=ha(g),_=y?v:void 0;s=ht(a)&&y?async(e,t)=>({content:[{type:"text",text:""}],_meta:_,structuredContent:{args:e}}):function(e,t,r,a="unknown-tool"){return async(i,n)=>{let o,s,l=e(i,(o=he(n),s=function(e){if(!e)return;let t={};return e.headers.forEach((e,r)=>{t[r]=e}),t}(n.http?.req),{signal:n.mcpReq.signal,authInfo:n.http?.authInfo,sessionId:n.sessionId,_meta:n.mcpReq._meta,requestId:n.mcpReq.id,requestInfo:s?{headers:s}:void 0,clientInfo:o,sendNotification:e=>n.mcpReq.notify(e),sendRequest:(e,t,r)=>n.mcpReq.send(e,t,r),elicit:(e,t)=>mB(n,e,t),sample:(e,t)=>m4(n,e,t),inputResponses:n.mcpReq.inputResponses,requestState:n.mcpReq.requestState}));if(l instanceof Promise&&(l=await l),lj(l))return l;if("string"==typeof l||"number"==typeof l){if(r){let e=Object.entries(r);if(1===e.length){let[t,r]=e[0];try{return r.parse(l),{content:[{type:"text",text:"number"==typeof l?`${l}`:l}],structuredContent:{[t]:l}}}catch{}}}return m7(t)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:t}:{content:[{type:"text",text:"number"==typeof l?`${l}`:l}]}}if(!r||!l||"object"!=typeof l||Array.isArray(l)||"structuredContent"in l||"content"in l&&Array.isArray(l.content)||"_meta"in l||"isError"in l||(m8(l,r,a,"returned data that does not match outputSchema"),l={structuredContent:l}),l&&"object"==typeof l&&"_meta"in l&&!("content"in l)&&!("structuredContent"in l)){let e=l._meta;if(m7(e))return{content:[{type:"text",text:""}],_meta:e}}if(!l||"object"!=typeof l){let e=null===l?"null":typeof l,t=void 0===l?"undefined":null===l?"null":"object"==typeof l?JSON.stringify(l,null,2):String(l);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
|
|
95
95
|
|
|
96
96
|
Expected CallToolResult format:
|
|
97
97
|
{
|
|
@@ -120,7 +120,7 @@ Or for widget metadata only:
|
|
|
120
120
|
_meta: {
|
|
121
121
|
"ui/...": ...
|
|
122
122
|
}
|
|
123
|
-
}`)}let
|
|
123
|
+
}`)}let c="content"in l&&Array.isArray(l.content),u="structuredContent"in l,d="isError"in l&&!0===l.isError;if(!c&&!u&&!d){let e=JSON.stringify(l,null,2);throw Error(`Tool handler must return at least 'content' or 'structuredContent'. Got: ${e}
|
|
124
124
|
|
|
125
125
|
Expected CallToolResult format:
|
|
126
126
|
{
|
|
@@ -141,7 +141,7 @@ Or both for backwards compatibility:
|
|
|
141
141
|
{
|
|
142
142
|
content: [{ type: "text", text: "fallback" }],
|
|
143
143
|
structuredContent: { your: "data" }
|
|
144
|
-
}`)}if(c&&!
|
|
144
|
+
}`)}if(d&&!c&&!u){let{isError:e,...t}=l,r=Object.keys(t).length>0?`Tool execution failed: ${JSON.stringify(t)}`:"Tool execution failed";l.content=[{type:"text",text:r}],c=!0}if(r&&u&&!d&&m8(l.structuredContent,r,a,"returned structuredContent that does not match outputSchema"),!c&&u&&(l.content=[{type:"text",text:JSON.stringify(l.structuredContent)}],c=!0),c)for(let e=0;e<l.content.length;e++){let t=l.content[e],r=m5(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
|
|
145
145
|
|
|
146
146
|
Content item: ${JSON.stringify(t,null,2)}
|
|
147
147
|
|
|
@@ -150,7 +150,7 @@ Expected content formats:
|
|
|
150
150
|
- Image: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
151
151
|
- Audio: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
152
152
|
- Resource: { type: "resource_link", name: "name", uri: "uri" }
|
|
153
|
-
All content types support an optional "_meta" object property`)}if(
|
|
153
|
+
All content types support an optional "_meta" object property`)}if(u){let e=l.structuredContent;if(null===e||"object"!=typeof e||Array.isArray(e)){let t=Array.isArray(e)?"array":typeof e;throw Error(`'structuredContent' must be a plain object (not an array or primitive). Got ${t}: ${JSON.stringify(e,null,2)}
|
|
154
154
|
|
|
155
155
|
Expected format:
|
|
156
156
|
{
|
|
@@ -158,18 +158,20 @@ Expected format:
|
|
|
158
158
|
key: "value",
|
|
159
159
|
nested: { data: "here" }
|
|
160
160
|
}
|
|
161
|
-
}`)}}return
|
|
161
|
+
}`)}}return l}}(u,_,o,c.name);let b={title:c.annotations?.title,description:c.description,inputSchema:mk(h),outputSchema:o?mk(o,{strict:!0}):void 0,annotations:c.annotations,_meta:v};e.registerTool(c.name,b,(n=c.name,l=hs(r),(e,t)=>l({method:"tools/call",params:{name:n,arguments:e}},t,()=>s(e,t))))})}(e,t,o),a.forEach((t,r)=>{let a=hu(r),i={name:a,title:a,description:"No description provided"},n={},{default:o,metadata:s,schema:l}=t;"object"==typeof s&&null!==s&&Object.assign(i,s);let c=function(e,t="assistant"){return async(r,a)=>{let i,n=e(r,a);if(n instanceof Promise&&(n=await n),Array.isArray(n)||null!==n&&"object"==typeof n&&"messages"in n){let e=Array.isArray(n)?{messages:n}:n,t=await cr.GetPromptResult["~standard"].validate(e);if(t.issues){let e=t.issues.map(e=>{let t=e.path?.map(e=>"object"==typeof e?e.key:e).join(".");return`${t||"result"}: ${e.message}`});throw Error(`Invalid prompt result: ${e.join("; ")}`)}return e}if("string"==typeof n||"number"==typeof n)i={type:"text",text:"number"==typeof n?`${n}`:n};else{let e=m5(n);if(e.valid)i=n;else{let t=null===n?"null":typeof n,r=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Prompt handler must return a PromptContent object, string, number, PromptMessage[], or GetPromptResult. Got ${t}: ${r}
|
|
162
162
|
|
|
163
163
|
Validation error: ${e.error}
|
|
164
164
|
|
|
165
165
|
Expected formats:
|
|
166
166
|
- String: "your text here"
|
|
167
167
|
- Number: 42
|
|
168
|
+
- Messages: [{ role: "user", content: { type: "text", text: "your text here" } }]
|
|
169
|
+
- Prompt result: { description: "optional description", messages: [...] }
|
|
168
170
|
- Text content: { type: "text", text: "your text here" }
|
|
169
171
|
- Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
170
172
|
- Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
171
173
|
- Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
|
|
172
|
-
- All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:i}]}}}(o,i.role||"assistant");
|
|
174
|
+
- All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:i}]}}}(o,i.role||"assistant");hc(l)?Object.assign(n,l):null!=l&&console.warn(`Invalid schema for prompt "${i.name}" at ${r}. Expected Record<string, z.ZodType>`),e.registerPrompt(i.name,{title:i.title,description:i.description,argsSchema:mk(n)},c)}),[...hr.getAll()].forEach(([t,a])=>{let i=a.mimeType||"text/html;profile=mcp-app",n=a?._meta?ha(a._meta):void 0,o={name:a.name,description:`Auto-generated resource for ${a.name} tool`,mimeType:a.mimeType,_meta:n},s=async(e,t)=>{if(a.mimeType&&a.toolPath)try{var n;let e,t,o=(n=a.toolPath,IS_CLOUDFLARE?function(e){let{normalizedPath:t,baseName:r}=hp(e),a=5381;for(let e=0;e<t.length;e++)a=Math.imul(a,33)+t.charCodeAt(e)>>>0;let i=a.toString(16).slice(0,6).padStart(6,"0");return`${r}_${i}`}(n):function(e){let{normalizedPath:t,baseName:a}=hp(e),i=r(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${a}_${i}`}(n)),s=function(e){if(INJECTED_CLIENT_BUNDLES)return INJECTED_CLIENT_BUNDLES[e]||null;if(!IS_CLOUDFLARE)try{let t=r(9896),a=r(6928);for(let r of[a.join(process.cwd(),"dist","client"),a.join(process.cwd(),"client")]){let i=a.join(r,`${e}.bundle.js`),n=a.join(r,`${e}.bundle.css`);if(t.existsSync(i)){let e,r=t.readFileSync(i,"utf-8");return t.existsSync(n)&&(e=t.readFileSync(n,"utf-8")),{js:r,css:e}}}}catch{}return null}(o);if(!s)throw Error(`React client bundle not found for "${a.name}" (bundle: "${o}").
|
|
173
175
|
React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
|
|
174
176
|
Please re-run the build so the framework can regenerate the bundle.`);let l=s.js,c=s.css,u=(e=`
|
|
175
177
|
<script type="module">
|
|
@@ -224,7 +226,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=s.js
|
|
|
224
226
|
<div id="root"></div>
|
|
225
227
|
${e}
|
|
226
228
|
</body>
|
|
227
|
-
</html>`);return{contents:[{uri:a.uri,text:u,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let o=a.handler({},t);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:a.uri,text:o,mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let e=o.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:a.uri,text:e.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}};e.registerResource(a.name,a.uri,o,s)}),i.forEach((t,r)=>{let a={name:
|
|
229
|
+
</html>`);return{contents:[{uri:a.uri,text:u,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let o=a.handler({},t);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:a.uri,text:o,mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let e=o.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:a.uri,text:e.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}};e.registerResource(a.name,a.uri,o,s)}),i.forEach((t,r)=>{let a={name:hu(r),description:"No description provided"},{default:i,metadata:n,schema:o,complete:s}=t;"object"==typeof n&&null!==n&&Object.assign(a,n);let l={};hc(o)?l=o:null!=o&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let c=hd(r);if(!c)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let u=c.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(u=u.endsWith(".html")?u:`${u}.html`);let d=function(e,t,r={}){let a=hd(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,i)=>{let n=e(function(e,t,r){let a={},i={};if(0===t.parameters.length)return i;let n=t.uriTemplate.split("://")[1]||"",o=e.split("://")[1]||"",s=n.split("/"),l=o.split("/");for(let e=0;e<s.length&&e<l.length;e++){let t=s[e],r=l[e],i=t.match(/^\{(.+)\}$/);i&&(a[i[1]]=r)}for(let e of t.parameters){let t=a[e],n=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!n){i[e]=t;continue}try{i[e]=n.parse(t)}catch(r){throw Error(`Invalid parameter "${e}": ${t}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return i}(t.href,a,r),i);if(n instanceof Promise&&(n=await n),"string"==typeof n)return{contents:[{uri:t.href,text:n}]};if(!n||"object"!=typeof n||!Array.isArray(n.contents)){let e=null===n?"null":typeof n,t=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${e}: ${t}
|
|
228
230
|
|
|
229
231
|
Expected ReadResourceResult format:
|
|
230
232
|
{
|
|
@@ -233,10 +235,10 @@ Expected ReadResourceResult format:
|
|
|
233
235
|
{ uri: "resource://uri", mimeType: "application/json", text: "json content" },
|
|
234
236
|
{ uri: "resource://uri", blob: base64data }
|
|
235
237
|
]
|
|
236
|
-
}`)}return n.contents.forEach(e=>{e.uri||(e.uri=t.href)}),n}}(i,r,
|
|
238
|
+
}`)}return n.contents.forEach(e=>{e.uri||(e.uri=t.href)}),n}}(i,r,l);if("direct"===c.type)e.registerResource(a.name,u,a,d);else{let t=Object.create(null);for(let e of c.parameters)s&&Object.hasOwn(s,e)&&(t[e]=s[e]);let r=new dh(u,{list:void 0,complete:t}),n=async(e,t,r)=>{let a={};for(let e of c.parameters){let r=t[e],i=l[e];if(void 0===r)throw Error(`Missing required parameter: ${e}. Available variables: ${Object.keys(t)}`);i?a[e]=i.parse(r):a[e]=r}let n=i(a,r);return n instanceof Promise&&(n=await n),"string"==typeof n?{contents:[{uri:e.href,text:n}]}:n};e.registerResource(a.name,r,a,n)}})}),e}async function hP(){let{toolModules:e,skippedTools:t}=await hb(h$);return hS(t),e}async function hE(){let{promptModules:e,skippedPrompts:t}=await hh(hw);return hf(t),e}async function hT(){let{resourceModules:e,skippedResources:t}=await hg(hR);return hv(t),e}async function hj(){let{instructions:e,...t}=hk,r=new dm(t,{instructions:e}),a=hP(),i=hE(),n=hT(),[o,s,l]=await Promise.all([a,i,n]);return hx(r,o,s,l)}let hC=require("node:crypto"),hO=HTTP_CORS_CONFIG,hI=(_=function(e,t={}){var r;let{legacy:a,onerror:i,responseMode:n}=t;if("function"==typeof a)throw TypeError("The 'legacy' option only accepts 'stateless' or 'reject', not a handler function. To serve 2025-era traffic with your own handler, route in user land with the exported isLegacyRequest(request) predicate in front of a strict (legacy: 'reject') handler.");let o=new Set,d=!1,p=e=>{try{i?.(e)}catch{}},m=t.bus??new di(p),h={toolsChanged:()=>m.publish({kind:"tools_list_changed"}),promptsChanged:()=>m.publish({kind:"prompts_list_changed"}),resourcesChanged:()=>m.publish({kind:"resources_list_changed"}),resourceUpdated:e=>m.publish({kind:"resource_updated",uri:e})},f=function(e){let{bus:t,onerror:r}=e,a=e.maxSubscriptions??1024,i=e.keepAliveMs??15e3,n=new Set;return{serve:function(e,o,s,l){var c,u,d;let p,m,h,f,y,g,v;if(n.size>=a)return r?.(Error(`subscriptions/listen refused: subscription limit reached (${a})`)),dn(e.id,-32603,"Subscription limit reached");let _=(c=e,(y=lf(lh).validateRequest("subscriptions/listen",c)).ok?y.value.params?.notifications:void 0);if(void 0===_)return dn(e.id,-32602,"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");let b=(u=_,d=s,g={},v=e=>void 0===d||!0===e,!0===u.toolsListChanged&&v(d?.tools?.listChanged)&&(g.toolsListChanged=!0),!0===u.promptsListChanged&&v(d?.prompts?.listChanged)&&(g.promptsListChanged=!0),!0===u.resourcesListChanged&&v(d?.resources?.listChanged)&&(g.resourcesListChanged=!0),void 0!==u.resourceSubscriptions&&u.resourceSubscriptions.length>0&&v(d?.resources?.subscribe)&&(g.resourceSubscriptions=[...u.resourceSubscriptions]),g),S=e.id,$=new TextEncoder,w=!1,R=e=>{if(!w)try{p.enqueue($.encode(e))}catch(e){r?.(e instanceof Error?e:Error(String(e)))}},k=(e,t)=>{R(`event: message
|
|
237
239
|
data: ${JSON.stringify({jsonrpc:"2.0",method:e,params:t})}
|
|
238
240
|
|
|
239
241
|
`)},x=e=>{if(!w){e&&R(`event: message
|
|
240
242
|
data: ${JSON.stringify({jsonrpc:"2.0",id:S,result:{resultType:"complete",_meta:{[iC]:S,[iT]:l}}})}
|
|
241
243
|
|
|
242
|
-
`),w=!0;try{m?.()}catch(e){r?.(e instanceof Error?e:Error(String(e)))}void 0!==h&&clearInterval(h),f?.(),n.delete(x);try{p.close()}catch{}}},P=new ReadableStream({start(e){p=e;let r=dn({method:"notifications/subscriptions/acknowledged",params:{notifications:b}},S);k(r.method,r.params),m=t.subscribe(e=>{if(w||!function(e,t){switch(t.kind){case"tools_list_changed":return!0===e.toolsListChanged;case"prompts_list_changed":return!0===e.promptsListChanged;case"resources_list_changed":return!0===e.resourcesListChanged;case"resource_updated":return void 0!==e.resourceSubscriptions&&e.resourceSubscriptions.includes(t.uri)}}(b,e))return;let t=dn(function(e){switch(e.kind){case"tools_list_changed":return{method:"notifications/tools/list_changed"};case"prompts_list_changed":return{method:"notifications/prompts/list_changed"};case"resources_list_changed":return{method:"notifications/resources/list_changed"};case"resource_updated":return{method:"notifications/resources/updated",params:{uri:e.uri}}}}(e),S);k(t.method,t.params)}),h=dr(i,()=>R(": keepalive\n\n")),n.add(x)},cancel(){x(!1)}});if(void 0!==o)if(o.aborted)x(!1);else{let e=()=>x(!1);o.addEventListener("abort",e,{once:!0}),f=()=>o.removeEventListener("abort",e)}return new Response(P,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let e of n)e(!0)},get openCount(){return n.size}}}({bus:m,maxSubscriptions:t.maxSubscriptions??1024,keepAliveMs:t.keepAliveMs??15e3,onerror:p});"json"===n&&console.warn("responseMode: 'json' drops mid-call notifications. subscriptions/listen streams are always served over SSE regardless; other notifications emitted before a result are dropped.");let y="reject"===a?void 0:(r=t.keepAliveMs,async(t,a)=>{if("POST"!==t.method.toUpperCase())return dx(405,-32e3,"Method not allowed.");try{let i=await e({era:"legacy",...a?.authInfo!==void 0&&{authInfo:a.authInfo},requestInfo:t}),n=new dR({sessionIdGenerator:void 0,...void 0!==r&&{keepAliveMs:r}});await i.connect(n);let o=()=>{n.close().catch(()=>{}),i.close().catch(()=>{})};t.signal?.addEventListener("abort",o,{once:!0});let s=await n.handleRequest(t,{...a?.authInfo!==void 0&&{authInfo:a.authInfo},...a?.parsedBody!==void 0&&{parsedBody:a.parsedBody}});if(null===s.body||"text/event-stream"!==cp(s.headers.get("content-type")))return o(),s;let l=s.body.getReader(),c=!1,u=()=>{c||(c=!0,o())},d=new ReadableStream({pull:async e=>{try{let{done:t,value:r}=await l.read();if(t){u(),e.close();return}void 0!==r&&e.enqueue(r)}catch(t){u(),e.error(t)}},cancel:e=>(u(),l.cancel(e).catch(()=>{}))});return new Response(d,{status:s.status,statusText:s.statusText,headers:s.headers})}catch(e){try{p?.(dE(e))}catch{}return dT(dk(a?.parsedBody))}});async function g(r,a,i){var d,m;let h=r.classification.revision;if(void 0===h||!sj.includes(h)){let e=new s8({supported:[...sj],requested:h??"unknown"});return p(e),dx(400,e.code,e.message,e.data,dk(r.message))}let y=function(e,t){if("request"!==t.messageKind)return;let r=t.message.method;if(void 0===e.mcpMethodHeader)return lH("method-header-missing","(missing)",`the body names method ${r} but the required Mcp-Method header is absent`,"standard-header-validation");let a=Object.hasOwn(lJ,r)?lJ[r]:void 0;if(void 0===a)return;let i=t.message.params?.[a],n="string"==typeof i?i:void 0;if(void 0===e.mcpNameHeader){if(void 0===n)return;return lH("name-header-missing","(missing)",`the body carries params.${a}="${n}" but the required Mcp-Name header is absent`,"standard-header-validation")}let o=lB(e.mcpNameHeader),s=lZ(o);return void 0===s?lH("name-header-invalid-encoding",o,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==n&&s!==n?lH("name-header-mismatch",o,`the body carries params.${a}="${n}" but the Mcp-Name header names "${s}"`,"standard-header-validation"):void 0}({httpMethod:a.method,mcpMethodHeader:a.headers.get("mcp-method")??void 0,mcpNameHeader:a.headers.get("mcp-name")??void 0},r);if(void 0!==y)return p(Error(`Rejected inbound request (${y.cell}): ${y.message}`)),dP(y,dk(r.message));let g="request"===r.messageKind?lS(r.message.params):void 0,v=g?.[ij];if("request"===r.messageKind){let e=Object.hasOwn(sx,d=r.message.method)?sx[d]:void 0;if(void 0!==e){let t=sE(e,v);if(void 0!==t){let e=new s7({requiredCapabilities:t});return p(e),dx(lU[e.code]??400,e.code,e.message,e.data,r.message.id)}}}let _=await e({era:"modern",...void 0!==i&&{authInfo:i},requestInfo:a}),b=_ instanceof dp?_.server:_;if("request"===r.messageKind&&"subscriptions/listen"===r.message.method){let e=b.getCapabilities(),t=u(b);return _.close().catch(p),f.serve(r.message,a.signal,e,t)}if("request"===r.messageKind&&"tools/call"===r.message.method&&_ instanceof dp){let e=r.message.params,t="string"==typeof e?.name?e.name:void 0,i=void 0===t?void 0:_.toolInputSchemaJson(t);if(void 0!==i){let t=lN(i);if(t.valid&&t.declarations.length>0){let i=function(e,t,r){for(let a of e){let e=`Mcp-Param-${a.headerName}`,i=r.get(e),n=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,a.path);if(null==n)continue;let o=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)}}(n);if(void 0===o)continue;if(null===i)return lV("param-header-missing",e,`the body carries ${lz(a.path)}=${JSON.stringify(n)} but the ${e} header is absent`);let s=lZ(i);if(void 0===s)return lV("param-header-invalid-encoding",e,`the ${e} header carries an invalid Base64 sentinel value`);if(!(("integer"===a.type||"number"===a.type)&&lL.test(s)&&"number"==typeof n?Number(s)===n:s===o))return lV("param-header-mismatch",e,`the ${e} header decodes to ${JSON.stringify(s)} but the body carries ${lz(a.path)}=${JSON.stringify(n)}`)}}(t.declarations,e?.arguments,a.headers);if(void 0!==i)return _.close().catch(p),p(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dP(i,r.message.id)}}}s(b,h),c(b,sj),void 0!==g&&(m={clientInfo:g[iE],clientCapabilities:v},l(b,m));let S=b.onclose;o.add(b),b.onclose=()=>{o.delete(b),S?.()};try{let e=await dw(_,r.message,{classification:r.classification,request:a,...void 0!==i&&{authInfo:i},...void 0!==n&&{responseMode:n},...void 0!==t.keepAliveMs&&{keepAliveMs:t.keepAliveMs}});return"notification"===r.messageKind&&queueMicrotask(()=>void b.close().catch(()=>{})),e}catch(e){if(e instanceof sk&&e.code===sR.ConnectionClosed)return new Response(null,{status:499});return await b.close().catch(()=>{}),o.delete(b),p(dE(e)),dT(dk(r.message))}}async function v(e,t,r,a){if(void 0!==y)return y(t,{...void 0!==r&&{authInfo:r},...void 0!==a&&{parsedBody:a}});let i=function(e,t){switch(e.reason){case"http-method":return lF("http-method","modern-only-method-not-allowed",405,new s3(-32e3,"Method not allowed."),!0);case"batch":return lF("jsonrpc-shape","modern-only-batch-not-supported",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return lF("jsonrpc-shape","modern-only-response-post",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return lF("era-classification","modern-only-missing-envelope",400,void 0===r?new s3(s4.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new s8({supported:[...t],requested:r}),!0)}}}(e,sj);return void 0===i?new Response(null,{status:202}):(p(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),dP(i,dk(a)))}async function _(e,t){let r=t?.authInfo;if("POST"===e.method.toUpperCase()&&!cm(e.headers.get("content-type")))return p(Error("Unsupported Media Type: Content-Type must be application/json")),dx(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let a=await dj(e,t?.parsedBody);if("unreadable-body"===a.step)return dx(400,-32700,"Parse error: the request body could not be read");if("no-json-body"===a.step)return void 0!==y?y(a.forwardRequest,{...void 0!==r&&{authInfo:r}}):dx(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:i,body:n,parsedBody:o,forwardRequest:s}=a;try{switch(i.kind){case"reject":return p(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dP(i,dk(n));case"modern":return await g(i,e,r);case"legacy":return await v(i,s,r,o)}}catch(e){return p(dE(e)),dT(dk(n))}}return{fetch:async(e,t)=>{if(d)throw Error("This MCP handler has been closed");try{return await _(e,t)}catch(e){return p(dE(e)),dT(dk(t?.parsedBody))}},notify:h,bus:m,close:async()=>{d=!0,f.closeAll();let e=[...o].map(e=>e.close().catch(()=>{}));o.clear(),await Promise.all(e)}}}(hk,{legacy:"stateless",onerror:HTTP_CONFIG.debug?e=>console.error("[HTTP-server] MCP handler error:",e):void 0}),b={onerror:e=>console.error("[HTTP-server] Error handling MCP request:",e)},async(e,t,r)=>{let a,i;"function"==typeof r&&(r=void 0);let n=!1,o=new AbortController;t.on("close",()=>{n||o.abort()}),!0===t.destroyed&&o.abort();try{let t=await dW(e,r,{signal:o.signal});a=await _.fetch(t,{...void 0!==e.auth&&{authInfo:e.auth},...void 0!==r&&{parsedBody:r}})}catch(e){var s;try{b?.onerror?.(e instanceof Error?e:Error(String(e)))}catch{}s=function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return null;let{method:t,id:r}=e;return"string"!=typeof t?null:"string"==typeof r||"number"==typeof r?r:null}(r),a=Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:s},{status:500})}let l={};for(let[e,t]of a.headers)l[e]=t;if(t.writeHead(a.status,l),null===a.body){n=!0,t.end();return}t.on("drain",()=>{i?.(),i=void 0});let c=new Promise(e=>{o.signal.addEventListener("abort",()=>e(),{once:!0})});try{for await(let e of a.body){if(o.signal.aborted)break;!1===t.write(e)&&await Promise.race([new Promise(e=>{i=e}),c])}}catch{}n=!0,t.end()});async function hT(e,t){let r=(0,hx.randomUUID)(),a=(e=>{for(let t of Array.isArray(e)?e:[e]){let e=mA(t);if(e)return e}})(e.body);await mC({id:r,headers:e.headers,clientInfo:a},async()=>{for(let[r,a]of Object.entries(function(e,t){let r={};if(void 0!==e.origin){if(!0===e.origin)t&&(r["Access-Control-Allow-Origin"]=t);else if(!1!==e.origin)if(Array.isArray(e.origin)){let a=t&&e.origin.includes(t)?t:e.origin[0]||"*";r["Access-Control-Allow-Origin"]=a}else r["Access-Control-Allow-Origin"]=String(e.origin)}return void 0!==e.methods&&(r["Access-Control-Allow-Methods"]=Array.isArray(e.methods)?e.methods.join(","):String(e.methods)),void 0!==e.allowedHeaders&&(r["Access-Control-Allow-Headers"]=Array.isArray(e.allowedHeaders)?e.allowedHeaders.join(","):String(e.allowedHeaders)),void 0!==e.exposedHeaders&&(r["Access-Control-Expose-Headers"]=Array.isArray(e.exposedHeaders)?e.exposedHeaders.join(","):String(e.exposedHeaders)),"boolean"==typeof e.credentials&&(r["Access-Control-Allow-Credentials"]=String(e.credentials)),"number"==typeof e.maxAge&&(r["Access-Control-Max-Age"]=String(e.maxAge)),r}(hP,e.headers.origin)))t.setHeader(r,a);await hE(e,t,e.body)})}})(),a})());
|
|
244
|
+
`),w=!0;try{m?.()}catch(e){r?.(e instanceof Error?e:Error(String(e)))}void 0!==h&&clearInterval(h),f?.(),n.delete(x);try{p.close()}catch{}}},P=new ReadableStream({start(e){p=e;let r=ds({method:"notifications/subscriptions/acknowledged",params:{notifications:b}},S);k(r.method,r.params),m=t.subscribe(e=>{if(w||!function(e,t){switch(t.kind){case"tools_list_changed":return!0===e.toolsListChanged;case"prompts_list_changed":return!0===e.promptsListChanged;case"resources_list_changed":return!0===e.resourcesListChanged;case"resource_updated":return void 0!==e.resourceSubscriptions&&e.resourceSubscriptions.includes(t.uri)}}(b,e))return;let t=ds(function(e){switch(e.kind){case"tools_list_changed":return{method:"notifications/tools/list_changed"};case"prompts_list_changed":return{method:"notifications/prompts/list_changed"};case"resources_list_changed":return{method:"notifications/resources/list_changed"};case"resource_updated":return{method:"notifications/resources/updated",params:{uri:e.uri}}}}(e),S);k(t.method,t.params)}),h=da(i,()=>R(": keepalive\n\n")),n.add(x)},cancel(){x(!1)}});if(void 0!==o)if(o.aborted)x(!1);else{let e=()=>x(!1);o.addEventListener("abort",e,{once:!0}),f=()=>o.removeEventListener("abort",e)}return new Response(P,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let e of n)e(!0)},get openCount(){return n.size}}}({bus:m,maxSubscriptions:t.maxSubscriptions??1024,keepAliveMs:t.keepAliveMs??15e3,onerror:p});"json"===n&&console.warn("responseMode: 'json' drops mid-call notifications. subscriptions/listen streams are always served over SSE regardless; other notifications emitted before a result are dropped.");let y="reject"===a?void 0:(r=t.keepAliveMs,async(t,a)=>{if("POST"!==t.method.toUpperCase())return dP(405,-32e3,"Method not allowed.");try{let i=await e({era:"legacy",...a?.authInfo!==void 0&&{authInfo:a.authInfo},requestInfo:t}),n=new dk({sessionIdGenerator:void 0,...void 0!==r&&{keepAliveMs:r}});await i.connect(n);let o=()=>{n.close().catch(()=>{}),i.close().catch(()=>{})};t.signal?.addEventListener("abort",o,{once:!0});let s=await n.handleRequest(t,{...a?.authInfo!==void 0&&{authInfo:a.authInfo},...a?.parsedBody!==void 0&&{parsedBody:a.parsedBody}});if(null===s.body||"text/event-stream"!==cm(s.headers.get("content-type")))return o(),s;let l=s.body.getReader(),c=!1,u=()=>{c||(c=!0,o())},d=new ReadableStream({pull:async e=>{try{let{done:t,value:r}=await l.read();if(t){u(),e.close();return}void 0!==r&&e.enqueue(r)}catch(t){u(),e.error(t)}},cancel:e=>(u(),l.cancel(e).catch(()=>{}))});return new Response(d,{status:s.status,statusText:s.statusText,headers:s.headers})}catch(e){try{p?.(dT(e))}catch{}return dj(dx(a?.parsedBody))}});async function g(r,a,i){var d,m;let h=r.classification.revision;if(void 0===h||!sj.includes(h)){let e=new s8({supported:[...sj],requested:h??"unknown"});return p(e),dP(400,e.code,e.message,e.data,dx(r.message))}let y=function(e,t){if("request"!==t.messageKind)return;let r=t.message.method;if(void 0===e.mcpMethodHeader)return lH("method-header-missing","(missing)",`the body names method ${r} but the required Mcp-Method header is absent`,"standard-header-validation");let a=Object.hasOwn(lJ,r)?lJ[r]:void 0;if(void 0===a)return;let i=t.message.params?.[a],n="string"==typeof i?i:void 0;if(void 0===e.mcpNameHeader){if(void 0===n)return;return lH("name-header-missing","(missing)",`the body carries params.${a}="${n}" but the required Mcp-Name header is absent`,"standard-header-validation")}let o=lB(e.mcpNameHeader),s=lZ(o);return void 0===s?lH("name-header-invalid-encoding",o,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==n&&s!==n?lH("name-header-mismatch",o,`the body carries params.${a}="${n}" but the Mcp-Name header names "${s}"`,"standard-header-validation"):void 0}({httpMethod:a.method,mcpMethodHeader:a.headers.get("mcp-method")??void 0,mcpNameHeader:a.headers.get("mcp-name")??void 0},r);if(void 0!==y)return p(Error(`Rejected inbound request (${y.cell}): ${y.message}`)),dE(y,dx(r.message));let g="request"===r.messageKind?lS(r.message.params):void 0,v=g?.[ij];if("request"===r.messageKind){let e=Object.hasOwn(sx,d=r.message.method)?sx[d]:void 0;if(void 0!==e){let t=sE(e,v);if(void 0!==t){let e=new s7({requiredCapabilities:t});return p(e),dP(lU[e.code]??400,e.code,e.message,e.data,r.message.id)}}}let _=await e({era:"modern",...void 0!==i&&{authInfo:i},requestInfo:a}),b=_ instanceof dm?_.server:_;if("request"===r.messageKind&&"subscriptions/listen"===r.message.method){let e=b.getCapabilities(),t=u(b);return _.close().catch(p),f.serve(r.message,a.signal,e,t)}if("request"===r.messageKind&&"tools/call"===r.message.method&&_ instanceof dm){let e=r.message.params,t="string"==typeof e?.name?e.name:void 0,i=void 0===t?void 0:_.toolInputSchemaJson(t);if(void 0!==i){let t=lN(i);if(t.valid&&t.declarations.length>0){let i=function(e,t,r){for(let a of e){let e=`Mcp-Param-${a.headerName}`,i=r.get(e),n=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,a.path);if(null==n)continue;let o=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)}}(n);if(void 0===o)continue;if(null===i)return lV("param-header-missing",e,`the body carries ${lz(a.path)}=${JSON.stringify(n)} but the ${e} header is absent`);let s=lZ(i);if(void 0===s)return lV("param-header-invalid-encoding",e,`the ${e} header carries an invalid Base64 sentinel value`);if(!(("integer"===a.type||"number"===a.type)&&lL.test(s)&&"number"==typeof n?Number(s)===n:s===o))return lV("param-header-mismatch",e,`the ${e} header decodes to ${JSON.stringify(s)} but the body carries ${lz(a.path)}=${JSON.stringify(n)}`)}}(t.declarations,e?.arguments,a.headers);if(void 0!==i)return _.close().catch(p),p(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dE(i,r.message.id)}}}s(b,h),c(b,sj),void 0!==g&&(m={clientInfo:g[iE],clientCapabilities:v},l(b,m));let S=b.onclose;o.add(b),b.onclose=()=>{o.delete(b),S?.()};try{let e=await dR(_,r.message,{classification:r.classification,request:a,...void 0!==i&&{authInfo:i},...void 0!==n&&{responseMode:n},...void 0!==t.keepAliveMs&&{keepAliveMs:t.keepAliveMs}});return"notification"===r.messageKind&&queueMicrotask(()=>void b.close().catch(()=>{})),e}catch(e){if(e instanceof sk&&e.code===sR.ConnectionClosed)return new Response(null,{status:499});return await b.close().catch(()=>{}),o.delete(b),p(dT(e)),dj(dx(r.message))}}async function v(e,t,r,a){if(void 0!==y)return y(t,{...void 0!==r&&{authInfo:r},...void 0!==a&&{parsedBody:a}});let i=function(e,t){switch(e.reason){case"http-method":return lF("http-method","modern-only-method-not-allowed",405,new s3(-32e3,"Method not allowed."),!0);case"batch":return lF("jsonrpc-shape","modern-only-batch-not-supported",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return lF("jsonrpc-shape","modern-only-response-post",400,new s3(s4.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return lF("era-classification","modern-only-missing-envelope",400,void 0===r?new s3(s4.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new s8({supported:[...t],requested:r}),!0)}}}(e,sj);return void 0===i?new Response(null,{status:202}):(p(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),dE(i,dx(a)))}async function _(e,t){let r=t?.authInfo;if("POST"===e.method.toUpperCase()&&!ch(e.headers.get("content-type")))return p(Error("Unsupported Media Type: Content-Type must be application/json")),dP(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let a=await dC(e,t?.parsedBody);if("unreadable-body"===a.step)return dP(400,-32700,"Parse error: the request body could not be read");if("no-json-body"===a.step)return void 0!==y?y(a.forwardRequest,{...void 0!==r&&{authInfo:r}}):dP(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:i,body:n,parsedBody:o,forwardRequest:s}=a;try{switch(i.kind){case"reject":return p(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dE(i,dx(n));case"modern":return await g(i,e,r);case"legacy":return await v(i,s,r,o)}}catch(e){return p(dT(e)),dj(dx(n))}}return{fetch:async(e,t)=>{if(d)throw Error("This MCP handler has been closed");try{return await _(e,t)}catch(e){return p(dT(e)),dj(dx(t?.parsedBody))}},notify:h,bus:m,close:async()=>{d=!0,f.closeAll();let e=[...o].map(e=>e.close().catch(()=>{}));o.clear(),await Promise.all(e)}}}(hj,{legacy:"stateless",onerror:HTTP_CONFIG.debug?e=>console.error("[HTTP-server] MCP handler error:",e):void 0}),b={onerror:e=>console.error("[HTTP-server] Error handling MCP request:",e)},async(e,t,r)=>{let a,i;"function"==typeof r&&(r=void 0);let n=!1,o=new AbortController;t.on("close",()=>{n||o.abort()}),!0===t.destroyed&&o.abort();try{let t=await dX(e,r,{signal:o.signal});a=await _.fetch(t,{...void 0!==e.auth&&{authInfo:e.auth},...void 0!==r&&{parsedBody:r}})}catch(e){var s;try{b?.onerror?.(e instanceof Error?e:Error(String(e)))}catch{}s=function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return null;let{method:t,id:r}=e;return"string"!=typeof t?null:"string"==typeof r||"number"==typeof r?r:null}(r),a=Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:s},{status:500})}let l={};for(let[e,t]of a.headers)l[e]=t;if(t.writeHead(a.status,l),null===a.body){n=!0,t.end();return}t.on("drain",()=>{i?.(),i=void 0});let c=new Promise(e=>{o.signal.addEventListener("abort",()=>e(),{once:!0})});try{for await(let e of a.body){if(o.signal.aborted)break;!1===t.write(e)&&await Promise.race([new Promise(e=>{i=e}),c])}}catch{}n=!0,t.end()});async function hN(e,t){let r=(0,hC.randomUUID)(),a=(e=>{for(let t of Array.isArray(e)?e:[e]){let e=mz(t);if(e)return e}})(e.body);await mO({id:r,headers:e.headers,clientInfo:a},async()=>{for(let[r,a]of Object.entries(function(e,t){let r={};if(void 0!==e.origin){if(!0===e.origin)t&&(r["Access-Control-Allow-Origin"]=t);else if(!1!==e.origin)if(Array.isArray(e.origin)){let a=t&&e.origin.includes(t)?t:e.origin[0]||"*";r["Access-Control-Allow-Origin"]=a}else r["Access-Control-Allow-Origin"]=String(e.origin)}return void 0!==e.methods&&(r["Access-Control-Allow-Methods"]=Array.isArray(e.methods)?e.methods.join(","):String(e.methods)),void 0!==e.allowedHeaders&&(r["Access-Control-Allow-Headers"]=Array.isArray(e.allowedHeaders)?e.allowedHeaders.join(","):String(e.allowedHeaders)),void 0!==e.exposedHeaders&&(r["Access-Control-Expose-Headers"]=Array.isArray(e.exposedHeaders)?e.exposedHeaders.join(","):String(e.exposedHeaders)),"boolean"==typeof e.credentials&&(r["Access-Control-Allow-Credentials"]=String(e.credentials)),"number"==typeof e.maxAge&&(r["Access-Control-Max-Age"]=String(e.maxAge)),r}(hO,e.headers.origin)))t.setHeader(r,a);await hI(e,t,e.body)})}})(),a})());
|