xmcp 1.7.2 → 1.9.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/README.md +36 -12
- package/dist/client.js +1 -1
- package/dist/config/index.d.ts +7 -0
- package/dist/config/schemas/transport/http.d.ts +16 -0
- package/dist/config.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -15
- package/dist/runtime/adapter-express.js +23 -23
- package/dist/runtime/adapter-fastify.js +23 -23
- package/dist/runtime/adapter-fetch-cloudflare.js +22 -22
- package/dist/runtime/adapter-fetch.js +23 -23
- package/dist/runtime/adapter-nestjs.js +23 -23
- package/dist/runtime/adapter-nextjs.js +38 -38
- package/dist/runtime/cloudflare-worker.js +48 -48
- package/dist/runtime/contexts/request-context.d.ts +3 -1
- package/dist/runtime/http.js +30 -30
- package/dist/runtime/stdio.js +18 -18
- package/dist/runtime/transports/http/base-streamable-http.d.ts +1 -0
- package/dist/runtime/utils/mcp-middleware.d.ts +2 -2
- package/dist/runtime/utils/tools.d.ts +2 -2
- package/dist/runtime/vercel.js +30 -30
- package/dist/types/mcp-middleware.d.ts +16 -2
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a=r();for(var i in a)("object"==typeof exports?exports:t)[i]=a[i]}}(this,()=>(()=>{"use strict";var t={6982(t){t.exports=require("crypto")},9896(t){t.exports=require("fs")},6928(t){t.exports=require("path")}},r={};function a(i){var n=r[i];if(void 0!==n)return n.exports;var o=r[i]={exports:{}};return t[i](o,o.exports,a),o.exports}a.d=(t,r)=>{for(var i in r)a.o(r,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{let t,r,n,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w;a.r(i),a.d(i,{xmcpHandler:()=>fL,withAuth:()=>fq,resourceMetadataOptions:()=>fM,serverCardHandler:()=>fZ,resourceMetadataHandler:()=>fA});var R,k,x,P,E,T,j,O,C,I,N,q,A,M=Object.create,z=Object.defineProperty,L=Object.getOwnPropertyDescriptor,Z=Object.getOwnPropertyNames,D=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty,F=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),U=(t,r,a)=>(a=null!=t?M(D(t)):{},((t,r,a,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var n,o=Z(r),s=0,l=o.length;s<l;s++)n=o[s],V.call(t,n)||n===a||z(t,n,{get:(t=>r[t]).bind(null,n),enumerable:!(i=L(r,n))||i.enumerable});return t})(!r&&t&&t.__esModule?a:z(a,"default",{value:t,enumerable:!0}),t));let H=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),J=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),B=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),K=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function G(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function W(t,r="|"){return t.map(t=>ev(t)).join(r)}function Y(t,r){return"bigint"==typeof r?r.toString():r}class X{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function Q(t){return new X(t)}function ee(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let et=Symbol("evaluating");function er(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function ea(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function ei(t){return ea(t._zod.def)??t._zod.def.shape}function en(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return er(this,r,t),t},enumerable:!0,configurable:!0})}function eo(t,r,a){r in t?er(t,r,a):t[r]=a}function es(t,r,a,i){let n=ei(r);for(let o of a){let a=Object.getOwnPropertyDescriptor(n,o);a.enumerable&&(a.get?en(t,o,()=>{let t=r._zod.def.shape[o];return i?i(t,o):t}):eo(t,o,i?i(a.value,o):a.value))}}function el(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let ec="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function eu(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ed=Q(()=>{if(eU.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function ep(t){if(!1===eu(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==eu(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function em(t){return ep(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let eh=new Set(["string","number","symbol"]);function ef(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ey(t,r,a){let i=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(i._zod.parent=t),i}function eg(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function ev(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let e_={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]},eb={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function eS(t,r){let a=ei(t),i=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&i.push(t)}return i}function e$(t,r){let a={};es(a,t,Reflect.ownKeys(ei(t)));for(let t of Reflect.ownKeys(r)){let i=Object.getOwnPropertyDescriptor(r,t);i.enumerable&&(i.get?en(a,t,()=>r[t]):eo(a,t,i.value))}return a}function ew(t,r,a,i="partial"){let n=r._zod.def.checks;if(n&&n.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let o=a?new Set(eS(r,a)):void 0,s={};return es(s,r,Reflect.ownKeys(ei(r)),t&&((r,a)=>o&&!o.has(a)?r:new t({type:"optional",innerType:r}))),ey(r,el(r._zod.def,{shape:s,checks:[]}))}function eR(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function ek(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function ex(t){return"string"==typeof t?t:t?.message}function eP(t,r,a){var i;for(let n=r;n<t.length;n++)(i=t[n]).schema??(i.schema=a)}function eE(t,r,a){let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let n=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:ex(t.inst?._zod.def?.error?.(t))??ex(n?.(t))??ex(r?.error?.(t))??ex(a.customError?.(t))??ex(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=o,r?.reportInput&&(s.input=t.input),s}let eT=/[\uD800-\uDBFF]/;function ej(t){let r=t.length;if(!eT.test(t))return r;let a=r;for(let i=0;i<r-1;i++)(64512&t.charCodeAt(i))==55296&&(64512&t.charCodeAt(i+1))==56320&&(a--,i++);return a}function eO(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eC(...t){let[r,a,i]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:i}:{...r}}function eI(t,r,a,i=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:i,value:a}),a}function eN(t,r){for(let a in t){let i=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eI(this,a,i(this))},set(t){eI(this,a,t)}})}return r}let eq=!1,eA={configurable:!0,get(){eq=!0}};function eM(r,a,i){let n=Object.getPrototypeOf(r._zod);if(a in n&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(n,a,{configurable:!0,get(){Object.defineProperty(this,a,eA);let t=eq;eq=!1;try{let r=i(this);return eq?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eq=eq||t,r}catch(r){throw delete this[a],eq=eq||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let ez=Object.freeze({status:"aborted"}),eL={value:void 0,enumerable:!1},eZ="captureStackTrace"in Error?Error:null;function eD(t,r,a,i){function n(t){this.def=t,this.constr=u,this.traits=new Set}n.prototype={};let o=a&&new WeakSet;function s(i,s){if(i._zod){if(i._zod.traits.has(t))return}else{eL.value=new n(s);try{Object.defineProperty(i,"_zod",eL)}finally{eL.value=void 0}}if(i._zod.traits.add(t),r(i,s),o){let t=Object.getPrototypeOf(i),r=i._zod.constr.prototype,n=t;for(;n&&n!==r;)n=Object.getPrototypeOf(n);let s=n??t;if(!o.has(s)){o.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eI(this,r,a.bind(this))},set(t){eI(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in i||(i[t]=l[t].bind(i)))}let l=i?.Parent??Object;class c extends l{}function u(t){let r=i?.Parent?function(t){let r=eZ;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eZ=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let n=globalThis.__zod_globalConfig?.postProcessor;return n&&n(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!i?.Parent&&r instanceof i.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eV extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eF extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(j=globalThis).__zod_globalConfig??(j.__zod_globalConfig={});let eU=globalThis.__zod_globalConfig;function eH(t){return t&&Object.assign(eU,t),eU}class eJ extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eB="~memo",eK=[];function eG(t){return null!==t&&"object"==typeof t}function eW(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eY=new WeakMap,eX=[],eQ={alloc(t,a,i){let n=r;if(!n)return i;r=void 0;let o={value:i,issues:null};return n.set(a.value,o),eX.push(o),i},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var i,n;let o;if("backward"!==a.direction&&(i=a,n=t.value,void 0!==(o=i[eB]?.backEdges)&&eG(n)&&o.has(n)))throw new eJ;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let i,n,o,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===i){let r=function t(r,a,i){var n,o;let s=eY.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let n=t(r,a,i);n>l&&(l=n)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=ea(d);u(r?((r,n)=>{let o=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(n&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,a,i):0;c>o&&(o=c)}return o})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let n=d._cachedInner??(i?r._zod.innerType:void 0);u(n?t(n,a,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),n=r,1!==(o=l)&&eY.set(n,2===o),o}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?i=!0:s=!0}let p=c.value;if(!eG(p))return a(c,u);let m=u[eB];if(m||(m={buckets:new WeakMap,backEdges:void 0},u[eB]=m),n===u)d=o;else{var h;let r;(r=(h=m).buckets.get(t))||(r=new WeakMap,h.buckets.set(t,r)),d=r,n=u,o=d}let f=d.get(p);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...eW(f.issues)):(c.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(f.value)),c;r=d;let y=eX.length,g=a(c,u);r=void 0;let v=eX.length>y?eX.pop():void 0;return g instanceof Promise?g.then(t=>(v&&(v.issues=t.issues.length?eW(t.issues):eK),t)):(v&&(v.issues=g.issues.length?eW(g.issues):eK),g)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},e0=/^[cC][0-9a-z]{6,}$/,e1=/^[0-9a-z]+$/,e2=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e9=/^[0-9a-vA-V]{20}$/,e4=/^[A-Za-z0-9]{27}$/,e3=/^[a-zA-Z0-9_-]{21}$/,e6=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e5=/^([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})$/,e8=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,e7=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,te=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,tt=/^(?:(?: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])$/,tr=/^(([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}|:))$/,ta=/^((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])$/,ti=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tn=/^https?$/,to=/^\+[1-9]\d{6,14}$/,ts="(?:(?:\\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])))",tl=RegExp(`^${ts}$`);function tc(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tu=/^[\s\S]{0,}$/,td=/^-?\d+$/,tp=/^-?\d+(?:\.\d+)?$/,tm=/^(?:true|false)$/i,th=/^null$/i,tf=/^[^A-Z]*$/,ty=/^[^a-z]*$/,tg=eD("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),tv=t=>{let r=t.value;return null!=r&&void 0!==r.length},t_={number:"number",bigint:"bigint",object:"date"},tb=eD("$ZodCheckLessThan",(t,r)=>{tg.init(t,r);let a=t_[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value<=r.value:i.value<r.value)||i.issues.push({origin:t_[typeof i.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tS=eD("$ZodCheckGreaterThan",(t,r)=>{tg.init(t,r);let a=t_[typeof r.value];t._zod.check=i=>{(r.inclusive?i.value>=r.value:i.value>r.value)||i.issues.push({origin:t_[typeof i.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:i.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),t$=eD("$ZodCheckMultipleOf",(t,r)=>{tg.init(t,r),t._zod.check=a=>{let i,n,o;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(n=Math.round(i=a.value/r.value),o=4*Number.EPSILON*Math.max(Math.abs(i),1),Math.abs(i-n)<o?0:i-n))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),tw=eD("$ZodCheckNumberFormat",(t,r)=>{tg.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),i=a?"int":"number",[n,o]=e_[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:i,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!r.abort}))}l<n&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!r.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!r.abort})}}),tR=eD("$ZodCheckMaxLength",(t,r)=>{var a;tg.init(t,r),(a=t._zod.def).when??(a.when=tv),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>r.maximum?ej(i):n)<=r.maximum)return;let o=eO(i);a.issues.push({origin:o,code:"too_big",maximum:r.maximum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tk=eD("$ZodCheckMinLength",(t,r)=>{var a;tg.init(t,r),(a=t._zod.def).when??(a.when=tv),t._zod.check=a=>{let i=a.value,n=i.length;if(("string"==typeof i&&n>=r.minimum&&n<2*r.minimum?ej(i):n)>=r.minimum)return;let o=eO(i);a.issues.push({origin:o,code:"too_small",minimum:r.minimum,inclusive:!0,input:i,inst:t,continue:!r.abort})}}),tx=eD("$ZodCheckLengthEquals",(t,r)=>{var a;tg.init(t,r),(a=t._zod.def).when??(a.when=tv),t._zod.check=a=>{let i=a.value,n=i.length,o="string"==typeof i&&n>=r.length&&n<=2*r.length?ej(i):n;if(o===r.length)return;let s=eO(i),l=o>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tP=eD("$ZodCheckStringFormat",(t,r)=>{var a,i;tg.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(i=t._zod).check??(i.check=()=>{})}),tE=eD("$ZodCheckRegex",(t,r)=>{tP.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tT=eD("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=tf),tP.init(t,r)}),tj=eD("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=ty),tP.init(t,r)}),tO=eD("$ZodCheckIncludes",(t,r)=>{tg.init(t,r);let a=ef(r.includes),i=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=i,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tC=eD("$ZodCheckStartsWith",(t,r)=>{tg.init(t,r);let a=RegExp(`^${ef(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tI=eD("$ZodCheckEndsWith",(t,r)=>{tg.init(t,r);let a=RegExp(`.*${ef(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tN=eD("$ZodCheckOverwrite",(t,r)=>{tg.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tq{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
1
|
+
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a=r();for(var n in a)("object"==typeof exports?exports:t)[n]=a[n]}}(this,()=>(()=>{"use strict";var t={6982(t){t.exports=require("crypto")},9896(t){t.exports=require("fs")},6928(t){t.exports=require("path")}},r={};function a(n){var i=r[n];if(void 0!==i)return i.exports;var o=r[n]={exports:{}};return t[n](o,o.exports,a),o.exports}a.d=(t,r)=>{for(var n in r)a.o(r,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},a.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{let t,r,i,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w;a.r(n),a.d(n,{xmcpHandler:()=>fX,withAuth:()=>fK,resourceMetadataOptions:()=>fW,serverCardHandler:()=>fQ,resourceMetadataHandler:()=>fG});let R=require("node:crypto");var k,x,P,E,T,j,O,C,I,N,q,A,M,z,L=Object.create,Z=Object.defineProperty,D=Object.getOwnPropertyDescriptor,U=Object.getOwnPropertyNames,V=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,H=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),J=(t,r,a)=>(a=null!=t?L(V(t)):{},((t,r,a,n)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var i,o=U(r),s=0,l=o.length;s<l;s++)i=o[s],F.call(t,i)||i===a||Z(t,i,{get:(t=>r[t]).bind(null,i),enumerable:!(n=D(r,i))||n.enumerable});return t})(!r&&t&&t.__esModule?a:Z(a,"default",{value:t,enumerable:!0}),t));let B=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),K=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),G=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),W=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Y(t){let r=Object.values(t).filter(t=>"number"==typeof t);return Object.entries(t).filter(([t,a])=>-1===r.indexOf(+t)).map(([t,r])=>r)}function X(t,r="|"){return t.map(t=>eb(t)).join(r)}function Q(t,r){return"bigint"==typeof r?r.toString():r}class ee{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return void 0!==t&&(this._value=t(),this._getter=void 0),this._value}}function et(t){return new ee(t)}function er(t){let r=+!!t.startsWith("^"),a=t.endsWith("$")?t.length-1:t.length;return t.slice(r,a)}let ea=Symbol("evaluating");function en(t,r,a){Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function ei(t){let r=Object.getOwnPropertyDescriptor(t,"shape");return r?.get?r.get.raw:r?.value}function eo(t){return ei(t._zod.def)??t._zod.def.shape}function es(t,r,a){Object.defineProperty(t,r,{get(){let t=a();return en(this,r,t),t},enumerable:!0,configurable:!0})}function el(t,r,a){r in t?en(t,r,a):t[r]=a}function ec(t,r,a,n){let i=eo(r);for(let o of a){let a=Object.getOwnPropertyDescriptor(i,o);a.enumerable&&(a.get?es(t,o,()=>{let t=r._zod.def.shape[o];return n?n(t,o):t}):el(t,o,n?n(a.value,o):a.value))}}function eu(...t){let r={};for(let a of t)Object.assign(r,Object.getOwnPropertyDescriptors(a));return Object.defineProperties({},r)}let ed="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ep(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let em=et(()=>{if(eJ.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function eh(t){if(!1===ep(t))return!1;let r=t.constructor;if(void 0===r||"function"!=typeof r)return!0;let a=r.prototype;return!1!==ep(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}function ef(t){return eh(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}let eg=new Set(["string","number","symbol"]);function ey(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ev(t,r,a){let n=new t._zod.constr(r??t._zod.def);return(!r||a?.parent)&&(n._zod.parent=t),n}function e_(t){if(!t)return{};if("string"==typeof t)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return(delete t.message,"string"==typeof t.error)?{...t,error:()=>t.error}:t}function eb(t){return"bigint"==typeof t?t.toString()+"n":"string"==typeof t?`"${t}"`:`${t}`}let eS={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]},e$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ew(t,r){let a=eo(t),n=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(a,t)?.enumerable)throw Error(`Unrecognized key: "${String(t)}"`);r[t]&&n.push(t)}return n}function eR(t,r){let a={};ec(a,t,Reflect.ownKeys(eo(t)));for(let t of Reflect.ownKeys(r)){let n=Object.getOwnPropertyDescriptor(r,t);n.enumerable&&(n.get?es(a,t,()=>r[t]):el(a,t,n.value))}return a}function ek(t,r,a,n="partial"){let i=r._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let o=a?new Set(ew(r,a)):void 0,s={};return ec(s,r,Reflect.ownKeys(eo(r)),t&&((r,a)=>o&&!o.has(a)?r:new t({type:"optional",innerType:r}))),ev(r,eu(r._zod.def,{shape:s,checks:[]}))}function ex(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue!==!0)return!0;return!1}function eP(t,r){return r.map(r=>(r.path??(r.path=[]),r.path.unshift(t),r))}function eE(t){return"string"==typeof t?t:t?.message}function eT(t,r,a){var n;for(let i=r;i<t.length;i++)(n=t[i]).schema??(n.schema=a)}function ej(t,r,a){let n=t.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?t.schema??(t.schema=t.inst):t.schema=t.inst);let i=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:eE(t.inst?._zod.def?.error?.(t))??eE(i?.(t))??eE(r?.error?.(t))??eE(a.customError?.(t))??eE(a.localeError?.(t))??"Invalid input",s={};for(let r of Object.keys(t))"inst"!==r&&"schema"!==r&&"continue"!==r&&"input"!==r&&"__proto__"!==r&&(s[r]=t[r]);return s.path??(s.path=[]),s.message=o,r?.reportInput&&(s.input=t.input),s}let eO=/[\uD800-\uDBFF]/;function eC(t){let r=t.length;if(!eO.test(t))return r;let a=r;for(let n=0;n<r-1;n++)(64512&t.charCodeAt(n))==55296&&(64512&t.charCodeAt(n+1))==56320&&(a--,n++);return a}function eI(t){return Array.isArray(t)?"array":"string"==typeof t?"string":"unknown"}function eN(...t){let[r,a,n]=t;return"string"==typeof r?{message:r,code:"custom",input:a,inst:n}:{...r}}function eq(t,r,a,n=!0){return Object.defineProperty(t,r,{configurable:!0,writable:!0,enumerable:n,value:a}),a}function eA(t,r){for(let a in t){let n=t[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return eq(this,a,n(this))},set(t){eq(this,a,t)}})}return r}let eM=!1,ez={configurable:!0,get(){eM=!0}};function eL(r,a,n){let i=Object.getPrototypeOf(r._zod);if(a in i&&t!==r._zod){t=void 0;return}t=r._zod,Object.defineProperty(i,a,{configurable:!0,get(){Object.defineProperty(this,a,ez);let t=eM;eM=!1;try{let r=n(this);return eM?delete this[a]:Object.defineProperty(this,a,{configurable:!0,writable:!0,value:r}),eM=eM||t,r}catch(r){throw delete this[a],eM=eM||t,r}},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:t})}})}let eZ=Object.freeze({status:"aborted"}),eD={value:void 0,enumerable:!1},eU="captureStackTrace"in Error?Error:null;function eV(t,r,a,n){function i(t){this.def=t,this.constr=u,this.traits=new Set}i.prototype={};let o=a&&new WeakSet;function s(n,s){if(n._zod){if(n._zod.traits.has(t))return}else{eD.value=new i(s);try{Object.defineProperty(n,"_zod",eD)}finally{eD.value=void 0}}if(n._zod.traits.add(t),r(n,s),o){let t=Object.getPrototypeOf(n),r=n._zod.constr.prototype,i=t;for(;i&&i!==r;)i=Object.getPrototypeOf(i);let s=i??t;if(!o.has(s)){o.add(s);for(let t in a){let r=Object.getOwnPropertyDescriptor(a,t);r.get?Object.defineProperty(s,t,{...r,enumerable:!1}):function(t,r,a){Object.defineProperty(t,r,{configurable:!0,get(){return this==null?a:eq(this,r,a.bind(this))},set(t){eq(this,r,t)}})}(s,t,r.value)}}}let l=u.prototype;for(let t in l)Object.prototype.hasOwnProperty.call(l,t)&&(t in n||(n[t]=l[t].bind(n)))}let l=n?.Parent??Object;class c extends l{}function u(t){let r=n?.Parent?function(t){let r=eU;if(r){let a=r.stackTraceLimit;if("number"==typeof a){try{r.stackTraceLimit=0}catch{return eU=null,new t}try{return new t}finally{r.stackTraceLimit=a}}}return new t}(c):this;s(r,t);let a=r._zod.deferred;if(a){for(let t of a)t();r._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(r),r}return Object.defineProperty(c,"name",{value:t}),Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:r=>!!n?.Parent&&r instanceof n.Parent||r?._zod?.traits?.has(t)}),Object.defineProperty(u,"name",{value:t}),u}class eF extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eH extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(C=globalThis).__zod_globalConfig??(C.__zod_globalConfig={});let eJ=globalThis.__zod_globalConfig;function eB(t){return t&&Object.assign(eJ,t),eJ}class eK extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}let eG="~memo",eW=[];function eY(t){return null!==t&&"object"==typeof t}function eX(t){return t.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}let eQ=new WeakMap,e0=[],e1={alloc(t,a,n){let i=r;if(!i)return n;r=void 0;let o={value:n,issues:null};return i.set(a.value,o),e0.push(o),n},guard(t){var r;(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,a=(t,a)=>{var n,i;let o;if("backward"!==a.direction&&(n=a,i=t.value,void 0!==(o=n[eG]?.backEdges)&&eY(i)&&o.has(i)))throw new eK;return r(t,a)};t._zod.parse=a,t._zod.run===r&&(t._zod.run=a)})},attach(t){var a;let n,i,o,s=!1;(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred.push(()=>{let a=t._zod.parse,l=(c,u)=>{let d;if(void 0===n){let r=function t(r,a,n){var i,o;let s=eQ.get(r);if(void 0!==s)return 2*!!s;if(a.has(r))return 2;a.add(r);let l=0,c=r=>{if(2!==l&&r?._zod){let i=t(r,a,n);i>l&&(l=i)}},u=t=>{t>l&&(l=t)},d=r._zod.def;switch(d.type){case"object":{let r=ei(d);u(r?((r,i)=>{let o=0;for(let s of Reflect.ownKeys(r)){let l=Object.getOwnPropertyDescriptor(r,s);if(i&&!l.enumerable)continue;let c=l.get?1:l.value?._zod?t(l.value,a,n):0;c>o&&(o=c)}return o})(r,!0):1),c(d.catchall);break}case"array":c(d.element);break;case"tuple":for(let t of d.items)c(t);c(d.rest);break;case"record":case"map":c(d.keyType),c(d.valueType);break;case"set":c(d.valueType);break;case"union":for(let t of d.options)c(t);break;case"intersection":c(d.left),c(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(d.innerType);break;case"pipe":c(d.in),c(d.out);break;case"function":c(d.input),c(d.output);break;case"lazy":{let i=d._cachedInner??(n?r._zod.innerType:void 0);u(i?t(i,a,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let t in d){let r=Object.getOwnPropertyDescriptor(d,t);if(!r||r.get)continue;let a=r.value;if(a&&"object"==typeof a){if(a._zod)c(a);else if(Array.isArray(a))for(let t of a)c(t)}}}return a.delete(r),i=r,1!==(o=l)&&eQ.set(i,2===o),o}(t,new Set,!1);if(0===r)return t._zod.parse=a,t._zod.run===l&&(t._zod.run=a),a(c,u);2===r||s?n=!0:s=!0}let p=c.value;if(!eY(p))return a(c,u);let m=u[eG];if(m||(m={buckets:new WeakMap,backEdges:void 0},u[eG]=m),i===u)d=o;else{var h;let r;(r=(h=m).buckets.get(t))||(r=new WeakMap,h.buckets.set(t,r)),d=r,i=u,o=d}let f=d.get(p);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...eX(f.issues)):(c.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(f.value)),c;r=d;let g=e0.length,y=a(c,u);r=void 0;let v=e0.length>g?e0.pop():void 0;return y instanceof Promise?y.then(t=>(v&&(v.issues=t.issues.length?eX(t.issues):eW),t)):(v&&(v.issues=y.issues.length?eX(y.issues):eW),y)};t._zod.parse=l,t._zod.run===a&&(t._zod.run=l)})}},e2=/^[cC][0-9a-z]{6,}$/,e9=/^[0-9a-z]+$/,e4=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,e3=/^[0-9a-vA-V]{20}$/,e6=/^[A-Za-z0-9]{27}$/,e5=/^[a-zA-Z0-9_-]{21}$/,e7=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e8=/^([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})$/,te=t=>t?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,ta=/^(?:(?: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])$/,tn=/^(([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}|:))$/,ti=/^((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])$/,to=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ts=/^https?$/,tl=/^\+[1-9]\d{6,14}$/,tc="(?:(?:\\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])))",tu=RegExp(`^${tc}$`);function td(t){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof t.precision?-1===t.precision?`${r}`:0===t.precision?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}let tp=/^[\s\S]{0,}$/,tm=/^-?\d+$/,th=/^-?\d+(?:\.\d+)?$/,tf=/^(?:true|false)$/i,tg=/^null$/i,ty=/^[^A-Z]*$/,tv=/^[^a-z]*$/,t_=eV("$ZodCheck",(t,r)=>{var a;t._zod??(t._zod={}),t._zod.def=r,(a=t._zod).onattach??(a.onattach=[])}),tb=t=>{let r=t.value;return null!=r&&void 0!==r.length},tS={number:"number",bigint:"bigint",object:"date"},t$=eV("$ZodCheckLessThan",(t,r)=>{t_.init(t,r);let a=tS[typeof r.value];t._zod.check=n=>{(r.inclusive?n.value<=r.value:n.value<r.value)||n.issues.push({origin:tS[typeof n.value]??a,code:"too_big",maximum:"object"==typeof r.value?r.value.getTime():r.value,input:n.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tw=eV("$ZodCheckGreaterThan",(t,r)=>{t_.init(t,r);let a=tS[typeof r.value];t._zod.check=n=>{(r.inclusive?n.value>=r.value:n.value>r.value)||n.issues.push({origin:tS[typeof n.value]??a,code:"too_small",minimum:"object"==typeof r.value?r.value.getTime():r.value,input:n.value,inclusive:r.inclusive,inst:t,continue:!r.abort})}}),tR=eV("$ZodCheckMultipleOf",(t,r)=>{t_.init(t,r),t._zod.check=a=>{let n,i,o;if(typeof a.value!=typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?r.value!==BigInt(0)&&a.value%r.value===BigInt(0):0==(i=Math.round(n=a.value/r.value),o=4*Number.EPSILON*Math.max(Math.abs(n),1),Math.abs(n-i)<o?0:n-i))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:t,continue:!r.abort})}}),tk=eV("$ZodCheckNumberFormat",(t,r)=>{t_.init(t,r),r.format=r.format||"float64";let a=r.format?.includes("int"),n=a?"int":"number",[i,o]=eS[r.format];t._zod.check=s=>{let l=s.value;if(a){if(!Number.isInteger(l))return void s.issues.push({expected:n,format:r.format,code:"invalid_type",continue:!1,input:l,inst:t});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!r.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!r.abort}))}l<i&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!r.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!r.abort})}}),tx=eV("$ZodCheckMaxLength",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length;if(("string"==typeof n&&i>r.maximum?eC(n):i)<=r.maximum)return;let o=eI(n);a.issues.push({origin:o,code:"too_big",maximum:r.maximum,inclusive:!0,input:n,inst:t,continue:!r.abort})}}),tP=eV("$ZodCheckMinLength",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length;if(("string"==typeof n&&i>=r.minimum&&i<2*r.minimum?eC(n):i)>=r.minimum)return;let o=eI(n);a.issues.push({origin:o,code:"too_small",minimum:r.minimum,inclusive:!0,input:n,inst:t,continue:!r.abort})}}),tE=eV("$ZodCheckLengthEquals",(t,r)=>{var a;t_.init(t,r),(a=t._zod.def).when??(a.when=tb),t._zod.check=a=>{let n=a.value,i=n.length,o="string"==typeof n&&i>=r.length&&i<=2*r.length?eC(n):i;if(o===r.length)return;let s=eI(n),l=o>r.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:a.value,inst:t,continue:!r.abort})}}),tT=eV("$ZodCheckStringFormat",(t,r)=>{var a,n;t_.init(t,r),r.pattern?(a=t._zod).check??(a.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:r.format,input:a.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:t,continue:!r.abort})}):(n=t._zod).check??(n.check=()=>{})}),tj=eV("$ZodCheckRegex",(t,r)=>{tT.init(t,r),t._zod.check=a=>{r.pattern.lastIndex=0,r.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:t,continue:!r.abort})}}),tO=eV("$ZodCheckLowerCase",(t,r)=>{r.pattern??(r.pattern=ty),tT.init(t,r)}),tC=eV("$ZodCheckUpperCase",(t,r)=>{r.pattern??(r.pattern=tv),tT.init(t,r)}),tI=eV("$ZodCheckIncludes",(t,r)=>{t_.init(t,r);let a=ey(r.includes),n=new RegExp("number"==typeof r.position?`^.{${r.position},}${a}`:a);r.pattern=n,t._zod.check=a=>{a.value.includes(r.includes,r.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:a.value,inst:t,continue:!r.abort})}}),tN=eV("$ZodCheckStartsWith",(t,r)=>{t_.init(t,r);let a=RegExp(`^${ey(r.prefix)}.*`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.startsWith(r.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:a.value,inst:t,continue:!r.abort})}}),tq=eV("$ZodCheckEndsWith",(t,r)=>{t_.init(t,r);let a=RegExp(`.*${ey(r.suffix)}$`);r.pattern??(r.pattern=a),t._zod.check=a=>{a.value.endsWith(r.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:a.value,inst:t,continue:!r.abort})}}),tA=eV("$ZodCheckOverwrite",(t,r)=>{t_.init(t,r),t._zod.check=t=>{t.value=r.tx(t.value)}});class tM{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if("function"==typeof t){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split("\n").filter(t=>t),a=Math.min(...r.map(t=>t.length-t.trimStart().length));for(let t of r.map(t=>t.slice(a)).map(t=>" ".repeat(2*this.indent)+t))this.content.push(t)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
2
2
|
${r.join("\n")}
|
|
3
|
-
};`)(...Object.values(this.closed))}}let tA={major:4,minor:6,patch:5},tM=eD("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tA;let i=t._zod.def.checks,n=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i?.length?[...i]:[];for(let r of n)for(let a of r._zod.onattach)a(t);if(0===n.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,i)=>{let n;if(r.memo)return r;let o=eR(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(o)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&i?.async===!1)throw new eV;if(n||l instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(eP(r.issues,a,t),o||(o=eR(r,a)))});else{if(r.issues.length===a)continue;eP(r.issues,a,t),o||(o=eR(r,a))}}return n?n.then(()=>r):r},a=(a,i,o)=>{if(eR(a))return a.aborted=!0,a;let s=r(i,n,o);if(s instanceof Promise){if(!1===o.async)throw new eV;return s.then(r=>t._zod.parse(r,o))}return t._zod.parse(s,o)};t._zod.run=(i,o)=>{if(o.skipChecks)return t._zod.parse(i,o);if("backward"===o.direction){let r=t._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,i,o)):a(r,i,o)}let s=t._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new eV;return s.then(t=>r(t,n,o))}return r(s,n,o)}}},{get"~standard"(){return eI(this,"~standard",tZ(this),!1)},set"~standard"(value){eI(this,"~standard",value)}}),tz=(t,r)=>t.issues.length?{issues:t.issues.map(t=>eE(t,r,eH()))}:{value:t.value};async function tL(t,r){let a={async:!0};return tz(await t._zod.run({value:r,issues:[]},a),a)}function tZ(t){return{validate:r=>{let a={async:!1};try{let i=t._zod.run({value:r,issues:[]},a);if(!(i instanceof Promise))return tz(i,a)}catch(t){}return tL(t,r)},vendor:"zod",version:1}}let tD=eD("$ZodString",(t,r)=>{tM.init(t,r),t._zod.pattern=r.pattern??tu,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tV=eD("$ZodStringFormat",(t,r)=>{tP.init(t,r),tD.init(t,r)}),tF=eD("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e5),tV.init(t,r)}),tU=eD("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=e8(t))}else r.pattern??(r.pattern=e8());tV.init(t,r)}),tH=eD("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=e7),tV.init(t,r)});function tJ(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tB=/[\t\n\r]/g;function tK(t){return t.replace(tB,"")}let tG=eD("$ZodURL",(t,r)=>{tV.init(t,r),t._zod.check=a=>{try{var i,n;let o=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===tn.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(o,r):tJ(o)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=tK(o);return}r.hostname&&((i=r.hostname).lastIndex=0,!i.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((n=r.protocol).lastIndex=0,!n.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:tK(o);return}catch(i){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),tW=eD("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(te,"u")),tV.init(t,r)}),tY=eD("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?e3:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tV.init(t,r)}),tX=eD("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=e0),tV.init(t,r)}),tQ=eD("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=e1),tV.init(t,r)}),t0=eD("$ZodULID",(t,r)=>{r.pattern??(r.pattern=e2),tV.init(t,r)}),t1=eD("$ZodXID",(t,r)=>{r.pattern??(r.pattern=e9),tV.init(t,r)}),t2=eD("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=e4),tV.init(t,r)}),t9=eD("$ZodISODateTime",(t,r)=>{let a,i,n;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${tc({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,n=r.local?`${i}|${tc({precision:r.precision})}`:i,r.pattern=RegExp(`^${ts}T(?:${n})$`)),tV.init(t,r)}),t4=eD("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tl),tV.init(t,r)}),t3=eD("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${tc(r)}$`)),tV.init(t,r)}),t6=eD("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e6),tV.init(t,r)}),t5=eD("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=tt),tV.init(t,r)}),t8=/^[0-9a-fA-F:.]+$/;function t7(t){return!!t8.test(t)&&tJ(`http://[${t}]`)}let re=eD("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tr),tV.init(t,r),t._zod.check=a=>{t7(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),rt=eD("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=ta),tV.init(t,r)}),rr=eD("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=ti),tV.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,i]=r;if(!i)return!1;let n=Number(i);return`${n}`===i&&!(n<0)&&!(n>128)&&t7(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function ra(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let ri=/^[0-9a-zA-Z+/]*={0,2}$/,rn=eD("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=ri),tV.init(t,r),t._zod.check=a=>{ra(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),ro=/^[A-Za-z0-9_-]*$/,rs=eD("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=ro),tV.init(t,r),t._zod.check=a=>{!function(t){if(!ro.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return ra(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),rl=eD("$ZodE164",(t,r)=>{r.pattern??(r.pattern=to),tV.init(t,r)}),rc=eD("$ZodJWT",(t,r)=>{tV.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[i]=a;if(!i)return!1;let n=JSON.parse(atob(i));if("typ"in n&&n?.typ!=="JWT"||!n.alg||r&&(!("alg"in n)||n.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),ru=eD("$ZodNumber",(t,r)=>{tM.init(t,r),t._zod.pattern=tp,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let n=a.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return a;let o="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),a}}),rd=eD("$ZodNumberFormat",(t,r)=>{tw.init(t,r),ru.init(t,r)}),rp=eD("$ZodBoolean",(t,r)=>{tM.init(t,r),t._zod.pattern=tm,t._zod.parse=(a,i)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let n=a.value;return"boolean"==typeof n||a.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),a}}),rm=eD("$ZodNull",(t,r)=>{tM.init(t,r),t._zod.pattern=th,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let i=r.value;return null===i||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),rh=eD("$ZodAny",(t,r)=>{tM.init(t,r),t._zod.parse=t=>t}),rf=eD("$ZodUnknown",(t,r)=>{tM.init(t,r),t._zod.parse=t=>t}),ry=eD("$ZodNever",(t,r)=>{tM.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function rg(t,r,a){t.issues.length&&r.issues.push(...ek(a,t.issues)),r.value[a]=t.value}let rv=eD("$ZodArray",(t,r)=>{tM.init(t,r);let a=eU.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),i;i.value=a?a.alloc(t,i,Array(o.length),n):Array(o.length);let s=[],l=n?.abortEarly;for(let t=0;t<o.length;t++){let a=o[t],c=r.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)s.push(c.then(r=>rg(r,i,t)));else if(rg(c,i,t),l&&0!==c.issues.length&&eR(c))break}return s.length?Promise.all(s).then(()=>i):i}});function r_(t,r,a,i,n,o){let s=a in i,l="optional"===o;if(s||!l||"optional"!==n){if(t.issues.length){if(void 0!==n&&l&&!s)return;r.issues.push(...ek(a,t.issues))}if(!s&&void 0===n){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===n&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let rb=[];function rS(t){var r;let a=Object.keys(t.shape),i=Object.getOwnPropertySymbols(t.shape),n=i.length?i:rb,o=n.length?[...a,...n]:a;for(let r of o)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:o,symbolKeys:n,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(s)}}function r$(t,r,a,i,n,o,s){let l=[],c=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin,m=u.optout,h=0;for(let n in r){if(s&&a.issues.length!==h){if(eR(a,h))break;h=a.issues.length}if(c.has(n))continue;if("__proto__"===n){"never"===d&&l.push(n);continue}if("never"===d){l.push(n);continue}let o=u.run({value:r[n],issues:[]},i);o instanceof Promise?t.push(o.then(t=>r_(t,a,n,r,p,m))):r_(o,a,n,r,p,m)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:o,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let rw=eD("$ZodObject",(t,r)=>{let a;tM.init(t,r);let i=Object.getOwnPropertyDescriptor(r,"shape"),n=i?.get?i.get.raw:r.shape??{};if(n){let t=()=>{let a={...n};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=n,Object.defineProperty(r,"shape",{get:t})}let o=Q(()=>rS(r));eM(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let i=r[t]._zod;if(i.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||er(a,t,new Set),i.values))a[t].add(r);void 0!==i.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=eU.memoizer;l?.attach(t),t._zod.parse=(r,i)=>{a??(a=o.value);let n=r.value;if(!eu(n))return r.issues.push({expected:"object",code:"invalid_type",input:n,inst:t}),r;r.value=l?l.alloc(t,r,{},i):{};let c=[],u=a.shape,d=i?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(eR(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:n[t],issues:[]},i);l instanceof Promise?c.push(l.then(a=>r_(a,r,t,n,o,s))):r_(l,r,t,n,o,s)}return s?r$(c,n,r,i,o.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rR=eD("$ZodObjectJIT",(t,r)=>{let a,i;rw.init(t,r);let n=t._zod.parse,o=Q(()=>rS(r)),s=eU.memoizer,l=!eU.jitless,c=l&&ed.value,u=r.catchall;t._zod.parse=(d,p)=>{i??(i=o.value);let m=d.value;return eu(m)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=o.value,i=a.symbolKeys,n=new tq(["payload","ctx"],{shape:r,inst:t,memo:s,syms:i}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
3
|
+
};`)(...Object.values(this.closed))}}let tz={major:4,minor:6,patch:5},tL=eV("$ZodType",(t,r)=>{var a;t??(t={}),t._zod.def=r,t._zod.bag=t._zod.bag||{},t._zod.version=tz;let n=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n?.length?[...n]:[];for(let r of i)for(let a of r._zod.onattach)a(t);if(0===i.length)(a=t._zod).deferred??(a.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let r=(r,a,n)=>{let i;if(r.memo)return r;let o=ex(r);for(let s of a){if(s._zod.def.when){if(function(t,r=0){if(!0===t.aborted)return!0;for(let a=r;a<t.issues.length;a++)if(t.issues[a]?.continue===!1)return!0;return!1}(r)||!s._zod.def.when(r))continue}else if(o)continue;let a=r.issues.length,l=s._zod.check(r);if(l instanceof Promise&&n?.async===!1)throw new eF;if(i||l instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await l,r.issues.length!==a&&(eT(r.issues,a,t),o||(o=ex(r,a)))});else{if(r.issues.length===a)continue;eT(r.issues,a,t),o||(o=ex(r,a))}}return i?i.then(()=>r):r},a=(a,n,o)=>{if(ex(a))return a.aborted=!0,a;let s=r(n,i,o);if(s instanceof Promise){if(!1===o.async)throw new eF;return s.then(r=>t._zod.parse(r,o))}return t._zod.parse(s,o)};t._zod.run=(n,o)=>{if(o.skipChecks)return t._zod.parse(n,o);if("backward"===o.direction){let r=t._zod.parse({value:n.value,issues:[]},{...o,skipChecks:!0});return r instanceof Promise?r.then(t=>a(t,n,o)):a(r,n,o)}let s=t._zod.parse(n,o);if(s instanceof Promise){if(!1===o.async)throw new eF;return s.then(t=>r(t,i,o))}return r(s,i,o)}}},{get"~standard"(){return eq(this,"~standard",tU(this),!1)},set"~standard"(value){eq(this,"~standard",value)}}),tZ=(t,r)=>t.issues.length?{issues:t.issues.map(t=>ej(t,r,eB()))}:{value:t.value};async function tD(t,r){let a={async:!0};return tZ(await t._zod.run({value:r,issues:[]},a),a)}function tU(t){return{validate:r=>{let a={async:!1};try{let n=t._zod.run({value:r,issues:[]},a);if(!(n instanceof Promise))return tZ(n,a)}catch(t){}return tD(t,r)},vendor:"zod",version:1}}let tV=eV("$ZodString",(t,r)=>{tL.init(t,r),t._zod.pattern=r.pattern??tp,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=String(a.value)}catch(t){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:t}),a}}),tF=eV("$ZodStringFormat",(t,r)=>{tT.init(t,r),tV.init(t,r)}),tH=eV("$ZodGUID",(t,r)=>{r.pattern??(r.pattern=e8),tF.init(t,r)}),tJ=eV("$ZodUUID",(t,r)=>{if(r.version){let t={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(void 0===t)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=te(t))}else r.pattern??(r.pattern=te());tF.init(t,r)}),tB=eV("$ZodEmail",(t,r)=>{r.pattern??(r.pattern=tt),tF.init(t,r)});function tK(t){try{if("undefined"!=typeof URL&&"function"==typeof URL.canParse)return URL.canParse(t);return new URL(t),!0}catch{return!1}}let tG=/[\t\n\r]/g;function tW(t){return t.replace(tG,"")}let tY=eV("$ZodURL",(t,r)=>{tF.init(t,r),t._zod.check=a=>{try{var n,i;let o=a.value.trim(),s="normalize"in r||"hostname"in r||"protocol"in r?function(t,r){if(!r.normalize&&r.protocol?.source===ts.source&&!/^https?:\/\//i.test(t))return 1;try{if("undefined"!=typeof URL){let r=URL;if("function"==typeof r.parse)return r.parse(t)??2}return new URL(t)}catch{return 2}}(o,r):tK(o)||2;if(1===s)return void a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:t,continue:!r.abort});if(2===s)return void a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort});if(!0===s){a.value=tW(o);return}r.hostname&&((n=r.hostname).lastIndex=0,!n.test(s.hostname))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:t,continue:!r.abort}),r.protocol&&((i=r.protocol).lastIndex=0,!i.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:t,continue:!r.abort}),a.value=r.normalize?s.href:tW(o);return}catch(n){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:t,continue:!r.abort})}}}),tX=eV("$ZodEmoji",(t,r)=>{r.pattern??(r.pattern=RegExp(tr,"u")),tF.init(t,r)}),tQ=eV("$ZodNanoID",(t,r)=>{var a;if(void 0!==r.length&&(!Number.isInteger(r.length)||r.length<1))throw Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=void 0===r.length?e5:(a=r.length,RegExp(`^[a-zA-Z0-9_-]{${a}}$`))),tF.init(t,r)}),t0=eV("$ZodCUID",(t,r)=>{r.pattern??(r.pattern=e2),tF.init(t,r)}),t1=eV("$ZodCUID2",(t,r)=>{r.pattern??(r.pattern=e9),tF.init(t,r)}),t2=eV("$ZodULID",(t,r)=>{r.pattern??(r.pattern=e4),tF.init(t,r)}),t9=eV("$ZodXID",(t,r)=>{r.pattern??(r.pattern=e3),tF.init(t,r)}),t4=eV("$ZodKSUID",(t,r)=>{r.pattern??(r.pattern=e6),tF.init(t,r)}),t3=eV("$ZodISODateTime",(t,r)=>{let a,n,i;r.pattern??(a=["Z"],r.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),n=`${td({precision:r.precision,seconds:!0})}(?:${a.join("|")})`,i=r.local?`${n}|${td({precision:r.precision})}`:n,r.pattern=RegExp(`^${tc}T(?:${i})$`)),tF.init(t,r)}),t6=eV("$ZodISODate",(t,r)=>{r.pattern??(r.pattern=tu),tF.init(t,r)}),t5=eV("$ZodISOTime",(t,r)=>{r.pattern??(r.pattern=RegExp(`^${td(r)}$`)),tF.init(t,r)}),t7=eV("$ZodISODuration",(t,r)=>{r.pattern??(r.pattern=e7),tF.init(t,r)}),t8=eV("$ZodIPv4",(t,r)=>{r.pattern??(r.pattern=ta),tF.init(t,r)}),re=/^[0-9a-fA-F:.]+$/;function rt(t){return!!re.test(t)&&tK(`http://[${t}]`)}let rr=eV("$ZodIPv6",(t,r)=>{r.pattern??(r.pattern=tn),tF.init(t,r),t._zod.check=a=>{rt(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:t,continue:!r.abort})}}),ra=eV("$ZodCIDRv4",(t,r)=>{r.pattern??(r.pattern=ti),tF.init(t,r)}),rn=eV("$ZodCIDRv6",(t,r)=>{r.pattern??(r.pattern=to),tF.init(t,r),t._zod.check=a=>{!function(t){let r=t.split("/");if(2!==r.length)return!1;let[a,n]=r;if(!n)return!1;let i=Number(n);return`${i}`===n&&!(i<0)&&!(i>128)&&rt(a)}(a.value)&&a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:t,continue:!r.abort})}});function ri(t){if(""===t)return!0;if(/\s/.test(t)||t.length%4!=0)return!1;try{return atob(t),!0}catch{return!1}}let ro=/^[0-9a-zA-Z+/]*={0,2}$/,rs=eV("$ZodBase64",(t,r)=>{r.pattern??(r.pattern=ro),tF.init(t,r),t._zod.check=a=>{ri(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:t,continue:!r.abort})}}),rl=/^[A-Za-z0-9_-]*$/,rc=eV("$ZodBase64URL",(t,r)=>{r.pattern??(r.pattern=rl),tF.init(t,r),t._zod.check=a=>{!function(t){if(!rl.test(t))return!1;let r=t.replace(/[-_]/g,t=>"-"===t?"+":"/");return ri(r.padEnd(4*Math.ceil(r.length/4),"="))}(a.value)&&a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:t,continue:!r.abort})}}),ru=eV("$ZodE164",(t,r)=>{r.pattern??(r.pattern=tl),tF.init(t,r)}),rd=eV("$ZodJWT",(t,r)=>{tF.init(t,r),t._zod.check=a=>{!function(t,r=null){try{let a=t.split(".");if(3!==a.length)return!1;let[n]=a;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||r&&(!("alg"in i)||i.alg!==r))return!1;return!0}catch{return!1}}(a.value,r.alg)&&a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:t,continue:!r.abort})}}),rp=eV("$ZodNumber",(t,r)=>{tL.init(t,r),t._zod.pattern=th,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=Number(a.value)}catch(t){}let i=a.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return a;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),a}}),rm=eV("$ZodNumberFormat",(t,r)=>{tk.init(t,r),rp.init(t,r)}),rh=eV("$ZodBoolean",(t,r)=>{tL.init(t,r),t._zod.pattern=tf,t._zod.parse=(a,n)=>{if(r.coerce)try{a.value=!!a.value}catch(t){}let i=a.value;return"boolean"==typeof i||a.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),a}}),rf=eV("$ZodNull",(t,r)=>{tL.init(t,r),t._zod.pattern=tg,t._zod.values=new Set([null]),t._zod.parse=(r,a)=>{let n=r.value;return null===n||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),rg=eV("$ZodAny",(t,r)=>{tL.init(t,r),t._zod.parse=t=>t}),ry=eV("$ZodUnknown",(t,r)=>{tL.init(t,r),t._zod.parse=t=>t}),rv=eV("$ZodNever",(t,r)=>{tL.init(t,r),t._zod.parse=(r,a)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function r_(t,r,a){t.issues.length&&r.issues.push(...eP(a,t.issues)),r.value[a]=t.value}let rb=eV("$ZodArray",(t,r)=>{tL.init(t,r);let a=eJ.memoizer;a?.attach(t),t._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=a?a.alloc(t,n,Array(o.length),i):Array(o.length);let s=[],l=i?.abortEarly;for(let t=0;t<o.length;t++){let a=o[t],c=r.element._zod.run({value:a,issues:[]},i);if(c instanceof Promise)s.push(c.then(r=>r_(r,n,t)));else if(r_(c,n,t),l&&0!==c.issues.length&&ex(c))break}return s.length?Promise.all(s).then(()=>n):n}});function rS(t,r,a,n,i,o){let s=a in n,l="optional"===o;if(s||!l||"optional"!==i){if(t.issues.length){if(void 0!==i&&l&&!s)return;r.issues.push(...eP(a,t.issues))}if(!s&&void 0===i){t.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}void 0===t.value?(s||"defaulted"===i&&!l)&&(r.value[a]=void 0):r.value[a]=t.value}}let r$=[];function rw(t){var r;let a=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),i=n.length?n:r$,o=i.length?[...a,...i]:a;for(let r of o)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let s=Object.keys(r=t.shape).filter(t=>void 0!==r[t]._zod.optin&&"optional"===r[t]._zod.optout);return{...t,allKeys:o,symbolKeys:i,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(s)}}function rR(t,r,a,n,i,o,s){let l=[],c=i.keySet,u=i.catchall._zod,d=u.def.type,p=u.optin,m=u.optout,h=0;for(let i in r){if(s&&a.issues.length!==h){if(ex(a,h))break;h=a.issues.length}if(c.has(i))continue;if("__proto__"===i){"never"===d&&l.push(i);continue}if("never"===d){l.push(i);continue}let o=u.run({value:r[i],issues:[]},n);o instanceof Promise?t.push(o.then(t=>rS(t,a,i,r,p,m))):rS(o,a,i,r,p,m)}return(l.length&&a.issues.push({code:"unrecognized_keys",keys:l,input:r,inst:o,continue:!0}),t.length)?Promise.all(t).then(()=>a):a}let rk=eV("$ZodObject",(t,r)=>{let a;tL.init(t,r);let n=Object.getOwnPropertyDescriptor(r,"shape"),i=n?.get?n.get.raw:r.shape??{};if(i){let t=()=>{let a={...i};return Object.defineProperty(r,"shape",{value:a}),t.raw=a,a};t.raw=i,Object.defineProperty(r,"shape",{get:t})}let o=et(()=>rw(r));eL(t,"propValues",t=>{let r=t.def.shape,a={};for(let t in r){let n=r[t]._zod;if(n.values){for(let r of(Object.prototype.hasOwnProperty.call(a,t)||en(a,t,new Set),n.values))a[t].add(r);void 0!==n.optin&&a[t].add(void 0)}}return a});let s=r.catchall,l=eJ.memoizer;l?.attach(t),t._zod.parse=(r,n)=>{a??(a=o.value);let i=r.value;if(!ep(i))return r.issues.push({expected:"object",code:"invalid_type",input:i,inst:t}),r;r.value=l?l.alloc(t,r,{},n):{};let c=[],u=a.shape,d=n?.abortEarly,p=r.issues.length;for(let t of a.allKeys){if(d&&r.issues.length!==p){if(ex(r,p))break;p=r.issues.length}if("__proto__"===t)continue;let a=u[t],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:i[t],issues:[]},n);l instanceof Promise?c.push(l.then(a=>rS(a,r,t,i,o,s))):rS(l,r,t,i,o,s)}return s?rR(c,i,r,n,o.value,t,!0===d):c.length?Promise.all(c).then(()=>r):r}}),rx=eV("$ZodObjectJIT",(t,r)=>{let a,n;rk.init(t,r);let i=t._zod.parse,o=et(()=>rw(r)),s=eJ.memoizer,l=!eJ.jitless,c=l&&em.value,u=r.catchall;t._zod.parse=(d,p)=>{n??(n=o.value);let m=d.value;return ep(m)?l&&c&&p?.async===!1&&!0!==p.jitless?(a||(a=(r=>{let a=o.value,n=a.symbolKeys,i=new tM(["payload","ctx"],{shape:r,inst:t,memo:s,syms:n}),l=t=>`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`,c=(t,r)=>`
|
|
4
4
|
let ${t}_ab = false;
|
|
5
5
|
for (let i = 0; i < ${t}.issues.length; i++) {
|
|
6
6
|
const iss = ${t}.issues[i];
|
|
@@ -11,7 +11,7 @@ ${r.join("\n")}
|
|
|
11
11
|
if (${t}_ab && ctx && ctx.abortEarly) {
|
|
12
12
|
payload.value = newResult;
|
|
13
13
|
return payload;
|
|
14
|
-
}`;
|
|
14
|
+
}`;i.write("const input = payload.value;");let u=Object.create(null),d=0;for(let t of a.allKeys)u[t]=`key_${d++}`;for(let t of(i.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),a.allKeys)){if("__proto__"===t)continue;let a=u[t],o="symbol"==typeof t?`syms[${n.indexOf(t)}]`:JSON.stringify(t),s=`${o} in input`,d=r[t],p=d?._zod?.optin,m=void 0!==p,h=d?._zod?.optout==="optional";if(i.write(`const ${a} = ${l(o)};`),m&&h){let t="optional"===p?`${a}_present`:`${a}.value !== undefined || ${a}_present`;i.write(`
|
|
15
15
|
const ${a}_present = ${s};
|
|
16
16
|
if (!${a}.issues.length || ${a}_present) {
|
|
17
17
|
if (${a}.issues.length) {${c(a,o)}
|
|
@@ -22,14 +22,14 @@ ${r.join("\n")}
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
`)}else m?(
|
|
25
|
+
`)}else m?(i.write(`
|
|
26
26
|
if (${a}.issues.length) {${c(a,o)}
|
|
27
27
|
}
|
|
28
|
-
`),"defaulted"===p?
|
|
28
|
+
`),"defaulted"===p?i.write(`newResult[${o}] = ${a}.value;`):i.write(`
|
|
29
29
|
if (${a}.value !== undefined || ${s}) {
|
|
30
30
|
newResult[${o}] = ${a}.value;
|
|
31
31
|
}
|
|
32
|
-
`)):
|
|
32
|
+
`)):i.write(`
|
|
33
33
|
const ${a}_present = ${s};
|
|
34
34
|
if (${a}.issues.length) {${c(a,o)}
|
|
35
35
|
}
|
|
@@ -50,41 +50,41 @@ ${r.join("\n")}
|
|
|
50
50
|
newResult[${o}] = ${a}.value;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
`)}return n.write("payload.value = newResult;"),n.write("return payload;"),n.compile()})(r.shape)),d=a(d,p),u)?r$([],m,d,p,i,t,p?.abortEarly===!0):d:n(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function rk(t,r,a,i){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let n=t.filter(t=>!eR(t));return 1===n.length?(r.value=n[0].value,n[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>eE(t,i,eH())))}),r)}let rx=eD("$ZodUnion",(t,r)=>{tM.init(t,r),eM(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),eM(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eM(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),eM(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>ee(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(i,n)=>{if(a)return a(i,n);let o=!1,s=[];for(let t of r.options){let r=t._zod.run({value:i.value,issues:[]},n);if(r instanceof Promise)s.push(r),o=!0;else{if(0===r.issues.length)return r;s.push(r)}}return o?Promise.all(s).then(r=>rk(r,i,t,n)):rk(s,i,t,n)}}),rP=eD("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rx.init(t,r);let a=t._zod.parse;eM(t,"propValues",t=>{let r={},a=0;for(let i of t.def.options){let n=i._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(i)}"`);for(let[i,o]of(n[t.def.discriminator]?.has(void 0)&&a++,Object.entries(n)))for(let t of(Object.prototype.hasOwnProperty.call(r,i)||er(r,i,new Set),o))r[i].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let i=ea(t._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let i=Q(()=>(function(t){let r=new Map;for(let a of t.options){let i=a._zod.propValues?.[t.discriminator];if(!i||0===i.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of i)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(n,o)=>{let s=n.value;if(!eu(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let l=s?.[r.discriminator],c=i.value.get(l);return c&&(void 0!==l||"backward"!==o.direction)?c._zod.run(n,o):r.unionFallback||"backward"===o.direction?a(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(i.value.keys()).filter(t=>null!==i.value.get(t)),input:s,path:[r.discriminator],inst:t}),n)}}),rE=eD("$ZodIntersection",(t,r)=>{tM.init(t,r),t._zod.parse=(t,a)=>{let i=t.value,n=r.left._zod.run({value:i,issues:[]},a),o=r.right._zod.run({value:i,issues:[]},a);return n instanceof Promise||o instanceof Promise?Promise.all([n,o]).then(([r,a])=>rT(t,r,a)):rT(t,n,o)}});function rT(t,r,a){let i,n=new Map,o=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);o.has(r)||o.set(r,t),a=[r]}else i??(i=t),a=t.keys;for(let t of a)n.has(t)||n.set(t,{}),n.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...n].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=i?l.filter(t=>i.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...i,keys:r}),l))!r.includes(a)&&o.has(a)&&t.issues.push(o.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(ep(r)&&ep(a)){let i=Object.keys(a),n=Object.keys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,n)){if("__proto__"===i)continue;let n=t(r[i],a[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i.push(o.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(eR(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rj=eD("$ZodRecord",(t,r)=>{tM.init(t,r);let a=eU.memoizer;a?.attach(t),t._zod.parse=(i,n)=>{let o=i.value;if(!ep(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),i;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;i.value=a?a.alloc(t,i,{},n):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>eE(t,n,eH())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:o[a],issues:[]},n);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&i.issues.push(...ek(a,t.issues)),i.value[c]=t.value})):(d.issues.length&&i.issues.push(...ek(a,d.issues)),i.value[c]=d.value)}for(let t in o)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;i.value[t]=o[t]}else(c=c??[]).push(t);c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}else{let c;for(let u of(i.value=a?a.alloc(t,i,{},n):{},Reflect.ownKeys(o))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},n);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&tp.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},n);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?i.value[u]=o[u]:l?(c=c??[]).push(u):i.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>eE(t,n,eH())),input:u,path:[u],inst:t});continue}let d=a.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:o[u],issues:[]},n);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&i.issues.push(...ek(u,t.issues)),i.value[d]=t.value})):(p.issues.length&&i.issues.push(...ek(u,p.issues)),i.value[d]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),rO=eD("$ZodEnum",(t,r)=>{tM.init(t,r);let a=G(r.entries),i=new Set(a);t._zod.values=i,eM(t,"pattern",t=>{let r=G(t.def.entries).filter(t=>eh.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>ef(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,n)=>{let o=r.value;return i.has(o)||r.issues.push({code:"invalid_value",values:a,input:o,inst:t}),r}}),rC=eD("$ZodLiteral",(t,r)=>{tM.init(t,r);let a=new Set(r.values);t._zod.values=a,eM(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?ef(t):t?ef(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,n)=>{let o=i.value;return a.has(o)||i.issues.push({code:"invalid_value",values:r.values,input:o,inst:t}),i}}),rI=eD("$ZodTransform",(t,r)=>{tM.init(t,r),t._zod.optin="optional",eU.memoizer?.guard(t),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eF(t.constructor.name);let n=r.transform(a.value,a);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(a.value=t,a));if(n instanceof Promise)throw new eV;return a.value=n,a}});function rN(t,r){return t.value=r.issues.length?void 0:r.value,t}let rq=eD("$ZodOptional",(t,r)=>{tM.init(t,r),eM(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eM(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eM(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${ee(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(r=>rN(t,r)):rN(t,i)}return r.innerType._zod.run(t,a)}}),rA=eD("$ZodExactOptional",(t,r)=>{rq.init(t,r),eM(t,"values",t=>t.def.innerType._zod.values),eM(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rM=eD("$ZodNullable",(t,r)=>{tM.init(t,r),eM(t,"optin",t=>t.def.innerType._zod.optin),eM(t,"optout",t=>t.def.innerType._zod.optout),eM(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${ee(r.source)}|null)$`):void 0}),eM(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rz=eD("$ZodDefault",(t,r)=>{tM.init(t,r),t._zod.optin="defaulted",eM(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(t=>rL(t,r)):rL(i,r)}});function rL(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rZ=eD("$ZodPrefault",(t,r)=>{tM.init(t,r),t._zod.optin="defaulted",eM(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rD=eD("$ZodNonOptional",(t,r)=>{tM.init(t,r),eM(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,i)=>{let n=r.innerType._zod.run(a,i);return n instanceof Promise?n.then(r=>rV(r,t)):rV(n,t)}});function rV(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rF(t,r,a,i){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>eE(t,i,eH()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rU=eD("$ZodCatch",(t,r)=>{tM.init(t,r),eM(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eM(t,"optout",t=>t.def.innerType._zod.optout),eM(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run({value:t.value,issues:[]},a);return i instanceof Promise?i.then(i=>rF(t,i,r,a)):rF(t,i,r,a)}}),rH=eD("$ZodPipe",(t,r)=>{tM.init(t,r),eM(t,"values",t=>t.def.in._zod.values),eM(t,"optin",t=>t.def.in._zod.optin),eM(t,"optout",t=>t.def.out._zod.optout),eM(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let i=r.out._zod.run(t,a);return i instanceof Promise?i.then(t=>rJ(t,r.in,a)):rJ(i,r.in,a)}let i=r.in._zod.run(t,a);return i instanceof Promise?i.then(t=>rJ(t,r.out,a)):rJ(i,r.out,a)}});function rJ(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let rB=eD("$ZodPreprocess",(t,r)=>{rH.init(t,r)}),rK=eD("$ZodReadonly",(t,r)=>{tM.init(t,r),eM(t,"propValues",t=>t.def.innerType._zod.propValues),eM(t,"values",t=>t.def.innerType._zod.values),eM(t,"optin",t=>t.def.innerType?._zod?.optin),eM(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let i=r.innerType._zod.run(t,a);return i instanceof Promise?i.then(rG):rG(i)}});function rG(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rW=eD("$ZodLazy",(t,r)=>{var a;let i;tM.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(i!==et)return void 0===i&&(i=et,i=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),i},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),eM(t,"pattern",t=>t.innerType?._zod?.pattern),eM(t,"propValues",t=>t.innerType?._zod?.propValues),eM(t,"optin",t=>t.innerType?._zod?.optin??void 0),eM(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),rY=eD("$ZodCustom",(t,r)=>{tg.init(t,r),tM.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let i=a.value,n=r.fn(i);if(n instanceof Promise)return n.then(r=>rX(r,a,i,t));rX(n,a,i,t)}});function rX(t,r,a,i){if(!t){let t={code:"custom",input:a,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(t.params=i._zod.def.params),r.issues.push(eC(t))}}(O=globalThis).__zod_globalRegistry??(O.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let i={...a,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let rQ=globalThis.__zod_globalRegistry;function r0(t){return t.checks&&(t.checks=[...t.checks]),t}function r1(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...eg(r)})}function r2(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...eg(r)})}function r9(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eg(r)})}function r4(t,r){return new t({type:"string",format:"date",check:"string_format",...eg(r)})}function r3(t,r){return new tb({check:"less_than",...eg(r),value:t,inclusive:!1})}function r6(t,r){return new tb({check:"less_than",...eg(r),value:t,inclusive:!0})}function r5(t,r){return new tS({check:"greater_than",...eg(r),value:t,inclusive:!1})}function r8(t,r){return new tS({check:"greater_than",...eg(r),value:t,inclusive:!0})}function r7(t,r){return new t$({check:"multiple_of",...eg(r),value:t})}function ae(t,r){return new tR({check:"max_length",...eg(r),maximum:t})}function at(t,r){return new tk({check:"min_length",...eg(r),minimum:t})}function ar(t,r){return new tx({check:"length_equals",...eg(r),length:t})}function aa(t){return new tN({check:"overwrite",tx:t})}function ai(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&er(t,r,a[r]);return t}function an(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??rQ,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function ao(t,r,a,i,n){let o="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:i.path,message:n}):r.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(n);return Object.assign(a,o),!0}function as(t,r,a={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let i={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,i);else{let a=s.schema,o=r.processors[n.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);o(t,r,a,i)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),as(o,r,i),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&ai(s.schema,c),"input"===r.io&&function t(r,a){let i=a??{seen:new Set};if(i.seen.has(r))return!1;i.seen.add(r);let n=r._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return t(n.element,i);if("set"===n.type)return t(n.valueType,i);if("lazy"===n.type)return t(n.getter(),i);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type||"catch"===n.type)return t(n.innerType,i);if("intersection"===n.type)return t(n.left,i)||t(n.right,i);if("record"===n.type||"map"===n.type)return t(n.keyType,i)||t(n.valueType,i);if("pipe"===n.type)return!!r._zod.traits.has("$ZodCodec")||t(n.in,i)||t(n.out,i);if("object"===n.type){for(let r in n.shape)if(t(n.shape[r],i))return!0;return!1}if("union"===n.type){for(let r of n.options)if(t(r,i))return!0;return!1}if("tuple"===n.type){for(let r of n.items)if(t(r,i))return!0;if(n.rest&&t(n.rest,i))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function al(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ac(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let i=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=i.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,r[0])}}let n=r=>{if(r[1].schema.$ref)return;let i=r[1],{ref:n,defId:o}=(r=>{let i="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,n=t.external.uri??(t=>t);if(a)return{ref:n(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${n("__shared")}#/${i}/${al(o)}`}}let n=`#/${i}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:n+al(o)}})(r);i.def={...i.schema},o&&(i.defId=o);let s=i.schema;for(let t in s)delete s[t];s.$ref=n};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
53
|
+
`)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(r.shape)),d=a(d,p),u)?rR([],m,d,p,n,t,p?.abortEarly===!0):d:i(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function rP(t,r,a,n){for(let a of t)if(0===a.issues.length)return r.value=a.value,r;let i=t.filter(t=>!ex(t));return 1===i.length?(r.value=i[0].value,i[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:t.map(t=>t.issues.map(t=>ej(t,n,eB())))}),r)}let rE=eV("$ZodUnion",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>t.def.options.some(t=>"defaulted"===t._zod.optin)?"defaulted":t.def.options.some(t=>void 0!==t._zod.optin)?"optional":void 0),eL(t,"optout",t=>t.def.options.some(t=>"optional"===t._zod.optout)?"optional":void 0),eL(t,"values",t=>{if(t.def.options.every(t=>t._zod.values))return new Set(t.def.options.flatMap(t=>Array.from(t._zod.values)))}),eL(t,"pattern",t=>{if(t.def.options.every(t=>t._zod.pattern)){let r=t.def.options.map(t=>t._zod.pattern);return RegExp(`^(${r.map(t=>er(t.source)).join("|")})$`)}});let a=1===r.options.length?r.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(a)return a(n,i);let o=!1,s=[];for(let t of r.options){let r=t._zod.run({value:n.value,issues:[]},i);if(r instanceof Promise)s.push(r),o=!0;else{if(0===r.issues.length)return r;s.push(r)}}return o?Promise.all(s).then(r=>rP(r,n,t,i)):rP(s,n,t,i)}}),rT=eV("$ZodDiscriminatedUnion",(t,r)=>{r.inclusive=!1,rE.init(t,r);let a=t._zod.parse;eL(t,"propValues",t=>{let r={},a=0;for(let n of t.def.options){let i=n._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${t.def.options.indexOf(n)}"`);for(let[n,o]of(i[t.def.discriminator]?.has(void 0)&&a++,Object.entries(i)))for(let t of(Object.prototype.hasOwnProperty.call(r,n)||en(r,n,new Set),o))r[n].add(t)}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),r.options.forEach((t,a)=>{let n=ei(t._zod.def);if(n&&!Object.prototype.hasOwnProperty.call(n,r.discriminator))throw Error(`Invalid discriminated union option at index "${a}"`)});let n=et(()=>(function(t){let r=new Map;for(let a of t.options){let n=a._zod.propValues?.[t.discriminator];if(!n||0===n.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of n)if(r.has(t)){if(void 0!==t)throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,null)}else r.set(t,a)}return r})(r));t._zod.parse=(i,o)=>{let s=i.value;if(!ep(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let l=s?.[r.discriminator],c=n.value.get(l);return c&&(void 0!==l||"backward"!==o.direction)?c._zod.run(i,o):r.unionFallback||"backward"===o.direction?a(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(n.value.keys()).filter(t=>null!==n.value.get(t)),input:s,path:[r.discriminator],inst:t}),i)}}),rj=eV("$ZodIntersection",(t,r)=>{tL.init(t,r),t._zod.parse=(t,a)=>{let n=t.value,i=r.left._zod.run({value:n,issues:[]},a),o=r.right._zod.run({value:n,issues:[]},a);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([r,a])=>rO(t,r,a)):rO(t,i,o)}});function rO(t,r,a){let n,i=new Map,o=new Map,s=(t,r)=>{let a;if("unrecognized_keys"!==t.code||t.path?.length)if("invalid_key"!==t.code||"record"!==t.origin||t.path?.length!==1)return!1;else{let r=String(t.path[0]);o.has(r)||o.set(r,t),a=[r]}else n??(n=t),a=t.keys;for(let t of a)i.has(t)||i.set(t,{}),i.get(t)[r]=!0;return!0};for(let a of r.issues)s(a,"l")||t.issues.push(a);for(let r of a.issues)s(r,"r")||t.issues.push(r);let l=[...i].filter(([,t])=>t.l&&t.r).map(([t])=>t);if(l.length){let r=n?l.filter(t=>n.keys.includes(t)):[];for(let a of(r.length&&t.issues.push({...n,keys:r}),l))!r.includes(a)&&o.has(a)&&t.issues.push(o.get(a))}let c=function t(r,a){if(r===a||r instanceof Date&&a instanceof Date&&+r==+a)return{valid:!0,data:r};if(eh(r)&&eh(a)){let n=Object.keys(a),i=Object.keys(r).filter(t=>-1!==n.indexOf(t)),o={...r,...a};for(let n of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===n)continue;let i=t(r[n],a[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<r.length;i++){let o=t(r[i],a[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(r.value,a.value);if(!c.valid){if(ex(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}let rC=eV("$ZodRecord",(t,r)=>{tL.init(t,r);let a=eJ.memoizer;a?.attach(t),t._zod.parse=(n,i)=>{let o=n.value;if(!eh(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let s=[],l=r.keyType._zod.values;if(l&&!r.partial){let c;n.value=a?a.alloc(t,n,{},i):{};let u=new Set;for(let a of l)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){if(u.add("number"==typeof a?a.toString():a),"__proto__"===a)continue;let l=r.keyType._zod.run({value:a,issues:[]},i);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(t=>ej(t,i,eB())),input:a,path:[a],inst:t});continue}let c=l.value;if("__proto__"===c)continue;let d=r.valueType._zod.run({value:o[a],issues:[]},i);d instanceof Promise?s.push(d.then(t=>{t.issues.length&&n.issues.push(...eP(a,t.issues)),n.value[c]=t.value})):(d.issues.length&&n.issues.push(...eP(a,d.issues)),n.value[c]=d.value)}for(let t in o)if(!u.has(t))if("loose"===r.mode){if("__proto__"===t)continue;n.value[t]=o[t]}else(c=c??[]).push(t);c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}else{let c;for(let u of(n.value=a?a.alloc(t,n,{},i):{},Reflect.ownKeys(o))){if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let a=r.keyType._zod.run({value:u,issues:[]},i);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof u&&th.test(u)&&a.issues.length){let t=r.keyType._zod.run({value:Number(u),issues:[]},i);if(t instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===t.issues.length&&(a=t)}if(a.issues.length){"loose"===r.mode?n.value[u]=o[u]:l?(c=c??[]).push(u):n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(t=>ej(t,i,eB())),input:u,path:[u],inst:t});continue}let d=a.value;if("__proto__"===d)continue;let p=r.valueType._zod.run({value:o[u],issues:[]},i);p instanceof Promise?s.push(p.then(t=>{t.issues.length&&n.issues.push(...eP(u,t.issues)),n.value[d]=t.value})):(p.issues.length&&n.issues.push(...eP(u,p.issues)),n.value[d]=p.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),rI=eV("$ZodEnum",(t,r)=>{tL.init(t,r);let a=Y(r.entries),n=new Set(a);t._zod.values=n,eL(t,"pattern",t=>{let r=Y(t.def.entries).filter(t=>eg.has(typeof t));return new RegExp(r.length?`^(${r.map(t=>ey(t.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(r,i)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:a,input:o,inst:t}),r}}),rN=eV("$ZodLiteral",(t,r)=>{tL.init(t,r);let a=new Set(r.values);t._zod.values=a,eL(t,"pattern",t=>{let r=t.def.values;return new RegExp(r.length?`^(${r.map(t=>"string"==typeof t?ey(t):t?ey(t.toString()):String(t)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(n,i)=>{let o=n.value;return a.has(o)||n.issues.push({code:"invalid_value",values:r.values,input:o,inst:t}),n}}),rq=eV("$ZodTransform",(t,r)=>{tL.init(t,r),t._zod.optin="optional",eJ.memoizer?.guard(t),t._zod.parse=(a,n)=>{if("backward"===n.direction)throw new eH(t.constructor.name);let i=r.transform(a.value,a);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(t=>(a.value=t,a));if(i instanceof Promise)throw new eF;return a.value=i,a}});function rA(t,r){return t.value=r.issues.length?void 0:r.value,t}let rM=eV("$ZodOptional",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),t._zod.optout="optional",eL(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),eL(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${er(r.source)})?$`):void 0}),t._zod.parse=(t,a)=>{if(void 0===t.value){if("defaulted"!==r.innerType._zod.optin)return t;let n=r.innerType._zod.run({value:t.value,issues:[]},a);return n instanceof Promise?n.then(r=>rA(t,r)):rA(t,n)}return r.innerType._zod.run(t,a)}}),rz=eV("$ZodExactOptional",(t,r)=>{rM.init(t,r),eL(t,"values",t=>t.def.innerType._zod.values),eL(t,"pattern",t=>t.def.innerType._zod.pattern),t._zod.parse=(t,a)=>r.innerType._zod.run(t,a)}),rL=eV("$ZodNullable",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>t.def.innerType._zod.optin),eL(t,"optout",t=>t.def.innerType._zod.optout),eL(t,"pattern",t=>{let r=t.def.innerType._zod.pattern;return r?RegExp(`^(${er(r.source)}|null)$`):void 0}),eL(t,"values",t=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),t._zod.parse=(t,a)=>null===t.value?t:r.innerType._zod.run(t,a)}),rZ=eV("$ZodDefault",(t,r)=>{tL.init(t,r),t._zod.optin="defaulted",eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);if(void 0===t.value)return t.value=r.defaultValue,t;let n=r.innerType._zod.run(t,a);return n instanceof Promise?n.then(t=>rD(t,r)):rD(n,r)}});function rD(t,r){return void 0===t.value&&(t.value=r.defaultValue),t}let rU=eV("$ZodPrefault",(t,r)=>{tL.init(t,r),t._zod.optin="defaulted",eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>("backward"===a.direction||void 0===t.value&&(t.value=r.defaultValue),r.innerType._zod.run(t,a))}),rV=eV("$ZodNonOptional",(t,r)=>{tL.init(t,r),eL(t,"values",t=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter(t=>void 0!==t)):void 0}),t._zod.parse=(a,n)=>{let i=r.innerType._zod.run(a,n);return i instanceof Promise?i.then(r=>rF(r,t)):rF(i,t)}});function rF(t,r){return t.issues.length||void 0!==t.value||t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:r}),t}function rH(t,r,a,n){return r.issues.length?t.value=a.catchValue({...r,value:t.value,error:{issues:r.issues.map(t=>ej(t,n,eB()))},input:t.value}):(t.value=r.value,r.memo&&(t.memo=!0)),t}let rJ=eV("$ZodCatch",(t,r)=>{tL.init(t,r),eL(t,"optin",t=>"defaulted"===t.def.innerType._zod.optin?"defaulted":"optional"),eL(t,"optout",t=>t.def.innerType._zod.optout),eL(t,"values",t=>t.def.innerType._zod.values),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let n=r.innerType._zod.run({value:t.value,issues:[]},a);return n instanceof Promise?n.then(n=>rH(t,n,r,a)):rH(t,n,r,a)}}),rB=eV("$ZodPipe",(t,r)=>{tL.init(t,r),eL(t,"values",t=>t.def.in._zod.values),eL(t,"optin",t=>t.def.in._zod.optin),eL(t,"optout",t=>t.def.out._zod.optout),eL(t,"propValues",t=>t.def.in._zod.propValues),t._zod.parse=(t,a)=>{if("backward"===a.direction){let n=r.out._zod.run(t,a);return n instanceof Promise?n.then(t=>rK(t,r.in,a)):rK(n,r.in,a)}let n=r.in._zod.run(t,a);return n instanceof Promise?n.then(t=>rK(t,r.out,a)):rK(n,r.out,a)}});function rK(t,r,a){return t.issues.some(t=>"unrecognized_keys"!==t.code)?(t.aborted=!0,t):r._zod.run({value:t.value,issues:t.issues},a)}let rG=eV("$ZodPreprocess",(t,r)=>{rB.init(t,r)}),rW=eV("$ZodReadonly",(t,r)=>{tL.init(t,r),eL(t,"propValues",t=>t.def.innerType._zod.propValues),eL(t,"values",t=>t.def.innerType._zod.values),eL(t,"optin",t=>t.def.innerType?._zod?.optin),eL(t,"optout",t=>t.def.innerType?._zod?.optout),t._zod.parse=(t,a)=>{if("backward"===a.direction)return r.innerType._zod.run(t,a);let n=r.innerType._zod.run(t,a);return n instanceof Promise?n.then(rY):rY(n)}});function rY(t){return t.memo||(t.value=Object.freeze(t.value)),t}let rX=eV("$ZodLazy",(t,r)=>{var a;let n;tL.init(t,r),a=t._zod,Object.defineProperty(a,"innerType",{get(){if(n!==ea)return void 0===n&&(n=ea,n=(()=>(r._cachedInner||(r._cachedInner=r.getter()),r._cachedInner))()),n},set(t){Object.defineProperty(a,"innerType",{value:t})},configurable:!0}),eL(t,"pattern",t=>t.innerType?._zod?.pattern),eL(t,"propValues",t=>t.innerType?._zod?.propValues),eL(t,"optin",t=>t.innerType?._zod?.optin??void 0),eL(t,"optout",t=>t.innerType?._zod?.optout??void 0),t._zod.parse=(r,a)=>t._zod.innerType._zod.run(r,a)}),rQ=eV("$ZodCustom",(t,r)=>{t_.init(t,r),tL.init(t,r),t._zod.parse=(t,r)=>t,t._zod.check=a=>{let n=a.value,i=r.fn(n);if(i instanceof Promise)return i.then(r=>r0(r,a,n,t));r0(i,a,n,t)}});function r0(t,r,a,n){if(!t){let t={code:"custom",input:a,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(t.params=n._zod.def.params),r.issues.push(eN(t))}}(I=globalThis).__zod_globalRegistry??(I.__zod_globalRegistry=new class t{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let a=r[0];return this._map.set(t,a),a&&"object"==typeof a&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&"object"==typeof r&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let n={...a,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}});let r1=globalThis.__zod_globalRegistry;function r2(t){return t.checks&&(t.checks=[...t.checks]),t}function r9(t,r){return new t({type:"string",format:"email",check:"string_format",abort:!1,...e_(r)})}function r4(t,r){return new t({type:"string",format:"url",check:"string_format",abort:!1,...e_(r)})}function r3(t,r){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e_(r)})}function r6(t,r){return new t({type:"string",format:"date",check:"string_format",...e_(r)})}function r5(t,r){return new t$({check:"less_than",...e_(r),value:t,inclusive:!1})}function r7(t,r){return new t$({check:"less_than",...e_(r),value:t,inclusive:!0})}function r8(t,r){return new tw({check:"greater_than",...e_(r),value:t,inclusive:!1})}function ae(t,r){return new tw({check:"greater_than",...e_(r),value:t,inclusive:!0})}function at(t,r){return new tR({check:"multiple_of",...e_(r),value:t})}function ar(t,r){return new tx({check:"max_length",...e_(r),maximum:t})}function aa(t,r){return new tP({check:"min_length",...e_(r),minimum:t})}function an(t,r){return new tE({check:"length_equals",...e_(r),length:t})}function ai(t){return new tA({check:"overwrite",tx:t})}function ao(t,...r){for(let a of r)for(let r of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,r)&&en(t,r,a[r]);return t}function as(t){let r=t?.target??"draft-2020-12";return"draft-4"===r&&(r="draft-04"),"draft-7"===r&&(r="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??r1,target:r,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function al(t,r,a,n,i){let o="function"==typeof r.unrepresentable?r.unrepresentable({zodSchema:t,path:n.path,message:i}):r.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(i);return Object.assign(a,o),!0}function ac(t,r,a={path:[],schemaPath:[]}){var n;let i=t._zod.def,o=r.seen.get(t);if(o)return o.count++,a.schemaPath.includes(t)&&(o.cycle=a.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(t,s),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let l=t._zod.toJSONSchema?.();if(l)s.schema=l;else{let n={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(r,s.schema,n);else{let a=s.schema,o=r.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(t,r,a,n)}let o=t._zod.parent;o&&(s.ref||(s.ref=o),ac(o,r,n),r.seen.get(o).isParent=!0)}let c=r.metadataRegistry.get(t);return c&&ao(s.schema,c),"input"===r.io&&function t(r,a){let n=a??{seen:new Set};if(n.seen.has(r))return!1;n.seen.add(r);let i=r._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return t(i.element,n);if("set"===i.type)return t(i.valueType,n);if("lazy"===i.type)return t(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return t(i.innerType,n);if("intersection"===i.type)return t(i.left,n)||t(i.right,n);if("record"===i.type||"map"===i.type)return t(i.keyType,n)||t(i.valueType,n);if("pipe"===i.type)return!!r._zod.traits.has("$ZodCodec")||t(i.in,n)||t(i.out,n);if("object"===i.type){for(let r in i.shape)if(t(i.shape[r],n))return!0;return!1}if("union"===i.type){for(let r of i.options)if(t(r,n))return!0;return!1}if("tuple"===i.type){for(let r of i.items)if(t(r,n))return!0;if(i.rest&&t(i.rest,n))return!0}return!1}(t)&&(delete s.schema.examples,delete s.schema.default),"input"===r.io&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,r.seen.get(t).schema}function au(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ad(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let n=new Map;for(let r of t.seen.entries()){let a=t.metadataRegistry.get(r[0])?.id;if(a){let t=n.get(a);if(t&&t!==r[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,r[0])}}let i=r=>{if(r[1].schema.$ref)return;let n=r[1],{ref:i,defId:o}=(r=>{let n="draft-2020-12"===t.target?"$defs":"definitions";if(t.external){let a=t.external.registry.get(r[0])?.id,i=t.external.uri??(t=>t);if(a)return{ref:i(a)};let o=r[1].defId??r[1].schema.id??`schema${t.counter++}`;return r[1].defId=o,{defId:o,ref:`${i("__shared")}#/${n}/${au(o)}`}}let i=`#/${n}/`;if(r[1]===a&&!r[1].schema.id)return{ref:"#"};let o=r[1].schema.id??`__schema${t.counter++}`;return{defId:o,ref:i+au(o)}})(r);n.def={...n.schema},o&&(n.defId=o);let s=n.schema;for(let t in s)delete s[t];s.$ref=i};if("throw"===t.cycles)for(let r of t.seen.entries()){let t=r[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
|
|
54
54
|
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let i=a[1];if(r===a[0]){n(a);continue}if(t.external){let i=t.external.registry.get(a[0])?.id;if(r!==a[0]&&i){n(a);continue}}if(t.metadataRegistry.get(a[0])?.id||i.cycle){n(a);continue}i.count>1&&"ref"===t.reused&&n(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let au=new Set(["type","properties","required","additionalProperties"]),ad=["oneOf","anyOf"];function ap(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function am(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!au.has(t))return null;r.push(a)}let a={},i=new Set;for(let t of r){for(let i in t.properties){if(Object.prototype.hasOwnProperty.call(a,i))continue;let t=[];for(let a of r){let r=a.properties?.[i]??ap(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}er(a,i,1===t.length?t[0]:am(t)??{allOf:t})}for(let r of t.required??[])i.add(r)}let n={type:"object",properties:a};if(i.size&&(n.required=[...i]),r.every(t=>!1===t.additionalProperties))n.additionalProperties=!1;else{let t=[];for(let a of r){let r=ap(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?n.additionalProperties=t[0]:t.length>1&&(n.additionalProperties={allOf:t})}return n}function ah(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=r=>{let a=t.seen.get(r);if(null===a.ref)return;let n=a.def??a.schema,o={...n},s=a.ref;if(a.ref=null,s){i(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(n.allOf=n.allOf??[],n.allOf.push(l)):ai(n,l),ai(n,o),r._zod.parent===s)for(let t in n)"$ref"!==t&&"allOf"!==t&&(t in o||delete n[t]);if(l.$ref&&a.def)for(let t in n)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(n[t])===JSON.stringify(a.def[t])&&delete n[t]}let l=r._zod.parent;if(l&&l!==s){i(l);let r=t.seen.get(l);if(r?.schema.$ref&&(n.$ref=r.schema.$ref,r.def))for(let t in n)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(n[t])===JSON.stringify(r.def[t])&&delete n[t]}t.override({zodSchema:r,jsonSchema:n,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())i(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let i=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let n=r.type;for(let t of Array.isArray(n)?n:[n]){if("string"!=typeof t)return;i.includes(t)||i.push(t)}}delete r.anyOf,r.type=1===i.length?i[0]:i}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let i=r.get(a);i?i.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of au)if(r in t)return;let a=r.filter(t=>ad.some(r=>Array.isArray(t[r]))),i=null;if(a.length){let t=a[0],n=ad.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let o=r.filter(r=>r!==t),s=t[n].map(t=>am([...o,t]));if(s.some(t=>!t))return;i={[n]:s}}else i=am(r);i&&(delete t.allOf,ai(t,i))}(t)}}let n={};if("draft-2020-12"===t.target?n.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?n.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}ai(n,a.defId?a.schema:a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&n.id===o&&delete n.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,er(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:af(r,"input",t.processors),output:af(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let af=(t,r,a={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=an({...n??{},target:o,io:r,processors:a});return as(t,s),ac(s,t),ah(s,t)},ay=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},ag=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},av=(t,r)=>{ay(t,"minimum",r),ag(t,"maximum",r)},a_=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},ab=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},aS=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},a$=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},aw=(t,r)=>ay(t,"minimum",r.minimum),aR=(t,r)=>ag(t,"maximum",r.maximum),ak=t=>(r,a)=>{a$(r,a.format);let[i,n]=t[a.format];ay(r,"minimum",i),ag(r,"maximum",n)},ax={greater_than:(t,r)=>ay(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>ag(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>a_(t,r.value),number_format:ak(e_),bigint_format:ak(eb),min_length:aw,max_length:aR,length_equals:(t,r)=>av(t,r.length),min_size:aw,max_size:aR,size_equals:(t,r)=>av(t,r.size),string_format:(t,r)=>{a$(t,r.format),r.pattern&&ab(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>aS(t,r.mime)};function aP(t){let r={},a=t._zod.def;for(let i of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])ax[i._zod.def.check]?.(r,i._zod.def);let i=t._zod.bag;for(let t of(void 0!==i.minimum&&ay(r,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&ay(r,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&ag(r,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&ag(r,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&a_(r,i.multipleOf),void 0!==i.format&&(r.format??(r.format=i.format),i.format.includes("int")&&(r.isInt=!0)),i.mime&&aS(r,i.mime),i.patterns??[]))ab(r,t);return r}let aE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aT=new Map([[ri,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[ro,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aj=t=>aT.get(t)??t,aO=(t,r,a,i)=>{a.type="string";let{minimum:n,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=aP(t);if("number"==typeof n&&(a.minLength=n),"number"==typeof o&&(a.maxLength=o),s&&(a.format=aE[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aj);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aC=(t,r,a,i)=>{let{minimum:n,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=aP(t);a.type=u?"integer":"number";let d="number"==typeof c&&c>=(n??-1/0),p="number"==typeof l&&l<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;if(d?m?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof n&&(a.minimum=n),p?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof o&&(a.maximum=o),s){let n=new Set;for(let o of s)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):ao(t,r,a,i,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...l]=n;void 0!==o&&(a.multipleOf=o),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aI=(t,r,a,i)=>{a.type="boolean"},aN=(t,r,a,i)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aq=(t,r,a,i)=>{a.not={}},aA=(t,r,a,i)=>{},aM=(t,r,a,i)=>{},az=(t,r,a,i)=>{let n=G(t._zod.def.entries);if(0===n.length){a.not={};return}n.every(t=>"number"==typeof t)&&(a.type="number"),n.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=n},aL=(t,r,a,i)=>{let n=t._zod.def;if(0===n.values.length){a.not={};return}let o=[];for(let s of n.values)if(void 0===s){if(ao(t,r,a,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(ao(t,r,a,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},aZ=(t,r,a,i)=>{ao(t,r,a,i,"Custom types cannot be represented in JSON Schema")},aD=(t,r,a,i)=>{ao(t,r,a,i,"Transforms cannot be represented in JSON Schema")},aV=(t,r,a,i)=>{let n=t._zod.def,{minimum:o,maximum:s}=aP(t);"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=as(n.element,r,{...i,path:[...i.path,"items"]})};function aF(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aF(r.out):"catch"===r.type?aF(r.innerType):t._zod.optin}let aU=(t,r,a,i)=>{let n=t._zod.def,o=n.shape;if(Object.getOwnPropertySymbols(o).length&&ao(t,r,a,i,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},o)er(a.properties,t,as(o[t],r,{...i,path:[...i.path,"properties",t]}));let s=[];for(let t of Object.keys(o)){let a=n.shape[t];("input"===r.io?void 0===aF(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),n.catchall?._zod.def.type==="never"?a.additionalProperties=!1:n.catchall?n.catchall&&(a.additionalProperties=as(n.catchall,r,{...i,path:[...i.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},aH=(t,r,a,i)=>{let n=t._zod.def,o=!1===n.inclusive,s=n.options.map((t,a)=>as(t,r,{...i,path:[...i.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},aJ=(t,r,a,i)=>{let n=t._zod.def,o=as(n.left,r,{...i,path:[...i.path,"allOf",0]}),s=as(n.right,r,{...i,path:[...i.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},aB=new WeakMap,aK=(t,r,a,i)=>{let n=t._zod.def;a.type="object";let o=n.keyType,s=aP(o).patterns;if("loose"===n.mode&&s&&s.size>0){let t=as(n.valueType,r,{...i,path:[...i.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))er(a.patternProperties,aj(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=as(n.keyType,r,{...i,path:[...i.path,"propertyNames"]});let o=aB.get(r);o||(o=[],aB.set(r,o),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let i of aB.get(t)??[]){let n=t.seen.get(i),o=(n?.def??n?.schema)?.propertyNames;if(!o||!0===o||a.has(o))continue;let s=function t(r,a,i){if(a.$ref){if(i.has(a))return a;i.add(a);let n=r.get(a)?.def;if(!n)return a;let o=t(r,n,i);return o===n?a:o}for(let n of["anyOf","oneOf"]){let o=a[n];if(!Array.isArray(o))continue;let s=o.map(a=>t(r,a,i));s.some((t,r)=>t!==o[r])&&(a={...a,[n]:s})}let n=Array.isArray(a.type)?a.type:[a.type],o=!n.includes("string")&&n.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!o&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:m,id:h,...f}=a;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?tp:td).source)),f}(r,o,new Set);s!==o&&a.set(o,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),o.push(t)}a.additionalProperties=as(n.valueType,r,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values,c="input"===r.io&&void 0!==aF(n.valueType);if(l&&!n.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},aG=(t,r,a,i)=>{let n=t._zod.def,o=as(n.innerType,r,i),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=n.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},aW=(t,r,a,i)=>{let n=t._zod.def;as(n.innerType,r,i),r.seen.get(t).ref=n.innerType},aY=Symbol();function aX(t,r,a,i,n){let o=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(o=!0,null));return o?(ao(r,a,i,n,"BigInt defaults cannot be represented in JSON Schema"),aY):JSON.parse(s)}let aQ=(t,r,a,i)=>{let n=t._zod.def;as(n.innerType,r,i),r.seen.get(t).ref=n.innerType;let o=aX(n.defaultValue,t,r,a,i);o!==aY&&(a.default=o)},a0=(t,r,a,i)=>{let n=t._zod.def;if(as(n.innerType,r,i),r.seen.get(t).ref=n.innerType,"input"!==r.io)return;let o=aX(n.defaultValue,t,r,a,i);o!==aY&&(a._prefault=o)},a1=(t,r,a,i)=>{let n,o=t._zod.def;as(o.innerType,r,i),r.seen.get(t).ref=o.innerType;try{n=o.catchValue(void 0)}catch{ao(t,r,a,i,"Dynamic catch values are not supported in JSON Schema");return}a.default=n},a2=(t,r,a,i)=>{let n=t._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?n.out:n.in:n.out;as(s,r,i),r.seen.get(t).ref=s},a9=(t,r,a,i)=>{let n=t._zod.def;as(n.innerType,r,i),r.seen.get(t).ref=n.innerType,a.readOnly=!0},a4=(t,r,a,i)=>{let n=t._zod.def;as(n.innerType,r,i),r.seen.get(t).ref=n.innerType},a3=(t,r,a,i)=>{let n=t._zod.innerType;as(n,r,i),r.seen.get(t).ref=n},a6={string:aO,number:aC,boolean:aI,bigint:(t,r,a,i)=>{ao(t,r,a,i,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,i)=>{ao(t,r,a,i,"Symbols cannot be represented in JSON Schema")},null:aN,undefined:(t,r,a,i)=>{ao(t,r,a,i,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,i)=>{ao(t,r,a,i,"Void cannot be represented in JSON Schema")},never:aq,any:aA,unknown:aM,date:(t,r,a,i)=>{ao(t,r,a,i,"Date cannot be represented in JSON Schema")},enum:az,literal:aL,nan:(t,r,a,i)=>{ao(t,r,a,i,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,i)=>{let n=t._zod.pattern;if(!n)throw Error("Pattern not found in template literal");a.type="string",a.pattern=n.source},file:(t,r,a,i)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:n,maximum:o,mime:s}=aP(t);void 0!==n&&(a.minLength=n),void 0!==o&&(a.maxLength=o),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,i)=>{a.type="boolean"},custom:aZ,function:(t,r,a,i)=>{ao(t,r,a,i,"Function types cannot be represented in JSON Schema")},transform:aD,map:(t,r,a,i)=>{ao(t,r,a,i,"Map cannot be represented in JSON Schema")},set:(t,r,a,i)=>{ao(t,r,a,i,"Set cannot be represented in JSON Schema")},array:aV,object:aU,union:aH,intersection:aJ,tuple:(t,r,a,i)=>{let n=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=n.items.map((t,a)=>as(t,r,{...i,path:[...i.path,o,a]})),c=n.rest?as(n.rest,r,{...i,path:[...i.path,s,..."openapi-3.0"===r.target?[n.items.length]:[]]}):null,u=n.items.length;for(;u>0;){let t=n.items[u-1];if(!("input"===r.io?void 0!==aF(t):"optional"===t._zod.optout))break;u--}let d=n.items.length,p=!n.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:m,maximum:h}=aP(t);"number"==typeof m&&(a.minItems=m),"number"==typeof h&&(a.maxItems=h)},record:aK,nullable:aG,nonoptional:aW,default:aQ,prefault:a0,catch:a1,pipe:a2,readonly:a9,promise:(t,r,a,i)=>{let n=t._zod.def;as(n.innerType,r,i),r.seen.get(t).ref=n.innerType},optional:a4,lazy:a3};function a5(t,r){if("_idmap"in t){let a=an({...r,processors:a6}),i={};for(let r of t._idmap.entries()){let[t,i]=r;as(i,a)}let n={};for(let o of(a.external={registry:t,uri:r?.uri,defs:i},t._idmap.entries())){let[t,r]=o;ac(a,r),er(n,t,ah(a,r))}return Object.keys(i).length>0&&(n.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:i}),{schemas:n}}let a=an({...r,processors:a6});return as(t,a),ac(a,t),ah(a,t)}let a8={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,Y,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},a7={value:void 0,enumerable:!1},ie=new WeakSet([Object.prototype,Error.prototype]),it=(t,r)=>{t.name="$ZodError",a7.value=r,Object.defineProperty(t,"issues",a7),a7.value=void 0,Object.defineProperty(t,"message",a8);let a=Object.getPrototypeOf(t);ie.has(a)||(ie.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},ir=eD("$ZodError",it);function ia(t,r){return{callee:r?.callee??t,Err:r?.Err}}eD("$ZodError",it,void 0,{Parent:Error});let ii=t=>{let r=(a,i,n,o)=>{let s=n?{...n,async:!1}:{async:!1},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise)throw new eV;if(l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eE(t,s,eH())));throw ec(a,o?.callee??r),a}return l.value};return r},io=t=>{let r=async(a,i,n,o)=>{let s=n?{...n,async:!0}:{async:!0},l=a._zod.run({value:i,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>eE(t,s,eH())));throw ec(a,o?.callee??r),a}return l.value};return r},is=t=>(r,a,i)=>{let n=i?{...i,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},n);if(o instanceof Promise)throw new eV;return o.issues.length?il(t,o.issues,n):{success:!0,data:o.value}};function il(t,r,a){let i;return{success:!1,get error(){return i||(i=new t(r.map(t=>eE(t,a,eH()))),r=void 0,a=void 0),i},set error(e){i=e,r=void 0,a=void 0}}}let ic=t=>async(r,a,i)=>{let n=i?{...i,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?il(t,o.issues,n):{success:!0,data:o.value}},iu=Symbol.for("zod.compile.invalid"),id=Symbol.for("zod.compile.fallback"),ip=async(t,r,a)=>{let i=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),0===n.issues.length},im=new WeakSet([Object.prototype,Error.prototype]);function ih(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let iy=eD("ZodError",(t,r)=>{ir.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);im.has(a)||(im.add(a),ih(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},i=(t,n=[])=>{for(let o of t.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(t=>i({issues:t},[...n,...o.path]));else if("invalid_key"===o.code)i({issues:o.issues},[...n,...o.path]);else if("invalid_element"===o.code)i({issues:o.issues},[...n,...o.path]);else{let t=[...n,...o.path];if(0===t.length)a._errors.push(r(o));else{let i=a,n=0;for(;n<t.length;){let a=t[n],s=n===t.length-1;if("_errors"===a){s&&i._errors.push(r(o)),n++;continue}Object.prototype.hasOwnProperty.call(i,a)||Object.defineProperty(i,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=i[a];s&&l._errors.push(r(o)),i=l,n++}}}};return i(t),a})(t,r)),ih(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},i=[];for(let s of t.issues)if(s.path.length>0){var n,o;(n=s.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(a,n)&&("__proto__"===n?Object.defineProperty(a,n,{value:o(),writable:!0,enumerable:!0,configurable:!0}):a[n]=o()),a[n]).push(r(s))}else i.push(r(s));return{formErrors:i,fieldErrors:a}})(t,r)),ih(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Y,2)}),ih(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Y,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ig=ii(iy),iv=io(iy),i_=is(iy),ib=ic(iy),iS=(f=ii(iy),y=(t,r,a,i)=>f(t,r,a?{...a,direction:"backward"}:{direction:"backward"},ia(y,i))),i$=(g=ii(iy),v=(t,r,a,i)=>g(t,r,a,ia(v,i))),iw=(_=io(iy),b=async(t,r,a,i)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return await _(t,r,n,ia(b,i))}),iR=(S=io(iy),$=async(t,r,a,i)=>await S(t,r,a,ia($,i))),ik=(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return is(iy)(t,r,i)},ix=(t,r,a)=>is(iy)(t,r,a),iP=async(t,r,a)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return ic(iy)(t,r,i)},iE=async(t,r,a)=>ic(iy)(t,r,a);function iT(){eU.memoizer||eH({memoizer:eQ})}let ij=eD("ZodType",(t,r)=>(eU.localeError||eH({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};function i(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=i(a.expected),r=i(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${ev(a.values[0])}`;return`Invalid option: expected one of ${W(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",i=t[a.origin]??null;if(i)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",i=t[a.origin]??null;if(i)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${i.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${W(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tM.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(el(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return ey(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new nZ({type:"custom",check:"custom",fn:t,...eg(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let i,n;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eC(t,r.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),r.issues.push(eC(t)))},t(r.value,r)),(n=new tg({check:"custom",...eg(r)}))._zod.check=a,i=n}(t,r))},overwrite(t){return this.check(aa(t))},optional(){return nx(this)},exactOptional(){var t;return t=this,new nP({type:"optional",innerType:t})},nullable(){return nT(this)},nullish(){return nx(nT(this))},nonoptional(t){var r;return r=this,new nC({type:"nonoptional",innerType:r,...eg(t)})},array(){return ns(this)},or(t){return np([this,t])},and(t){return ny(this,t)},transform(t){return nq(this,nR(t))},default(t){var r,a;return r=this,a=t,new nj({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():em(a)}})},prefault(t){var r,a;return r=this,a=t,new nO({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():em(a)}})},catch(t){return function(t,r){let a;return new nI({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return nq(this,t)},readonly(){var t;return t=this,new nM({type:"readonly",innerType:t})},describe(t){let r=this.clone();return rQ.add(r,{description:t}),r},meta(...t){if(0===t.length)return rQ.get(this);let r=this.clone();return rQ.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eI(this,"~standard",{...tZ(this),jsonSchema:{input:af(this,"input"),output:af(this,"output")}},!1)},set"~standard"(value){eI(this,"~standard",value)},parse:function t(r,a){return ig(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await iv(this,r,a,{callee:t})},safeParse(t,r){return i_(this,t,r)},async safeParseAsync(t,r){return ib(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eI(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==iu)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let i,n=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;if(o?(n[id]=!0,i=o({value:r,issues:[]},n)):i=t._zod.run({value:r,issues:[]},n),i instanceof Promise)throw new eV;return 0===i.issues.length}(this,t,r)},validateAsync(t,r){return ip(this,t,r)},encode:function t(r,a){return iS(this,r,a,{callee:t})},decode:function t(r,a){return i$(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await iw(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await iR(this,r,a,{callee:t})},safeEncode(t,r){return ik(this,t,r)},safeDecode(t,r){return ix(this,t,r)},async safeEncodeAsync(t,r){return iP(this,t,r)},async safeDecodeAsync(t,r){return iE(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let i=an({...a,processors:r});return as(t,i),ac(i,t),ah(i,t)})(this,{})(t)},get description(){return rQ.get(this)?.description},get _def(){return this._zod.def}}),iO=eD("_ZodString",(t,r)=>{tD.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aO(t,r,a,i)},eN({format:t=>aP(t).format??null,minLength:t=>aP(t).minimum??null,maxLength:t=>aP(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tE({check:"string_format",format:"regex",...eg(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tO({check:"string_format",format:"includes",...eg(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tC({check:"string_format",format:"starts_with",...eg(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tI({check:"string_format",format:"ends_with",...eg(r),suffix:t})}(...t))},min(...t){return this.check(at(...t))},max(...t){return this.check(ae(...t))},length(...t){return this.check(ar(...t))},nonempty(...t){return this.check(at(1,...t))},lowercase(t){return this.check(new tT({check:"string_format",format:"lowercase",...eg(t)}))},uppercase(t){return this.check(new tj({check:"string_format",format:"uppercase",...eg(t)}))},trim(){return this.check(aa(t=>t.trim()))},normalize(...t){return this.check(function(t){return aa(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(aa(t=>t.toLowerCase()))},toUpperCase(){return this.check(aa(t=>t.toUpperCase()))},slugify(){return this.check(aa(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),iC=eD("ZodString",(t,r)=>{tD.init(t,r),iO.init(t,r)},{email(t){return this.check(r1(iL,t))},url(t){return this.check(r2(iV,t))},jwt(t){return this.check(new i9({type:"string",format:"jwt",check:"string_format",abort:!1,...eg(t)}))},emoji(t){return this.check(new iF({type:"string",format:"emoji",check:"string_format",abort:!1,...eg(t)}))},guid(t){return this.check(new iZ({type:"string",format:"guid",check:"string_format",abort:!1,...eg(t)}))},uuid(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,...eg(t)}))},uuidv4(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eg(t)}))},uuidv6(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eg(t)}))},uuidv7(t){return this.check(new iD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eg(t)}))},nanoid(t){return this.check(new iU({type:"string",format:"nanoid",check:"string_format",abort:!1,...eg(t)}))},cuid(t){return this.check(new iH({type:"string",format:"cuid",check:"string_format",abort:!1,...eg(t)}))},cuid2(t){return this.check(new iJ({type:"string",format:"cuid2",check:"string_format",abort:!1,...eg(t)}))},ulid(t){return this.check(new iB({type:"string",format:"ulid",check:"string_format",abort:!1,...eg(t)}))},base64(t){return this.check(new i0({type:"string",format:"base64",check:"string_format",abort:!1,...eg(t)}))},base64url(t){return this.check(new i1({type:"string",format:"base64url",check:"string_format",abort:!1,...eg(t)}))},xid(t){return this.check(new iK({type:"string",format:"xid",check:"string_format",abort:!1,...eg(t)}))},ksuid(t){return this.check(new iG({type:"string",format:"ksuid",check:"string_format",abort:!1,...eg(t)}))},ipv4(t){return this.check(new iW({type:"string",format:"ipv4",check:"string_format",abort:!1,...eg(t)}))},ipv6(t){return this.check(new iY({type:"string",format:"ipv6",check:"string_format",abort:!1,...eg(t)}))},cidrv4(t){return this.check(new iX({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eg(t)}))},cidrv6(t){return this.check(new iQ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eg(t)}))},e164(t){return this.check(new i2({type:"string",format:"e164",check:"string_format",abort:!1,...eg(t)}))},datetime(t){return this.check(r9(iq,t))},date(t){return this.check(r4(iA,t))},time(t){return this.check(new iM({type:"string",format:"time",check:"string_format",precision:null,...eg(t)}))},duration(t){return this.check(new iz({type:"string",format:"duration",check:"string_format",...eg(t)}))}});function iI(t){return new iC(r0({type:"string",...eg(t)}))}let iN=eD("ZodStringFormat",(t,r)=>{tV.init(t,r),iO.init(t,r)}),iq=eD("ZodISODateTime",(t,r)=>{t9.init(t,r),iN.init(t,r)}),iA=eD("ZodISODate",(t,r)=>{t4.init(t,r),iN.init(t,r)}),iM=eD("ZodISOTime",(t,r)=>{t3.init(t,r),iN.init(t,r)}),iz=eD("ZodISODuration",(t,r)=>{t6.init(t,r),iN.init(t,r)}),iL=eD("ZodEmail",(t,r)=>{tH.init(t,r),iN.init(t,r)}),iZ=eD("ZodGUID",(t,r)=>{tF.init(t,r),iN.init(t,r)}),iD=eD("ZodUUID",(t,r)=>{tU.init(t,r),iN.init(t,r)}),iV=eD("ZodURL",(t,r)=>{tG.init(t,r),iN.init(t,r)}),iF=eD("ZodEmoji",(t,r)=>{tW.init(t,r),iN.init(t,r)}),iU=eD("ZodNanoID",(t,r)=>{tY.init(t,r),iN.init(t,r)}),iH=eD("ZodCUID",(t,r)=>{tX.init(t,r),iN.init(t,r)}),iJ=eD("ZodCUID2",(t,r)=>{tQ.init(t,r),iN.init(t,r)}),iB=eD("ZodULID",(t,r)=>{t0.init(t,r),iN.init(t,r)}),iK=eD("ZodXID",(t,r)=>{t1.init(t,r),iN.init(t,r)}),iG=eD("ZodKSUID",(t,r)=>{t2.init(t,r),iN.init(t,r)}),iW=eD("ZodIPv4",(t,r)=>{t5.init(t,r),iN.init(t,r)}),iY=eD("ZodIPv6",(t,r)=>{re.init(t,r),iN.init(t,r)}),iX=eD("ZodCIDRv4",(t,r)=>{rt.init(t,r),iN.init(t,r)}),iQ=eD("ZodCIDRv6",(t,r)=>{rr.init(t,r),iN.init(t,r)}),i0=eD("ZodBase64",(t,r)=>{rn.init(t,r),iN.init(t,r)}),i1=eD("ZodBase64URL",(t,r)=>{rs.init(t,r),iN.init(t,r)}),i2=eD("ZodE164",(t,r)=>{rl.init(t,r),iN.init(t,r)}),i9=eD("ZodJWT",(t,r)=>{rc.init(t,r),iN.init(t,r)}),i4=eD("ZodNumber",(t,r)=>{ru.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aC(t,r,a,i),t.isFinite=!0},eN({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=aP(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=aP(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=aP(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>aP(t).format??null},{gt(t,r){return this.check(r5(t,r))},gte(t,r){return this.check(r8(t,r))},min(t,r){return this.check(r8(t,r))},lt(t,r){return this.check(r3(t,r))},lte(t,r){return this.check(r6(t,r))},max(t,r){return this.check(r6(t,r))},int(t){return this.check(i5(t))},safe(t){return this.check(i5(t))},positive(t){return this.check(r5(0,t))},nonnegative(t){return this.check(r8(0,t))},negative(t){return this.check(r3(0,t))},nonpositive(t){return this.check(r6(0,t))},multipleOf(t,r){return this.check(r7(t,r))},step(t,r){return this.check(r7(t,r))},finite(){return this}}));function i3(t){return new i4(r0({type:"number",checks:[],...eg(t)}))}let i6=eD("ZodNumberFormat",(t,r)=>{rd.init(t,r),i4.init(t,r)});function i5(t){return new i6({type:"number",check:"number_format",abort:!1,format:"safeint",...eg(t)})}let i8=eD("ZodBoolean",(t,r)=>{rp.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aI(t,r,a,i)});function i7(t){return new i8({type:"boolean",...eg(t)})}let ne=eD("ZodNull",(t,r)=>{rm.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aN(t,r,a,i)});function nt(t){return new ne({type:"null",...eg(t)})}let nr=eD("ZodAny",(t,r)=>{rh.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aA(t,r,a,i)}),na=eD("ZodUnknown",(t,r)=>{rf.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aM(t,r,a,i)});function ni(){return new na({type:"unknown"})}let nn=eD("ZodNever",(t,r)=>{ry.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aq(t,r,a,i)}),no=eD("ZodArray",(t,r)=>{iT(),rv.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aV(t,r,a,i),t.element=r.element},{min(t,r){return this.check(at(t,r))},nonempty(t){return this.check(at(1,t))},max(t,r){return this.check(ae(t,r))},length(t,r){return this.check(ar(t,r))},unwrap(){return this.element}});function ns(t,r){return new no({type:"array",element:t,...eg(r)})}let nl=eD("ZodObject",(t,r)=>{var a;let i,n;iT(),rR.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aU(t,r,a,i),a="shape",(n=a in(i=Object.getPrototypeOf(t))?void 0:i)&&Object.defineProperty(n,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return nb(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(el(this._zod.def,{catchall:t}))},passthrough(){return this.clone(el(this._zod.def,{catchall:ni()}))},loose(){return this.clone(el(this._zod.def,{catchall:ni()}))},strict(){return this.clone(el(this._zod.def,{catchall:new nn({type:"never",...eg(void 0)})}))},strip(){return this.clone(el(this._zod.def,{catchall:void 0}))},extend(t){if(!ep(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=ei(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ey(this,el(this._zod.def,{shape:e$(this,t)}))},safeExtend(t){if(!ep(t))throw Error("Invalid input to safeExtend: expected a plain object");return ey(this,el(this._zod.def,{shape:e$(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return es(r,this,Reflect.ownKeys(ei(this))),es(r,t,Reflect.ownKeys(ei(t))),ey(this,el(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n={};return es(n,t,eS(t,r)),ey(t,el(a,{shape:n,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,i=a.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=new Set(eS(t,r)),o={};return es(o,t,Reflect.ownKeys(ei(t)).filter(t=>!n.has(t))),ey(t,el(a,{shape:o,checks:[]}))}(this,t)},partial(...t){return ew(nk,this,t[0])},exactPartial(...t){return ew(nP,this,t[0],"exactPartial")},required(...t){var r;let a,i;return a=(r=t[0])?new Set(eS(this,r)):void 0,es(i={},this,Reflect.ownKeys(ei(this)),(t,r)=>a&&!a.has(r)?t:new nC({type:"nonoptional",innerType:t})),ey(this,el(this._zod.def,{shape:i}))}});function nc(t,r){return new nl({type:"object",shape:t??{},...eg(r)})}function nu(t,r){return new nl({type:"object",shape:t,catchall:ni(),...eg(r)})}let nd=eD("ZodUnion",(t,r)=>{rx.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aH(t,r,a,i),t.options=r.options});function np(t,r){return new nd({type:"union",options:t,...eg(r)})}let nm=eD("ZodDiscriminatedUnion",(t,r)=>{nd.init(t,r),rP.init(t,r)});function nh(t,r,a){return new nm({type:"union",options:r,discriminator:t,...eg(a)})}let nf=eD("ZodIntersection",(t,r)=>{rE.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aJ(t,r,a,i)});function ny(t,r){return new nf({type:"intersection",left:t,right:r})}let ng=eD("ZodRecord",(t,r)=>{iT(),rj.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aK(t,r,a,i),t.keyType=r.keyType,t.valueType=r.valueType});function nv(t,r,a){return new ng(r&&r._zod?{type:"record",keyType:t,valueType:r,...eg(a)}:{type:"record",keyType:iI(),valueType:t,...eg(r)})}let n_=eD("ZodEnum",(t,r)=>{rO.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>az(t,r,a,i),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,i)=>{let n={};for(let i of t)if(a.has(i))n[i]=r.entries[i];else throw Error(`Key ${i} not found in enum`);return new n_({...r,checks:[],...eg(i),entries:n})},t.exclude=(t,i)=>{let n={...r.entries};for(let r of t)if(a.has(r))delete n[r];else throw Error(`Key ${r} not found in enum`);return new n_({...r,checks:[],...eg(i),entries:n})}});function nb(t,r){return new n_({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...eg(r)})}let nS=eD("ZodLiteral",(t,r)=>{rC.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aL(t,r,a,i),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function n$(t,r){return new nS({type:"literal",values:Array.isArray(t)?t:[t],...eg(r)})}let nw=eD("ZodTransform",(t,r)=>{iT(),rI.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aD(t,r,a,i),t._zod.parse=(a,i)=>{if("backward"===i.direction)throw new eF(t.constructor.name);a.addIssue=i=>{"string"==typeof i?a.issues.push(eC(i,a.value,r)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=a.value),i.inst??(i.inst=t),a.issues.push(eC(i)))};let n=r.transform(a.value,a);return n instanceof Promise?n.then(t=>(a.value=t,a)):(a.value=n,a)}});function nR(t){return new nw({type:"transform",transform:t})}let nk=eD("ZodOptional",(t,r)=>{rq.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a4(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nx(t){return new nk({type:"optional",innerType:t})}let nP=eD("ZodExactOptional",(t,r)=>{rA.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a4(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nE=eD("ZodNullable",(t,r)=>{rM.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aG(t,r,a,i),t.unwrap=()=>t._zod.def.innerType});function nT(t){return new nE({type:"nullable",innerType:t})}let nj=eD("ZodDefault",(t,r)=>{rz.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aQ(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),nO=eD("ZodPrefault",(t,r)=>{rZ.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a0(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nC=eD("ZodNonOptional",(t,r)=>{rD.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aW(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nI=eD("ZodCatch",(t,r)=>{rU.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a1(t,r,a,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),nN=eD("ZodPipe",(t,r)=>{rH.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a2(t,r,a,i),t.in=r.in,t.out=r.out});function nq(t,r){return new nN({type:"pipe",in:t,out:r})}let nA=eD("ZodPreprocess",(t,r)=>{nN.init(t,r),rB.init(t,r)}),nM=eD("ZodReadonly",(t,r)=>{rK.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a9(t,r,a,i),t.unwrap=()=>t._zod.def.innerType}),nz=eD("ZodLazy",(t,r)=>{rW.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>a3(t,r,a,i),t.unwrap=()=>t._zod.def.getter()});function nL(t){return new nz({type:"lazy",getter:t})}let nZ=eD("ZodCustom",(t,r)=>{rY.init(t,r),ij.init(t,r),t._zod.processJSONSchema=(r,a,i)=>aZ(t,r,a,i)});function nD(t,r){return new nA({type:"pipe",in:nR(t),out:r})}C||(C={});let nV="2025-11-25",nF=[nV,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nU="io.modelcontextprotocol/protocolVersion",nH="io.modelcontextprotocol/clientInfo",nJ="io.modelcontextprotocol/serverInfo",nB="io.modelcontextprotocol/clientCapabilities",nK="io.modelcontextprotocol/subscriptionId",nG="io.modelcontextprotocol/logLevel",nW=nL(()=>np([iI(),i3(),i7(),nt(),nv(iI(),nW),ns(nW)])),nY=nv(iI(),nW),nX=ns(nW),nQ=np([iI(),i3().int()]),n0=iI(),n1=nc({ttl:i3().optional()}),n2=nc({taskId:iI()}),n9=nu({progressToken:nQ.optional(),"io.modelcontextprotocol/related-task":n2.optional()}),n4=nc({_meta:n9.optional()}),n3=n4.extend({task:n1.optional()}),n6=nc({method:iI(),params:n4.loose().optional()}),n5=nc({_meta:n9.optional()}),n8=nc({method:iI(),params:n5.loose().optional()}),n7=nu({get[nJ](){return oh.optional().catch(void 0)}}),oe=nu({_meta:n7.optional()}),ot=np([iI(),i3().int()]),or=nc({jsonrpc:n$("2.0"),id:ot,...n6.shape}).strict(),oa=nc({jsonrpc:n$("2.0"),...n8.shape}).strict(),oi=nc({jsonrpc:n$("2.0"),id:ot,result:oe}).strict(),on=nc({jsonrpc:n$("2.0"),id:ot.optional(),error:nc({code:i3().int(),message:iI(),data:ni().optional()})}).strict(),oo=np([or,oa,oi,on]),os=np([oi,on]),ol=oe.strict(),oc=n5.extend({requestId:ot.optional(),reason:iI().optional()}),ou=n8.extend({method:n$("notifications/cancelled"),params:oc}),od=nc({src:iI(),mimeType:iI().optional(),sizes:ns(iI()).optional(),theme:nb(["light","dark"]).optional()}),op=nc({icons:ns(od).optional()}),om=nc({name:iI(),title:iI().optional()}),oh=om.extend({...om.shape,...op.shape,version:iI(),websiteUrl:iI().optional(),description:iI().optional()}),of=ny(nc({applyDefaults:i7().optional()}),nY),oy=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ny(nc({form:of.optional(),url:nY.optional()}),nY.optional())),og=nu({list:nY.optional(),cancel:nY.optional(),requests:nu({sampling:nu({createMessage:nY.optional()}).optional(),elicitation:nu({create:nY.optional()}).optional()}).optional()}),ov=nu({list:nY.optional(),cancel:nY.optional(),requests:nu({tools:nu({call:nY.optional()}).optional()}).optional()}),o_=nc({experimental:nv(iI(),nY).optional(),sampling:nc({context:nY.optional(),tools:nY.optional()}).optional(),elicitation:oy.optional(),roots:nc({listChanged:i7().optional()}).optional(),tasks:og.optional(),extensions:nv(iI(),nY).optional()}),ob=n4.extend({protocolVersion:iI(),capabilities:o_,clientInfo:oh}),oS=n6.extend({method:n$("initialize"),params:ob}),o$=nc({experimental:nv(iI(),nY).optional(),logging:nY.optional(),completions:nY.optional(),prompts:nc({listChanged:i7().optional()}).optional(),resources:nc({subscribe:i7().optional(),listChanged:i7().optional()}).optional(),tools:nc({listChanged:i7().optional()}).optional(),tasks:ov.optional(),extensions:nv(iI(),nY).optional()}),ow=oe.extend({protocolVersion:iI(),capabilities:o$,serverInfo:oh,instructions:iI().optional()}),oR=n8.extend({method:n$("notifications/initialized"),params:n5.optional()}),ok=n6.extend({method:n$("server/discover"),params:n4.optional()}),ox=oe.extend({supportedVersions:ns(iI()),capabilities:o$,instructions:iI().optional()}),oP=n6.extend({method:n$("ping"),params:n4.optional()}),oE=nc({progress:i3(),total:nx(i3()),message:nx(iI())}),oT=nc({...n5.shape,...oE.shape,progressToken:nQ}),oj=n8.extend({method:n$("notifications/progress"),params:oT}),oO=n4.extend({cursor:n0.optional()}),oC=n6.extend({params:oO.optional()}),oI=oe.extend({nextCursor:n0.optional()}),oN=nc({uri:iI(),mimeType:nx(iI()),_meta:nv(iI(),ni()).optional()}),oq=oN.extend({text:iI()}),oA=iI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oM=oN.extend({blob:oA}),oz=nb(["user","assistant"]),oL=nc({audience:ns(oz).optional(),priority:i3().min(0).max(1).optional(),lastModified:r9(iq,{offset:!0}).optional()}),oZ=nc({...om.shape,...op.shape,uri:iI(),description:nx(iI()),mimeType:nx(iI()),size:nx(i3()),annotations:oL.optional(),_meta:nx(nu({}))}),oD=nc({...om.shape,...op.shape,uriTemplate:iI(),description:nx(iI()),mimeType:nx(iI()),annotations:oL.optional(),_meta:nx(nu({}))}),oV=oC.extend({method:n$("resources/list")}),oF=oI.extend({resources:ns(oZ)}),oU=oC.extend({method:n$("resources/templates/list")}),oH=oI.extend({resourceTemplates:ns(oD)}),oJ=n4.extend({uri:iI()}),oB=n6.extend({method:n$("resources/read"),params:oJ}),oK=oe.extend({contents:ns(np([oq,oM]))}),oG=n8.extend({method:n$("notifications/resources/list_changed"),params:n5.optional()}),oW=n6.extend({method:n$("resources/subscribe"),params:oJ}),oY=n6.extend({method:n$("resources/unsubscribe"),params:oJ}),oX=nc({toolsListChanged:i7().optional(),promptsListChanged:i7().optional(),resourcesListChanged:i7().optional(),resourceSubscriptions:ns(iI()).optional()}),oQ=n4.extend({notifications:oX}),o0=n6.extend({method:n$("subscriptions/listen"),params:oQ}),o1=n5.extend({notifications:oX}),o2=n8.extend({method:n$("notifications/subscriptions/acknowledged"),params:o1}),o9=n7.extend({[nK]:ot}),o4=oe.extend({_meta:o9}),o3=n5.extend({uri:iI()}),o6=n8.extend({method:n$("notifications/resources/updated"),params:o3}),o5=nc({name:iI(),description:nx(iI()),required:nx(i7())}),o8=nc({...om.shape,...op.shape,description:nx(iI()),arguments:nx(ns(o5)),_meta:nx(nu({}))}),o7=oC.extend({method:n$("prompts/list")}),se=oI.extend({prompts:ns(o8)}),st=n4.extend({name:iI(),arguments:nv(iI(),iI()).optional()}),sr=n6.extend({method:n$("prompts/get"),params:st}),sa=nc({type:n$("text"),text:iI(),annotations:oL.optional(),_meta:nv(iI(),ni()).optional()}),si=nc({type:n$("image"),data:oA,mimeType:iI(),annotations:oL.optional(),_meta:nv(iI(),ni()).optional()}),sn=nc({type:n$("audio"),data:oA,mimeType:iI(),annotations:oL.optional(),_meta:nv(iI(),ni()).optional()}),so=nc({type:n$("tool_use"),name:iI(),id:iI(),input:nv(iI(),ni()),_meta:nv(iI(),ni()).optional()}),ss=nc({type:n$("resource"),resource:np([oq,oM]),annotations:oL.optional(),_meta:nv(iI(),ni()).optional()}),sl=oZ.extend({type:n$("resource_link")}),sc=np([sa,si,sn,sl,ss]),su=nc({role:oz,content:sc}),sd=oe.extend({description:iI().optional(),messages:ns(su)}),sp=n8.extend({method:n$("notifications/prompts/list_changed"),params:n5.optional()}),sm=nc({title:iI().optional(),readOnlyHint:i7().optional(),destructiveHint:i7().optional(),idempotentHint:i7().optional(),openWorldHint:i7().optional()}),sh=nc({taskSupport:nb(["required","optional","forbidden"]).optional()}),sf=nc({...om.shape,...op.shape,description:iI().optional(),inputSchema:nc({type:n$("object"),properties:nv(iI(),nW).optional(),required:ns(iI()).optional()}).catchall(ni()),outputSchema:nu({$schema:iI().optional()}).optional(),annotations:sm.optional(),execution:sh.optional(),_meta:nv(iI(),ni()).optional()}),sy=oC.extend({method:n$("tools/list")}),sg=oI.extend({tools:ns(sf)}),sv=oe.extend({content:ns(sc).default([]),structuredContent:ni().optional(),isError:i7().optional()}),s_=sv.or(oe.extend({toolResult:ni()})),sb=n3.extend({name:iI(),arguments:nv(iI(),ni()).optional()}),sS=n6.extend({method:n$("tools/call"),params:sb}),s$=n8.extend({method:n$("notifications/tools/list_changed"),params:n5.optional()}),sw=nc({autoRefresh:i7().default(!0),debounceMs:i3().int().nonnegative().default(300)}),sR=nb(["debug","info","notice","warning","error","critical","alert","emergency"]),sk=n4.extend({level:sR}),sx=n6.extend({method:n$("logging/setLevel"),params:sk}),sP=n5.extend({level:sR,logger:iI().optional(),data:ni()}),sE=n8.extend({method:n$("notifications/message"),params:sP}),sT=nc({name:iI().optional()}),sj=nc({hints:ns(sT).optional(),costPriority:i3().min(0).max(1).optional(),speedPriority:i3().min(0).max(1).optional(),intelligencePriority:i3().min(0).max(1).optional()}),sO=nc({mode:nb(["auto","required","none"]).optional()}),sC=nc({type:n$("tool_result"),toolUseId:iI().describe("The unique identifier for the corresponding tool call."),content:ns(sc),structuredContent:ni().optional(),isError:i7().optional(),_meta:nv(iI(),ni()).optional()}),sI=nh("type",[sa,si,sn]),sN=nh("type",[sa,si,sn,so,sC]),sq=nc({role:oz,content:np([sN,ns(sN)]),_meta:nv(iI(),ni()).optional()}),sA=n3.extend({messages:ns(sq),modelPreferences:sj.optional(),systemPrompt:iI().optional(),includeContext:nb(["none","thisServer","allServers"]).optional(),temperature:i3().optional(),maxTokens:i3().int(),stopSequences:ns(iI()).optional(),metadata:nY.optional(),tools:ns(sf).optional(),toolChoice:sO.optional()}),sM=n6.extend({method:n$("sampling/createMessage"),params:sA}),sz=oe.extend({model:iI(),stopReason:nx(nb(["endTurn","stopSequence","maxTokens"]).or(iI())),role:oz,content:sI}),sL=oe.extend({model:iI(),stopReason:nx(nb(["endTurn","stopSequence","maxTokens","toolUse"]).or(iI())),role:oz,content:np([sN,ns(sN)])}),sZ=nc({type:n$("boolean"),title:iI().optional(),description:iI().optional(),default:i7().optional()}),sD=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),minLength:i3().optional(),maxLength:i3().optional(),format:nb(["email","uri","date","date-time"]).optional(),default:iI().optional()}),sV=nc({type:nb(["number","integer"]),title:iI().optional(),description:iI().optional(),minimum:i3().optional(),maximum:i3().optional(),default:i3().optional()}),sF=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),default:iI().optional()}),sU=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),oneOf:ns(nc({const:iI(),title:iI()})),default:iI().optional()}),sH=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),enumNames:ns(iI()).optional(),default:iI().optional()}),sJ=np([sF,sU]),sB=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({type:n$("string"),enum:ns(iI())}),default:ns(iI()).optional()}),sK=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({anyOf:ns(nc({const:iI(),title:iI()}))}),default:ns(iI()).optional()}),sG=np([sB,sK]),sW=np([sH,sJ,sG]),sY=np([sW,sZ,sD,sV]),sX=n3.extend({mode:n$("form").optional(),message:iI(),requestedSchema:nc({type:n$("object"),properties:nv(iI(),sY),required:ns(iI()).optional()}).catchall(ni())}),sQ=n3.extend({mode:n$("url"),message:iI(),elicitationId:iI(),url:iI().url()}),s0=np([sX,sQ]),s1=n6.extend({method:n$("elicitation/create"),params:s0}),s2=n5.extend({elicitationId:iI()}),s9=n8.extend({method:n$("notifications/elicitation/complete"),params:s2}),s4=oe.extend({action:nb(["accept","decline","cancel"]),content:nD(t=>null===t?void 0:t,nv(iI(),np([iI(),i3(),i7(),ns(iI())])).optional())}),s3=nc({type:n$("ref/resource"),uri:iI()}),s6=nc({type:n$("ref/prompt"),name:iI()}),s5=n4.extend({ref:np([s6,s3]),argument:nc({name:iI(),value:iI()}),context:nc({arguments:nv(iI(),iI()).optional()}).optional()}),s8=n6.extend({method:n$("completion/complete"),params:s5}),s7=oe.extend({completion:nu({values:ns(iI()).max(100),total:nx(i3().int()),hasMore:nx(i7())})}),le=nc({uri:iI().startsWith("file://"),name:iI().optional(),_meta:nv(iI(),ni()).optional()}),lt=n6.extend({method:n$("roots/list"),params:n4.optional()}),lr=oe.extend({roots:ns(le)}),la=n8.extend({method:n$("notifications/roots/list_changed"),params:n5.optional()}),li=nu({ttl:i3().optional(),pollInterval:i3().optional()}),ln=nb(["working","input_required","completed","failed","cancelled"]),lo=nc({taskId:iI(),status:ln,ttl:np([i3(),nt()]),createdAt:iI(),lastUpdatedAt:iI(),pollInterval:nx(i3()),statusMessage:nx(iI())}),ls=oe.extend({task:lo}),ll=n5.merge(lo),lc=n8.extend({method:n$("notifications/tasks/status"),params:ll}),lu=n6.extend({method:n$("tasks/get"),params:n4.extend({taskId:iI()})}),ld=oe.merge(lo),lp=n6.extend({method:n$("tasks/result"),params:n4.extend({taskId:iI()})}),lm=oe.loose(),lh=oC.extend({method:n$("tasks/list")}),lf=oI.extend({tasks:ns(lo)}),ly=n6.extend({method:n$("tasks/cancel"),params:n4.extend({taskId:iI()})}),lg=oe.merge(lo),lv=np([oP,oS,ok,s8,sx,sr,o7,oV,oU,oB,oW,oY,o0,sS,sy]),l_=np([ou,oj,oR,la]),lb=np([ol,sz,sL,s4,lr]),lS=np([oP,sM,s1,lt]),l$=np([ou,oj,sE,o6,oG,s$,sp,o2,s9]),lw=np([ol,ow,ox,s7,sd,se,oF,oH,oK,sv,sg,o4]),lR=r2(iV,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),ez}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lk=nu({resource:iI().url(),authorization_servers:ns(lR).optional(),jwks_uri:iI().url().optional(),scopes_supported:ns(iI()).optional(),bearer_methods_supported:ns(iI()).optional(),resource_signing_alg_values_supported:ns(iI()).optional(),resource_name:iI().optional(),resource_documentation:iI().optional(),resource_policy_uri:iI().url().optional(),resource_tos_uri:iI().url().optional(),tls_client_certificate_bound_access_tokens:i7().optional(),authorization_details_types_supported:ns(iI()).optional(),dpop_signing_alg_values_supported:ns(iI()).optional(),dpop_bound_access_tokens_required:i7().optional()}),lx=nu({issuer:iI(),authorization_endpoint:lR,token_endpoint:lR,registration_endpoint:lR.optional(),scopes_supported:ns(iI()).optional(),response_types_supported:ns(iI()),response_modes_supported:ns(iI()).optional(),grant_types_supported:ns(iI()).optional(),token_endpoint_auth_methods_supported:ns(iI()).optional(),token_endpoint_auth_signing_alg_values_supported:ns(iI()).optional(),service_documentation:lR.optional(),revocation_endpoint:lR.optional(),revocation_endpoint_auth_methods_supported:ns(iI()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ns(iI()).optional(),introspection_endpoint:iI().optional(),introspection_endpoint_auth_methods_supported:ns(iI()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ns(iI()).optional(),code_challenge_methods_supported:ns(iI()).optional(),client_id_metadata_document_supported:i7().optional(),authorization_response_iss_parameter_supported:i7().optional().catch(void 0)}),lP=nu({issuer:iI(),authorization_endpoint:lR,token_endpoint:lR,userinfo_endpoint:lR.optional(),jwks_uri:lR,registration_endpoint:lR.optional(),scopes_supported:ns(iI()).optional(),response_types_supported:ns(iI()),response_modes_supported:ns(iI()).optional(),grant_types_supported:ns(iI()).optional(),acr_values_supported:ns(iI()).optional(),subject_types_supported:ns(iI()),id_token_signing_alg_values_supported:ns(iI()),id_token_encryption_alg_values_supported:ns(iI()).optional(),id_token_encryption_enc_values_supported:ns(iI()).optional(),userinfo_signing_alg_values_supported:ns(iI()).optional(),userinfo_encryption_alg_values_supported:ns(iI()).optional(),userinfo_encryption_enc_values_supported:ns(iI()).optional(),request_object_signing_alg_values_supported:ns(iI()).optional(),request_object_encryption_alg_values_supported:ns(iI()).optional(),request_object_encryption_enc_values_supported:ns(iI()).optional(),token_endpoint_auth_methods_supported:ns(iI()).optional(),token_endpoint_auth_signing_alg_values_supported:ns(iI()).optional(),display_values_supported:ns(iI()).optional(),claim_types_supported:ns(iI()).optional(),claims_supported:ns(iI()).optional(),service_documentation:iI().optional(),claims_locales_supported:ns(iI()).optional(),ui_locales_supported:ns(iI()).optional(),claims_parameter_supported:i7().optional(),request_parameter_supported:i7().optional(),request_uri_parameter_supported:i7().optional(),require_request_uri_registration:i7().optional(),op_policy_uri:lR.optional(),op_tos_uri:lR.optional(),client_id_metadata_document_supported:i7().optional(),authorization_response_iss_parameter_supported:i7().optional().catch(void 0)}),lE=nc({...lP.shape,...lx.pick({code_challenge_methods_supported:!0}).shape}),lT=nc({access_token:iI(),id_token:iI().optional(),token_type:iI(),expires_in:new i4(r0({type:"number",coerce:!0,checks:[],...eg(void 0)})).optional(),scope:iI().optional(),refresh_token:iI().optional()}).strip(),lj=nc({issued_token_type:n$("urn:ietf:params:oauth:token-type:id-jag"),access_token:iI(),token_type:iI().optional(),expires_in:i3().optional(),scope:iI().optional()}).strip(),lO=nc({error:iI(),error_description:iI().optional(),error_uri:iI().optional()}),lC=lR.optional().or(n$("").transform(()=>void 0)),lI=nc({redirect_uris:ns(lR),token_endpoint_auth_method:iI().optional(),grant_types:ns(iI()).optional(),response_types:ns(iI()).optional(),application_type:iI().optional(),client_name:iI().optional(),client_uri:lR.optional(),logo_uri:lC,scope:iI().optional(),contacts:ns(iI()).optional(),tos_uri:lC,policy_uri:iI().optional(),jwks_uri:lR.optional(),jwks:new nr({type:"any"}).optional(),software_id:iI().optional(),software_version:iI().optional(),software_statement:iI().optional()}).strip(),lN=nc({client_id:iI(),client_secret:iI().optional(),client_id_issued_at:i3().optional(),client_secret_expires_at:i3().optional()}).strip(),lq=lI.merge(lN),lA=nc({error:iI(),error_description:iI().optional()}).strip(),lM=nc({token:iI(),token_type_hint:iI().optional()}).strip(),lz=Symbol.for("mcp.sdk.errorBrands");function lL(t,r){let a=new Set,i=r;for(;"function"==typeof i;){let t=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&"string"==typeof t&&a.add(t),i=Object.getPrototypeOf(i)}0!==a.size&&Object.defineProperty(t,lz,{value:a,enumerable:!1,configurable:!0})}function lZ(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lz)){let a=r[lz];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}(class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lZ(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lZ(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lL(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}});let lD=((R={}).NotConnected="NOT_CONNECTED",R.AlreadyConnected="ALREADY_CONNECTED",R.NotInitialized="NOT_INITIALIZED",R.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",R.RequestTimeout="REQUEST_TIMEOUT",R.ConnectionClosed="CONNECTION_CLOSED",R.SendFailed="SEND_FAILED",R.InvalidResult="INVALID_RESULT",R.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",R.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",R.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",R.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",R.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",R.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",R.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",R.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",R.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",R.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",R.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",R);var lV=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lZ(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lZ(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="SdkError",lL(this,new.target)}};(class extends lV{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a){super(t,r,a),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lF={};function lU(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function lH(t,r){let a={};for(let[i,n]of Object.entries(t)){if(void 0===n)continue;let t=void 0===r?void 0:r[i];if(void 0===t){a[i]=n;continue}if(lU(n)&&lU(t)){let r={};for(let[a,o]of Object.entries(n))void 0!==o&&void 0===t[a]&&("elicitation"!==i||"form"!==a||void 0!==t.form||void 0!==t.url)&&(r[a]=o);Object.keys(r).length>0&&(a[i]=r)}}return Object.keys(a).length>0?a:void 0}let lJ="2026-07-28",lB=[lJ];function lK(t){return t.filter(t=>t>=lJ)}function lG(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let lW=["task","inputRequests","requestState"];function lY(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||lW.some(r=>r in t)?t:{...t,content:[]}}function lX(){let t,r,a,i,o,s,l,c,u,d,p,m,h,f,y,g,v,_,b,S,$,w,R,k,x,P,E,T,j,O,C,I,N,q,A,M,z,L,Z,D,V,F,U,H,J,B,K,G,W,Y,X,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,eO,eC,eI,eN,eq,eA,eM,ez,eL,eZ,eD,eV,eF,eU,eH,eJ,eB,eK,eG,eW,eY,eX,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$,tw;return n??=(t=nL(()=>np([iI(),i3(),i7(),nt(),nv(iI(),t),ns(t)])),r=nv(iI(),t),a=np([iI(),i3().int()]),i=iI(),o=nc({ttl:i3().optional()}),s=nc({taskId:iI()}),u=(c=nc({_meta:(l=nu({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:o.optional()}),d=nc({method:iI(),params:c.loose().optional()}),p=nc({_meta:l.optional()}),m=nc({method:iI(),params:p.loose().optional()}),h=nu({_meta:l.optional()}),f=np([iI(),i3().int()]),y=h.strict(),g=p.extend({requestId:f.optional(),reason:iI().optional()}),v=m.extend({method:n$("notifications/cancelled"),params:g}),_=nc({src:iI(),mimeType:iI().optional(),sizes:ns(iI()).optional(),theme:nb(["light","dark"]).optional()}),b=nc({icons:ns(_).optional()}),$=(S=nc({name:iI(),title:iI().optional()})).extend({...S.shape,...b.shape,version:iI(),websiteUrl:iI().optional(),description:iI().optional()}),w=ny(nc({applyDefaults:i7().optional()}),r),R=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ny(nc({form:w.optional(),url:r.optional()}),r.optional())),k=nu({list:r.optional(),cancel:r.optional(),requests:nu({sampling:nu({createMessage:r.optional()}).optional(),elicitation:nu({create:r.optional()}).optional()}).optional()}),x=nu({list:r.optional(),cancel:r.optional(),requests:nu({tools:nu({call:r.optional()}).optional()}).optional()}),P=nc({experimental:nv(iI(),r).optional(),sampling:nc({context:r.optional(),tools:r.optional()}).optional(),elicitation:R.optional(),roots:nc({listChanged:i7().optional()}).optional(),tasks:k.optional(),extensions:nv(iI(),r).optional()}),E=c.extend({protocolVersion:iI(),capabilities:P,clientInfo:$}),T=d.extend({method:n$("initialize"),params:E}),j=nc({experimental:nv(iI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:nc({listChanged:i7().optional()}).optional(),resources:nc({subscribe:i7().optional(),listChanged:i7().optional()}).optional(),tools:nc({listChanged:i7().optional()}).optional(),tasks:x.optional(),extensions:nv(iI(),r).optional()}),O=h.extend({protocolVersion:iI(),capabilities:j,serverInfo:$,instructions:iI().optional()}),C=m.extend({method:n$("notifications/initialized"),params:p.optional()}),I=d.extend({method:n$("ping"),params:c.optional()}),N=nc({progress:i3(),total:nx(i3()),message:nx(iI())}),q=nc({...p.shape,...N.shape,progressToken:a}),A=m.extend({method:n$("notifications/progress"),params:q}),M=c.extend({cursor:i.optional()}),z=d.extend({params:M.optional()}),L=h.extend({nextCursor:i.optional()}),D=(Z=nc({uri:iI(),mimeType:nx(iI()),_meta:nv(iI(),ni()).optional()})).extend({text:iI()}),V=iI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),F=Z.extend({blob:V}),H=nc({audience:ns(U=nb(["user","assistant"])).optional(),priority:i3().min(0).max(1).optional(),lastModified:r9(iq,{offset:!0}).optional()}),J=nc({...S.shape,...b.shape,uri:iI(),description:nx(iI()),mimeType:nx(iI()),size:nx(i3()),annotations:H.optional(),_meta:nx(nu({}))}),B=nc({...S.shape,...b.shape,uriTemplate:iI(),description:nx(iI()),mimeType:nx(iI()),annotations:H.optional(),_meta:nx(nu({}))}),K=z.extend({method:n$("resources/list")}),G=L.extend({resources:ns(J)}),W=z.extend({method:n$("resources/templates/list")}),Y=L.extend({resourceTemplates:ns(B)}),X=c.extend({uri:iI()}),Q=d.extend({method:n$("resources/read"),params:X}),ee=h.extend({contents:ns(np([D,F]))}),et=m.extend({method:n$("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:n$("resources/subscribe"),params:X}),ea=d.extend({method:n$("resources/unsubscribe"),params:X}),ei=p.extend({uri:iI()}),en=m.extend({method:n$("notifications/resources/updated"),params:ei}),eo=nc({name:iI(),description:nx(iI()),required:nx(i7())}),es=nc({...S.shape,...b.shape,description:nx(iI()),arguments:nx(ns(eo)),_meta:nx(nu({}))}),el=z.extend({method:n$("prompts/list")}),ec=L.extend({prompts:ns(es)}),eu=c.extend({name:iI(),arguments:nv(iI(),iI()).optional()}),ed=d.extend({method:n$("prompts/get"),params:eu}),ep=nc({type:n$("text"),text:iI(),annotations:H.optional(),_meta:nv(iI(),ni()).optional()}),em=nc({type:n$("image"),data:V,mimeType:iI(),annotations:H.optional(),_meta:nv(iI(),ni()).optional()}),eh=nc({type:n$("audio"),data:V,mimeType:iI(),annotations:H.optional(),_meta:nv(iI(),ni()).optional()}),ef=nc({type:n$("tool_use"),name:iI(),id:iI(),input:nv(iI(),ni()),_meta:nv(iI(),ni()).optional()}),ey=nc({type:n$("resource"),resource:np([D,F]),annotations:H.optional(),_meta:nv(iI(),ni()).optional()}),e_=nc({role:U,content:ev=np([ep,em,eh,eg=J.extend({type:n$("resource_link")}),ey])}),eb=h.extend({description:iI().optional(),messages:ns(e_)}),eS=m.extend({method:n$("notifications/prompts/list_changed"),params:p.optional()}),e$=nc({title:iI().optional(),readOnlyHint:i7().optional(),destructiveHint:i7().optional(),idempotentHint:i7().optional(),openWorldHint:i7().optional()}),ew=nc({taskSupport:nb(["required","optional","forbidden"]).optional()}),eR=nc({...S.shape,...b.shape,description:iI().optional(),inputSchema:nc({type:n$("object"),properties:nv(iI(),t).optional(),required:ns(iI()).optional()}).catchall(ni()),outputSchema:nc({type:n$("object"),properties:nv(iI(),t).optional(),required:ns(iI()).optional()}).catchall(ni()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:nv(iI(),ni()).optional()}),ek=z.extend({method:n$("tools/list")}),ex=L.extend({tools:ns(eR)}),eP=h.extend({content:ns(ev),structuredContent:nv(iI(),ni()).optional(),isError:i7().optional()}),eE=u.extend({name:iI(),arguments:nv(iI(),ni()).optional()}),eT=d.extend({method:n$("tools/call"),params:eE}),ej=m.extend({method:n$("notifications/tools/list_changed"),params:p.optional()}),eO=nb(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:eO}),eI=d.extend({method:n$("logging/setLevel"),params:eC}),eN=p.extend({level:eO,logger:iI().optional(),data:ni()}),eq=m.extend({method:n$("notifications/message"),params:eN}),eA=nc({name:iI().optional()}),eM=nc({hints:ns(eA).optional(),costPriority:i3().min(0).max(1).optional(),speedPriority:i3().min(0).max(1).optional(),intelligencePriority:i3().min(0).max(1).optional()}),ez=nc({mode:nb(["auto","required","none"]).optional()}),eL=nc({type:n$("tool_result"),toolUseId:iI().describe("The unique identifier for the corresponding tool call."),content:ns(ev),structuredContent:nc({}).loose().optional(),isError:i7().optional(),_meta:nv(iI(),ni()).optional()}),eZ=nh("type",[ep,em,eh]),eV=nc({role:U,content:np([eD=nh("type",[ep,em,eh,ef,eL]),ns(eD)]),_meta:nv(iI(),ni()).optional()}),eF=u.extend({messages:ns(eV),modelPreferences:eM.optional(),systemPrompt:iI().optional(),includeContext:nb(["none","thisServer","allServers"]).optional(),temperature:i3().optional(),maxTokens:i3().int(),stopSequences:ns(iI()).optional(),metadata:r.optional(),tools:ns(eR).optional(),toolChoice:ez.optional()}),eU=d.extend({method:n$("sampling/createMessage"),params:eF}),eH=h.extend({model:iI(),stopReason:nx(nb(["endTurn","stopSequence","maxTokens"]).or(iI())),role:U,content:eZ}),eJ=h.extend({model:iI(),stopReason:nx(nb(["endTurn","stopSequence","maxTokens","toolUse"]).or(iI())),role:U,content:np([eD,ns(eD)])}),eB=nc({type:n$("boolean"),title:iI().optional(),description:iI().optional(),default:i7().optional()}),eK=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),minLength:i3().optional(),maxLength:i3().optional(),format:nb(["email","uri","date","date-time"]).optional(),default:iI().optional()}),eG=nc({type:nb(["number","integer"]),title:iI().optional(),description:iI().optional(),minimum:i3().optional(),maximum:i3().optional(),default:i3().optional()}),eW=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),default:iI().optional()}),eY=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),oneOf:ns(nc({const:iI(),title:iI()})),default:iI().optional()}),eX=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),enumNames:ns(iI()).optional(),default:iI().optional()}),eQ=np([eW,eY]),e0=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({type:n$("string"),enum:ns(iI())}),default:ns(iI()).optional()}),e2=np([e0,e1=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({anyOf:ns(nc({const:iI(),title:iI()}))}),default:ns(iI()).optional()})]),e9=np([eX,eQ,e2]),e4=np([e9,eB,eK,eG]),e3=u.extend({mode:n$("form").optional(),message:iI(),requestedSchema:nc({type:n$("object"),properties:nv(iI(),e4),required:ns(iI()).optional()}).catchall(ni())}),e5=np([e3,e6=u.extend({mode:n$("url"),message:iI(),elicitationId:iI(),url:iI().url()})]),e8=d.extend({method:n$("elicitation/create"),params:e5}),e7=p.extend({elicitationId:iI()}),te=m.extend({method:n$("notifications/elicitation/complete"),params:e7}),tt=h.extend({action:nb(["accept","decline","cancel"]),content:nD(t=>null===t?void 0:t,nv(iI(),np([iI(),i3(),i7(),ns(iI())])).optional())}),tr=nc({type:n$("ref/resource"),uri:iI()}),ta=nc({type:n$("ref/prompt"),name:iI()}),ti=c.extend({ref:np([ta,tr]),argument:nc({name:iI(),value:iI()}),context:nc({arguments:nv(iI(),iI()).optional()}).optional()}),tn=d.extend({method:n$("completion/complete"),params:ti}),to=h.extend({completion:nu({values:ns(iI()).max(100),total:nx(i3().int()),hasMore:nx(i7())})}),ts=nc({uri:iI().startsWith("file://"),name:iI().optional(),_meta:nv(iI(),ni()).optional()}),tl=d.extend({method:n$("roots/list"),params:c.optional()}),tc=h.extend({roots:ns(ts)}),tu=m.extend({method:n$("notifications/roots/list_changed"),params:p.optional()}),td=nu({ttl:i3().optional(),pollInterval:i3().optional()}),tp=nb(["working","input_required","completed","failed","cancelled"]),tm=nc({taskId:iI(),status:tp,ttl:np([i3(),nt()]),createdAt:iI(),lastUpdatedAt:iI(),pollInterval:nx(i3()),statusMessage:nx(iI())}),th=h.extend({task:tm}),tf=p.merge(tm),ty=m.extend({method:n$("notifications/tasks/status"),params:tf}),tg=d.extend({method:n$("tasks/get"),params:c.extend({taskId:iI()})}),tv=h.merge(tm),t_=d.extend({method:n$("tasks/result"),params:c.extend({taskId:iI()})}),tb=h.loose(),tS=z.extend({method:n$("tasks/list")}),t$=L.extend({tasks:ns(tm)}),tw=d.extend({method:n$("tasks/cancel"),params:c.extend({taskId:iI()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:m,ResultSchema:h,RequestIdSchema:f,EmptyResultSchema:y,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:E,InitializeRequestSchema:T,ServerCapabilitiesSchema:j,InitializeResultSchema:O,InitializedNotificationSchema:C,PingRequestSchema:I,ProgressSchema:N,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:A,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:z,PaginatedResultSchema:L,ResourceContentsSchema:Z,TextResourceContentsSchema:D,BlobResourceContentsSchema:F,RoleSchema:U,AnnotationsSchema:H,ResourceSchema:J,ResourceTemplateSchema:B,ListResourcesRequestSchema:K,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:W,ListResourceTemplatesResultSchema:Y,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:ei,ResourceUpdatedNotificationSchema:en,PromptArgumentSchema:eo,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:em,AudioContentSchema:eh,ToolUseContentSchema:ef,EmbeddedResourceSchema:ey,ResourceLinkSchema:eg,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:eR,ListToolsRequestSchema:ek,ListToolsResultSchema:ex,CallToolResultSchema:eP,CallToolRequestParamsSchema:eE,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:ej,LoggingLevelSchema:eO,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eI,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eq,ModelHintSchema:eA,ModelPreferencesSchema:eM,ToolChoiceSchema:ez,ToolResultContentSchema:eL,SamplingContentSchema:eZ,SamplingMessageContentBlockSchema:eD,SamplingMessageSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eH,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eB,StringSchemaSchema:eK,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eW,TitledSingleSelectEnumSchemaSchema:eY,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e3,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e8,ElicitationCompleteNotificationParamsSchema:e7,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:ti,CompleteRequestSchema:tn,CompleteResultSchema:to,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:tm,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:ty,GetTaskRequestSchema:tg,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tm),ClientRequestSchema:np([I,T,tn,eI,ed,el,K,W,Q,er,ea,eT,ek,tg,t_,tS,tw]),ClientNotificationSchema:np([v,A,C,tu,ty]),ClientResultSchema:np([y,eH,eJ,tt,tc,tv,t$,th]),ServerRequestSchema:np([I,eU,e8,tl,tg,t_,tS,tw]),ServerNotificationSchema:np([v,A,eq,en,et,ej,eS,ty,te]),ServerResultSchema:np([y,O,to,eb,ec,G,Y,ee,eP,ex,tv,t$,th]),CallToolResultWireSchema:ni().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of lW)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(lY).pipe(eP)})}function lQ(t){return"object"!==t.type}let l0=new Set(["const","enum","default","examples"]),l1=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l2(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l9={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},l4={"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},l3={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 l6(){if(o)return o;let t=lX();return o={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function l5(t){return Object.prototype.hasOwnProperty.call(l9,t)}function l8(t){return Object.prototype.hasOwnProperty.call(l4,t)}function l7(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ce(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(l9),Object.keys(l4);let ct={ok:!1,reason:"not-in-era"};function cr(t){return l7(t)&&l7(t.outputSchema)&&lQ(t.outputSchema)}let ca={era:"2025-11-25",hasRequestMethod:l5,hasNotificationMethod:l8,validateRequest:(t,r)=>ce(l5(t)?l6().requestSchemas[t]:void 0,r),validateResult:(t,r)=>ce(Object.prototype.hasOwnProperty.call(l3,t)?l6().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>ce(l8(t)?l6().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ct,validateInputResponse:()=>ct,samplingResultVariant:(t,r)=>{let a=lX();return ce(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=lG(t),i=a.structuredContent;if(void 0===i)return a;let n="object"!=typeof i||null===i||Array.isArray(i),o=void 0!==r&&lQ(r);return n||o?{...a,structuredContent:{result:i}}:a},decodeResult(t,r){if(l7(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>cr(t))?{...r,tools:a.map(t=>cr(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(l2(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let i="string"==typeof(r=t.$schema)&&J.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,n=(t,r)=>{if(Array.isArray(t))return t.map(t=>n(t,!1));if(null===t||"object"!=typeof t||!r&&l2(t.$id))return t;let a={},o=!1;for(let[s,l]of Object.entries(t))r?a[s]=n(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&i?o=!0:l0.has(s)?a[s]=l:l1.has(s)?a[s]=n(l,!0):a[s]=n(l,!1);return o&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:n(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function ci(){return s??=function(){let t=nL(()=>np([iI(),i3(),i7(),nt(),nv(iI(),t),ns(t)])),r=nv(iI(),t),a=np([iI(),i3().int()]),i=iI(),n=np([iI(),i3().int()]),o=nb(["user","assistant"]),s=nb(["debug","info","notice","warning","error","critical","alert","emergency"]),l=iI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=nc({ttl:i3().optional()}),u=nc({taskId:iI()}),d=nu({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=nc({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=nc({_meta:d.optional()}),f=nc({method:iI(),params:h.loose().optional()}),y=nc({src:iI(),mimeType:iI().optional(),sizes:ns(iI()).optional(),theme:nb(["light","dark"]).optional()}),g=nc({icons:ns(y).optional()}),v=nc({name:iI(),title:iI().optional()}),_=v.extend({...v.shape,...g.shape,version:iI(),websiteUrl:iI().optional(),description:iI().optional()}),b=ny(nc({applyDefaults:i7().optional()}),r),S=nD(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,ny(nc({form:b.optional(),url:r.optional()}),r.optional())),$=nu({list:r.optional(),cancel:r.optional(),requests:nu({sampling:nu({createMessage:r.optional()}).optional(),elicitation:nu({create:r.optional()}).optional()}).optional()}),w=nu({list:r.optional(),cancel:r.optional(),requests:nu({tools:nu({call:r.optional()}).optional()}).optional()}),R=nc({experimental:nv(iI(),r).optional(),sampling:nc({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:nc({listChanged:i7().optional()}).optional(),tasks:$.optional(),extensions:nv(iI(),r).optional()}),k=nc({experimental:nv(iI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:nc({listChanged:i7().optional()}).optional(),resources:nc({subscribe:i7().optional(),listChanged:i7().optional()}).optional(),tools:nc({listChanged:i7().optional()}).optional(),tasks:w.optional(),extensions:nv(iI(),r).optional()}),x=nc({progress:i3(),total:nx(i3()),message:nx(iI())}),P=nc({...h.shape,...x.shape,progressToken:a}),E=f.extend({method:n$("notifications/progress"),params:P}),T=h.extend({level:s,logger:iI().optional(),data:ni()}),j=f.extend({method:n$("notifications/message"),params:T}),O=nc({uri:iI(),mimeType:nx(iI()),_meta:nv(iI(),ni()).optional()}),C=O.extend({text:iI()}),I=O.extend({blob:l}),N=nc({audience:ns(o).optional(),priority:i3().min(0).max(1).optional(),lastModified:r9(iq,{offset:!0}).optional()}),q=nc({...v.shape,...g.shape,uri:iI(),description:nx(iI()),mimeType:nx(iI()),size:nx(i3()),annotations:N.optional(),_meta:nx(nu({}))}),A=nc({...v.shape,...g.shape,uriTemplate:iI(),description:nx(iI()),mimeType:nx(iI()),annotations:N.optional(),_meta:nx(nu({}))}),M=f.extend({method:n$("notifications/resources/list_changed"),params:h.optional()}),z=h.extend({uri:iI()}),L=f.extend({method:n$("notifications/resources/updated"),params:z}),Z=nc({name:iI(),description:nx(iI()),required:nx(i7())}),D=nc({...v.shape,...g.shape,description:nx(iI()),arguments:nx(ns(Z)),_meta:nx(nu({}))}),V=f.extend({method:n$("notifications/prompts/list_changed"),params:h.optional()}),F=nc({type:n$("text"),text:iI(),annotations:N.optional(),_meta:nv(iI(),ni()).optional()}),U=nc({type:n$("image"),data:l,mimeType:iI(),annotations:N.optional(),_meta:nv(iI(),ni()).optional()}),H=nc({type:n$("audio"),data:l,mimeType:iI(),annotations:N.optional(),_meta:nv(iI(),ni()).optional()}),J=nc({type:n$("tool_use"),name:iI(),id:iI(),input:nv(iI(),ni()),_meta:nv(iI(),ni()).optional()}),B=nc({type:n$("resource"),resource:np([C,I]),annotations:N.optional(),_meta:nv(iI(),ni()).optional()}),K=q.extend({type:n$("resource_link")}),G=np([F,U,H,K,B]),W=nc({role:o,content:G}),Y=nc({title:iI().optional(),readOnlyHint:i7().optional(),destructiveHint:i7().optional(),idempotentHint:i7().optional(),openWorldHint:i7().optional()}),X=f.extend({method:n$("notifications/tools/list_changed"),params:h.optional()}),Q=nc({name:iI().optional()}),ee=nc({hints:ns(Q).optional(),costPriority:i3().min(0).max(1).optional(),speedPriority:i3().min(0).max(1).optional(),intelligencePriority:i3().min(0).max(1).optional()}),et=nc({mode:nb(["auto","required","none"]).optional()}),er=nc({type:n$("boolean"),title:iI().optional(),description:iI().optional(),default:i7().optional()}),ea=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),minLength:i3().optional(),maxLength:i3().optional(),format:nb(["email","uri","date","date-time"]).optional(),default:iI().optional()}),ei=nc({type:nb(["number","integer"]),title:iI().optional(),description:iI().optional(),minimum:i3().optional(),maximum:i3().optional(),default:i3().optional()}),en=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),default:iI().optional()}),eo=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),oneOf:ns(nc({const:iI(),title:iI()})),default:iI().optional()}),es=nc({type:n$("string"),title:iI().optional(),description:iI().optional(),enum:ns(iI()),enumNames:ns(iI()).optional(),default:iI().optional()}),el=np([en,eo]),ec=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({type:n$("string"),enum:ns(iI())}),default:ns(iI()).optional()}),eu=nc({type:n$("array"),title:iI().optional(),description:iI().optional(),minItems:i3().optional(),maxItems:i3().optional(),items:nc({anyOf:ns(nc({const:iI(),title:iI()}))}),default:ns(iI()).optional()}),ed=np([ec,eu]),ep=np([es,el,ed]),em=np([ep,er,ea,ei]),eh=m.extend({mode:n$("form").optional(),message:iI(),requestedSchema:nc({type:n$("object"),properties:nv(iI(),em),required:ns(iI()).optional()}).catchall(ni())}),ef=nc({type:n$("ref/resource"),uri:iI()}),ey=nc({type:n$("ref/prompt"),name:iI()}),eg=nc({uri:iI().startsWith("file://"),name:iI().optional(),_meta:nv(iI(),ni()).optional()}),ev=R.shape,e_=nc({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=k.shape,eS=nc({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),e$=nu({progressToken:a.optional(),[nU]:iI(),[nH]:_.optional(),[nB]:e_,[nG]:s.optional()}),ew=nc({...v.shape,...g.shape,description:iI().optional(),inputSchema:nu({$schema:iI().optional(),type:n$("object")}),outputSchema:nu({$schema:iI().optional()}).optional(),annotations:Y.optional(),_meta:nv(iI(),ni()).optional()}),eR=nc({type:n$("tool_result"),toolUseId:iI(),content:ns(G),structuredContent:ni().optional(),isError:i7().optional(),_meta:nv(iI(),ni()).optional()}),ek=np([F,U,H,J,eR]),ex=nc({role:o,content:np([ek,ns(ek)]),_meta:nv(iI(),ni()).optional()}),eP=iI(),eE=nu({[nJ]:_.optional().catch(void 0)}),eT=eE.optional();function ej(t){return nu({_meta:eT,resultType:eP.default("complete"),...t})}let eO=ej({}),eC=ej({nextCursor:i.optional()}),eI=ej({content:ns(G),structuredContent:ni().optional(),isError:i7().optional()}),eN=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),tools:ns(ew),nextCursor:i.optional()}),eq=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),prompts:ns(D),nextCursor:i.optional()}),eA=ej({description:iI().optional(),messages:ns(W)}),eM=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),resources:ns(q),nextCursor:i.optional()}),ez=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),resourceTemplates:ns(A),nextCursor:i.optional()}),eL=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),contents:ns(np([C,I]))}),eZ=ej({completion:nc({values:ns(iI()).max(100),total:i3().int().optional(),hasMore:i7().optional()}).loose()}),eD=ej({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"])}),eV=ej({ttlMs:i3().int().min(0).catch(0),cacheScope:nb(["public","private"]).catch("private"),supportedVersions:ns(iI()),capabilities:eS,instructions:iI().optional()}),eF=nc({messages:ns(ex),modelPreferences:ee.optional(),systemPrompt:iI().optional(),includeContext:nb(["none","thisServer","allServers"]).optional(),temperature:i3().optional(),maxTokens:i3().int(),stopSequences:ns(iI()).optional(),metadata:r.optional(),tools:ns(ew).optional(),toolChoice:et.optional()}),eU=nc({method:n$("sampling/createMessage"),params:eF}),eH=nc({method:n$("roots/list"),params:nc({_meta:nv(iI(),ni()).optional()}).optional()}),eJ=nc({...ex.shape,model:iI(),stopReason:iI().optional()}),eB=nc({roots:ns(eg)}),eK=nc({action:nb(["accept","decline","cancel"]),content:nv(iI(),np([iI(),i3(),i7(),ns(iI())])).optional()}),eG=nc({mode:n$("url"),message:iI(),url:iI().url()}),eW=np([eh,eG]),eY=nc({method:n$("elicitation/create"),params:eW}),eX=np([eU,eH,eY]),eQ=np([eJ,eB,eK]),e0=nv(iI(),eX),e1=nv(iI(),eQ),e2=ej({inputRequests:e0.optional(),requestState:iI().optional()}),e9={inputResponses:e1.optional(),requestState:iI().optional()},e4=nc({_meta:e$,...e9}),e3=nu({progressToken:a.optional()});function e6(t,r){return nc({method:n$(t),params:nc({_meta:e$,...r})})}function e5(t,r){return nc({method:n$(t),params:nc({_meta:e3.optional(),...r}).optional()})}let e8={name:iI(),arguments:nv(iI(),ni()).optional(),...e9},e7={cursor:i.optional()},te=e6("tools/call",e8),tt=e6("tools/list",e7),tr=e6("prompts/list",e7),ta=e6("prompts/get",{name:iI(),arguments:nv(iI(),iI()).optional(),...e9}),ti=e6("resources/list",e7),tn=e6("resources/templates/list",e7),to=e6("resources/read",{uri:iI(),...e9}),ts={ref:np([ey,ef]),argument:nc({name:iI(),value:iI()}),context:nc({arguments:nv(iI(),iI()).optional()}).optional()},tl=e6("completion/complete",ts),tc=e6("server/discover",{}),tu=nc({toolsListChanged:i7().optional(),promptsListChanged:i7().optional(),resourcesListChanged:i7().optional(),resourceSubscriptions:ns(iI()).optional()}),td={notifications:tu},tp=e6("subscriptions/listen",td),tm=eE.extend({"io.modelcontextprotocol/subscriptionId":n}),th=nu({_meta:tm,resultType:eP.default("complete")}),tf={"tools/call":e5("tools/call",e8),"tools/list":e5("tools/list",e7),"prompts/get":e5("prompts/get",{name:iI(),arguments:nv(iI(),iI()).optional()}),"prompts/list":e5("prompts/list",e7),"resources/list":e5("resources/list",e7),"resources/templates/list":e5("resources/templates/list",e7),"resources/read":e5("resources/read",{uri:iI()}),"completion/complete":e5("completion/complete",ts),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",td)};function ty(t){return nu({_meta:eT,...t})}let tg={"tools/call":ty({content:ns(G),structuredContent:ni().optional(),isError:i7().optional()}),"tools/list":ty({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),tools:ns(ew),nextCursor:i.optional()}),"prompts/get":ty({description:iI().optional(),messages:ns(W)}),"prompts/list":ty({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),prompts:ns(D),nextCursor:i.optional()}),"resources/list":ty({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),resources:ns(q),nextCursor:i.optional()}),"resources/templates/list":ty({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),resourceTemplates:ns(A),nextCursor:i.optional()}),"resources/read":ty({ttlMs:i3().int().min(0),cacheScope:nb(["public","private"]),contents:ns(np([C,I]))}),"completion/complete":ty({completion:nc({values:ns(iI()).max(100),total:i3().int().optional(),hasMore:i7().optional()}).loose()}),"server/discover":ty({ttlMs:i3().int().min(0).catch(0),cacheScope:nb(["public","private"]).catch("private"),supportedVersions:ns(iI()),capabilities:eS,instructions:iI().optional()}),"subscriptions/listen":ty({})},tv=nu({"io.modelcontextprotocol/subscriptionId":n.optional()}),t_=nc({method:n$("notifications/subscriptions/acknowledged"),params:nc({_meta:tv.optional(),notifications:tu})}),tb=nc({_meta:tv.optional(),requestId:n,reason:iI().optional()}),tS=nc({method:n$("notifications/cancelled"),params:tb}),t$=t=>nc({jsonrpc:n$("2.0"),id:np([iI(),i3().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,RequestIdSchema:n,RoleSchema:o,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:y,IconsSchema:g,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:R,ServerCapabilitiesSchema:k,ProgressSchema:x,ProgressNotificationParamsSchema:P,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:j,ResourceContentsSchema:O,TextResourceContentsSchema:C,BlobResourceContentsSchema:I,AnnotationsSchema:N,ResourceSchema:q,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:M,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:Z,PromptSchema:D,PromptListChangedNotificationSchema:V,TextContentSchema:F,ImageContentSchema:U,AudioContentSchema:H,ToolUseContentSchema:J,EmbeddedResourceSchema:B,ResourceLinkSchema:K,ContentBlockSchema:G,PromptMessageSchema:W,ToolAnnotationsSchema:Y,ToolListChangedNotificationSchema:X,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:ei,UntitledSingleSelectEnumSchemaSchema:en,TitledSingleSelectEnumSchemaSchema:eo,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:ey,RootSchema:eg,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:eR,SamplingMessageContentBlockSchema:ek,SamplingMessageSchema:ex,ResultTypeSchema:eP,ResultMetaSchema:eE,ResultSchema:eO,PaginatedResultSchema:eC,CallToolResultSchema:eI,ListToolsResultSchema:eN,ListPromptsResultSchema:eq,GetPromptResultSchema:eA,ListResourcesResultSchema:eM,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eL,CompleteResultSchema:eZ,CacheableResultSchema:eD,DiscoverResultSchema:eV,CreateMessageRequestParamsSchema:eF,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eH,CreateMessageResultSchema:eJ,ListRootsResultSchema:eB,ElicitResultSchema:eK,ElicitRequestURLParamsSchema:eG,ElicitRequestParamsSchema:eW,ElicitRequestSchema:eY,InputRequestSchema:eX,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:ti,ListResourceTemplatesRequestSchema:tn,ReadResourceRequestSchema:to,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tf,dispatchResultSchemas:tg,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":E,"notifications/message":j,"notifications/resources/updated":L,"notifications/resources/list_changed":M,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":V,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:t$(eO),CallToolResultResponseSchema:t$(np([eI,e2])),ListToolsResultResponseSchema:t$(eN),ListPromptsResultResponseSchema:t$(eq),GetPromptResultResponseSchema:t$(np([eA,e2])),ListResourcesResultResponseSchema:t$(eM),ListResourceTemplatesResultResponseSchema:t$(ez),ReadResourceResultResponseSchema:t$(np([eL,e2])),CompleteResultResponseSchema:t$(eZ),DiscoverResultResponseSchema:t$(eV)}}()}let cn=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],co=Symbol("modelcontextprotocol.resultCacheHintFallback");function cs(t,r){if(void 0===r)return t;let a=t[co];if(void 0===a)return{...t,[co]:r};let i={},n=a.ttlMs??r.ttlMs;void 0!==n&&(i.ttlMs=n);let o=a.cacheScope??r.cacheScope;return void 0!==o&&(i.cacheScope=o),{...t,[co]:i}}function cl(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cc(t){return"public"===t||"private"===t}function cu(t,r){if(void 0!==t.ttlMs&&!cl(t.ttlMs))throw RangeError(`Invalid cache hint for ${r}: ttlMs must be a non-negative safe integer (got ${String(t.ttlMs)})`);if(void 0!==t.cacheScope&&!cc(t.cacheScope))throw RangeError(`Invalid cache hint for ${r}: cacheScope must be 'public' or 'private' (got ${String(t.cacheScope)})`)}let cd=((k={})[k.ParseError=-32700]="ParseError",k[k.InvalidRequest=-32600]="InvalidRequest",k[k.MethodNotFound=-32601]="MethodNotFound",k[k.InvalidParams=-32602]="InvalidParams",k[k.InternalError=-32603]="InternalError",k[k.ResourceNotFound=-32002]="ResourceNotFound",k[k.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",k[k.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",k[k.UrlElicitationRequired=-32042]="UrlElicitationRequired",k);var cp=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lZ(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lZ(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lL(this,new.target)}static fromError(r,a,i){return r===cd.UrlElicitationRequired&&i&&i.elicitations?new ch(i.elicitations,a):r===cd.UnsupportedProtocolVersion&&i&&Array.isArray(i.supported)&&"string"==typeof i.requested?new cf({supported:i.supported,requested:i.requested},a):(r===cd.InvalidParams||r===cd.ResourceNotFound)&&"string"==typeof i?.uri&&(r===cd.ResourceNotFound||1===Object.keys(i).length)?new cm(i.uri,a):r===cd.MissingRequiredClientCapability&&i&&null!==i.requiredCapabilities&&"object"==typeof i.requiredCapabilities&&!Array.isArray(i.requiredCapabilities)?new cy({requiredCapabilities:i.requiredCapabilities},a):new t(r,a,i)}},cm=class extends cp{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cd.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},ch=class extends cp{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cd.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},cf=class extends cp{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cd.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},cy=class extends cp{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cd.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cg=["tools/call","prompts/get","resources/read"],cv=["elicitation/create","sampling/createMessage","roots/list"];function c_(){if(l)return l;let t=ci();return l={request:{"elicitation/create":nc({method:n$("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":nc({method:n$("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":nc({method:n$("roots/list"),params:nu({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cb(t){return cv.includes(t)}function cS(t){return cb(t)?c_().request[t]:void 0}let c$={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},cw={"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 cR(t){return Object.prototype.hasOwnProperty.call(c$,t)}function ck(t){return Object.prototype.hasOwnProperty.call(cw,t)}function cx(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cP(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(c$),Object.keys(cw);let cE={ok:!1,reason:"not-in-era"},cT=[nU,nB],cj={era:"2026-07-28",hasRequestMethod:cR,hasNotificationMethod:ck,hasInputRequestMethod:t=>void 0!==cS(t),validateRequest:(t,r)=>cP(cR(t)?ci().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>cP(Object.prototype.hasOwnProperty.call(c$,t)?ci().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>cP(ck(t)?ci().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>cP(cS(t),r),validateInputResponse:(t,r)=>cP(cb(t)?c_().response[t]:void 0,r),samplingResultVariant:()=>cE,outboundEnvelope:t=>({[nU]:t.protocolVersion,[nH]:t.clientInfo,[nB]:t.clientCapabilities,...void 0!==t.logLevel&&{[nG]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of cT)a in t||r.push({key:a,problem:"missing"});let a=ci().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),i=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===i&&"missing"===t.problem)||r.push({key:i,problem:t.message})}return r},projectCallToolResult:t=>lG(t),inputRequestSchema:cS,decodeResult(t,r){if(!cx(r))return{kind:"invalid",error:new lV(lD.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new lV(lD.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new lV(lD.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,i=cx(a)?a:{},n=r.requestState;return 0===Object.keys(i).length&&"string"!=typeof n?{kind:"invalid",error:new lV(lD.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:i,..."string"==typeof n&&{requestState:n}}}if("complete"!==a)return{kind:"invalid",error:new lV(lD.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let i=function(){if(c)return c;let t=ci();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),n=Object.hasOwn(i,t)?i[t]:void 0;if(void 0!==n){let a=n.safeParse(r);if(!a.success)return{kind:"invalid",error:new lV(lD.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let o={...r};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[nJ]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[nJ]?t:{...t,_meta:{...a,[nJ]:r}}})(function(t,r){var a,i;let n=r[co];if("complete"!==r.resultType||!cn.includes(t)){let t;return void 0===n?r:(t={...r},delete t[co],t)}let o=cl(r.ttlMs)?r.ttlMs:void 0!==(a=n)&&cl(a.ttlMs)?a.ttlMs:0,s=cc(r.cacheScope)?r.cacheScope:void 0!==(i=n)&&cc(i.cacheScope)?i.cacheScope:"private",l={...r,ttlMs:o,cacheScope:s};return delete l[co],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||cg.includes(t))return r;throw new cp(cd.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,i=!1,n=()=>(i||(a={...a},i=!0),a),o=r.tools;"tools/list"===t&&Array.isArray(o)&&o.some(t=>cx(t)&&"execution"in t)&&(n().tools=o.map(t=>{if(!cx(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(cx(s)&&"tasks"in s){let t={...s};delete t.tasks,n().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=ci().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cO="2026-07-28";function cC(t){return void 0!==t&&t>=lJ?cj:ca}function cI(t){return void 0!==t.revision?cC(t.revision).era:"modern"===t.era?cj.era:ca.era}function cN(t){return cA.some(r=>r.hasRequestMethod(t))}function cq(t){return cA.some(r=>r.hasNotificationMethod(t))}let cA=[ca,cj];function cM(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cz(t){if(!cM(t))return;let r=t._meta;return cM(r)?r:void 0}function cL(t){let r=cz(t);return void 0!==r&&nU in r}function cZ(t){let r=cz(t)?.[nU];return"string"==typeof r?r:void 0}function cD(t){return cC(cO).validateEnvelopeMeta(t)}var cV=((t,r)=>{let a={};for(var i in t)z(a,i,{get:t[i],enumerable:!0});return r&&z(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>oL,AudioContentSchema:()=>sn,BaseMetadataSchema:()=>om,BaseRequestParamsSchema:()=>n4,BlobResourceContentsSchema:()=>oM,BooleanSchemaSchema:()=>sZ,CallToolRequestParamsSchema:()=>sb,CallToolRequestSchema:()=>sS,CallToolResultSchema:()=>sv,CancelTaskRequestSchema:()=>ly,CancelTaskResultSchema:()=>lg,CancelledNotificationParamsSchema:()=>oc,CancelledNotificationSchema:()=>ou,ClientCapabilitiesSchema:()=>o_,ClientNotificationSchema:()=>l_,ClientRequestSchema:()=>lv,ClientResultSchema:()=>lb,ClientTasksCapabilitySchema:()=>og,CompatibilityCallToolResultSchema:()=>s_,CompleteRequestParamsSchema:()=>s5,CompleteRequestSchema:()=>s8,CompleteResultSchema:()=>s7,ContentBlockSchema:()=>sc,CreateMessageRequestParamsSchema:()=>sA,CreateMessageRequestSchema:()=>sM,CreateMessageResultSchema:()=>sz,CreateMessageResultWithToolsSchema:()=>sL,CreateTaskResultSchema:()=>ls,CursorSchema:()=>n0,DiscoverRequestSchema:()=>ok,DiscoverResultSchema:()=>ox,ElicitRequestFormParamsSchema:()=>sX,ElicitRequestParamsSchema:()=>s0,ElicitRequestSchema:()=>s1,ElicitRequestURLParamsSchema:()=>sQ,ElicitResultSchema:()=>s4,ElicitationCompleteNotificationParamsSchema:()=>s2,ElicitationCompleteNotificationSchema:()=>s9,EmbeddedResourceSchema:()=>ss,EmptyResultSchema:()=>ol,EnumSchemaSchema:()=>sW,GetPromptRequestParamsSchema:()=>st,GetPromptRequestSchema:()=>sr,GetPromptResultSchema:()=>sd,GetTaskPayloadRequestSchema:()=>lp,GetTaskPayloadResultSchema:()=>lm,GetTaskRequestSchema:()=>lu,GetTaskResultSchema:()=>ld,IconSchema:()=>od,IconsSchema:()=>op,ImageContentSchema:()=>si,ImplementationSchema:()=>oh,InitializeRequestParamsSchema:()=>ob,InitializeRequestSchema:()=>oS,InitializeResultSchema:()=>ow,InitializedNotificationSchema:()=>oR,JSONArraySchema:()=>nX,JSONObjectSchema:()=>nY,JSONRPCErrorResponseSchema:()=>on,JSONRPCMessageSchema:()=>oo,JSONRPCNotificationSchema:()=>oa,JSONRPCRequestSchema:()=>or,JSONRPCResponseSchema:()=>os,JSONRPCResultResponseSchema:()=>oi,JSONValueSchema:()=>nW,LegacyTitledEnumSchemaSchema:()=>sH,ListChangedOptionsBaseSchema:()=>sw,ListPromptsRequestSchema:()=>o7,ListPromptsResultSchema:()=>se,ListResourceTemplatesRequestSchema:()=>oU,ListResourceTemplatesResultSchema:()=>oH,ListResourcesRequestSchema:()=>oV,ListResourcesResultSchema:()=>oF,ListRootsRequestSchema:()=>lt,ListRootsResultSchema:()=>lr,ListTasksRequestSchema:()=>lh,ListTasksResultSchema:()=>lf,ListToolsRequestSchema:()=>sy,ListToolsResultSchema:()=>sg,LoggingLevelSchema:()=>sR,LoggingMessageNotificationParamsSchema:()=>sP,LoggingMessageNotificationSchema:()=>sE,ModelHintSchema:()=>sT,ModelPreferencesSchema:()=>sj,MultiSelectEnumSchemaSchema:()=>sG,NotificationSchema:()=>n8,NotificationsParamsSchema:()=>n5,NumberSchemaSchema:()=>sV,PaginatedRequestParamsSchema:()=>oO,PaginatedRequestSchema:()=>oC,PaginatedResultSchema:()=>oI,PingRequestSchema:()=>oP,PrimitiveSchemaDefinitionSchema:()=>sY,ProgressNotificationParamsSchema:()=>oT,ProgressNotificationSchema:()=>oj,ProgressSchema:()=>oE,ProgressTokenSchema:()=>nQ,PromptArgumentSchema:()=>o5,PromptListChangedNotificationSchema:()=>sp,PromptMessageSchema:()=>su,PromptReferenceSchema:()=>s6,PromptSchema:()=>o8,ReadResourceRequestParamsSchema:()=>oJ,ReadResourceRequestSchema:()=>oB,ReadResourceResultSchema:()=>oK,RelatedTaskMetadataSchema:()=>n2,RequestIdSchema:()=>ot,RequestMetaSchema:()=>n9,RequestSchema:()=>n6,ResourceContentsSchema:()=>oN,ResourceLinkSchema:()=>sl,ResourceListChangedNotificationSchema:()=>oG,ResourceRequestParamsSchema:()=>oJ,ResourceSchema:()=>oZ,ResourceTemplateReferenceSchema:()=>s3,ResourceTemplateSchema:()=>oD,ResourceUpdatedNotificationParamsSchema:()=>o3,ResourceUpdatedNotificationSchema:()=>o6,ResultMetaObjectSchema:()=>n7,ResultSchema:()=>oe,RoleSchema:()=>oz,RootSchema:()=>le,RootsListChangedNotificationSchema:()=>la,SamplingContentSchema:()=>sI,SamplingMessageContentBlockSchema:()=>sN,SamplingMessageSchema:()=>sq,ServerCapabilitiesSchema:()=>o$,ServerNotificationSchema:()=>l$,ServerRequestSchema:()=>lS,ServerResultSchema:()=>lw,ServerTasksCapabilitySchema:()=>ov,SetLevelRequestParamsSchema:()=>sk,SetLevelRequestSchema:()=>sx,SingleSelectEnumSchemaSchema:()=>sJ,StringSchemaSchema:()=>sD,SubscribeRequestParamsSchema:()=>oJ,SubscribeRequestSchema:()=>oW,SubscriptionFilterSchema:()=>oX,SubscriptionsAcknowledgedNotificationParamsSchema:()=>o1,SubscriptionsAcknowledgedNotificationSchema:()=>o2,SubscriptionsListenRequestParamsSchema:()=>oQ,SubscriptionsListenRequestSchema:()=>o0,SubscriptionsListenResultMetaSchema:()=>o9,SubscriptionsListenResultSchema:()=>o4,TaskAugmentedRequestParamsSchema:()=>n3,TaskCreationParamsSchema:()=>li,TaskMetadataSchema:()=>n1,TaskSchema:()=>lo,TaskStatusNotificationParamsSchema:()=>ll,TaskStatusNotificationSchema:()=>lc,TaskStatusSchema:()=>ln,TextContentSchema:()=>sa,TextResourceContentsSchema:()=>oq,TitledMultiSelectEnumSchemaSchema:()=>sK,TitledSingleSelectEnumSchemaSchema:()=>sU,ToolAnnotationsSchema:()=>sm,ToolChoiceSchema:()=>sO,ToolExecutionSchema:()=>sh,ToolListChangedNotificationSchema:()=>s$,ToolResultContentSchema:()=>sC,ToolSchema:()=>sf,ToolUseContentSchema:()=>so,UnsubscribeRequestParamsSchema:()=>oJ,UnsubscribeRequestSchema:()=>oY,UntitledMultiSelectEnumSchemaSchema:()=>sB,UntitledSingleSelectEnumSchemaSchema:()=>sF});let cF=t=>or.safeParse(t).success,cU=t=>oa.safeParse(t).success,cH=t=>oi.safeParse(t).success,cJ=t=>on.safeParse(t).success,cB=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cK="x-mcp-header",cG=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,cW=new Set(["string","integer","boolean","number"]);function cY(t){let r=[],a=new Map,i=(t,n,o)=>{if(null===t||"object"!=typeof t)return;if(cK in t){if(!o||0===n.length)return`${c0(n)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let i=t[cK];if("string"!=typeof i||0===i.length)return`${c0(n)}: x-mcp-header MUST be a non-empty string`;if(!cG.test(i))return`${c0(n)}: x-mcp-header '${i}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!cW.has(s))return`${c0(n)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=i.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,i),r.push({path:n,headerName:i,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=i(r,[...n,t],o);if(void 0!==a)return a}for(let r of cX){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&cQ.has(r)?Object.values(a):[a]){let a=i(t,[...n,`<${r}>`],!1);if(void 0!==a)return a}}},n=i(t,[],!0);return void 0===n?{valid:!0,declarations:r}:{valid:!1,reason:n}}let cX=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cQ=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function c0(t){return 0===t.length?"<root>":t.join(".")}let c1=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c2=/^-?\d+(\.\d+)?$/;function c9(t){if(!(t.startsWith("=?base64?")&&t.endsWith("?=")))return t;let r=t.slice(9,t.length-2);if(c1.test(r))try{let t=atob(r),a=new Uint8Array(t.length);for(let r=0;r<t.length;r++)a[r]=t.codePointAt(r);return new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{return}}function c4(t,r,a){return{kind:"reject",rung:"param-header-validation",cell:t,httpStatus:400,code:c3,message:`Bad Request: the request headers and body disagree: ${a}`,data:{mismatch:{header:r,body:a}},settled:!0}}let c3=-32020;cd.InvalidRequest,cd.UnsupportedProtocolVersion,cd.InvalidParams,cd.MethodNotFound,cd.InvalidParams,cd.MissingRequiredClientCapability;let c6={[cd.ParseError]:400,[cd.InvalidRequest]:400,[cd.MethodNotFound]:404,[cd.UnsupportedProtocolVersion]:400,[cd.MissingRequiredClientCapability]:400,[c3]:400};function c5(t,r,a,i,n){return{kind:"reject",rung:t,cell:r,httpStatus:a,code:i.code,message:i.message,...void 0!==i.data&&{data:i.data},settled:n}}function c8(t,r,a,i="era-classification"){return c5(i,t,400,new cp(c3,`Bad Request: the request headers and body disagree: ${a}`,{mismatch:{header:r,body:a}}),!0)}let c7={"tools/call":"name","prompts/get":"name","resources/read":"uri"};function ue(t){let r=0;for(;r<t.length;){let a=t.codePointAt(r);if(9!==a&&32!==a)break;r+=1}let a=t.length;for(;a>r;){let r=t.codePointAt(a-1);if(9!==r&&32!==r)break;a-=1}return 0===r&&a===t.length?t:t.slice(r,a)}function ut(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function ur(t){return void 0===t?{era:"modern"}:{era:t>=lJ?"modern":"legacy",revision:t}}function ua(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function ui(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let un=!1,uo="draft-2020-12";function us(t,r="input"){let a,i=t["~standard"];if(i.jsonSchema)a=i.jsonSchema[r]({target:uo});else if("zod"===i.vendor){if(!("_zod"in t))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");un||(un=!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.")),a=a5(t,{target:uo,io:r})}else throw Error(`Schema library "${i.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let i=r[a];if(Array.isArray(i)&&i.length>0)return i.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}async function ul(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let uc=/\\\.\\d\{(\d+)\}/;function uu(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ud=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function up(t){return ud.has(t)||t.startsWith("x-")}let um=new Set(["$schema",...Object.keys(sX.shape.requestedSchema.shape)]),uh={string:ua([sD,sF,sU,sH]),number:ua([sV]),integer:ua([sV]),boolean:ua([sZ]),array:ua([sB,sK])},uf=new Set(sD.shape.format.unwrap().options);Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!ui(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,i=function(t,r){let a={},i=[];for(let[n,o]of Object.entries(t))"properties"===n&&uu(o)?a[n]=Object.fromEntries(Object.entries(o).map(([t,a])=>[t,function(t,r,a,i){if(!uu(t))return t;let n="string"==typeof t.type&&Object.hasOwn(uh,t.type)?uh[t.type]:void 0;if(void 0===n)return t;let o={};for(let[l,c]of Object.entries(t))if(n.has(l)||up(l))o[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(uf.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[r1(iL,void 0)];break;case"uri":a=[r2(iV,void 0)];break;case"date":a=[r4(iA,void 0)];break;case"date-time":let i,n;i=uc.exec(r),n=[void 0,-1,0],i&&n.push(Number(i[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>n.map(a=>r9(iq,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=a5(t,{target:uo,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||i.push(`${r}.${l}`)}else o[l]=c;else i.push(`${r}.${l}`);return o}(a,`properties.${t}`,r,i)])):um.has(n)?a[n]=o:up(n)||i.push(n);if(i.length>0)throw new cp(cd.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return a}(function(t){try{return us(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cp(cd.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),n=(r=sX.shape.requestedSchema,i_(r,i));if(!n.success)throw new cp(cd.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!uu(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!i_(sY,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(i,n.error.message)}`);let o=function t(r,a,i=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,n)=>t(r,a[n],`${i}[${n}]`)):uu(r)&&uu(a)?Object.entries(r).flatMap(([r,n])=>{let o=i?`${i}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(n,a[r],o):up(r)?[]:[o]}):[]}(i,n.data);if(o.length>0)throw new cp(cd.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(n.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(n.data.properties,t));if(s.length>0)throw new cp(cd.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:n.data}}(t)}}catch(t){throw t instanceof cp?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let uy={},ug={};function uv(t,r){let a=t.slice(0,-6);uy[a]=r,ug[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])uv(t,cV[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lj,OAuthClientInformationFullSchema:lq,OAuthClientInformationSchema:lN,OAuthClientMetadataSchema:lI,OAuthClientRegistrationErrorSchema:lA,OAuthErrorResponseSchema:lO,OAuthMetadataSchema:lx,OAuthProtectedResourceMetadataSchema:lk,OAuthTokenRevocationRequestSchema:lM,OAuthTokensSchema:lT,OpenIdProviderDiscoveryMetadataSchema:lE,OpenIdProviderMetadataSchema:lP}))uv(t,r);let u_=Object.freeze(uy);Object.freeze(ug);let ub=[nU,nH,nB,nG],uS=["inputResponses","requestState"];function u$(t,r){let a=t.params;if(!uP(a))return{message:t,lifted:{}};let i=a._meta,n=uP(i)?ub.filter(t=>t in i):[],o="request"===r?uS.filter(t=>t in a):[];if(0===n.length&&0===o.length)return{message:t,lifted:{}};let s={},l={...a};if(n.length>0&&uP(i)){let t={},r={...i};for(let a of n)t[a]=i[a],delete r[a];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of o)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function uw(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let i=t.validateResult(r,a);return i.ok?{value:i.value}:{issues:[{message:"invalid"===i.reason?i.message:`not-in-era: ${r}`}]}}}}}let uR=(x=void 0,()=>x);function uk(t,r){return{...t,mcpReq:{...t.mcpReq,requestState:()=>r}}}var ux=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{u=(t,r)=>{t._negotiatedProtocolVersion=r}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??nF,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lV(lD.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,i,n=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lV(lD.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let i=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{i?.(t,r),cH(t)||cJ(t)?this._onresponse(t):cF(t)?this._onrequest(t,r):cU(t)?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new lV(lD.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=u$(t,"notification"),i=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cI(r.classification);if(t!==i.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${i.era}`))}if(cq(a.method)&&!i.hasNotificationMethod(a.method))return;let n=this._notificationHandlers.get(a.method),o=this.fallbackNotificationHandler;(void 0!==n||void 0!==o)&&Promise.resolve().then(()=>void 0===n?o(a):n(a,i)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:i,lifted:n}=u$(t,"request"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,a)=>{let n={jsonrpc:"2.0",id:i.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(n).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cI(r.classification);if(t!==o.era){this._onerror(Error(`Era mismatch on inbound request '${i.method}': classified as ${t} but this instance serves ${o.era}`));let a=r.classification.revision??t;l(cd.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(cN(i.method)&&!o.hasRequestMethod(i.method))return void l(cd.MethodNotFound,"Method not found");let c=this._requestHandlers.get(i.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cd.MethodNotFound,"Method not found");let u=o.checkInboundEnvelope(n);if(void 0!==u)return void l(cd.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:i.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:i.id}),m=new AbortController;this._requestHandlerAbortControllers.set(i.id,m);let h=void 0===n.inputResponses?void 0:function(t){let r={},a=[];if(!uE(t))return{accepted:r,droppedKeys:a};for(let[i,n]of Object.entries(t)){if(!uE(n)||"method"in n||"result"in n){a.push(i);continue}r[i]=n}return{accepted:r,droppedKeys:a}}(n.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:i.id,method:i.method,_meta:i.params?._meta,...void 0!==n.envelope&&{envelope:n.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===n.requestState?uR:(a=n.requestState,()=>a),signal:m.signal,send:(t,r,a)=>{let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),ui(r))return p(t,r,a);let n=uw(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,n,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},y=this.buildContext(f,r);Promise.resolve().then(()=>c(i,y)).then(async t=>{let r;if(m.signal.aborted)return;try{r=o.encodeResult(i.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${i.method}: ${t}`)),l(cd.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:i.id};await s?.send(a)},async t=>{if(m.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cd.InternalError,a={jsonrpc:"2.0",id:i.id,error:{code:o.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(i.id)===m&&this._requestHandlerAbortControllers.delete(i.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,i=Number(r),n=this._progressHandlers.get(i);if(!n)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(t){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(t);return}n(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(cH(t)?t:cp.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let i=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(i,t.method),ui(r))return this._requestWithSchemaViaCodec(i,t,r,a);let n=uw(i,t.method);if(void 0===n)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,n,r)}_negotiatedWireCodec(){return cC(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cC(void 0);case"server/discover":return cC(cO);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cN(r)&&!t.hasRequestMethod(r))throw new lV(lD.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,r,a)}_requestWithSchemaViaCodec(t,r,a,i){let n,o,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=i??{},d=Date.now();return new Promise((p,m)=>{let h=t=>{m(t)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){h(t);return}if(i?.signal?.aborted){let t=i.signal.reason;throw t instanceof lV?t:new lV(lD.RequestTimeout,String(t))}let f=t.era===cO&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,y=this._requestMessageId++;o=y;let g={...r,jsonrpc:"2.0",id:y};i?.onprogress&&(this._progressHandlers.set(y,i.onprogress),g.params={...r.params,_meta:{...r.params?._meta,progressToken:y}});let v=this._envelopeOutbound(g),_=!1,b=t=>{_||(this._progressHandlers.delete(y),void 0===f?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),m(t instanceof lV?t:new lV(lD.RequestTimeout,String(t))))};this._responseHandlers.set(y,n=>{let o;if(!i?.signal?.aborted){if(_=!0,n instanceof Error)return m(n);try{o=t.decodeResult(r.method,n.result)}catch(t){return m(t instanceof Error?t:Error(String(t)))}if("invalid"===o.kind)return m(o.error);if("input_required"===o.kind){var s;return i?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=o).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState}}):p(this._resolveNonCompleteResult(o,{codec:t,request:r,resultSchema:a,options:i,flowStartedAt:d,retry:(i,n)=>this._requestWithSchemaViaCodec(t,void 0===i?{method:r.method}:{method:r.method,params:i},a,n)}))}ul(a,o.result).then(t=>{t.success?p(t.data):m(new lV(lD.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},m)}}),n=()=>b(i?.signal?.reason),i?.signal?.addEventListener("abort",n,{once:!0});let S=i?.timeout??6e4;this._setupTimeout(y,S,i?.maxTotalTimeout,()=>b(new lV(lD.RequestTimeout,"Request timed out",{timeout:S})),i?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(y),m(t)})}).finally(()=>{n&&i?.signal?.removeEventListener("abort",n),void 0!==o&&(this._responseHandlers.delete(o),this._cleanupTimeout(o))})}async notification(t,r){return this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,a){if(!this._transport)throw new lV(lD.NotConnected,"Not connected");if(cq(r.method)&&!t.hasNotificationMethod(r.method))throw new lV(lD.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let i=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&!a?.relatedRequestId){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(i,a).catch(t=>this._onerror(t))});return}await this._transport.send(i,a)}setRequestHandler(t,r,a){let i;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cN(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(a,i)=>{let n=this._negotiatedWireCodec(),o=n.validateRequest(t,a);if(o.ok||"not-in-era"!==o.reason||(o=n.validateInputRequest(t,a)),!o.ok){if("not-in-era"===o.reason)throw new cp(cd.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(o.message)}return Promise.resolve(r(o.value,i))}}else if(a)i=async(i,n)=>{let o=await ul(r.params,{...i.params});if(!o.success)throw new cp(cd.InvalidParams,`Invalid params for ${t}: ${o.error}`);return a(o.data,n)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!cq(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,i)=>{let n=i.validateNotification(t,a);if(!n.ok){if("not-in-era"===n.reason)throw new cp(cd.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(n.message)}return Promise.resolve(r(n.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{let n=await ul(r.params,{...i.params});if(!n.success)throw new cp(cd.InvalidParams,`Invalid params for notification ${t}: ${n.error}`);await a(n.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function uP(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function uE(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}var uT=U(F(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function n(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var o,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!i.test(d))throw TypeError("invalid media type");var p=new n(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,o=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(a,"$1")),p.parameters[o]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1);function uj(t){if(t)try{return uT.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}function uO(t){return"application/json"===t||"application/json"===uj(t)}let uC=/^[A-Za-z0-9._-]{1,128}$/;function uI(t){let r=function(t){let r=[];if(0===t.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&r.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&r.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&r.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&r.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!uC.test(t)){let a=[...t].filter(t=>!/[A-Za-z0-9._-]/.test(t)).filter((t,r,a)=>a.indexOf(t)===r);return r.push(`Tool name contains invalid characters: ${a.map(t=>`"${t}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:r}}return{isValid:!0,warnings:r}}(t);var a=r.warnings;if(a.length>0){for(let r of(console.warn(`Tool name validation warning for "${t}":`),a))console.warn(` - ${r}`);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 r.isValid}var uN=class t{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,a){if(t.length>r)throw Error(`${a} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>"string"==typeof t?[]:t.names)}constructor(r){t.validateLength(r,1e6,"Template"),this.template=r,this.parts=this.parse(r)}toString(){return this.template}parse(r){let a=[],i="",n=0,o=0;for(;n<r.length;)if("{"===r[n]){i&&(a.push(i),i="");let s=r.indexOf("}",n);if(-1===s)throw Error("Unclosed template expression");if(++o>1e4)throw Error("Template contains too many expressions (max 10000)");let l=r.slice(n+1,s),c=this.getOperator(l),u=l.includes("*"),d=this.getNames(l),p=d[0];for(let r of d)t.validateLength(r,1e6,"Variable name");a.push({name:p,operator:c,names:d,exploded:u}),n=s+1}else i+=r[n],n++;return i&&a.push(i),a}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(r,a){return(t.validateLength(r,1e6,"Variable value"),"+"===a||"#"===a)?encodeURI(r):encodeURIComponent(r)}expandPart(t,r){if("?"===t.operator||"&"===t.operator){let a=t.names.map(a=>{let i=r[a];return void 0===i?"":`${a}=${Array.isArray(i)?i.map(r=>this.encodeValue(r,t.operator)).join(","):this.encodeValue(i.toString(),t.operator)}`}).filter(t=>t.length>0);return 0===a.length?"":("?"===t.operator?"?":"&")+a.join("&")}if(t.names.length>1){let a=t.names.map(t=>r[t]).filter(t=>void 0!==t);return 0===a.length?"":a.map(t=>Array.isArray(t)?t[0]:t).join(",")}let a=r[t.name];if(void 0===a)return"";let i=(Array.isArray(a)?a:[a]).map(r=>this.encodeValue(r,t.operator));switch(t.operator){case"":case"+":default:return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/")}}expand(t){let r="",a=!1;for(let i of this.parts){if("string"==typeof i){r+=i;continue}let n=this.expandPart(i,t);n&&(r+=("?"===i.operator||"&"===i.operator)&&a?n.replace("?","&"):n,("?"===i.operator||"&"===i.operator)&&(a=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(r){let a,i=[];for(let a of r.names)t.validateLength(a,1e6,"Variable name");if("?"===r.operator||"&"===r.operator){for(let t=0;t<r.names.length;t++){let a=r.names[t],n=0===t?"\\"+r.operator:"&";i.push({pattern:n+this.escapeRegExp(a)+"=([^&]+)",name:a})}return i}let n=r.name;switch(r.operator){case"":a=r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":a="(.+)";break;case".":a=String.raw`\.([^/,]+)`;break;case"/":a="/"+(r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:a="([^/]+)"}return i.push({pattern:a,name:n}),i}match(r){t.validateLength(r,1e6,"URI");let a="^",i=[];for(let t of this.parts)if("string"==typeof t)a+=this.escapeRegExp(t);else for(let{pattern:r,name:n}of this.partToRegExp(t))a+=r,i.push({name:n,exploded:t.exploded});a+="$",t.validateLength(a,1e6,"Generated regex pattern");let n=new RegExp(a),o=r.match(n);if(!o)return null;let s={};for(let[t,r]of i.entries()){let{name:a,exploded:i}=r,n=o[t+1];s[a.replace("*","")]=i&&n.includes(",")?n.split(","):n}return s}};function uq(t){if(void 0!==t){if(function(t){if("object"!=typeof t||null===t||ui(t))return!1;let r=Object.getPrototypeOf(t);return(r===Object.prototype||null===r)&&Object.values(t).every(t=>"object"==typeof t&&null!==t&&"_zod"in t)}(t))return nc(t);if("object"==typeof t&&null!==t&&!ui(t)&&Object.values(t).some(t=>"object"==typeof t&&null!==t&&!("_zod"in t)&&"_def"in t&&"string"==typeof t._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(!ui(t))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return t}}var uA=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var i=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function n(t,...r){let a=[t[0]],o=0;for(;o<r.length;)l(a,r[o]),a.push(t[++o]);return new i(a)}t._Code=i,t.nil=new i(""),t._=n;let o=new i("+");function s(t,...r){let n=[c(t[0])],u=0;for(;u<r.length;)n.push(o),l(n,r[u]),n.push(o,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===o){var i,n;let o=(i=t[r-1],'""'===(n=t[r+1])?i:'""'===i?n:"string"==typeof i?n instanceof a||'"'!==i[i.length-1]?void 0:"string"!=typeof n?`${i.slice(0,-1)}${n}"`:'"'===n[0]?i.slice(0,-1)+n.slice(1):void 0:"string"!=typeof n||'"'!==n[0]||i instanceof a?void 0:`"${i}${n.slice(1)}`);if(void 0!==o){t.splice(r-1,3,o);continue}t[r++]="+"}r++}}(n),new i(n)}function l(t,r){var n;r instanceof i?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(n=r)||"boolean"==typeof n||null===n?n:c(Array.isArray(n)?n.join(","):n))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new i(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new i(`.${r}`):n`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new i(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new i(t.toString())}}),uM=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uA();var a,i,n=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=i||(t.UsedValueState=i={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=o;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:i}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${i}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:n}=i,o=null!=(a=r.key)?a:r.ref,s=this._values[n];if(s){let t=s.get(o);if(t)return t}else s=this._values[n]=new Map;s.set(o,i);let l=this._scope[n]||(this._scope[n]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:n,itemIndex:c}),i}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,o,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,i.Started);let s=o(a);if(s){let i=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${i} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new n(a);p.set(a,i.Completed)})}return c}};t.ValueScope=c}),uz=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=uA(),a=uM();var i=uA();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=uM();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var o=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends o{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let i=t?a.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends o{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,t,a),this}get names(){return j(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,i){super(t,a,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends o{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},m=class extends o{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=O(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},h=class extends o{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,i=a.length;for(;i--;){let n=a[i];n.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,n.names),a.splice(i,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(t,r.names),{})}},f=class extends h{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},y=class extends h{},g=class extends f{};g.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new g(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=O(this.condition,t,r),this}get names(){let t=super.names;return j(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=O(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,a,i){super(),this.varKind=t,this.name=r,this.from=a,this.to=i}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){return j(j(super.names,this.from),this.to)}},$=class extends _{constructor(t,r,a,i){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=O(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},w=class extends f{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};w.kind="func";var R=class extends h{render(t){return"return "+super.render(t)}};R.kind="return";var k=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var a,i;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(i=this.finally)||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},x=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};x.kind="catch";var P=class extends f{render(t){return"finally"+super.render(t)}};P.kind="finally";var E=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new a.Scope({parent:t}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,i){let n=this._scope.toName(r);return void 0!==a&&i&&(this._constants[n.str]=a),this._leafNode(new s(t,n,a)),n}const(t,r,i){return this._def(a.varKinds.const,t,r,i)}let(t,r,i){return this._def(a.varKinds.let,t,r,i)}var(t,r,i){return this._def(a.varKinds.var,t,r,i)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new m(t)),this}object(...t){let a=["{"];for(let[i,n]of t)a.length>1&&a.push(","),a.push(i),(i!==n||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,n));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(o,s,r,i),()=>n(s))}forOf(t,i,n,o=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=i instanceof r.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),n(s)})}return this._for(new $("of",o,s,i),()=>n(s))}forIn(t,i,n,o=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${i})`,n);let s=this._scope.toName(t);return this._for(new $("in",o,s,i),()=>n(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new R;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(R)}try(t,r,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new k;if(this._blockNode(i),this.code(t),r){let t=this.name("e");this._currNode=i.catch=new x(t),r(t)}return a&&(this._currNode=i.finally=new P,this.code(a)),this._endBlockNode(x,P)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,i,n){return this._blockNode(new w(t,a,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function j(t,a){return a instanceof r._CodeOrName?T(t,a.names):t}function O(t,a,i){var n;if(t instanceof r.Name)return o(t);if(!((n=t)instanceof r._Code&&n._items.some(t=>t instanceof r.Name&&1===a[t.str]&&void 0!==i[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=o(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function o(t){let r=i[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${A(t)}`}t.CodeGen=E,t.not=C;let I=q(t.operators.AND);t.and=function(...t){return t.reduce(I)};let N=q(t.operators.OR);function q(t){return(a,i)=>a===r.nil?i:i===r.nil?a:(0,r._)`${A(a)} ${t} ${A(i)}`}function A(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(N)}}),uL=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=uz(),n=uA();function o(t,r=t.schema){let{opts:a,self:i}=t;if(!a.strictSchema||"boolean"==typeof r)return;let n=i.RULES.keywords;for(let a in r)n[a]||h(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:n}){return(o,s,l,c)=>{let u=void 0===l?s:l instanceof i.Name?(s instanceof i.Name?t(o,s,l):r(o,s,l),l):s instanceof i.Name?(r(o,l,s),s):a(s,l);return c!==i.Name||u instanceof i.Name?u:n(o,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,i._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,i._)`${r}${(0,i.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(o(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,n,o){if(!o){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,i._)`${a}`}return(0,i._)`${t}${r}${(0,i.getProperty)(n)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,i._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,i._)`${a} || {}`).code((0,i._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,i._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,i._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,i._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,i._)`${a} !== true`,()=>t.assign(a,!0===r||(0,i._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let m={};function h(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:m[r.code]||(m[r.code]=new n._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,n){if(t instanceof i.Name){let o=a===r.Num;return n?o?(0,i._)`"[" + ${t} + "]"`:(0,i._)`"['" + ${t} + "']"`:o?(0,i._)`"/" + ${t}`:(0,i._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,i.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=h}),uZ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),uD=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uz(),a=uL(),i=uZ();function n(t,a){let n=t.const("err",a);t.if((0,r._)`${i.default.vErrors} === null`,()=>t.assign(i.default.vErrors,(0,r._)`[${n}]`),(0,r._)`${i.default.vErrors}.push(${n})`),t.code((0,r._)`${i.default.errors}++`)}function o(t,a){let{gen:i,validateName:n,schemaEnv:o}=t;o.$async?i.throw((0,r._)`new ${t.ValidationError}(${a})`):(i.assign((0,r._)`${n}.errors`,a),i.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,i=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:m}=u,h=l(a,i,s);(null!=c?c:p||m)?n(d,h):o(u,(0,r._)`[${h}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;n(u,l(r,a,s)),d||p||o(c,i.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(i.default.errors,a),t.if((0,r._)`${i.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${i.default.vErrors}.length`,a),()=>t.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,schemaValue:n,data:o,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,i.default.errors,s=>{t.const(c,(0,r._)`${i.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(i.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,n),t.assign((0,r._)`${c}.data`,o))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,n,o){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,n,o={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:n}){let o=n?(0,r.str)`${t}${(0,a.getErrorPath)(n,a.Type.Str)}`:t;return[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,o)]}(c,o),function({keyword:t,it:{errSchemaPath:i}},{schemaPath:n,parentSchema:o}){let l=o?i:(0,r.str)`${i}/${t}`;return n&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(n,a.Type.Str)}`),[s.schemaPath,l]}(t,o)];return function(t,{params:a,message:n},o){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:m,topSchemaRef:h,schemaPath:f}=d;o.push([s.keyword,l],[s.params,"function"==typeof a?a(t):a||(0,r._)`{}`]),p.messages&&o.push([s.message,"function"==typeof n?n(t):n]),p.verbose&&o.push([s.schema,u],[s.parentSchema,(0,r._)`${h}${f}`],[i.default.data,c]),m&&o.push([s.propertyName,m])}(t,n,u),l.object(...u)}(t,n,o)}}),uV=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uD(),a=uz(),i=uZ(),n={message:"boolean schema is false"};function o(t,a){let{gen:i,data:o}=t;(0,r.reportError)({gen:i,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},n,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:n,validateName:s}=t;!1===n?o(t,!1):"object"==typeof n&&!0===n.$async?r.return(i.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:i}=t;!1===i?(a.var(r,!1),o(t)):a.var(r,!0)}}),uF=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),uU=F(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},i){let n=a.RULES.types[i];return n&&!0!==n&&r(t,n)},t.shouldUseGroup=r,t.shouldUseRule=a}),uH=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=uF(),n=uU(),o=uD(),s=uz(),l=uL();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(i.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var i,o;let{gen:l,data:c,opts:d}=t,m=(i=a,(o=d.coerceTypes)?i.filter(t=>u.has(t)||"array"===o&&"array"===t):[]),f=a.length>0&&!(0===m.length&&1===a.length&&(0,n.schemaHasRulesForType)(t,a[0]));if(f){let i=p(a,c,d.strictNumbers,r.Wrong);l.if(i,()=>{m.length?function(t,r,a){let{gen:i,data:n,opts:o}=t,l=i.let("dataType",(0,s._)`typeof ${n}`),c=i.let("coerced",(0,s._)`undefined`);for(let t of("array"===o.coerceTypes&&i.if((0,s._)`${l} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,s._)`${n}[0]`).assign(l,(0,s._)`typeof ${n}`).if(p(r,n,o.strictNumbers),()=>i.assign(c,n))),i.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===o.coerceTypes)&&function(t){switch(t){case"string":i.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${n}`).elseIf((0,s._)`${n} === null`).assign(c,(0,s._)`""`);return;case"number":i.elseIf((0,s._)`${l} == "boolean" || ${n} === null
|
|
56
|
-
|| (${l} == "string" && ${
|
|
57
|
-
|| (${l} === "string" && ${
|
|
58
|
-
|| ${l} === "boolean" || ${n} === null`).assign(c,(0,s._)`[${n}]`)}}(t);i.else(),h(t),i.endIf(),i.if((0,s._)`${c} !== undefined`,()=>{i.assign(n,c),function({gen:t,parentData:r,parentDataProperty:a},i){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,i))}(t,c)})}(t,a,m):h(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,i,n=r.Correct){let o,l=n===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":o=(0,s._)`Array.isArray(${a})`;break;case"object":o=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":o=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":o=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return n===r.Correct?o:(0,s.not)(o);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,i?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,i){let n;if(1===t.length)return d(t[0],r,a,i);let o=(0,l.toHash)(t);if(o.array&&o.object){let t=(0,s._)`typeof ${r} != "object"`;n=o.null?t:(0,s._)`!${r} || ${t}`,delete o.null,delete o.array,delete o.object}else n=s.nil;for(let t in o.number&&delete o.integer,o)n=(0,s.and)(n,d(t,r,a,i));return n}t.checkDataType=d,t.checkDataTypes=p;let m={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function h(t){let r=function(t){let{gen:r,data:a,schema:i}=t,n=(0,l.schemaRefOrVal)(t,i,"type");return{gen:r,keyword:"type",data:a,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);(0,o.reportError)(r,m)}t.reportTypeError=h}),uJ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uz(),a=uL();function i(t,i,n){let{gen:o,compositeRule:s,data:l,opts:c}=t;if(void 0===n)return;let u=(0,r._)`${l}${(0,r.getProperty)(i)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),o.if(d,(0,r._)`${u} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(t,r){let{properties:a,items:n}=t.schema;if("object"===r&&a)for(let r in a)i(t,r,a[r].default);else"array"===r&&Array.isArray(n)&&n.forEach((r,a)=>i(t,a,r.default))}}),uB=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=uz(),a=uL(),i=uZ(),n=uL();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,i){return(0,r._)`${o(t)}.call(${a}, ${i})`}function l(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} === undefined`;return n?(0,r.or)(o,(0,r.not)(s(t,a,i))):o}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:i,data:n,it:o}=t;i.if(l(i,n,a,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:i}},n,o){return(0,r.or)(...n.map(n=>(0,r.and)(l(t,a,n,i.ownProperties),(0,r._)`${o} = ${n}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=o,t.isOwnProperty=s,t.propertyInData=function(t,a,i,n){let o=(0,r._)`${a}${(0,r.getProperty)(i)} !== undefined`;return n?(0,r._)`${o} && ${s(t,a,i)}`:o},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(i=>!(0,a.alwaysValidSchema)(t,r[i]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:n,topSchemaRef:o,schemaPath:s,errorPath:l},it:c},u,d,p){let m=p?(0,r._)`${t}, ${a}, ${o}${s}`:a,h=[[i.default.instancePath,(0,r.strConcat)(i.default.instancePath,l)],[i.default.parentData,c.parentData],[i.default.parentDataProperty,c.parentDataProperty],[i.default.rootData,i.default.rootData]];c.opts.dynamicRef&&h.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let f=(0,r._)`${m}, ${n.object(...h)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:a}},i){let o=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(i,o);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,n.useFunc)(t,s)}(${i}, ${o})`})},t.validateArray=function(t){let{gen:i,data:n,keyword:o,it:s}=t,l=i.name("valid");if(s.allErrors){let t=i.let("valid",!0);return c(()=>i.assign(t,!1)),t}return i.var(l,!0),c(()=>i.break()),l;function c(s){let c=i.const("len",(0,r._)`${n}.length`);i.forRange("i",0,c,n=>{t.subschema({keyword:o,dataProp:n,dataPropType:a.Type.Num},l),i.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:i,schema:n,keyword:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=i.let("valid",!1),c=i.name("_valid");i.block(()=>n.forEach((a,n)=>{let s=t.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);i.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||i.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uK=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uz(),a=uZ(),i=uB(),n=uD();function o(t){let{gen:a,data:i,it:n}=t;a.if(n.parentData,()=>a.assign(i,(0,r._)`${n.parentData}[${n.parentDataProperty}]`))}function s(t,a,i){if(void 0===i)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof i?{ref:i}:{ref:i,code:(0,r.stringify)(i)})}t.macroKeywordCode=function(t,a){let{gen:i,keyword:n,schema:o,parentSchema:l,it:c}=t,u=a.macro.call(c.self,o,l,c),d=s(i,n,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=i.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:m,$data:h,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let y=s(u,d,!h&&l.compile?l.compile.call(f.self,p,m,f):l.validate),g=u.let("valid");function v(n=l.async?(0,r._)`await `:r.nil){let o=f.opts.passContext?a.default.this:a.default.self,s=!("compile"in l&&!h||!1===l.schema);u.assign(g,(0,r._)`${n}${(0,i.callValidateCode)(t,y,o,s)}`,l.modifying)}function _(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:g),t)}t.block$data(g,function(){if(!1===l.errors)v(),l.modifying&&o(t),_(()=>t.error());else{let i,s,c=l.async?(i=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(g,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(i,(0,r._)`${t}.errors`),()=>u.throw(t))),i):(s=(0,r._)`${y}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&o(t),_(()=>(function(t,i){let{gen:o}=t;o.if((0,r._)`Array.isArray(${i})`,()=>{o.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${i} : ${a.default.vErrors}.concat(${i})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,n.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:g)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let t=`keyword "${o}" value is invalid at path "${i}": `+a.errorsText(n.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),uG=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uz(),a=uL();t.getSubschema=function(t,{keyword:i,schemaProp:n,schema:o,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==i&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==i){let o=t.schema[i];return void 0===n?{schema:o,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${i}`}:{schema:o[n],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(i)}${(0,r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${i}/${(0,a.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,i,{dataProp:n,dataPropType:o,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==n)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=i;if(void 0!==n){let{errorPath:s,dataPathArr:l,opts:c}=i;d(u.let("data",(0,r._)`${i.data}${(0,r.getProperty)(n)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(n,o,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${n}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=i.dataLevel+1,t.dataTypes=[],i.definedProperties=new Set,t.parentData=i.data,t.dataNames=[...i.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=r,t.jtdMetadata=a}}),uW=F((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((i=r.length)!=a.length)return!1;for(n=i;0!=n--;)if(!t(r[n],a[n]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((i=(o=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(a,o[n]))return!1;for(n=i;0!=n--;){var i,n,o,s=o[n];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),uY=F((t,r)=>{var a=r.exports=function(t,r,i){"function"==typeof r&&(i=r,r={});var n="function"==typeof(i=r.cb||i)?i:i.pre||function(){};!function t(r,i,n,o,s,l,c,u,d,p){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var m in i(o,s,l,c,u,d,p),o){var h=o[m];if(Array.isArray(h)){if(m in a.arrayKeywords)for(var f=0;f<h.length;f++)t(r,i,n,h[f],s+"/"+m+"/"+f,l,s,m,o,f)}else if(m in a.propsKeywords){if(h&&"object"==typeof h)for(var y in h)t(r,i,n,h[y],s+"/"+m+"/"+y.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,m,o,y)}else(m in a.keywords||r.allKeys&&!(m in a.skipKeywords))&&t(r,i,n,h,s+"/"+m,l,s,m,o)}n(o,s,l,c,u,d,p)}}(r,n,i.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.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}}),uX=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uL(),a=uW(),i=uY(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(o.has(a))return!0;let i=r[a];if(Array.isArray(i)&&i.some(t)||"object"==typeof i&&t(i))return!0}return!1}(t):!!a&&function t(a){let i=0;for(let o in a)if("$ref"===o||(i++,!n.has(o)&&("object"==typeof a[o]&&(0,r.eachItem)(a[o],r=>i+=t(r)),i===1/0)))return 1/0;return i}(t)<=a)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:n,uriResolver:o}=this.opts,l=u(t[n]||r),c={"":l},p=s(o,l,!1),m={},h=new Set;return i(t,{allKeys:!0},(t,r,a,i)=>{if(void 0===i)return;let o=p+r,s=c[i];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),h.has(r))throw y(r);h.add(r);let i=this.refs[r];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,r):r!==u(o)&&("#"===r[0]?(f(t,m[r],r),m[r]=t):this.refs[r]=o),r}function g(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[n]&&(s=l.call(this,t[n])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),c[r]=s}),m;function f(t,r,i){if(void 0!==r&&!a(t,r))throw y(i)}function y(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),uQ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uV(),a=uH(),i=uU(),n=uH(),o=uJ(),s=uK(),l=uG(),c=uz(),u=uZ(),d=uX(),p=uL(),m=uD();function h({gen:t,validateName:r,schema:a,schemaEnv:i,opts:n},o){var s;n.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,i.$async,()=>{var r,i;t.code((0,c._)`"use strict"; ${f(a,n)}`),r=t,i=n,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),i.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(o)}):t.func(r,(0,c._)`${u.default.data}, ${(s=n,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,i.$async,()=>t.code(f(a,n)).code(o))}function f(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function y({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function g(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:i,self:n}=t;r.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let i=(0,a.getSchemaTypes)(t.schema);S(t,i,!(0,a.coerceAndCheckDataType)(t,i),r)}function b({gen:t,schemaEnv:r,schema:a,errSchemaPath:i,opts:n}){let o=a.$comment;if(!0===n.$comment)t.code((0,c._)`${u.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){let a=(0,c.str)`${i}/$comment`,n=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${o}, ${a}, ${n}.schema)`)}}function S(t,r,a,o){var s,l,d,m;let{gen:h,schema:f,data:y,allErrors:g,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void h.block(()=>x(t,"$ref",b.all.$ref.definition));function S(s){(0,i.shouldUseGroup)(f,s)&&(s.type?(h.if((0,n.checkDataType)(s.type,y,v.strictNumbers)),$(t,s),1===r.length&&r[0]===s.type&&a&&(h.else(),(0,n.reportTypeError)(t)),h.endIf()):$(t,s),g||h.if((0,c._)`${u.default.errors} === ${o||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(t.dataTypes,r)||R(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let a=[];for(let i of t.dataTypes)w(r,i)?a.push(i):r.includes("integer")&&"number"===i&&a.push("integer");t.dataTypes=a}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(m=l).length>1&&!(2===m.length&&m.includes("null"))&&R(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let a=t.self.RULES.all;for(let n in a){let o=a[n];if("object"==typeof o&&(0,i.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(t=>{var a,i;return a=r,i=t,a.includes(i)||"number"===i&&a.includes("integer")})&&R(t,`missing type "${a.join(",")}" for keyword "${n}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function $(t,r){let{gen:a,schema:n,opts:{useDefaults:s}}=t;s&&(0,o.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,i.shouldUseRule)(n,a)&&x(t,a.keyword,a.definition,r.type)})}function w(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function R(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){g(t)&&(v(t),y(t))?function(t){let{schema:r,opts:a,gen:i}=t;h(t,()=>{a.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(u.default.vErrors,null),i.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:a,validateName:i,ValidationError:n,opts:o}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${n}(${u.default.vErrors})`)):(r.assign((0,c._)`${i}.errors`,u.default.vErrors),o.unevaluated&&function({gen:t,evaluated:r,props:a,items:i}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),i instanceof c.Name&&t.assign((0,c._)`${r}.items`,i)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):h(t,()=>(0,r.topBoolOrEmptySchema)(t))};var k=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?m.reportExtraError:m.reportError)(this,this.def.error,r)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:i,schemaType:n,def:o}=this;a.if((0,c.or)((0,c._)`${i} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(n.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:i,it:o}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,n.checkDataTypes)(t,r,o.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(i.validateSchema){let a=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let i=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(i,this.it,t),(0,l.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return!function(t,a){if(g(t)&&(v(t),y(t)))return function(t,r){var a;let i,{schema:n,gen:o,opts:s}=t;s.$comment&&n.$comment&&b(t),(i=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,i)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=o.const("_errs",u.default.errors);_(t,l),o.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(n,a),n}mergeEvaluated(t,r){let{it:a,gen:i}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(i,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(i,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:i}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return i.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function x(t,r,a,i){let n=new k(t,a,r);"code"in a?a.code(n,i):n.$data&&a.validate?(0,s.funcKeywordCode)(n,a):"macro"in a?(0,s.macroKeywordCode)(n,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(n,a)}t.KeywordCxt=k;let P=/^\/(?:[^~]|~0|~1)*$/,E=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:a,dataPathArr:i}){let n,o;if(""===t)return u.default.rootData;if("/"===t[0]){if(!P.test(t))throw Error(`Invalid JSON-pointer: ${t}`);n=t,o=u.default.rootData}else{let s=E.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(n=s[2])){if(c>=r)throw Error(l("property/index",c));return i[r-c]}if(c>r)throw Error(l("data",c));if(o=a[r-c],!n)return o}let s=o;for(let t of n.split("/"))t&&(o=(0,c._)`${o}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${o}`);return s;function l(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=T}),u0=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),u1=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX();t.default=class extends Error{constructor(t,a,i,n){super(n||`can't resolve reference ${i} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,i),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),u2=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uz(),a=u0(),i=uZ(),n=uX(),o=uL(),s=uQ();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,n.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let o,l,c=d.call(this,t);if(c)return c;let u=(0,n.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:m}=this.opts.code,{ownProperties:h}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:m,ownProperties:h});t.$async&&(o=f.scopeValue("Error",{ref:a.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let y=f.scopeName("validate");t.validateName=y;let g={gen:f,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:y,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(g),f.optimize(this.opts.code.optimize);let a=f.toString();l=`${f.scopeRefs(i.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let n=Function(`${i.default.self}`,`${i.default.scope}`,l)(this,this.scope.get());if(this.scope.value(y,{ref:n}),n.errors=null,n.schema=t.schema,n.schemaEnv=t,t.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:y,validateCode:a,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:a}=g;n.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},n.source&&(n.source.evaluated=(0,r.stringify)(n.evaluated))}return t.validate=n,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,n.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let i of this._compilations){var r,a;if(r=i,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return i}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||m.call(this,t,r)}function m(t,r){let a=this.opts.uriResolver.parse(r),i=(0,n._getFullPath)(this.opts.uriResolver,a),o=(0,n.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===o)return f.call(this,a,t);let s=(0,n.normalizeId)(i),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=m.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,n.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,i=r[a];return i&&(o=(0,n.resolveUrl)(this.opts.uriResolver,o,i)),new l({schema:r,schemaId:a,root:t,baseId:o})}return f.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var i;a=(0,n.resolveUrl)(this.opts.uriResolver,r,a);let o=t.refs[a];if(o)return o;let s=p.call(this,t,a);if(void 0===s){let n=null==(i=t.localRefs)?void 0:i[a],{schemaId:o}=this.opts;n&&(s=new l({schema:n,schemaId:o,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=m;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:a,root:i}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,o.unescapeFragment)(i)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!h.has(i)&&s&&(r=(0,n.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,o.schemaHasRulesButRef)(a,this.RULES)){let t=(0,n.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=m.call(this,i,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:i,baseId:r})).schema!==c.root.schema)return c}}),u9=F((t,r)=>{r.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),u4=F((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(t){let r="",a=0,i=0;for(i=0;i<t.length;i++)if(48!==(a=t[i].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i];break}for(i+=1;i<t.length;i++){if(!((a=t[i].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[i]}return r}function o(t){return t.length=0,!0}function s(t,r,a){if(t.length){let i=n(t);if(""===i)return a.error=!0,!1;r.push(i),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},i=[],l=[],c=!1,u=!1,d=s;for(let n=0;n<t.length;n++){let s=t[n];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,i,a))break;if(++r>7){a.error=!0;break}n>0&&":"===t[n-1]&&(c=!0),i.push(":");continue}else if("%"===s){if(!d(l,i,a))break;d=o}else{l.push(s);continue}}return l.length&&(d===o?a.zone=l.join(""):u?i.push(l.join("")):i.push(n(l))),a.address=i.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!i(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],i=-1,n=0;for(;n=r.length;){if(1===n)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===n){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===n&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(i=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,i)),r=r.slice(i)}return a.join("")},isIPv4:i,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:n}}),u3=F((t,r)=>{let{isUUID:a}=u4(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function o(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=o(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(o(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},m={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let a=t.path.match(i);if(a){let i=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let n=h(`${i}:${r.nid||t.nid}`);t.path=void 0,n&&(t=n.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),n=h(`${a}:${r.nid||i}`);n&&(t=n.serialize(t,r));let o=t,s=t.nss;return o.path=`${i||r.nid}:${s}`,r.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function h(t){return t&&(m[t]||m[t.toLowerCase()])||void 0}Object.setPrototypeOf(m,null),r.exports={wsIsSecure:o,SCHEMES:m,isValidSchemeName:function(t){return -1!==n.indexOf(t)},getSchemeHandler:h}}),u6=F((t,r)=>{let{normalizeIPv6:a,removeDotSegments:i,recomposeAuthority:n,normalizeComponentEncoding:o,isIPv4:s,nonSimpleDomain:l}=u4(),{SCHEMES:c,getSchemeHandler:u}=u3();function d(t,r,a,n){let o={};return n||(t=h(p(t,a),a),r=h(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=i(r.path||""),o.query=r.query):(r.path?("/"===r.path[0]?o.path=i(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=i(o.path)),o.query=r.query):(o.path=t.path,void 0!==r.query?o.query=r.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=r.fragment,o}function p(t,r){let a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},r),s=[],l=u(o.scheme||a.scheme);l&&l.serialize&&l.serialize(a,o),void 0!==a.path&&(o.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==o.reference&&a.scheme&&s.push(a.scheme,":");let c=n(a);if(void 0!==c&&("suffix"!==o.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;o.absolutePath||l&&l.absolutePath||(t=i(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){let i=Object.assign({},r),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;"suffix"===i.reference&&(t=i.scheme?i.scheme+":"+t:"//"+t);let c=t.match(m);if(c){if(n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]),n.host)if(!1===s(n.host)){let t=a(n.host);n.host=t.host.toLowerCase(),o=t.isIPV6}else o=!0;void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",i.reference&&"suffix"!==i.reference&&i.reference!==n.reference&&(n.error=n.error||"URI is not a "+i.reference+" reference.");let r=u(i.scheme||n.scheme);if(!i.unicodeSupport&&(!r||!r.unicodeSupport)&&n.host&&(i.domainHost||r&&r.domainHost)&&!1===o&&l(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(t){n.error=n.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),r&&r.parse&&r.parse(n,i)}else n.error=n.error||"URI can not be parsed.";return n}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(h(t,r),r):"object"==typeof t&&(t=h(p(t,r),r)),t},resolve:function(t,r,a){let i=a?Object.assign({scheme:"null"},a):{scheme:"null"},n=d(h(t,i),h(r,i),i,!0);return i.skipEscape=!0,p(n,i)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(o(h(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(o(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(o(h(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(o(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:h};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),u5=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u6();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),u8=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=uQ();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=uz();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let i=u0(),n=u1(),o=uF(),s=u2(),l=uz(),c=uX(),u=uH(),d=uL(),p=u9(),m=u5(),h=(t,r)=>new RegExp(t,r);h.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,i,n,o,s,l,c,u,d,p,f,y,g,v,_,b,S,$,w,R,k,x,P,E;let T=t.strict,j=null==(r=t.code)?void 0:r.optimize,O=!0===j||void 0===j?1:j||0,C=null!=(i=null==(a=t.code)?void 0:a.regExp)?i:h,I=null!=(n=t.uriResolver)?n:m.default;return{strictSchema:null==(s=null!=(o=t.strictSchema)?o:T)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:T)?f:"log",strictRequired:null!=(g=null!=(y=t.strictRequired)?y:T)&&g,code:t.code?{...t.code,optimize:O,regExp:C}:{optimize:O,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(R=t.addUsedSchema)||R,validateSchema:null==(k=t.validateSchema)||k,validateFormats:null==(x=t.validateFormats)||x,unicodeRegExp:null==(P=t.unicodeRegExp)||P,int32range:null==(E=t.int32range)||E,uriResolver:I}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:r,lines:a}),this.logger=function(t){if(!1===t)return x;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,g,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=k.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&R.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,i=p;"id"===a&&((i={...p}).id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let i=a(r);return"$async"in a||(this.errors=a.errors),i}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return i.call(this,t,r);async function i(t,r){await o.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function o(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof n.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await o.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,i=this.opts.validateSchema){let n;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,i);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(n=t[r])&&"string"!=typeof n)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||n),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,i,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(a,t);if(!i&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return i}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,i=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,i,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(E.call(this,a,r),!r)return(0,d.eachItem)(a,t=>T.call(this,t)),this;O.call(this,r);let i={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===i.type.length?t=>T.call(this,t,i):t=>i.type.forEach(r=>T.call(this,t,i,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let i of(t=JSON.parse(JSON.stringify(t)),r)){let r=i.split("/").slice(1),n=t;for(let t of r)n=n[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:i}=r.definition,o=n[t];i&&o&&(n[t]=I(o))}}return t}_removeAllSchemas(t,r){for(let a in t){let i=t[a];(!r||r.test(a))&&("string"==typeof i?delete t[a]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[a]))}}_addSchema(t,r,a,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if("object"==typeof t)o=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;a=(0,c.normalizeId)(o||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),n&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),i&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,a,i="error"){for(let n in t)n in r&&this.logger[i](`${a}: option ${n}. ${t[n]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function R(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function k(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=i.default,_.MissingRefError=n.default,t.default=_;let x={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function E(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!P.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function T(t,r,a){var i;let n=null==r?void 0:r.post;if(a&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:t})=>t===a);if(s||(s={type:a,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?j.call(this,s,l,r.before):s.rules.push(l),o.all[t]=l,null==(i=r.implements)||i.forEach(t=>this.addKeyword(t))}function j(t,r,a){let i=t.rules.findIndex(t=>t.keyword===a);i>=0?t.rules.splice(i,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function O(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=I(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(t){return{anyOf:[t,C]}}}),u7=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),de=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=u1(),a=uB(),i=uz(),n=uZ(),o=u2(),s=uL();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,i._)`${a.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,o,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:m}=u,h=m.passContext?n.default.this:i.nil;function f(t){let r=(0,i._)`${t}.errors`;c.assign(n.default.vErrors,(0,i._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`),c.assign(n.default.errors,(0,i._)`${n.default.vErrors}.length`)}function y(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==o?void 0:o.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,i._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,i.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,i._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,i.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let n=c.let("valid");c.try(()=>{c.code((0,i._)`await ${(0,a.callValidateCode)(t,r,h)}`),y(r),d||c.assign(n,!0)},t=>{c.if((0,i._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(n,!1)}),t.ok(n)}():t.result((0,a.callValidateCode)(t,r,h),()=>y(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,n;let s,u,d,{gen:p,schema:m,it:h}=t,{baseId:f,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===m||"#/"===m)&&f===b.baseId){if(y===b)return c(t,g,y,y.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,i._)`${r}.validate`,b,b.$async)}let S=o.resolveRef.call(_,b,f,m);if(void 0===S)throw new r.default(h.opts.uriResolver,f,m);return S instanceof o.SchemaEnv?void c(t,l(t,a=S),a,a.$async):(n=S,s=p.scopeValue("schema",!0===v.code.source?{ref:n,code:(0,i.stringify)(n)}:{ref:n}),u=p.name("valid"),d=t.subschema({schema:n,dataTypes:[],schemaPath:i.nil,topSchemaRef:s,errSchemaPath:m},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),dt=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u7(),a=de();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),dr=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=r.operators,i={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${i[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${i[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:n,schemaCode:o}=t;t.fail$data((0,r._)`${n} ${i[a].fail} ${o} || isNaN(${n})`)}}}),da=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:i,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${n} === 0 || (${l} = ${i}/${n}, ${c}))`)}}}),di=F(t=>{function r(t){let r,a=t.length,i=0,n=0;for(;n<a;)i++,(r=t.charCodeAt(n++))>=55296&&r<=56319&&n<a&&(64512&(r=t.charCodeAt(n)))==56320&&n++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),dn=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL(),i=di();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:n,data:o,schemaCode:s,it:l}=t,c="maxLength"===n?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${o}.length`:(0,r._)`${(0,a.useFunc)(t.gen,i.default)}(${o})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),ds=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uB(),a=uL(),i=uz();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,i.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,i._)`{pattern: ${t}}`},code(t){let{gen:n,data:o,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,i._)`new RegExp`:(0,a.useFunc)(n,r),l=n.let("valid");n.try(()=>n.assign(l,(0,i._)`${s}(${c}, ${d}).test(${o})`),()=>n.assign(l,!1)),t.fail$data((0,i._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,i._)`!${a}.test(${o})`)}}}}),dl=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${i}).length ${o} ${n}`)}}}),dc=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uB(),a=uz(),i=uL();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:n,schema:o,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===o.length)return;let p=o.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(a.nil,m);else for(let a of o)(0,r.checkReportMissingProp)(t,a)}():function(){let i=n.let("missing");if(p||c){let o=n.let("valid",!0);t.block$data(o,()=>{var c,u;return c=i,u=o,void(t.setParams({missingProperty:c}),n.forOf(c,s,()=>{n.assign(u,(0,r.propertyInData)(n,l,c,d.ownProperties)),n.if((0,a.not)(u),()=>{t.error(),n.break()})},a.nil))}),t.ok(o)}else n.if((0,r.checkMissingProp)(t,o,i)),(0,r.reportMissingProp)(t,i),n.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of o)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(u,r,u.opts.strictRequired)}}function m(){n.forOf("prop",s,a=>{t.setParams({missingProperty:a}),n.if((0,r.noPropertyInData)(n,l,a,d.ownProperties),()=>t.error())})}}}}),du=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:i,schemaCode:n}=t,o="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${i}.length ${o} ${n}`)}}}),dd=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uW();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),dp=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uH(),a=uz(),i=uL(),n=dd();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen:o,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let m=o.let("valid"),h=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(m,function(){let l=o.let("i",(0,a._)`${s}.length`),c=o.let("j");t.setParams({i:l,j:c}),o.assign(m,!0),o.if((0,a._)`${l} > 1`,()=>(h.length>0&&!h.some(t=>"object"===t||"array"===t)?function(i,n){let l=o.name("item"),c=(0,r.checkDataTypes)(h,l,p.opts.strictNumbers,r.DataType.Wrong),u=o.const("indices",(0,a._)`{}`);o.for((0,a._)`;${i}--;`,()=>{o.let(l,(0,a._)`${s}[${i}]`),o.if(c,(0,a._)`continue`),h.length>1&&o.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),o.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{o.assign(n,(0,a._)`${u}[${l}]`),t.error(),o.assign(m,!1).break()}).code((0,a._)`${u}[${l}] = ${i}`)})}:function(r,l){let c=(0,i.useFunc)(o,n.default),u=o.name("outer");o.label(u).for((0,a._)`;${r}--;`,()=>o.for((0,a._)`${l} = ${r}; ${l}--;`,()=>o.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),o.assign(m,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(m)}}}),dm=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL(),i=dd();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:n,data:o,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,a.useFunc)(n,i.default)}(${o}, ${l})`):t.fail((0,r._)`${c} !== ${o}`)}}}),dh=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL(),i=dd();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let n,o,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let m=u.length>=p.opts.loopEnum,h=()=>null!=n?n:n=(0,a.useFunc)(s,i.default);if(m||c)o=s.let("valid"),t.block$data(o,function(){s.assign(o,!1),s.forOf("v",d,t=>s.if((0,r._)`${h()}(${l}, ${t})`,()=>s.assign(o,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);o=(0,r.or)(...u.map((a,i)=>{var n,o;let s;return n=t,"object"==typeof(s=u[o=i])&&null!==s?(0,r._)`${h()}(${l}, ${n}[${o}])`:(0,r._)`${l} === ${s}`}))}t.pass(o)}}}),df=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dr(),a=da(),i=dn(),n=ds(),o=dl(),s=dc(),l=du(),c=dp(),u=dm(),d=dh();t.default=[r.default,a.default,i.default,n.default,o.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),dy=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uz(),a=uL();function i(t,i){let{gen:n,schema:o,data:s,keyword:l,it:c}=t;c.items=!0;let u=n.const("len",(0,r._)`${s}.length`);if(!1===o)t.setParams({len:i.length}),t.pass((0,r._)`${u} <= ${i.length}`);else if("object"==typeof o&&!(0,a.alwaysValidSchema)(c,o)){let o=n.var("valid",(0,r._)`${u} <= ${i.length}`);n.if((0,r.not)(o),()=>{var s;return s=o,void n.forRange("i",i.length,u,i=>{t.subschema({keyword:l,dataProp:i,dataPropType:a.Type.Num},s),c.allErrors||n.if((0,r.not)(s),()=>n.break())})}),t.ok(o)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:n}=t,{items:o}=r;Array.isArray(o)?i(t,o):(0,a.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),dg=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uz(),a=uL(),i=uB();function n(t,i,o=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:n}=d,s=o.length,l=s===t.minItems&&(s===t.maxItems||!1===t[i]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${i} are not specified or different at path "${n}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&o.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,o.length,d.items));let p=s.name("valid"),m=s.const("len",(0,r._)`${c}.length`);o.forEach((i,n)=>{(0,a.alwaysValidSchema)(d,i)||(s.if((0,r._)`${m} > ${n}`,()=>t.subschema({keyword:u,schemaProp:n,dataProp:n},p)),t.ok(p))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:o}=t;if(Array.isArray(r))return n(t,"additionalItems",r);o.items=!0,(0,a.alwaysValidSchema)(o,r)||t.ok((0,i.validateArray)(t))}}}),dv=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dg();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),d_=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL(),i=uB(),n=dy();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:o,it:s}=t,{prefixItems:l}=o;s.items=!0,(0,a.alwaysValidSchema)(s,r)||(l?(0,n.validateAdditionalItems)(t,l):t.ok((0,i.validateArray)(t)))}}}),db=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let i,n,{gen:o,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(i=void 0===d?1:d,n=p):i=1;let m=o.const("len",(0,r._)`${c}.length`);if(t.setParams({min:i,max:n}),void 0===n&&0===i)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==n&&i>n){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${m} >= ${i}`;void 0!==n&&(a=(0,r._)`${a} && ${m} <= ${n}`),t.pass(a);return}u.items=!0;let h=o.name("valid");function f(){let t=o.name("_valid"),a=o.let("count",0);y(t,()=>o.if(t,()=>{var t;return t=a,void(o.code((0,r._)`${t}++`),void 0===n?o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0).break()):(o.if((0,r._)`${t} > ${n}`,()=>o.assign(h,!1).break()),1===i?o.assign(h,!0):o.if((0,r._)`${t} >= ${i}`,()=>o.assign(h,!0))))}))}function y(r,i){o.forRange("i",0,m,n=>{t.subschema({keyword:"contains",dataProp:n,dataPropType:a.Type.Num,compositeRule:!0},r),i()})}void 0===n&&1===i?y(h,()=>o.if(h,()=>o.break())):0===i?(o.let(h,!0),void 0!==n&&o.if((0,r._)`${c}.length > 0`,f)):(o.let(h,!1),f()),t.result(h,()=>t.reset())}}}),dS=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uz(),a=uL(),i=uB();t.error={message:({params:{property:t,depsCount:a,deps:i}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${i} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:i,missingProperty:n}})=>(0,r._)`{property: ${t},
|
|
59
|
-
missingProperty: ${
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let n=a[1];if(r===a[0]){i(a);continue}if(t.external){let n=t.external.registry.get(a[0])?.id;if(r!==a[0]&&n){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id||n.cycle){i(a);continue}n.count>1&&"ref"===t.reused&&i(a)}t.external&&(t.sharedDefsExtractedFor=t.external)}let ap=new Set(["type","properties","required","additionalProperties"]),am=["oneOf","anyOf"];function ah(t){let r=t.additionalProperties;return void 0===r||!1===r||"object"!=typeof r||null===r?null:Object.keys(r).length?r:null}function af(t){let r=[];for(let a of t){if("object"!=typeof a||"object"!==a.type)return null;for(let t in a)if(!ap.has(t))return null;r.push(a)}let a={},n=new Set;for(let t of r){for(let n in t.properties){if(Object.prototype.hasOwnProperty.call(a,n))continue;let t=[];for(let a of r){let r=a.properties?.[n]??ah(a);null!=r&&(t.some(t=>JSON.stringify(t)===JSON.stringify(r))||t.push(r))}en(a,n,1===t.length?t[0]:af(t)??{allOf:t})}for(let r of t.required??[])n.add(r)}let i={type:"object",properties:a};if(n.size&&(i.required=[...n]),r.every(t=>!1===t.additionalProperties))i.additionalProperties=!1;else{let t=[];for(let a of r){let r=ah(a);r&&!t.some(t=>JSON.stringify(t)===JSON.stringify(r))&&t.push(r)}1===t.length?i.additionalProperties=t[0]:t.length>1&&(i.additionalProperties={allOf:t})}return i}function ag(t,r){let a=t.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let n=r=>{let a=t.seen.get(r);if(null===a.ref)return;let i=a.def??a.schema,o={...i},s=a.ref;if(a.ref=null,s){n(s);let a=t.seen.get(s),l=a.schema;if(l.$ref&&("draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target)?(i.allOf=i.allOf??[],i.allOf.push(l)):ao(i,l),ao(i,o),r._zod.parent===s)for(let t in i)"$ref"!==t&&"allOf"!==t&&(t in o||delete i[t]);if(l.$ref&&a.def)for(let t in i)"$ref"!==t&&"allOf"!==t&&t in a.def&&JSON.stringify(i[t])===JSON.stringify(a.def[t])&&delete i[t]}let l=r._zod.parent;if(l&&l!==s){n(l);let r=t.seen.get(l);if(r?.schema.$ref&&(i.$ref=r.schema.$ref,r.def))for(let t in i)"$ref"!==t&&"allOf"!==t&&t in r.def&&JSON.stringify(i[t])===JSON.stringify(r.def[t])&&delete i[t]}t.override({zodSchema:r,jsonSchema:i,path:a.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let r of[...t.seen.entries()].reverse())n(r[0]);if("openapi-3.0"!==t.target)for(let r of t.seen.entries())!function t(r){let a=r.anyOf;if(!Array.isArray(a)||0===a.length||void 0!==r.type)return;let n=[];for(let r of a){if(!r||"object"!=typeof r)return;t(r);let a=Object.keys(r);if(1!==a.length||"type"!==a[0])return;let i=r.type;for(let t of Array.isArray(i)?i:[i]){if("string"!=typeof t)return;n.includes(t)||n.push(t)}}delete r.anyOf,r.type=1===n.length?n[0]:n}(r[1].def??r[1].schema);for(let r of t.deferred)r();if(t.intersections.length){let r=new Map;for(let a of t.seen.values())for(let t of[a.schema,a.def]){let a=t?.allOf;if(!Array.isArray(a))continue;let n=r.get(a);n?n.push(t):r.set(a,[t])}for(let a of t.intersections)for(let t of r.get(a)??[])!function(t){let r=t.allOf;if(!Array.isArray(r)||r.length<2)return;for(let r of ap)if(r in t)return;let a=r.filter(t=>am.some(r=>Array.isArray(t[r]))),n=null;if(a.length){let t=a[0],i=am.find(r=>Array.isArray(t[r]));if(1!==Object.keys(t).length)return;let o=r.filter(r=>r!==t),s=t[i].map(t=>af([...o,t]));if(s.some(t=>!t))return;n={[i]:s}}else n=af(r);n&&(delete t.allOf,ao(t,n))}(t)}}let i={};if("draft-2020-12"===t.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===t.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===t.target?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(r)?.id;if(!a)throw Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}ao(i,a.defId?a.schema:a.def??a.schema);let o=t.metadataRegistry.get(r)?.id;void 0!==o&&i.id===o&&delete i.id;let s=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let r of t.seen.entries()){let t=r[1];t.def&&t.defId&&(t.def.id===t.defId&&delete t.def.id,en(s,t.defId,t.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(s).length>0&&("draft-2020-12"===t.target?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...r["~standard"],jsonSchema:{input:ay(r,"input",t.processors),output:ay(r,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch(t){throw Error("Error converting schema to JSON.")}}let ay=(t,r,a={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=as({...i??{},target:o,io:r,processors:a});return ac(t,s),ad(s,t),ag(s,t)},av=(t,r,a)=>{(void 0===t[r]||a>t[r])&&(t[r]=a)},a_=(t,r,a)=>{(void 0===t[r]||a<t[r])&&(t[r]=a)},ab=(t,r)=>{av(t,"minimum",r),a_(t,"maximum",r)},aS=(t,r)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(r)||t.multipleOf.push(r)},a$=(t,r)=>{t.patterns??(t.patterns=new Set),t.patterns.add(r)},aw=(t,r)=>{t.mime=t.mime?t.mime.filter(t=>r.includes(t)):[...r]},aR=(t,r)=>{t.format=r,r.includes("int")&&(t.isInt=!0)},ak=(t,r)=>av(t,"minimum",r.minimum),ax=(t,r)=>a_(t,"maximum",r.maximum),aP=t=>(r,a)=>{aR(r,a.format);let[n,i]=t[a.format];av(r,"minimum",n),a_(r,"maximum",i)},aE={greater_than:(t,r)=>av(t,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(t,r)=>a_(t,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(t,r)=>aS(t,r.value),number_format:aP(eS),bigint_format:aP(e$),min_length:ak,max_length:ax,length_equals:(t,r)=>ab(t,r.length),min_size:ak,max_size:ax,size_equals:(t,r)=>ab(t,r.size),string_format:(t,r)=>{aR(t,r.format),r.pattern&&a$(t,r.pattern),("base64"===r.format||"base64url"===r.format)&&(t.contentEncoding=r.format),(r.local||-1===r.precision)&&(t.laxFormat=!0)},mime_type:(t,r)=>aw(t,r.mime)};function aT(t){let r={},a=t._zod.def;for(let n of t._zod.traits.has("$ZodCheck")?[t,...a.checks??[]]:a.checks??[])aE[n._zod.def.check]?.(r,n._zod.def);let n=t._zod.bag;for(let t of(void 0!==n.minimum&&av(r,"minimum",n.minimum),void 0!==n.exclusiveMinimum&&av(r,"exclusiveMinimum",n.exclusiveMinimum),void 0!==n.maximum&&a_(r,"maximum",n.maximum),void 0!==n.exclusiveMaximum&&a_(r,"exclusiveMaximum",n.exclusiveMaximum),void 0!==n.multipleOf&&aS(r,n.multipleOf),void 0!==n.format&&(r.format??(r.format=n.format),n.format.includes("int")&&(r.isInt=!0)),n.mime&&aw(r,n.mime),n.patterns??[]))a$(r,t);return r}let aj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},aO=new Map([[ro,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rl,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),aC=t=>aO.get(t)??t,aI=(t,r,a,n)=>{a.type="string";let{minimum:i,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=aT(t);if("number"==typeof i&&(a.minLength=i),"number"==typeof o&&(a.maxLength=o),s&&(a.format=aj[s]??s,""===a.format&&delete a.format,("time"===s||u)&&delete a.format),c&&(a.contentEncoding=c),l&&l.size>0){let t=[...l].map(aC);1===t.length?a.pattern=t[0].source:t.length>1&&(a.allOf=[...t.map(t=>({..."draft-07"===r.target||"draft-04"===r.target||"openapi-3.0"===r.target?{type:"string"}:{},pattern:t.source}))])}},aN=(t,r,a,n)=>{let{minimum:i,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=aT(t);a.type=u?"integer":"number";let d="number"==typeof c&&c>=(i??-1/0),p="number"==typeof l&&l<=(o??1/0),m="draft-04"===r.target||"openapi-3.0"===r.target;if(d?m?(a.minimum=c,a.exclusiveMinimum=!0):a.exclusiveMinimum=c:"number"==typeof i&&(a.minimum=i),p?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:"number"==typeof o&&(a.maximum=o),s){let i=new Set;for(let o of s)Number.isFinite(o)&&0!==o?i.add(Math.abs(o)):al(t,r,a,n,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...l]=i;void 0!==o&&(a.multipleOf=o),l.length&&(a.allOf=[...a.allOf??[],...l.map(t=>({multipleOf:t}))])}},aq=(t,r,a,n)=>{a.type="boolean"},aA=(t,r,a,n)=>{"openapi-3.0"===r.target?(a.type="string",a.nullable=!0,a.enum=[null]):a.type="null"},aM=(t,r,a,n)=>{a.not={}},az=(t,r,a,n)=>{},aL=(t,r,a,n)=>{},aZ=(t,r,a,n)=>{let i=Y(t._zod.def.entries);if(0===i.length){a.not={};return}i.every(t=>"number"==typeof t)&&(a.type="number"),i.every(t=>"string"==typeof t)&&(a.type="string"),a.enum=i},aD=(t,r,a,n)=>{let i=t._zod.def;if(0===i.values.length){a.not={};return}let o=[];for(let s of i.values)if(void 0===s){if(al(t,r,a,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(al(t,r,a,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){let t=o[0];a.type=null===t?"null":typeof t,"draft-04"===r.target||"openapi-3.0"===r.target?a.enum=[t]:a.const=t}else o.every(t=>"number"==typeof t)&&(a.type="number"),o.every(t=>"string"==typeof t)&&(a.type="string"),o.every(t=>"boolean"==typeof t)&&(a.type="boolean"),o.every(t=>null===t)&&(a.type="null"),a.enum=o},aU=(t,r,a,n)=>{al(t,r,a,n,"Custom types cannot be represented in JSON Schema")},aV=(t,r,a,n)=>{al(t,r,a,n,"Transforms cannot be represented in JSON Schema")},aF=(t,r,a,n)=>{let i=t._zod.def,{minimum:o,maximum:s}=aT(t);"number"==typeof o&&(a.minItems=o),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=ac(i.element,r,{...n,path:[...n.path,"items"]})};function aH(t){let r=t._zod.def;return"pipe"===r.type&&r.in._zod.traits.has("$ZodTransform")?aH(r.out):"catch"===r.type?aH(r.innerType):t._zod.optin}let aJ=(t,r,a,n)=>{let i=t._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&al(t,r,a,n,"Symbol keys cannot be represented in JSON Schema"))return;for(let t in a.type="object",a.properties={},o)en(a.properties,t,ac(o[t],r,{...n,path:[...n.path,"properties",t]}));let s=[];for(let t of Object.keys(o)){let a=i.shape[t];("input"===r.io?void 0===aH(a):void 0===a._zod.optout)&&s.push(t)}s.length>0&&(a.required=s),i.catchall?._zod.def.type==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=ac(i.catchall,r,{...n,path:[...n.path,"additionalProperties"]})):"output"===r.io&&(a.additionalProperties=!1)},aB=(t,r,a,n)=>{let i=t._zod.def,o=!1===i.inclusive,s=i.options.map((t,a)=>ac(t,r,{...n,path:[...n.path,o?"oneOf":"anyOf",a]}));o?a.oneOf=s:a.anyOf=s},aK=(t,r,a,n)=>{let i=t._zod.def,o=ac(i.left,r,{...n,path:[...n.path,"allOf",0]}),s=ac(i.right,r,{...n,path:[...n.path,"allOf",1]}),l=t=>"allOf"in t&&1===Object.keys(t).length,c=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];a.allOf=c,r.intersections.push(c)},aG=new WeakMap,aW=(t,r,a,n)=>{let i=t._zod.def;a.type="object";let o=i.keyType,s=aT(o).patterns;if("loose"===i.mode&&s&&s.size>0){let t=ac(i.valueType,r,{...n,path:[...n.path,"patternProperties","*"]});for(let r of(a.patternProperties={},s))en(a.patternProperties,aC(r).source,t)}else{if("draft-07"===r.target||"draft-2020-12"===r.target){a.propertyNames=ac(i.keyType,r,{...n,path:[...n.path,"propertyNames"]});let o=aG.get(r);o||(o=[],aG.set(r,o),r.deferred.push(()=>(function(t){let r=new Map;for(let a of t.seen.values())a.def&&!r.has(a.schema)&&r.set(a.schema,a);let a=new Map;for(let n of aG.get(t)??[]){let i=t.seen.get(n),o=(i?.def??i?.schema)?.propertyNames;if(!o||!0===o||a.has(o))continue;let s=function t(r,a,n){if(a.$ref){if(n.has(a))return a;n.add(a);let i=r.get(a)?.def;if(!i)return a;let o=t(r,i,n);return o===i?a:o}for(let i of["anyOf","oneOf"]){let o=a[i];if(!Array.isArray(o))continue;let s=o.map(a=>t(r,a,n));s.some((t,r)=>t!==o[r])&&(a={...a,[i]:s})}let i=Array.isArray(a.type)?a.type:[a.type],o=!i.includes("string")&&i.some(t=>"number"===t||"integer"===t),s=a.enum??(void 0!==a.const?[a.const]:void 0);if(!o&&!s?.some(t=>"number"==typeof t))return a;let{minimum:l,maximum:c,exclusiveMinimum:u,exclusiveMaximum:d,multipleOf:p,format:m,id:h,...f}=a;return f.enum?f.enum=f.enum.map(t=>"number"==typeof t?String(t):t):"number"==typeof f.const&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(i.includes("number")?th:tm).source)),f}(r,o,new Set);s!==o&&a.set(o,s)}if(a.size)for(let r of t.seen.values())for(let t of[r.schema,r.def]){let r=t&&a.get(t.propertyNames);r&&(t.propertyNames=r)}})(r))),o.push(t)}a.additionalProperties=ac(i.valueType,r,{...n,path:[...n.path,"additionalProperties"]})}let l=o._zod.values,c="input"===r.io&&void 0!==aH(i.valueType);if(l&&!i.partial&&!c){let t=[...l].filter(t=>"string"==typeof t||"number"==typeof t);t.length>0&&(a.required=t.map(String))}},aY=(t,r,a,n)=>{let i=t._zod.def,o=ac(i.innerType,r,n),s=r.seen.get(t);"openapi-3.0"===r.target?(s.ref=i.innerType,a.nullable=!0):a.anyOf=[o,{type:"null"}]},aX=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},aQ=Symbol();function a0(t,r,a,n,i){let o=!1,s=JSON.stringify(t,(t,r)=>"bigint"!=typeof r?r:(o=!0,null));return o?(al(r,a,n,i,"BigInt defaults cannot be represented in JSON Schema"),aQ):JSON.parse(s)}let a1=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType;let o=a0(i.defaultValue,t,r,a,n);o!==aQ&&(a.default=o)},a2=(t,r,a,n)=>{let i=t._zod.def;if(ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType,"input"!==r.io)return;let o=a0(i.defaultValue,t,r,a,n);o!==aQ&&(a._prefault=o)},a9=(t,r,a,n)=>{let i,o=t._zod.def;ac(o.innerType,r,n),r.seen.get(t).ref=o.innerType;try{i=o.catchValue(void 0)}catch{al(t,r,a,n,"Dynamic catch values are not supported in JSON Schema");return}a.default=i},a4=(t,r,a,n)=>{let i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===r.io?o?i.out:i.in:i.out;ac(s,r,n),r.seen.get(t).ref=s},a3=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType,a.readOnly=!0},a6=(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},a5=(t,r,a,n)=>{let i=t._zod.innerType;ac(i,r,n),r.seen.get(t).ref=i},a7={string:aI,number:aN,boolean:aq,bigint:(t,r,a,n)=>{al(t,r,a,n,"BigInt cannot be represented in JSON Schema")},symbol:(t,r,a,n)=>{al(t,r,a,n,"Symbols cannot be represented in JSON Schema")},null:aA,undefined:(t,r,a,n)=>{al(t,r,a,n,"Undefined cannot be represented in JSON Schema")},void:(t,r,a,n)=>{al(t,r,a,n,"Void cannot be represented in JSON Schema")},never:aM,any:az,unknown:aL,date:(t,r,a,n)=>{al(t,r,a,n,"Date cannot be represented in JSON Schema")},enum:aZ,literal:aD,nan:(t,r,a,n)=>{al(t,r,a,n,"NaN cannot be represented in JSON Schema")},template_literal:(t,r,a,n)=>{let i=t._zod.pattern;if(!i)throw Error("Pattern not found in template literal");a.type="string",a.pattern=i.source},file:(t,r,a,n)=>{a.type="string",a.format="binary",a.contentEncoding="binary";let{minimum:i,maximum:o,mime:s}=aT(t);void 0!==i&&(a.minLength=i),void 0!==o&&(a.maxLength=o),s&&(0===s.length?a.not={}:1===s.length?a.contentMediaType=s[0]:a.anyOf=s.map(t=>({contentMediaType:t})))},success:(t,r,a,n)=>{a.type="boolean"},custom:aU,function:(t,r,a,n)=>{al(t,r,a,n,"Function types cannot be represented in JSON Schema")},transform:aV,map:(t,r,a,n)=>{al(t,r,a,n,"Map cannot be represented in JSON Schema")},set:(t,r,a,n)=>{al(t,r,a,n,"Set cannot be represented in JSON Schema")},array:aF,object:aJ,union:aB,intersection:aK,tuple:(t,r,a,n)=>{let i=t._zod.def;a.type="array";let o="draft-2020-12"===r.target?"prefixItems":"items",s="draft-2020-12"===r.target||"openapi-3.0"===r.target?"items":"additionalItems",l=i.items.map((t,a)=>ac(t,r,{...n,path:[...n.path,o,a]})),c=i.rest?ac(i.rest,r,{...n,path:[...n.path,s,..."openapi-3.0"===r.target?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let t=i.items[u-1];if(!("input"===r.io?void 0!==aH(t):"optional"===t._zod.optout))break;u--}let d=i.items.length,p=!i.rest;"draft-2020-12"===r.target?(a.prefixItems=l,p?a.items=!1:c&&(a.items=c)):"openapi-3.0"===r.target?(a.items={anyOf:l},c&&a.items.anyOf.push(c)):(a.items=l,p?a.additionalItems=!1:c&&(a.additionalItems=c)),u>0&&(a.minItems=u),p&&(a.maxItems=d);let{minimum:m,maximum:h}=aT(t);"number"==typeof m&&(a.minItems=m),"number"==typeof h&&(a.maxItems=h)},record:aW,nullable:aY,nonoptional:aX,default:a1,prefault:a2,catch:a9,pipe:a4,readonly:a3,promise:(t,r,a,n)=>{let i=t._zod.def;ac(i.innerType,r,n),r.seen.get(t).ref=i.innerType},optional:a6,lazy:a5};function a8(t,r){if("_idmap"in t){let a=as({...r,processors:a7}),n={};for(let r of t._idmap.entries()){let[t,n]=r;ac(n,a)}let i={};for(let o of(a.external={registry:t,uri:r?.uri,defs:n},t._idmap.entries())){let[t,r]=o;ad(a,r),en(i,t,ag(a,r))}return Object.keys(n).length>0&&(i.__shared={["draft-2020-12"===a.target?"$defs":"definitions"]:n}),{schemas:i}}let a=as({...r,processors:a7});return ac(t,a),ad(a,t),ag(a,t)}let ne={get:function(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,Q,2)),t.message},set:function(t){this._zod.message=t},enumerable:!0,configurable:!0},nt={value:void 0,enumerable:!1},nr=new WeakSet([Object.prototype,Error.prototype]),na=(t,r)=>{t.name="$ZodError",nt.value=r,Object.defineProperty(t,"issues",nt),nt.value=void 0,Object.defineProperty(t,"message",ne);let a=Object.getPrototypeOf(t);nr.has(a)||(nr.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){let t=()=>this.message;return Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,"toString",{value:t,configurable:!0,writable:!0})}}))},nn=eV("$ZodError",na);function ni(t,r){return{callee:r?.callee??t,Err:r?.Err}}eV("$ZodError",na,void 0,{Parent:Error});let no=t=>{let r=(a,n,i,o)=>{let s=i?{...i,async:!1}:{async:!1},l=a._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new eF;if(l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>ej(t,s,eB())));throw ed(a,o?.callee??r),a}return l.value};return r},ns=t=>{let r=async(a,n,i,o)=>{let s=i?{...i,async:!0}:{async:!0},l=a._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){let a=new(o?.Err??t)(l.issues.map(t=>ej(t,s,eB())));throw ed(a,o?.callee??r),a}return l.value};return r},nl=t=>(r,a,n)=>{let i=n?{...n,async:!1}:{async:!1},o=r._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new eF;return o.issues.length?nc(t,o.issues,i):{success:!0,data:o.value}};function nc(t,r,a){let n;return{success:!1,get error(){return n||(n=new t(r.map(t=>ej(t,a,eB()))),r=void 0,a=void 0),n},set error(e){n=e,r=void 0,a=void 0}}}let nu=t=>async(r,a,n)=>{let i=n?{...n,async:!0}:{async:!0},o=r._zod.run({value:a,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?nc(t,o.issues,i):{success:!0,data:o.value}},nd=Symbol.for("zod.compile.invalid"),np=Symbol.for("zod.compile.fallback"),nm=async(t,r,a)=>{let n=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),0===i.issues.length},nh=new WeakSet([Object.prototype,Error.prototype]);function nf(t,r,a){Object.defineProperty(t,r,{configurable:!0,enumerable:!1,get(){let t=a(this);return Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0}),t},set(t){Object.defineProperty(this,r,{value:t,configurable:!0,writable:!0})}})}let ng=eV("ZodError",(t,r)=>{nn.init(t,r),t.name="ZodError";let a=Object.getPrototypeOf(t);nh.has(a)||(nh.add(a),nf(a,"format",t=>r=>(function(t,r=t=>t.message){let a={_errors:[]},n=(t,i=[])=>{for(let o of t.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(t=>n({issues:t},[...i,...o.path]));else if("invalid_key"===o.code)n({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)n({issues:o.issues},[...i,...o.path]);else{let t=[...i,...o.path];if(0===t.length)a._errors.push(r(o));else{let n=a,i=0;for(;i<t.length;){let a=t[i],s=i===t.length-1;if("_errors"===a){s&&n._errors.push(r(o)),i++;continue}Object.prototype.hasOwnProperty.call(n,a)||Object.defineProperty(n,a,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let l=n[a];s&&l._errors.push(r(o)),n=l,i++}}}};return n(t),a})(t,r)),nf(a,"flatten",t=>r=>(function(t,r=t=>t.message){let a={},n=[];for(let s of t.issues)if(s.path.length>0){var i,o;(i=s.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(a,i)&&("__proto__"===i?Object.defineProperty(a,i,{value:o(),writable:!0,enumerable:!0,configurable:!0}):a[i]=o()),a[i]).push(r(s))}else n.push(r(s));return{formErrors:n,fieldErrors:a}})(t,r)),nf(a,"addIssue",t=>r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Q,2)}),nf(a,"addIssues",t=>r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Q,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),ny=no(ng),nv=ns(ng),n_=nl(ng),nb=nu(ng),nS=(f=no(ng),g=(t,r,a,n)=>f(t,r,a?{...a,direction:"backward"}:{direction:"backward"},ni(g,n))),n$=(y=no(ng),v=(t,r,a,n)=>y(t,r,a,ni(v,n))),nw=(_=ns(ng),b=async(t,r,a,n)=>{let i=a?{...a,direction:"backward"}:{direction:"backward"};return await _(t,r,i,ni(b,n))}),nR=(S=ns(ng),$=async(t,r,a,n)=>await S(t,r,a,ni($,n))),nk=(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return nl(ng)(t,r,n)},nx=(t,r,a)=>nl(ng)(t,r,a),nP=async(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return nu(ng)(t,r,n)},nE=async(t,r,a)=>nu(ng)(t,r,a);function nT(){eJ.memoizer||eB({memoizer:e1})}let nj=eV("ZodType",(t,r)=>(eJ.localeError||eB({localeError:(()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};function n(t,r){return"number"!==t||"number"!=typeof r||Number.isFinite(r)?a[t]??t:String(r)}return a=>{switch(a.code){case"invalid_type":{let t=n(a.expected),r=n(function(t){let r=typeof t;switch(r){case"number":return Number.isNaN(t)?"nan":"number";case"object":if(null===t)return"null";if(Array.isArray(t))return"array";if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}return r}(a.input),a.input);return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===a.values.length)return`Invalid input: expected ${eb(a.values[0])}`;return`Invalid option: expected one of ${X(a.values,"|")}`;case"too_big":{let r=a.exact?"exactly ":a.inclusive?"<=":"<",n=t[a.origin]??null;if(n)return`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${n.unit??"elements"}`;return`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{let r=a.exact?"exactly ":a.inclusive?">=":">",n=t[a.origin]??null;if(n)return`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${n.unit}`;return`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":if("starts_with"===a.format)return`Invalid string: must start with "${a.prefix}"`;if("ends_with"===a.format)return`Invalid string: must end with "${a.suffix}"`;if("includes"===a.format)return`Invalid string: must include "${a.includes}"`;if("regex"===a.format)return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??a.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${X(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":if(a.options&&Array.isArray(a.options)&&a.options.length>0){let t=a.options.map(t=>`'${t}'`).join(" | ");return`Invalid discriminator value. Expected ${t}`}if(!1===a.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}})()}),tL.init(t,r),t.def=r,t.type=r.type,t),{check(...t){let r=this.def;return this.clone(eu(r,{checks:[...r.checks??[],...t.map(t=>"function"==typeof t?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return ev(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this},refine(t,r){return this.check(function(t,r={}){return new iU({type:"custom",check:"custom",fn:t,...e_(r)})}(t,r))},superRefine(t,r){return this.check(function(t,r){var a;let n,i;return a=r=>(r.addIssue=t=>{"string"==typeof t?r.issues.push(eN(t,r.value,n._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=r.value),t.inst??(t.inst=n),t.continue??(t.continue=!n._zod.def.abort),r.issues.push(eN(t)))},t(r.value,r)),(i=new t_({check:"custom",...e_(r)}))._zod.check=a,n=i}(t,r))},overwrite(t){return this.check(ai(t))},optional(){return iE(this)},exactOptional(){var t;return t=this,new iT({type:"optional",innerType:t})},nullable(){return iO(this)},nullish(){return iE(iO(this))},nonoptional(t){var r;return r=this,new iN({type:"nonoptional",innerType:r,...e_(t)})},array(){return il(this)},or(t){return im([this,t])},and(t){return iv(this,t)},transform(t){return iM(this,ix(t))},default(t){var r,a;return r=this,a=t,new iC({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():ef(a)}})},prefault(t){var r,a;return r=this,a=t,new iI({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():ef(a)}})},catch(t){return function(t,r){let a;return new iq({type:"catch",innerType:t,catchValue:"function"==typeof r?r:((a=()=>r)["~constantCatch"]=!0,a)})}(this,t)},pipe(t){return iM(this,t)},readonly(){var t;return t=this,new iL({type:"readonly",innerType:t})},describe(t){let r=this.clone();return r1.add(r,{description:t}),r},meta(...t){if(0===t.length)return r1.get(this);let r=this.clone();return r1.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...r){return 0===r.length?t(this):t(this,...r)},get"~standard"(){return eq(this,"~standard",{...tU(this),jsonSchema:{input:ay(this,"input"),output:ay(this,"output")}},!1)},set"~standard"(value){eq(this,"~standard",value)},parse:function t(r,a){return ny(this,r,a,{callee:t})},parseAsync:async function t(r,a){return await nv(this,r,a,{callee:t})},safeParse(t,r){return n_(this,t,r)},async safeParseAsync(t,r){return nb(this,t,r)},get spa(){return this?.safeParseAsync},set spa(value){eq(this,"spa",value)},validate(t,r){let a=this._zod.bag.validator;if(void 0!==a){if(a(t)!==nd)return!0;if(!0===a.definite&&void 0===r)return!1}return function(t,r,a){let n,i=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=t._zod.bag.fallbackRun;if(o?(i[np]=!0,n=o({value:r,issues:[]},i)):n=t._zod.run({value:r,issues:[]},i),n instanceof Promise)throw new eF;return 0===n.issues.length}(this,t,r)},validateAsync(t,r){return nm(this,t,r)},encode:function t(r,a){return nS(this,r,a,{callee:t})},decode:function t(r,a){return n$(this,r,a,{callee:t})},encodeAsync:async function t(r,a){return await nw(this,r,a,{callee:t})},decodeAsync:async function t(r,a){return await nR(this,r,a,{callee:t})},safeEncode(t,r){return nk(this,t,r)},safeDecode(t,r){return nx(this,t,r)},async safeEncodeAsync(t,r){return nP(this,t,r)},async safeDecodeAsync(t,r){return nE(this,t,r)},toJSONSchema(t){return((t,r={})=>a=>{let n=as({...a,processors:r});return ac(t,n),ad(n,t),ag(n,t)})(this,{})(t)},get description(){return r1.get(this)?.description},get _def(){return this._zod.def}}),nO=eV("_ZodString",(t,r)=>{tV.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aI(t,r,a,n)},eA({format:t=>aT(t).format??null,minLength:t=>aT(t).minimum??null,maxLength:t=>aT(t).maximum??null},{regex(...t){return this.check(function(t,r){return new tj({check:"string_format",format:"regex",...e_(r),pattern:t})}(...t))},includes(...t){return this.check(function(t,r){return new tI({check:"string_format",format:"includes",...e_(r),includes:t})}(...t))},startsWith(...t){return this.check(function(t,r){return new tN({check:"string_format",format:"starts_with",...e_(r),prefix:t})}(...t))},endsWith(...t){return this.check(function(t,r){return new tq({check:"string_format",format:"ends_with",...e_(r),suffix:t})}(...t))},min(...t){return this.check(aa(...t))},max(...t){return this.check(ar(...t))},length(...t){return this.check(an(...t))},nonempty(...t){return this.check(aa(1,...t))},lowercase(t){return this.check(new tO({check:"string_format",format:"lowercase",...e_(t)}))},uppercase(t){return this.check(new tC({check:"string_format",format:"uppercase",...e_(t)}))},trim(){return this.check(ai(t=>t.trim()))},normalize(...t){return this.check(function(t){return ai(r=>r.normalize(t))}(...t))},toLowerCase(){return this.check(ai(t=>t.toLowerCase()))},toUpperCase(){return this.check(ai(t=>t.toUpperCase()))},slugify(){return this.check(ai(t=>t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})),nC=eV("ZodString",(t,r)=>{tV.init(t,r),nO.init(t,r)},{email(t){return this.check(r9(nL,t))},url(t){return this.check(r4(nU,t))},jwt(t){return this.check(new n9({type:"string",format:"jwt",check:"string_format",abort:!1,...e_(t)}))},emoji(t){return this.check(new nV({type:"string",format:"emoji",check:"string_format",abort:!1,...e_(t)}))},guid(t){return this.check(new nZ({type:"string",format:"guid",check:"string_format",abort:!1,...e_(t)}))},uuid(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,...e_(t)}))},uuidv4(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e_(t)}))},uuidv6(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e_(t)}))},uuidv7(t){return this.check(new nD({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e_(t)}))},nanoid(t){return this.check(new nF({type:"string",format:"nanoid",check:"string_format",abort:!1,...e_(t)}))},cuid(t){return this.check(new nH({type:"string",format:"cuid",check:"string_format",abort:!1,...e_(t)}))},cuid2(t){return this.check(new nJ({type:"string",format:"cuid2",check:"string_format",abort:!1,...e_(t)}))},ulid(t){return this.check(new nB({type:"string",format:"ulid",check:"string_format",abort:!1,...e_(t)}))},base64(t){return this.check(new n0({type:"string",format:"base64",check:"string_format",abort:!1,...e_(t)}))},base64url(t){return this.check(new n1({type:"string",format:"base64url",check:"string_format",abort:!1,...e_(t)}))},xid(t){return this.check(new nK({type:"string",format:"xid",check:"string_format",abort:!1,...e_(t)}))},ksuid(t){return this.check(new nG({type:"string",format:"ksuid",check:"string_format",abort:!1,...e_(t)}))},ipv4(t){return this.check(new nW({type:"string",format:"ipv4",check:"string_format",abort:!1,...e_(t)}))},ipv6(t){return this.check(new nY({type:"string",format:"ipv6",check:"string_format",abort:!1,...e_(t)}))},cidrv4(t){return this.check(new nX({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e_(t)}))},cidrv6(t){return this.check(new nQ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e_(t)}))},e164(t){return this.check(new n2({type:"string",format:"e164",check:"string_format",abort:!1,...e_(t)}))},datetime(t){return this.check(r3(nq,t))},date(t){return this.check(r6(nA,t))},time(t){return this.check(new nM({type:"string",format:"time",check:"string_format",precision:null,...e_(t)}))},duration(t){return this.check(new nz({type:"string",format:"duration",check:"string_format",...e_(t)}))}});function nI(t){return new nC(r2({type:"string",...e_(t)}))}let nN=eV("ZodStringFormat",(t,r)=>{tF.init(t,r),nO.init(t,r)}),nq=eV("ZodISODateTime",(t,r)=>{t3.init(t,r),nN.init(t,r)}),nA=eV("ZodISODate",(t,r)=>{t6.init(t,r),nN.init(t,r)}),nM=eV("ZodISOTime",(t,r)=>{t5.init(t,r),nN.init(t,r)}),nz=eV("ZodISODuration",(t,r)=>{t7.init(t,r),nN.init(t,r)}),nL=eV("ZodEmail",(t,r)=>{tB.init(t,r),nN.init(t,r)}),nZ=eV("ZodGUID",(t,r)=>{tH.init(t,r),nN.init(t,r)}),nD=eV("ZodUUID",(t,r)=>{tJ.init(t,r),nN.init(t,r)}),nU=eV("ZodURL",(t,r)=>{tY.init(t,r),nN.init(t,r)}),nV=eV("ZodEmoji",(t,r)=>{tX.init(t,r),nN.init(t,r)}),nF=eV("ZodNanoID",(t,r)=>{tQ.init(t,r),nN.init(t,r)}),nH=eV("ZodCUID",(t,r)=>{t0.init(t,r),nN.init(t,r)}),nJ=eV("ZodCUID2",(t,r)=>{t1.init(t,r),nN.init(t,r)}),nB=eV("ZodULID",(t,r)=>{t2.init(t,r),nN.init(t,r)}),nK=eV("ZodXID",(t,r)=>{t9.init(t,r),nN.init(t,r)}),nG=eV("ZodKSUID",(t,r)=>{t4.init(t,r),nN.init(t,r)}),nW=eV("ZodIPv4",(t,r)=>{t8.init(t,r),nN.init(t,r)}),nY=eV("ZodIPv6",(t,r)=>{rr.init(t,r),nN.init(t,r)}),nX=eV("ZodCIDRv4",(t,r)=>{ra.init(t,r),nN.init(t,r)}),nQ=eV("ZodCIDRv6",(t,r)=>{rn.init(t,r),nN.init(t,r)}),n0=eV("ZodBase64",(t,r)=>{rs.init(t,r),nN.init(t,r)}),n1=eV("ZodBase64URL",(t,r)=>{rc.init(t,r),nN.init(t,r)}),n2=eV("ZodE164",(t,r)=>{ru.init(t,r),nN.init(t,r)}),n9=eV("ZodJWT",(t,r)=>{rd.init(t,r),nN.init(t,r)}),n4=eV("ZodNumber",(t,r)=>{rp.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aN(t,r,a,n),t.isFinite=!0},eA({minValue:t=>{let{minimum:r,exclusiveMinimum:a}=aT(t);return Math.max(r??-1/0,a??-1/0)},maxValue:t=>{let{maximum:r,exclusiveMaximum:a}=aT(t);return Math.min(r??1/0,a??1/0)},isInt:t=>{let{isInt:r,multipleOf:a}=aT(t);return!!r||!!a?.some(Number.isSafeInteger)},format:t=>aT(t).format??null},{gt(t,r){return this.check(r8(t,r))},gte(t,r){return this.check(ae(t,r))},min(t,r){return this.check(ae(t,r))},lt(t,r){return this.check(r5(t,r))},lte(t,r){return this.check(r7(t,r))},max(t,r){return this.check(r7(t,r))},int(t){return this.check(n5(t))},safe(t){return this.check(n5(t))},positive(t){return this.check(r8(0,t))},nonnegative(t){return this.check(ae(0,t))},negative(t){return this.check(r5(0,t))},nonpositive(t){return this.check(r7(0,t))},multipleOf(t,r){return this.check(at(t,r))},step(t,r){return this.check(at(t,r))},finite(){return this}}));function n3(t){return new n4(r2({type:"number",checks:[],...e_(t)}))}let n6=eV("ZodNumberFormat",(t,r)=>{rm.init(t,r),n4.init(t,r)});function n5(t){return new n6({type:"number",check:"number_format",abort:!1,format:"safeint",...e_(t)})}let n7=eV("ZodBoolean",(t,r)=>{rh.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aq(t,r,a,n)});function n8(t){return new n7({type:"boolean",...e_(t)})}let ie=eV("ZodNull",(t,r)=>{rf.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aA(t,r,a,n)});function it(t){return new ie({type:"null",...e_(t)})}let ir=eV("ZodAny",(t,r)=>{rg.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>az(t,r,a,n)}),ia=eV("ZodUnknown",(t,r)=>{ry.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aL(t,r,a,n)});function ii(){return new ia({type:"unknown"})}let io=eV("ZodNever",(t,r)=>{rv.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aM(t,r,a,n)}),is=eV("ZodArray",(t,r)=>{nT(),rb.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aF(t,r,a,n),t.element=r.element},{min(t,r){return this.check(aa(t,r))},nonempty(t){return this.check(aa(1,t))},max(t,r){return this.check(ar(t,r))},length(t,r){return this.check(an(t,r))},unwrap(){return this.element}});function il(t,r){return new is({type:"array",element:t,...e_(r)})}let ic=eV("ZodObject",(t,r)=>{var a;let n,i;nT(),rx.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aJ(t,r,a,n),a="shape",(i=a in(n=Object.getPrototypeOf(t))?void 0:n)&&Object.defineProperty(i,a,{configurable:!0,get(){let t={configurable:!0,writable:!0,enumerable:!1,value:void 0};return Object.defineProperty(this,a,t),t.value=(t=>t._zod.def.shape)(this),Object.defineProperty(this,a,t),t.value},set(t){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!1,value:t})}})},{keyof(){return i$(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(eu(this._zod.def,{catchall:t}))},passthrough(){return this.clone(eu(this._zod.def,{catchall:ii()}))},loose(){return this.clone(eu(this._zod.def,{catchall:ii()}))},strict(){return this.clone(eu(this._zod.def,{catchall:new io({type:"never",...e_(void 0)})}))},strip(){return this.clone(eu(this._zod.def,{catchall:void 0}))},extend(t){if(!eh(t))throw Error("Invalid input to extend: expected a plain object");let r=this._zod.def.checks;if(r&&r.length>0){let r=eo(this);for(let a of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(r,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ev(this,eu(this._zod.def,{shape:eR(this,t)}))},safeExtend(t){if(!eh(t))throw Error("Invalid input to safeExtend: expected a plain object");return ev(this,eu(this._zod.def,{shape:eR(this,t)}))},merge(t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(this._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};return ec(r,this,Reflect.ownKeys(eo(this))),ec(r,t,Reflect.ownKeys(eo(t))),ev(this,eu(this._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))},pick(t){return function(t,r){let a=t._zod.def,n=a.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return ec(i,t,ew(t,r)),ev(t,eu(a,{shape:i,checks:[]}))}(this,t)},omit(t){return function(t,r){let a=t._zod.def,n=a.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ew(t,r)),o={};return ec(o,t,Reflect.ownKeys(eo(t)).filter(t=>!i.has(t))),ev(t,eu(a,{shape:o,checks:[]}))}(this,t)},partial(...t){return ek(iP,this,t[0])},exactPartial(...t){return ek(iT,this,t[0],"exactPartial")},required(...t){var r;let a,n;return a=(r=t[0])?new Set(ew(this,r)):void 0,ec(n={},this,Reflect.ownKeys(eo(this)),(t,r)=>a&&!a.has(r)?t:new iN({type:"nonoptional",innerType:t})),ev(this,eu(this._zod.def,{shape:n}))}});function iu(t,r){return new ic({type:"object",shape:t??{},...e_(r)})}function id(t,r){return new ic({type:"object",shape:t,catchall:ii(),...e_(r)})}let ip=eV("ZodUnion",(t,r)=>{rE.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aB(t,r,a,n),t.options=r.options});function im(t,r){return new ip({type:"union",options:t,...e_(r)})}let ih=eV("ZodDiscriminatedUnion",(t,r)=>{ip.init(t,r),rT.init(t,r)});function ig(t,r,a){return new ih({type:"union",options:r,discriminator:t,...e_(a)})}let iy=eV("ZodIntersection",(t,r)=>{rj.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aK(t,r,a,n)});function iv(t,r){return new iy({type:"intersection",left:t,right:r})}let i_=eV("ZodRecord",(t,r)=>{nT(),rC.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aW(t,r,a,n),t.keyType=r.keyType,t.valueType=r.valueType});function ib(t,r,a){return new i_(r&&r._zod?{type:"record",keyType:t,valueType:r,...e_(a)}:{type:"record",keyType:nI(),valueType:t,...e_(r)})}let iS=eV("ZodEnum",(t,r)=>{rI.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aZ(t,r,a,n),t.enum=r.entries,t.options=[...t._zod.values];let a=new Set(Object.keys(r.entries));t.extract=(t,n)=>{let i={};for(let n of t)if(a.has(n))i[n]=r.entries[n];else throw Error(`Key ${n} not found in enum`);return new iS({...r,checks:[],...e_(n),entries:i})},t.exclude=(t,n)=>{let i={...r.entries};for(let r of t)if(a.has(r))delete i[r];else throw Error(`Key ${r} not found in enum`);return new iS({...r,checks:[],...e_(n),entries:i})}});function i$(t,r){return new iS({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(t=>[t,t])):t,...e_(r)})}let iw=eV("ZodLiteral",(t,r)=>{rN.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aD(t,r,a,n),t.values=new Set(r.values),Object.defineProperty(t,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function iR(t,r){return new iw({type:"literal",values:Array.isArray(t)?t:[t],...e_(r)})}let ik=eV("ZodTransform",(t,r)=>{nT(),rq.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aV(t,r,a,n),t._zod.parse=(a,n)=>{if("backward"===n.direction)throw new eH(t.constructor.name);a.addIssue=n=>{"string"==typeof n?a.issues.push(eN(n,a.value,r)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=a.value),n.inst??(n.inst=t),a.issues.push(eN(n)))};let i=r.transform(a.value,a);return i instanceof Promise?i.then(t=>(a.value=t,a)):(a.value=i,a)}});function ix(t){return new ik({type:"transform",transform:t})}let iP=eV("ZodOptional",(t,r)=>{rM.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a6(t,r,a,n),t.unwrap=()=>t._zod.def.innerType});function iE(t){return new iP({type:"optional",innerType:t})}let iT=eV("ZodExactOptional",(t,r)=>{rz.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a6(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),ij=eV("ZodNullable",(t,r)=>{rL.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aY(t,r,a,n),t.unwrap=()=>t._zod.def.innerType});function iO(t){return new ij({type:"nullable",innerType:t})}let iC=eV("ZodDefault",(t,r)=>{rZ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a1(t,r,a,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap}),iI=eV("ZodPrefault",(t,r)=>{rU.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a2(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iN=eV("ZodNonOptional",(t,r)=>{rV.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aX(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iq=eV("ZodCatch",(t,r)=>{rJ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a9(t,r,a,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap}),iA=eV("ZodPipe",(t,r)=>{rB.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a4(t,r,a,n),t.in=r.in,t.out=r.out});function iM(t,r){return new iA({type:"pipe",in:t,out:r})}let iz=eV("ZodPreprocess",(t,r)=>{iA.init(t,r),rG.init(t,r)}),iL=eV("ZodReadonly",(t,r)=>{rW.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a3(t,r,a,n),t.unwrap=()=>t._zod.def.innerType}),iZ=eV("ZodLazy",(t,r)=>{rX.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>a5(t,r,a,n),t.unwrap=()=>t._zod.def.getter()});function iD(t){return new iZ({type:"lazy",getter:t})}let iU=eV("ZodCustom",(t,r)=>{rQ.init(t,r),nj.init(t,r),t._zod.processJSONSchema=(r,a,n)=>aU(t,r,a,n)});function iV(t,r){return new iz({type:"pipe",in:ix(t),out:r})}N||(N={});let iF="2025-11-25",iH=[iF,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iJ="io.modelcontextprotocol/protocolVersion",iB="io.modelcontextprotocol/clientInfo",iK="io.modelcontextprotocol/serverInfo",iG="io.modelcontextprotocol/clientCapabilities",iW="io.modelcontextprotocol/subscriptionId",iY="io.modelcontextprotocol/logLevel",iX=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),iX),il(iX)])),iQ=ib(nI(),iX),i0=il(iX),i1=im([nI(),n3().int()]),i2=nI(),i9=iu({ttl:n3().optional()}),i4=iu({taskId:nI()}),i3=id({progressToken:i1.optional(),"io.modelcontextprotocol/related-task":i4.optional()}),i6=iu({_meta:i3.optional()}),i5=i6.extend({task:i9.optional()}),i7=iu({method:nI(),params:i6.loose().optional()}),i8=iu({_meta:i3.optional()}),oe=iu({method:nI(),params:i8.loose().optional()}),ot=id({get[iK](){return og.optional().catch(void 0)}}),or=id({_meta:ot.optional()}),oa=im([nI(),n3().int()]),on=iu({jsonrpc:iR("2.0"),id:oa,...i7.shape}).strict(),oi=iu({jsonrpc:iR("2.0"),...oe.shape}).strict(),oo=iu({jsonrpc:iR("2.0"),id:oa,result:or}).strict(),os=iu({jsonrpc:iR("2.0"),id:oa.optional(),error:iu({code:n3().int(),message:nI(),data:ii().optional()})}).strict(),ol=im([on,oi,oo,os]),oc=im([oo,os]),ou=or.strict(),od=i8.extend({requestId:oa.optional(),reason:nI().optional()}),op=oe.extend({method:iR("notifications/cancelled"),params:od}),om=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),oh=iu({icons:il(om).optional()}),of=iu({name:nI(),title:nI().optional()}),og=of.extend({...of.shape,...oh.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),oy=iv(iu({applyDefaults:n8().optional()}),iQ),ov=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:oy.optional(),url:iQ.optional()}),iQ.optional())),o_=id({list:iQ.optional(),cancel:iQ.optional(),requests:id({sampling:id({createMessage:iQ.optional()}).optional(),elicitation:id({create:iQ.optional()}).optional()}).optional()}),ob=id({list:iQ.optional(),cancel:iQ.optional(),requests:id({tools:id({call:iQ.optional()}).optional()}).optional()}),oS=iu({experimental:ib(nI(),iQ).optional(),sampling:iu({context:iQ.optional(),tools:iQ.optional()}).optional(),elicitation:ov.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:o_.optional(),extensions:ib(nI(),iQ).optional()}),o$=i6.extend({protocolVersion:nI(),capabilities:oS,clientInfo:og}),ow=i7.extend({method:iR("initialize"),params:o$}),oR=iu({experimental:ib(nI(),iQ).optional(),logging:iQ.optional(),completions:iQ.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:ob.optional(),extensions:ib(nI(),iQ).optional()}),ok=or.extend({protocolVersion:nI(),capabilities:oR,serverInfo:og,instructions:nI().optional()}),ox=oe.extend({method:iR("notifications/initialized"),params:i8.optional()}),oP=i7.extend({method:iR("server/discover"),params:i6.optional()}),oE=or.extend({supportedVersions:il(nI()),capabilities:oR,instructions:nI().optional()}),oT=i7.extend({method:iR("ping"),params:i6.optional()}),oj=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),oO=iu({...i8.shape,...oj.shape,progressToken:i1}),oC=oe.extend({method:iR("notifications/progress"),params:oO}),oI=i6.extend({cursor:i2.optional()}),oN=i7.extend({params:oI.optional()}),oq=or.extend({nextCursor:i2.optional()}),oA=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()}),oM=oA.extend({text:nI()}),oz=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),oL=oA.extend({blob:oz}),oZ=i$(["user","assistant"]),oD=iu({audience:il(oZ).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),oU=iu({...of.shape,...oh.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:oD.optional(),_meta:iE(id({}))}),oV=iu({...of.shape,...oh.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:oD.optional(),_meta:iE(id({}))}),oF=oN.extend({method:iR("resources/list")}),oH=oq.extend({resources:il(oU)}),oJ=oN.extend({method:iR("resources/templates/list")}),oB=oq.extend({resourceTemplates:il(oV)}),oK=i6.extend({uri:nI()}),oG=i7.extend({method:iR("resources/read"),params:oK}),oW=or.extend({contents:il(im([oM,oL]))}),oY=oe.extend({method:iR("notifications/resources/list_changed"),params:i8.optional()}),oX=i7.extend({method:iR("resources/subscribe"),params:oK}),oQ=i7.extend({method:iR("resources/unsubscribe"),params:oK}),o0=iu({toolsListChanged:n8().optional(),promptsListChanged:n8().optional(),resourcesListChanged:n8().optional(),resourceSubscriptions:il(nI()).optional()}),o1=i6.extend({notifications:o0}),o2=i7.extend({method:iR("subscriptions/listen"),params:o1}),o9=i8.extend({notifications:o0}),o4=oe.extend({method:iR("notifications/subscriptions/acknowledged"),params:o9}),o3=ot.extend({[iW]:oa}),o6=or.extend({_meta:o3}),o5=i8.extend({uri:nI()}),o7=oe.extend({method:iR("notifications/resources/updated"),params:o5}),o8=iu({name:nI(),description:iE(nI()),required:iE(n8())}),se=iu({...of.shape,...oh.shape,description:iE(nI()),arguments:iE(il(o8)),_meta:iE(id({}))}),st=oN.extend({method:iR("prompts/list")}),sr=oq.extend({prompts:il(se)}),sa=i6.extend({name:nI(),arguments:ib(nI(),nI()).optional()}),sn=i7.extend({method:iR("prompts/get"),params:sa}),si=iu({type:iR("text"),text:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),so=iu({type:iR("image"),data:oz,mimeType:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),ss=iu({type:iR("audio"),data:oz,mimeType:nI(),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),sl=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),sc=iu({type:iR("resource"),resource:im([oM,oL]),annotations:oD.optional(),_meta:ib(nI(),ii()).optional()}),su=oU.extend({type:iR("resource_link")}),sd=im([si,so,ss,su,sc]),sp=iu({role:oZ,content:sd}),sm=or.extend({description:nI().optional(),messages:il(sp)}),sh=oe.extend({method:iR("notifications/prompts/list_changed"),params:i8.optional()}),sf=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),sg=iu({taskSupport:i$(["required","optional","forbidden"]).optional()}),sy=iu({...of.shape,...oh.shape,description:nI().optional(),inputSchema:iu({type:iR("object"),properties:ib(nI(),iX).optional(),required:il(nI()).optional()}).catchall(ii()),outputSchema:id({$schema:nI().optional()}).optional(),annotations:sf.optional(),execution:sg.optional(),_meta:ib(nI(),ii()).optional()}),sv=oN.extend({method:iR("tools/list")}),s_=oq.extend({tools:il(sy)}),sb=or.extend({content:il(sd).default([]),structuredContent:ii().optional(),isError:n8().optional()}),sS=sb.or(or.extend({toolResult:ii()})),s$=i5.extend({name:nI(),arguments:ib(nI(),ii()).optional()}),sw=i7.extend({method:iR("tools/call"),params:s$}),sR=oe.extend({method:iR("notifications/tools/list_changed"),params:i8.optional()}),sk=iu({autoRefresh:n8().default(!0),debounceMs:n3().int().nonnegative().default(300)}),sx=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),sP=i6.extend({level:sx}),sE=i7.extend({method:iR("logging/setLevel"),params:sP}),sT=i8.extend({level:sx,logger:nI().optional(),data:ii()}),sj=oe.extend({method:iR("notifications/message"),params:sT}),sO=iu({name:nI().optional()}),sC=iu({hints:il(sO).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),sI=iu({mode:i$(["auto","required","none"]).optional()}),sN=iu({type:iR("tool_result"),toolUseId:nI().describe("The unique identifier for the corresponding tool call."),content:il(sd),structuredContent:ii().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),sq=ig("type",[si,so,ss]),sA=ig("type",[si,so,ss,sl,sN]),sM=iu({role:oZ,content:im([sA,il(sA)]),_meta:ib(nI(),ii()).optional()}),sz=i5.extend({messages:il(sM),modelPreferences:sC.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:iQ.optional(),tools:il(sy).optional(),toolChoice:sI.optional()}),sL=i7.extend({method:iR("sampling/createMessage"),params:sz}),sZ=or.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens"]).or(nI())),role:oZ,content:sq}),sD=or.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens","toolUse"]).or(nI())),role:oZ,content:im([sA,il(sA)])}),sU=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),sV=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),sF=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),sH=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),sJ=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),sB=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),sK=im([sH,sJ]),sG=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),sW=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()}),sY=im([sG,sW]),sX=im([sB,sK,sY]),sQ=im([sX,sU,sV,sF]),s0=i5.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),sQ),required:il(nI()).optional()}).catchall(ii())}),s1=i5.extend({mode:iR("url"),message:nI(),elicitationId:nI(),url:nI().url()}),s2=im([s0,s1]),s9=i7.extend({method:iR("elicitation/create"),params:s2}),s4=i8.extend({elicitationId:nI()}),s3=oe.extend({method:iR("notifications/elicitation/complete"),params:s4}),s6=or.extend({action:i$(["accept","decline","cancel"]),content:iV(t=>null===t?void 0:t,ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional())}),s5=iu({type:iR("ref/resource"),uri:nI()}),s7=iu({type:iR("ref/prompt"),name:nI()}),s8=i6.extend({ref:im([s7,s5]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()}),le=i7.extend({method:iR("completion/complete"),params:s8}),lt=or.extend({completion:id({values:il(nI()).max(100),total:iE(n3().int()),hasMore:iE(n8())})}),lr=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),la=i7.extend({method:iR("roots/list"),params:i6.optional()}),ln=or.extend({roots:il(lr)}),li=oe.extend({method:iR("notifications/roots/list_changed"),params:i8.optional()}),lo=id({ttl:n3().optional(),pollInterval:n3().optional()}),ls=i$(["working","input_required","completed","failed","cancelled"]),ll=iu({taskId:nI(),status:ls,ttl:im([n3(),it()]),createdAt:nI(),lastUpdatedAt:nI(),pollInterval:iE(n3()),statusMessage:iE(nI())}),lc=or.extend({task:ll}),lu=i8.merge(ll),ld=oe.extend({method:iR("notifications/tasks/status"),params:lu}),lp=i7.extend({method:iR("tasks/get"),params:i6.extend({taskId:nI()})}),lm=or.merge(ll),lh=i7.extend({method:iR("tasks/result"),params:i6.extend({taskId:nI()})}),lf=or.loose(),lg=oN.extend({method:iR("tasks/list")}),ly=oq.extend({tasks:il(ll)}),lv=i7.extend({method:iR("tasks/cancel"),params:i6.extend({taskId:nI()})}),l_=or.merge(ll),lb=im([oT,ow,oP,le,sE,sn,st,oF,oJ,oG,oX,oQ,o2,sw,sv]),lS=im([op,oC,ox,li]),l$=im([ou,sZ,sD,s6,ln]),lw=im([oT,sL,s9,la]),lR=im([op,oC,sj,o7,oY,sR,sh,o4,s3]),lk=im([ou,ok,oE,lt,sm,sr,oH,oB,oW,sb,s_,o6]),lx=r4(nU,void 0).superRefine((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),eZ}).refine(t=>{let r=new URL(t);return"javascript:"!==r.protocol&&"data:"!==r.protocol&&"vbscript:"!==r.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),lP=id({resource:nI().url(),authorization_servers:il(lx).optional(),jwks_uri:nI().url().optional(),scopes_supported:il(nI()).optional(),bearer_methods_supported:il(nI()).optional(),resource_signing_alg_values_supported:il(nI()).optional(),resource_name:nI().optional(),resource_documentation:nI().optional(),resource_policy_uri:nI().url().optional(),resource_tos_uri:nI().url().optional(),tls_client_certificate_bound_access_tokens:n8().optional(),authorization_details_types_supported:il(nI()).optional(),dpop_signing_alg_values_supported:il(nI()).optional(),dpop_bound_access_tokens_required:n8().optional()}),lE=id({issuer:nI(),authorization_endpoint:lx,token_endpoint:lx,registration_endpoint:lx.optional(),scopes_supported:il(nI()).optional(),response_types_supported:il(nI()),response_modes_supported:il(nI()).optional(),grant_types_supported:il(nI()).optional(),token_endpoint_auth_methods_supported:il(nI()).optional(),token_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),service_documentation:lx.optional(),revocation_endpoint:lx.optional(),revocation_endpoint_auth_methods_supported:il(nI()).optional(),revocation_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),introspection_endpoint:nI().optional(),introspection_endpoint_auth_methods_supported:il(nI()).optional(),introspection_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),code_challenge_methods_supported:il(nI()).optional(),client_id_metadata_document_supported:n8().optional(),authorization_response_iss_parameter_supported:n8().optional().catch(void 0),dpop_signing_alg_values_supported:il(nI()).optional()}),lT=id({issuer:nI(),authorization_endpoint:lx,token_endpoint:lx,userinfo_endpoint:lx.optional(),jwks_uri:lx,registration_endpoint:lx.optional(),scopes_supported:il(nI()).optional(),response_types_supported:il(nI()),response_modes_supported:il(nI()).optional(),grant_types_supported:il(nI()).optional(),acr_values_supported:il(nI()).optional(),subject_types_supported:il(nI()),id_token_signing_alg_values_supported:il(nI()),id_token_encryption_alg_values_supported:il(nI()).optional(),id_token_encryption_enc_values_supported:il(nI()).optional(),userinfo_signing_alg_values_supported:il(nI()).optional(),userinfo_encryption_alg_values_supported:il(nI()).optional(),userinfo_encryption_enc_values_supported:il(nI()).optional(),request_object_signing_alg_values_supported:il(nI()).optional(),request_object_encryption_alg_values_supported:il(nI()).optional(),request_object_encryption_enc_values_supported:il(nI()).optional(),token_endpoint_auth_methods_supported:il(nI()).optional(),token_endpoint_auth_signing_alg_values_supported:il(nI()).optional(),display_values_supported:il(nI()).optional(),claim_types_supported:il(nI()).optional(),claims_supported:il(nI()).optional(),service_documentation:nI().optional(),claims_locales_supported:il(nI()).optional(),ui_locales_supported:il(nI()).optional(),claims_parameter_supported:n8().optional(),request_parameter_supported:n8().optional(),request_uri_parameter_supported:n8().optional(),require_request_uri_registration:n8().optional(),op_policy_uri:lx.optional(),op_tos_uri:lx.optional(),client_id_metadata_document_supported:n8().optional(),authorization_response_iss_parameter_supported:n8().optional().catch(void 0)}),lj=iu({...lT.shape,...lE.pick({code_challenge_methods_supported:!0}).shape}),lO=iu({access_token:nI(),id_token:nI().optional(),token_type:nI(),expires_in:new n4(r2({type:"number",coerce:!0,checks:[],...e_(void 0)})).optional(),scope:nI().optional(),refresh_token:nI().optional(),issuer:nI().optional().catch(void 0)}).strip(),lC=iu({issued_token_type:iR("urn:ietf:params:oauth:token-type:id-jag"),access_token:nI(),token_type:nI().optional(),expires_in:n3().optional(),scope:nI().optional()}).strip(),lI=iu({error:nI(),error_description:nI().optional(),error_uri:nI().optional()}),lN=lx.optional().or(iR("").transform(()=>void 0)),lq=iu({redirect_uris:il(lx),token_endpoint_auth_method:nI().optional(),grant_types:il(nI()).optional(),response_types:il(nI()).optional(),application_type:nI().optional(),client_name:nI().optional(),client_uri:lx.optional(),logo_uri:lN,scope:nI().optional(),contacts:il(nI()).optional(),tos_uri:lN,policy_uri:nI().optional(),jwks_uri:lx.optional(),jwks:new ir({type:"any"}).optional(),software_id:nI().optional(),software_version:nI().optional(),software_statement:nI().optional()}).strip(),lA=iu({client_id:nI(),client_secret:nI().optional(),client_id_issued_at:n3().optional(),client_secret_expires_at:n3().optional(),issuer:nI().optional().catch(void 0)}).strip(),lM=lq.merge(lA),lz=iu({error:nI(),error_description:nI().optional()}).strip(),lL=iu({token:nI(),token_type_hint:nI().optional()}).strip(),lZ=Symbol.for("mcp.sdk.errorBrands");function lD(t,r){let a=new Set,n=r;for(;"function"==typeof n;){let t=n.mcpBrand;Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&"string"==typeof t&&a.add(t),n=Object.getPrototypeOf(n)}0!==a.size&&Object.defineProperty(t,lZ,{value:a,enumerable:!1,configurable:!0})}function lU(t,r){try{if("object"==typeof r&&null!==r&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&"string"==typeof t.mcpBrand&&Object.prototype.hasOwnProperty.call(r,lZ)){let a=r[lZ];if(a&&"function"==typeof a.has&&a.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,r)}let lV=((k={}).InvalidRequest="invalid_request",k.InvalidClient="invalid_client",k.InvalidGrant="invalid_grant",k.UnauthorizedClient="unauthorized_client",k.UnsupportedGrantType="unsupported_grant_type",k.InvalidScope="invalid_scope",k.AccessDenied="access_denied",k.ServerError="server_error",k.TemporarilyUnavailable="temporarily_unavailable",k.UnsupportedResponseType="unsupported_response_type",k.UnsupportedTokenType="unsupported_token_type",k.InvalidToken="invalid_token",k.MethodNotAllowed="method_not_allowed",k.TooManyRequests="too_many_requests",k.InvalidClientMetadata="invalid_client_metadata",k.InvalidRedirectUri="invalid_redirect_uri",k.InsufficientScope="insufficient_scope",k.InvalidTarget="invalid_target",k.InvalidDpopProof="invalid_dpop_proof",k.UseDpopNonce="use_dpop_nonce",k);var lF=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a){super(r),this.code=t,this.errorUri=a,this.name="OAuthError",lD(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(r){return new t(r.error,r.error_description??r.error,r.error_uri)}};let lH=((x={}).NotConnected="NOT_CONNECTED",x.AlreadyConnected="ALREADY_CONNECTED",x.NotInitialized="NOT_INITIALIZED",x.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",x.RequestTimeout="REQUEST_TIMEOUT",x.ConnectionClosed="CONNECTION_CLOSED",x.SendFailed="SEND_FAILED",x.InvalidResult="INVALID_RESULT",x.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",x.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",x.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",x.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",x.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",x.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",x.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",x.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",x.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",x.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",x.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",x);var lJ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a,n){super(r,n),this.code=t,this.data=a,this.name="SdkError",lD(this,new.target)}};(class extends lJ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(t,r,a,n){super(t,r,a,n),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let lB={};function lK(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function lG(t,r){let a={};for(let[n,i]of Object.entries(t)){if(void 0===i)continue;let t=void 0===r?void 0:r[n];if(void 0===t){a[n]=i;continue}if(lK(i)&&lK(t)){let r={};for(let[a,o]of Object.entries(i))void 0!==o&&void 0===t[a]&&("elicitation"!==n||"form"!==a||void 0!==t.form||void 0!==t.url)&&(r[a]=o);Object.keys(r).length>0&&(a[n]=r)}}return Object.keys(a).length>0?a:void 0}let lW="2026-07-28",lY=[lW];function lX(t){return t.filter(t=>t>=lW)}function lQ(t){let r=t.structuredContent;return void 0===r||!("object"!=typeof r||null===r||Array.isArray(r))||t.content?.some(t=>"text"===t.type)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(r)}]}}let l0=["task","inputRequests","requestState"];function l1(t){return null===t||"object"!=typeof t||Array.isArray(t)||void 0!==t.content||l0.some(r=>r in t)?t:{...t,content:[]}}function l2(){let t,r,a,n,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w,R,k,x,P,E,T,j,O,C,I,N,q,A,M,z,L,Z,D,U,V,F,H,J,B,K,G,W,Y,X,Q,ee,et,er,ea,en,ei,eo,es,el,ec,eu,ed,ep,em,eh,ef,eg,ey,ev,e_,eb,eS,e$,ew,eR,ek,ex,eP,eE,eT,ej,eO,eC,eI,eN,eq,eA,eM,ez,eL,eZ,eD,eU,eV,eF,eH,eJ,eB,eK,eG,eW,eY,eX,eQ,e0,e1,e2,e9,e4,e3,e6,e5,e7,e8,te,tt,tr,ta,tn,ti,to,ts,tl,tc,tu,td,tp,tm,th,tf,tg,ty,tv,t_,tb,tS,t$,tw;return i??=(t=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),t),il(t)])),r=ib(nI(),t),a=im([nI(),n3().int()]),n=nI(),o=iu({ttl:n3().optional()}),s=iu({taskId:nI()}),u=(c=iu({_meta:(l=id({progressToken:a.optional(),"io.modelcontextprotocol/related-task":s.optional()})).optional()})).extend({task:o.optional()}),d=iu({method:nI(),params:c.loose().optional()}),p=iu({_meta:l.optional()}),m=iu({method:nI(),params:p.loose().optional()}),h=id({_meta:l.optional()}),f=im([nI(),n3().int()]),g=h.strict(),y=p.extend({requestId:f.optional(),reason:nI().optional()}),v=m.extend({method:iR("notifications/cancelled"),params:y}),_=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),b=iu({icons:il(_).optional()}),$=(S=iu({name:nI(),title:nI().optional()})).extend({...S.shape,...b.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),w=iv(iu({applyDefaults:n8().optional()}),r),R=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:w.optional(),url:r.optional()}),r.optional())),k=id({list:r.optional(),cancel:r.optional(),requests:id({sampling:id({createMessage:r.optional()}).optional(),elicitation:id({create:r.optional()}).optional()}).optional()}),x=id({list:r.optional(),cancel:r.optional(),requests:id({tools:id({call:r.optional()}).optional()}).optional()}),P=iu({experimental:ib(nI(),r).optional(),sampling:iu({context:r.optional(),tools:r.optional()}).optional(),elicitation:R.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:k.optional(),extensions:ib(nI(),r).optional()}),E=c.extend({protocolVersion:nI(),capabilities:P,clientInfo:$}),T=d.extend({method:iR("initialize"),params:E}),j=iu({experimental:ib(nI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:x.optional(),extensions:ib(nI(),r).optional()}),O=h.extend({protocolVersion:nI(),capabilities:j,serverInfo:$,instructions:nI().optional()}),C=m.extend({method:iR("notifications/initialized"),params:p.optional()}),I=d.extend({method:iR("ping"),params:c.optional()}),N=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),q=iu({...p.shape,...N.shape,progressToken:a}),A=m.extend({method:iR("notifications/progress"),params:q}),M=c.extend({cursor:n.optional()}),z=d.extend({params:M.optional()}),L=h.extend({nextCursor:n.optional()}),D=(Z=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()})).extend({text:nI()}),U=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=Z.extend({blob:U}),H=iu({audience:il(F=i$(["user","assistant"])).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),J=iu({...S.shape,...b.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:H.optional(),_meta:iE(id({}))}),B=iu({...S.shape,...b.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:H.optional(),_meta:iE(id({}))}),K=z.extend({method:iR("resources/list")}),G=L.extend({resources:il(J)}),W=z.extend({method:iR("resources/templates/list")}),Y=L.extend({resourceTemplates:il(B)}),X=c.extend({uri:nI()}),Q=d.extend({method:iR("resources/read"),params:X}),ee=h.extend({contents:il(im([D,V]))}),et=m.extend({method:iR("notifications/resources/list_changed"),params:p.optional()}),er=d.extend({method:iR("resources/subscribe"),params:X}),ea=d.extend({method:iR("resources/unsubscribe"),params:X}),en=p.extend({uri:nI()}),ei=m.extend({method:iR("notifications/resources/updated"),params:en}),eo=iu({name:nI(),description:iE(nI()),required:iE(n8())}),es=iu({...S.shape,...b.shape,description:iE(nI()),arguments:iE(il(eo)),_meta:iE(id({}))}),el=z.extend({method:iR("prompts/list")}),ec=L.extend({prompts:il(es)}),eu=c.extend({name:nI(),arguments:ib(nI(),nI()).optional()}),ed=d.extend({method:iR("prompts/get"),params:eu}),ep=iu({type:iR("text"),text:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),em=iu({type:iR("image"),data:U,mimeType:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),eh=iu({type:iR("audio"),data:U,mimeType:nI(),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),ef=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),eg=iu({type:iR("resource"),resource:im([D,V]),annotations:H.optional(),_meta:ib(nI(),ii()).optional()}),e_=iu({role:F,content:ev=im([ep,em,eh,ey=J.extend({type:iR("resource_link")}),eg])}),eb=h.extend({description:nI().optional(),messages:il(e_)}),eS=m.extend({method:iR("notifications/prompts/list_changed"),params:p.optional()}),e$=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),ew=iu({taskSupport:i$(["required","optional","forbidden"]).optional()}),eR=iu({...S.shape,...b.shape,description:nI().optional(),inputSchema:iu({type:iR("object"),properties:ib(nI(),t).optional(),required:il(nI()).optional()}).catchall(ii()),outputSchema:iu({type:iR("object"),properties:ib(nI(),t).optional(),required:il(nI()).optional()}).catchall(ii()).optional(),annotations:e$.optional(),execution:ew.optional(),_meta:ib(nI(),ii()).optional()}),ek=z.extend({method:iR("tools/list")}),ex=L.extend({tools:il(eR)}),eP=h.extend({content:il(ev),structuredContent:ib(nI(),ii()).optional(),isError:n8().optional()}),eE=u.extend({name:nI(),arguments:ib(nI(),ii()).optional()}),eT=d.extend({method:iR("tools/call"),params:eE}),ej=m.extend({method:iR("notifications/tools/list_changed"),params:p.optional()}),eO=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),eC=c.extend({level:eO}),eI=d.extend({method:iR("logging/setLevel"),params:eC}),eN=p.extend({level:eO,logger:nI().optional(),data:ii()}),eq=m.extend({method:iR("notifications/message"),params:eN}),eA=iu({name:nI().optional()}),eM=iu({hints:il(eA).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),ez=iu({mode:i$(["auto","required","none"]).optional()}),eL=iu({type:iR("tool_result"),toolUseId:nI().describe("The unique identifier for the corresponding tool call."),content:il(ev),structuredContent:iu({}).loose().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),eZ=ig("type",[ep,em,eh]),eU=iu({role:F,content:im([eD=ig("type",[ep,em,eh,ef,eL]),il(eD)]),_meta:ib(nI(),ii()).optional()}),eV=u.extend({messages:il(eU),modelPreferences:eM.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:r.optional(),tools:il(eR).optional(),toolChoice:ez.optional()}),eF=d.extend({method:iR("sampling/createMessage"),params:eV}),eH=h.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens"]).or(nI())),role:F,content:eZ}),eJ=h.extend({model:nI(),stopReason:iE(i$(["endTurn","stopSequence","maxTokens","toolUse"]).or(nI())),role:F,content:im([eD,il(eD)])}),eB=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),eK=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),eG=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),eW=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),eY=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),eX=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),eQ=im([eW,eY]),e0=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),e2=im([e0,e1=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()})]),e9=im([eX,eQ,e2]),e4=im([e9,eB,eK,eG]),e3=u.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),e4),required:il(nI()).optional()}).catchall(ii())}),e5=im([e3,e6=u.extend({mode:iR("url"),message:nI(),elicitationId:nI(),url:nI().url()})]),e7=d.extend({method:iR("elicitation/create"),params:e5}),e8=p.extend({elicitationId:nI()}),te=m.extend({method:iR("notifications/elicitation/complete"),params:e8}),tt=h.extend({action:i$(["accept","decline","cancel"]),content:iV(t=>null===t?void 0:t,ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional())}),tr=iu({type:iR("ref/resource"),uri:nI()}),ta=iu({type:iR("ref/prompt"),name:nI()}),tn=c.extend({ref:im([ta,tr]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()}),ti=d.extend({method:iR("completion/complete"),params:tn}),to=h.extend({completion:id({values:il(nI()).max(100),total:iE(n3().int()),hasMore:iE(n8())})}),ts=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),tl=d.extend({method:iR("roots/list"),params:c.optional()}),tc=h.extend({roots:il(ts)}),tu=m.extend({method:iR("notifications/roots/list_changed"),params:p.optional()}),td=id({ttl:n3().optional(),pollInterval:n3().optional()}),tp=i$(["working","input_required","completed","failed","cancelled"]),tm=iu({taskId:nI(),status:tp,ttl:im([n3(),it()]),createdAt:nI(),lastUpdatedAt:nI(),pollInterval:iE(n3()),statusMessage:iE(nI())}),th=h.extend({task:tm}),tf=p.merge(tm),tg=m.extend({method:iR("notifications/tasks/status"),params:tf}),ty=d.extend({method:iR("tasks/get"),params:c.extend({taskId:nI()})}),tv=h.merge(tm),t_=d.extend({method:iR("tasks/result"),params:c.extend({taskId:nI()})}),tb=h.loose(),tS=z.extend({method:iR("tasks/list")}),t$=L.extend({tasks:il(tm)}),tw=d.extend({method:iR("tasks/cancel"),params:c.extend({taskId:nI()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:l,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:p,NotificationSchema:m,ResultSchema:h,RequestIdSchema:f,EmptyResultSchema:g,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:v,IconSchema:_,IconsSchema:b,BaseMetadataSchema:S,ImplementationSchema:$,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:P,InitializeRequestParamsSchema:E,InitializeRequestSchema:T,ServerCapabilitiesSchema:j,InitializeResultSchema:O,InitializedNotificationSchema:C,PingRequestSchema:I,ProgressSchema:N,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:A,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:z,PaginatedResultSchema:L,ResourceContentsSchema:Z,TextResourceContentsSchema:D,BlobResourceContentsSchema:V,RoleSchema:F,AnnotationsSchema:H,ResourceSchema:J,ResourceTemplateSchema:B,ListResourcesRequestSchema:K,ListResourcesResultSchema:G,ListResourceTemplatesRequestSchema:W,ListResourceTemplatesResultSchema:Y,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:ee,ResourceListChangedNotificationSchema:et,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:er,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:ea,ResourceUpdatedNotificationParamsSchema:en,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:eo,PromptSchema:es,ListPromptsRequestSchema:el,ListPromptsResultSchema:ec,GetPromptRequestParamsSchema:eu,GetPromptRequestSchema:ed,TextContentSchema:ep,ImageContentSchema:em,AudioContentSchema:eh,ToolUseContentSchema:ef,EmbeddedResourceSchema:eg,ResourceLinkSchema:ey,ContentBlockSchema:ev,PromptMessageSchema:e_,GetPromptResultSchema:eb,PromptListChangedNotificationSchema:eS,ToolAnnotationsSchema:e$,ToolExecutionSchema:ew,ToolSchema:eR,ListToolsRequestSchema:ek,ListToolsResultSchema:ex,CallToolResultSchema:eP,CallToolRequestParamsSchema:eE,CallToolRequestSchema:eT,ToolListChangedNotificationSchema:ej,LoggingLevelSchema:eO,SetLevelRequestParamsSchema:eC,SetLevelRequestSchema:eI,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eq,ModelHintSchema:eA,ModelPreferencesSchema:eM,ToolChoiceSchema:ez,ToolResultContentSchema:eL,SamplingContentSchema:eZ,SamplingMessageContentBlockSchema:eD,SamplingMessageSchema:eU,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,CreateMessageResultSchema:eH,CreateMessageResultWithToolsSchema:eJ,BooleanSchemaSchema:eB,StringSchemaSchema:eK,NumberSchemaSchema:eG,UntitledSingleSelectEnumSchemaSchema:eW,TitledSingleSelectEnumSchemaSchema:eY,LegacyTitledEnumSchemaSchema:eX,SingleSelectEnumSchemaSchema:eQ,UntitledMultiSelectEnumSchemaSchema:e0,TitledMultiSelectEnumSchemaSchema:e1,MultiSelectEnumSchemaSchema:e2,EnumSchemaSchema:e9,PrimitiveSchemaDefinitionSchema:e4,ElicitRequestFormParamsSchema:e3,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e7,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:te,ElicitResultSchema:tt,ResourceTemplateReferenceSchema:tr,PromptReferenceSchema:ta,CompleteRequestParamsSchema:tn,CompleteRequestSchema:ti,CompleteResultSchema:to,RootSchema:ts,ListRootsRequestSchema:tl,ListRootsResultSchema:tc,RootsListChangedNotificationSchema:tu,TaskCreationParamsSchema:td,TaskStatusSchema:tp,TaskSchema:tm,CreateTaskResultSchema:th,TaskStatusNotificationParamsSchema:tf,TaskStatusNotificationSchema:tg,GetTaskRequestSchema:ty,GetTaskResultSchema:tv,GetTaskPayloadRequestSchema:t_,GetTaskPayloadResultSchema:tb,ListTasksRequestSchema:tS,ListTasksResultSchema:t$,CancelTaskRequestSchema:tw,CancelTaskResultSchema:h.merge(tm),ClientRequestSchema:im([I,T,ti,eI,ed,el,K,W,Q,er,ea,eT,ek,ty,t_,tS,tw]),ClientNotificationSchema:im([v,A,C,tu,tg]),ClientResultSchema:im([g,eH,eJ,tt,tc,tv,t$,th]),ServerRequestSchema:im([I,eF,e7,tl,ty,t_,tS,tw]),ServerNotificationSchema:im([v,A,eq,ei,et,ej,eS,tg,te]),ServerResultSchema:im([g,O,to,eb,ec,G,Y,ee,eP,ex,tv,t$,th]),CallToolResultWireSchema:ii().superRefine((t,r)=>{if(!("object"!=typeof t||null===t||Array.isArray(t))&&void 0===t.content){for(let a of l0)if(a in t)return void r.addIssue({code:"custom",message:`content is required when the body carries '${a}' — another result family cannot default into an empty tools/call success`})}}).transform(l1).pipe(eP)})}function l9(t){return"object"!==t.type}let l4=new Set(["const","enum","default","examples"]),l3=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function l6(t){return void 0!==t&&!("string"==typeof t&&t.startsWith("#"))}let l5={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},l7={"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},l8={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 ce(){if(o)return o;let t=l2();return o={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}}}function ct(t){return Object.prototype.hasOwnProperty.call(l5,t)}function cr(t){return Object.prototype.hasOwnProperty.call(l7,t)}function ca(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cn(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(l5),Object.keys(l7);let ci={ok:!1,reason:"not-in-era"};function co(t){return ca(t)&&ca(t.outputSchema)&&l9(t.outputSchema)}let cs={era:"2025-11-25",hasRequestMethod:ct,hasNotificationMethod:cr,validateRequest:(t,r)=>cn(ct(t)?ce().requestSchemas[t]:void 0,r),validateResult:(t,r)=>cn(Object.prototype.hasOwnProperty.call(l8,t)?ce().resultSchemas[t]:void 0,r),validateNotification:(t,r)=>cn(cr(t)?ce().notificationSchemas[t]:void 0,r),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ci,validateInputResponse:()=>ci,samplingResultVariant:(t,r)=>{let a=l2();return cn(t?a.CreateMessageResultWithToolsSchema:a.CreateMessageResultSchema,r)},outboundEnvelope:t=>void 0,validateEnvelopeMeta:t=>[],projectCallToolResult(t,r){let a=lQ(t),n=a.structuredContent;if(void 0===n)return a;let i="object"!=typeof n||null===n||Array.isArray(n),o=void 0!==r&&l9(r);return i||o?{...a,structuredContent:{result:n}}:a},decodeResult(t,r){if(ca(r)&&"resultType"in r){let t={...r};return delete t.resultType,{kind:"complete",result:t}}return{kind:"complete",result:r}},encodeResult(t,r){if("tools/list"!==t)return r;let a=r.tools;return Array.isArray(a)&&a.some(t=>co(t))?{...r,tools:a.map(t=>co(t)?{...t,outputSchema:function(t){var r;let a="string"==typeof t.$schema?t.$schema:void 0;if(l6(t.$id))return{...void 0!==a&&{$schema:a},type:"object",properties:{result:t},required:["result"]};let n="string"==typeof(r=t.$schema)&&K.has(r.replace(/#$/,""))&&!0!==t.$recursiveAnchor,i=(t,r)=>{if(Array.isArray(t))return t.map(t=>i(t,!1));if(null===t||"object"!=typeof t||!r&&l6(t.$id))return t;let a={},o=!1;for(let[s,l]of Object.entries(t))r?a[s]=i(l,!1):("$ref"===s||"$dynamicRef"===s)&&"string"==typeof l?a[s]="#"===l?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:"$recursiveRef"===s&&"#"===l&&n?o=!0:l4.has(s)?a[s]=l:l3.has(s)?a[s]=i(l,!0):a[s]=i(l,!1);return o&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...void 0!==a&&{$schema:a},type:"object",properties:{result:i(t,!1)},required:["result"]}}(t.outputSchema)}:t)}:r},encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope:t=>void 0};function cl(){return s??=function(){let t=iD(()=>im([nI(),n3(),n8(),it(),ib(nI(),t),il(t)])),r=ib(nI(),t),a=im([nI(),n3().int()]),n=nI(),i=im([nI(),n3().int()]),o=i$(["user","assistant"]),s=i$(["debug","info","notice","warning","error","critical","alert","emergency"]),l=nI().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=iu({ttl:n3().optional()}),u=iu({taskId:nI()}),d=id({progressToken:a.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=iu({_meta:d.optional()}),m=p.extend({task:c.optional()}),h=iu({_meta:d.optional()}),f=iu({method:nI(),params:h.loose().optional()}),g=iu({src:nI(),mimeType:nI().optional(),sizes:il(nI()).optional(),theme:i$(["light","dark"]).optional()}),y=iu({icons:il(g).optional()}),v=iu({name:nI(),title:nI().optional()}),_=v.extend({...v.shape,...y.shape,version:nI(),websiteUrl:nI().optional(),description:nI().optional()}),b=iv(iu({applyDefaults:n8().optional()}),r),S=iV(t=>t&&"object"==typeof t&&!Array.isArray(t)&&0===Object.keys(t).length?{form:{}}:t,iv(iu({form:b.optional(),url:r.optional()}),r.optional())),$=id({list:r.optional(),cancel:r.optional(),requests:id({sampling:id({createMessage:r.optional()}).optional(),elicitation:id({create:r.optional()}).optional()}).optional()}),w=id({list:r.optional(),cancel:r.optional(),requests:id({tools:id({call:r.optional()}).optional()}).optional()}),R=iu({experimental:ib(nI(),r).optional(),sampling:iu({context:r.optional(),tools:r.optional()}).optional(),elicitation:S.optional(),roots:iu({listChanged:n8().optional()}).optional(),tasks:$.optional(),extensions:ib(nI(),r).optional()}),k=iu({experimental:ib(nI(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:iu({listChanged:n8().optional()}).optional(),resources:iu({subscribe:n8().optional(),listChanged:n8().optional()}).optional(),tools:iu({listChanged:n8().optional()}).optional(),tasks:w.optional(),extensions:ib(nI(),r).optional()}),x=iu({progress:n3(),total:iE(n3()),message:iE(nI())}),P=iu({...h.shape,...x.shape,progressToken:a}),E=f.extend({method:iR("notifications/progress"),params:P}),T=h.extend({level:s,logger:nI().optional(),data:ii()}),j=f.extend({method:iR("notifications/message"),params:T}),O=iu({uri:nI(),mimeType:iE(nI()),_meta:ib(nI(),ii()).optional()}),C=O.extend({text:nI()}),I=O.extend({blob:l}),N=iu({audience:il(o).optional(),priority:n3().min(0).max(1).optional(),lastModified:r3(nq,{offset:!0}).optional()}),q=iu({...v.shape,...y.shape,uri:nI(),description:iE(nI()),mimeType:iE(nI()),size:iE(n3()),annotations:N.optional(),_meta:iE(id({}))}),A=iu({...v.shape,...y.shape,uriTemplate:nI(),description:iE(nI()),mimeType:iE(nI()),annotations:N.optional(),_meta:iE(id({}))}),M=f.extend({method:iR("notifications/resources/list_changed"),params:h.optional()}),z=h.extend({uri:nI()}),L=f.extend({method:iR("notifications/resources/updated"),params:z}),Z=iu({name:nI(),description:iE(nI()),required:iE(n8())}),D=iu({...v.shape,...y.shape,description:iE(nI()),arguments:iE(il(Z)),_meta:iE(id({}))}),U=f.extend({method:iR("notifications/prompts/list_changed"),params:h.optional()}),V=iu({type:iR("text"),text:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),F=iu({type:iR("image"),data:l,mimeType:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),H=iu({type:iR("audio"),data:l,mimeType:nI(),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),J=iu({type:iR("tool_use"),name:nI(),id:nI(),input:ib(nI(),ii()),_meta:ib(nI(),ii()).optional()}),B=iu({type:iR("resource"),resource:im([C,I]),annotations:N.optional(),_meta:ib(nI(),ii()).optional()}),K=q.extend({type:iR("resource_link")}),G=im([V,F,H,K,B]),W=iu({role:o,content:G}),Y=iu({title:nI().optional(),readOnlyHint:n8().optional(),destructiveHint:n8().optional(),idempotentHint:n8().optional(),openWorldHint:n8().optional()}),X=f.extend({method:iR("notifications/tools/list_changed"),params:h.optional()}),Q=iu({name:nI().optional()}),ee=iu({hints:il(Q).optional(),costPriority:n3().min(0).max(1).optional(),speedPriority:n3().min(0).max(1).optional(),intelligencePriority:n3().min(0).max(1).optional()}),et=iu({mode:i$(["auto","required","none"]).optional()}),er=iu({type:iR("boolean"),title:nI().optional(),description:nI().optional(),default:n8().optional()}),ea=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),minLength:n3().optional(),maxLength:n3().optional(),format:i$(["email","uri","date","date-time"]).optional(),default:nI().optional()}),en=iu({type:i$(["number","integer"]),title:nI().optional(),description:nI().optional(),minimum:n3().optional(),maximum:n3().optional(),default:n3().optional()}),ei=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),default:nI().optional()}),eo=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),oneOf:il(iu({const:nI(),title:nI()})),default:nI().optional()}),es=iu({type:iR("string"),title:nI().optional(),description:nI().optional(),enum:il(nI()),enumNames:il(nI()).optional(),default:nI().optional()}),el=im([ei,eo]),ec=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({type:iR("string"),enum:il(nI())}),default:il(nI()).optional()}),eu=iu({type:iR("array"),title:nI().optional(),description:nI().optional(),minItems:n3().optional(),maxItems:n3().optional(),items:iu({anyOf:il(iu({const:nI(),title:nI()}))}),default:il(nI()).optional()}),ed=im([ec,eu]),ep=im([es,el,ed]),em=im([ep,er,ea,en]),eh=m.extend({mode:iR("form").optional(),message:nI(),requestedSchema:iu({type:iR("object"),properties:ib(nI(),em),required:il(nI()).optional()}).catchall(ii())}),ef=iu({type:iR("ref/resource"),uri:nI()}),eg=iu({type:iR("ref/prompt"),name:nI()}),ey=iu({uri:nI().startsWith("file://"),name:nI().optional(),_meta:ib(nI(),ii()).optional()}),ev=R.shape,e_=iu({experimental:ev.experimental,sampling:ev.sampling,elicitation:ev.elicitation,roots:ev.roots,extensions:ev.extensions}),eb=k.shape,eS=iu({experimental:eb.experimental,logging:eb.logging,completions:eb.completions,prompts:eb.prompts,resources:eb.resources,tools:eb.tools,extensions:eb.extensions}),e$=id({progressToken:a.optional(),[iJ]:nI(),[iB]:_.optional(),[iG]:e_,[iY]:s.optional()}),ew=iu({...v.shape,...y.shape,description:nI().optional(),inputSchema:id({$schema:nI().optional(),type:iR("object")}),outputSchema:id({$schema:nI().optional()}).optional(),annotations:Y.optional(),_meta:ib(nI(),ii()).optional()}),eR=iu({type:iR("tool_result"),toolUseId:nI(),content:il(G),structuredContent:ii().optional(),isError:n8().optional(),_meta:ib(nI(),ii()).optional()}),ek=im([V,F,H,J,eR]),ex=iu({role:o,content:im([ek,il(ek)]),_meta:ib(nI(),ii()).optional()}),eP=nI(),eE=id({[iK]:_.optional().catch(void 0)}),eT=eE.optional();function ej(t){return id({_meta:eT,resultType:eP.default("complete"),...t})}let eO=ej({}),eC=ej({nextCursor:n.optional()}),eI=ej({content:il(G),structuredContent:ii().optional(),isError:n8().optional()}),eN=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),tools:il(ew),nextCursor:n.optional()}),eq=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),prompts:il(D),nextCursor:n.optional()}),eA=ej({description:nI().optional(),messages:il(W)}),eM=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resources:il(q),nextCursor:n.optional()}),ez=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resourceTemplates:il(A),nextCursor:n.optional()}),eL=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),contents:il(im([C,I]))}),eZ=ej({completion:iu({values:il(nI()).max(100),total:n3().int().optional(),hasMore:n8().optional()}).loose()}),eD=ej({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"])}),eU=ej({ttlMs:n3().int().min(0).catch(0),cacheScope:i$(["public","private"]).catch("private"),supportedVersions:il(nI()),capabilities:eS,instructions:nI().optional()}),eV=iu({messages:il(ex),modelPreferences:ee.optional(),systemPrompt:nI().optional(),includeContext:i$(["none","thisServer","allServers"]).optional(),temperature:n3().optional(),maxTokens:n3().int(),stopSequences:il(nI()).optional(),metadata:r.optional(),tools:il(ew).optional(),toolChoice:et.optional()}),eF=iu({method:iR("sampling/createMessage"),params:eV}),eH=iu({method:iR("roots/list"),params:iu({_meta:ib(nI(),ii()).optional()}).optional()}),eJ=iu({...ex.shape,model:nI(),stopReason:nI().optional()}),eB=iu({roots:il(ey)}),eK=iu({action:i$(["accept","decline","cancel"]),content:ib(nI(),im([nI(),n3(),n8(),il(nI())])).optional()}),eG=iu({mode:iR("url"),message:nI(),url:nI().url()}),eW=im([eh,eG]),eY=iu({method:iR("elicitation/create"),params:eW}),eX=im([eF,eH,eY]),eQ=im([eJ,eB,eK]),e0=ib(nI(),eX),e1=ib(nI(),eQ),e2=ej({inputRequests:e0.optional(),requestState:nI().optional()}),e9={inputResponses:e1.optional(),requestState:nI().optional()},e4=iu({_meta:e$,...e9}),e3=id({progressToken:a.optional()});function e6(t,r){return iu({method:iR(t),params:iu({_meta:e$,...r})})}function e5(t,r){return iu({method:iR(t),params:iu({_meta:e3.optional(),...r}).optional()})}let e7={name:nI(),arguments:ib(nI(),ii()).optional(),...e9},e8={cursor:n.optional()},te=e6("tools/call",e7),tt=e6("tools/list",e8),tr=e6("prompts/list",e8),ta=e6("prompts/get",{name:nI(),arguments:ib(nI(),nI()).optional(),...e9}),tn=e6("resources/list",e8),ti=e6("resources/templates/list",e8),to=e6("resources/read",{uri:nI(),...e9}),ts={ref:im([eg,ef]),argument:iu({name:nI(),value:nI()}),context:iu({arguments:ib(nI(),nI()).optional()}).optional()},tl=e6("completion/complete",ts),tc=e6("server/discover",{}),tu=iu({toolsListChanged:n8().optional(),promptsListChanged:n8().optional(),resourcesListChanged:n8().optional(),resourceSubscriptions:il(nI()).optional()}),td={notifications:tu},tp=e6("subscriptions/listen",td),tm=eE.extend({"io.modelcontextprotocol/subscriptionId":i}),th=id({_meta:tm,resultType:eP.default("complete")}),tf={"tools/call":e5("tools/call",e7),"tools/list":e5("tools/list",e8),"prompts/get":e5("prompts/get",{name:nI(),arguments:ib(nI(),nI()).optional()}),"prompts/list":e5("prompts/list",e8),"resources/list":e5("resources/list",e8),"resources/templates/list":e5("resources/templates/list",e8),"resources/read":e5("resources/read",{uri:nI()}),"completion/complete":e5("completion/complete",ts),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",td)};function tg(t){return id({_meta:eT,...t})}let ty={"tools/call":tg({content:il(G),structuredContent:ii().optional(),isError:n8().optional()}),"tools/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),tools:il(ew),nextCursor:n.optional()}),"prompts/get":tg({description:nI().optional(),messages:il(W)}),"prompts/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),prompts:il(D),nextCursor:n.optional()}),"resources/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resources:il(q),nextCursor:n.optional()}),"resources/templates/list":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),resourceTemplates:il(A),nextCursor:n.optional()}),"resources/read":tg({ttlMs:n3().int().min(0),cacheScope:i$(["public","private"]),contents:il(im([C,I]))}),"completion/complete":tg({completion:iu({values:il(nI()).max(100),total:n3().int().optional(),hasMore:n8().optional()}).loose()}),"server/discover":tg({ttlMs:n3().int().min(0).catch(0),cacheScope:i$(["public","private"]).catch("private"),supportedVersions:il(nI()),capabilities:eS,instructions:nI().optional()}),"subscriptions/listen":tg({})},tv=id({"io.modelcontextprotocol/subscriptionId":i.optional()}),t_=iu({method:iR("notifications/subscriptions/acknowledged"),params:iu({_meta:tv.optional(),notifications:tu})}),tb=iu({_meta:tv.optional(),requestId:i,reason:nI().optional()}),tS=iu({method:iR("notifications/cancelled"),params:tb}),t$=t=>iu({jsonrpc:iR("2.0"),id:im([nI(),n3().int()]),result:t}).strict();return{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:n,RequestIdSchema:i,RoleSchema:o,LoggingLevelSchema:s,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:m,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:g,IconsSchema:y,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:R,ServerCapabilitiesSchema:k,ProgressSchema:x,ProgressNotificationParamsSchema:P,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:T,LoggingMessageNotificationSchema:j,ResourceContentsSchema:O,TextResourceContentsSchema:C,BlobResourceContentsSchema:I,AnnotationsSchema:N,ResourceSchema:q,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:M,ResourceUpdatedNotificationParamsSchema:z,ResourceUpdatedNotificationSchema:L,PromptArgumentSchema:Z,PromptSchema:D,PromptListChangedNotificationSchema:U,TextContentSchema:V,ImageContentSchema:F,AudioContentSchema:H,ToolUseContentSchema:J,EmbeddedResourceSchema:B,ResourceLinkSchema:K,ContentBlockSchema:G,PromptMessageSchema:W,ToolAnnotationsSchema:Y,ToolListChangedNotificationSchema:X,ModelHintSchema:Q,ModelPreferencesSchema:ee,ToolChoiceSchema:et,BooleanSchemaSchema:er,StringSchemaSchema:ea,NumberSchemaSchema:en,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:eo,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:el,UntitledMultiSelectEnumSchemaSchema:ec,TitledMultiSelectEnumSchemaSchema:eu,MultiSelectEnumSchemaSchema:ed,EnumSchemaSchema:ep,PrimitiveSchemaDefinitionSchema:em,ElicitRequestFormParamsSchema:eh,ResourceTemplateReferenceSchema:ef,PromptReferenceSchema:eg,RootSchema:ey,ClientCapabilities2026Schema:e_,ServerCapabilities2026Schema:eS,RequestMetaEnvelopeSchema:e$,ToolSchema:ew,ToolResultContentSchema:eR,SamplingMessageContentBlockSchema:ek,SamplingMessageSchema:ex,ResultTypeSchema:eP,ResultMetaSchema:eE,ResultSchema:eO,PaginatedResultSchema:eC,CallToolResultSchema:eI,ListToolsResultSchema:eN,ListPromptsResultSchema:eq,GetPromptResultSchema:eA,ListResourcesResultSchema:eM,ListResourceTemplatesResultSchema:ez,ReadResourceResultSchema:eL,CompleteResultSchema:eZ,CacheableResultSchema:eD,DiscoverResultSchema:eU,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eF,ListRootsRequestSchema:eH,CreateMessageResultSchema:eJ,ListRootsResultSchema:eB,ElicitResultSchema:eK,ElicitRequestURLParamsSchema:eG,ElicitRequestParamsSchema:eW,ElicitRequestSchema:eY,InputRequestSchema:eX,InputResponseSchema:eQ,InputRequestsSchema:e0,InputResponsesSchema:e1,InputRequiredResultSchema:e2,InputResponseRequestParamsSchema:e4,CallToolRequestSchema:te,ListToolsRequestSchema:tt,ListPromptsRequestSchema:tr,GetPromptRequestSchema:ta,ListResourcesRequestSchema:tn,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:to,CompleteRequestSchema:tl,DiscoverRequestSchema:tc,SubscriptionFilterSchema:tu,SubscriptionsListenRequestSchema:tp,SubscriptionsListenResultMetaSchema:tm,SubscriptionsListenResultSchema:th,dispatchRequestSchemas:tf,dispatchResultSchemas:ty,NotificationMetaSchema:tv,SubscriptionsAcknowledgedNotificationSchema:t_,CancelledNotificationParamsSchema:tb,CancelledNotificationSchema:tS,notificationSchemas2026:{"notifications/cancelled":tS,"notifications/progress":E,"notifications/message":j,"notifications/resources/updated":L,"notifications/resources/list_changed":M,"notifications/tools/list_changed":X,"notifications/prompts/list_changed":U,"notifications/subscriptions/acknowledged":t_},JSONRPCResultResponseSchema:t$(eO),CallToolResultResponseSchema:t$(im([eI,e2])),ListToolsResultResponseSchema:t$(eN),ListPromptsResultResponseSchema:t$(eq),GetPromptResultResponseSchema:t$(im([eA,e2])),ListResourcesResultResponseSchema:t$(eM),ListResourceTemplatesResultResponseSchema:t$(ez),ReadResourceResultResponseSchema:t$(im([eL,e2])),CompleteResultResponseSchema:t$(eZ),DiscoverResultResponseSchema:t$(eU),SubscriptionsListenResultResponseSchema:t$(th)}}()}let cc=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],cu=Symbol("modelcontextprotocol.resultCacheHintFallback");function cd(t,r){if(void 0===r)return t;let a=t[cu];if(void 0===a)return{...t,[cu]:r};let n={},i=a.ttlMs??r.ttlMs;void 0!==i&&(n.ttlMs=i);let o=a.cacheScope??r.cacheScope;return void 0!==o&&(n.cacheScope=o),{...t,[cu]:n}}function cp(t){return"number"==typeof t&&Number.isSafeInteger(t)&&t>=0}function cm(t){return"public"===t||"private"===t}function ch(t,r){if(void 0!==t.ttlMs&&!cp(t.ttlMs))throw RangeError(`Invalid cache hint for ${r}: ttlMs must be a non-negative safe integer (got ${String(t.ttlMs)})`);if(void 0!==t.cacheScope&&!cm(t.cacheScope))throw RangeError(`Invalid cache hint for ${r}: cacheScope must be 'public' or 'private' (got ${String(t.cacheScope)})`)}let cf=((P={})[P.ParseError=-32700]="ParseError",P[P.InvalidRequest=-32600]="InvalidRequest",P[P.MethodNotFound=-32601]="MethodNotFound",P[P.InvalidParams=-32602]="InvalidParams",P[P.InternalError=-32603]="InternalError",P[P.ResourceNotFound=-32002]="ResourceNotFound",P[P.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",P[P.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",P[P.UrlElicitationRequired=-32042]="UrlElicitationRequired",P);var cg=class t extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return lU(this,t)}static isInstance(t){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return lU(this,t)}constructor(t,r,a){super(r),this.code=t,this.data=a,this.name="ProtocolError",lD(this,new.target)}static fromError(r,a,n){return r===cf.UrlElicitationRequired&&n&&n.elicitations?new cv(n.elicitations,a):r===cf.UnsupportedProtocolVersion&&n&&Array.isArray(n.supported)&&"string"==typeof n.requested?new c_({supported:n.supported,requested:n.requested},a):(r===cf.InvalidParams||r===cf.ResourceNotFound)&&"string"==typeof n?.uri&&(r===cf.ResourceNotFound||1===Object.keys(n).length)?new cy(n.uri,a):r===cf.MissingRequiredClientCapability&&n&&null!==n.requiredCapabilities&&"object"==typeof n.requiredCapabilities&&!Array.isArray(n.requiredCapabilities)?new cb({requiredCapabilities:n.requiredCapabilities},a):new t(r,a,n)}},cy=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(t,r=`Resource not found: ${t}`){super(cf.InvalidParams,r,{uri:t})}get uri(){return this.data.uri}},cv=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(cf.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}},c_=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(t,r=`Unsupported protocol version: ${t.requested}`){super(cf.UnsupportedProtocolVersion,r,t)}get supported(){return this.data.supported}get requested(){return this.data.requested}},cb=class extends cg{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(t,r=`Missing required client capabilities: ${Object.keys(t.requiredCapabilities).join(", ")}`){super(cf.MissingRequiredClientCapability,r,t)}get requiredCapabilities(){return this.data.requiredCapabilities}};let cS=["tools/call","prompts/get","resources/read"],c$=["elicitation/create","sampling/createMessage","roots/list"];function cw(){if(l)return l;let t=cl();return l={request:{"elicitation/create":iu({method:iR("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":iu({method:iR("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":iu({method:iR("roots/list"),params:id({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}}}function cR(t){return c$.includes(t)}function ck(t){return cR(t)?cw().request[t]:void 0}let cx={"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},cP={"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 cE(t){return Object.prototype.hasOwnProperty.call(cx,t)}function cT(t){return Object.prototype.hasOwnProperty.call(cP,t)}function cj(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cO(t,r){if(void 0===t)return{ok:!1,reason:"not-in-era"};let a=t.safeParse(r);return a.success?{ok:!0,value:a.data}:{ok:!1,reason:"invalid",message:String(a.error)}}Object.keys(cx),Object.keys(cP);let cC={ok:!1,reason:"not-in-era"},cI=[iJ,iG],cN={era:"2026-07-28",hasRequestMethod:cE,hasNotificationMethod:cT,hasInputRequestMethod:t=>void 0!==ck(t),validateRequest:(t,r)=>cO(cE(t)?cl().dispatchRequestSchemas[t]:void 0,r),validateResult:(t,r)=>cO(Object.prototype.hasOwnProperty.call(cx,t)?cl().dispatchResultSchemas[t]:void 0,r),validateNotification:(t,r)=>cO(cT(t)?cl().notificationSchemas2026[t]:void 0,r),validateInputRequest:(t,r)=>cO(ck(t),r),validateInputResponse:(t,r)=>cO(cR(t)?cw().response[t]:void 0,r),samplingResultVariant:()=>cC,outboundEnvelope:t=>({[iJ]:t.protocolVersion,[iB]:t.clientInfo,[iG]:t.clientCapabilities,...void 0!==t.logLevel&&{[iY]:t.logLevel}}),validateEnvelopeMeta(t){let r=[];for(let a of cI)a in t||r.push({key:a,problem:"missing"});let a=cl().RequestMetaEnvelopeSchema.safeParse(t);if(!a.success)for(let t of a.error.issues){let a=t.path.map(String),n=a.length>0?a.join("."):"_meta";1===a.length&&r.some(t=>t.key===n&&"missing"===t.problem)||r.push({key:n,problem:t.message})}return r},projectCallToolResult:t=>lQ(t),inputRequestSchema:ck,decodeResult(t,r){if(!cj(r))return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};let a=r.resultType;if(void 0===a)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if("string"!=typeof a)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:a})};if("input_required"===a){let a=r.inputRequests,n=cj(a)?a:{},i=r.requestState,o=void 0===r._meta?void 0:cl().ResultMetaSchema.safeParse(r._meta),s=o?.success?o.data:void 0;return 0===Object.keys(n).length&&"string"!=typeof i?{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:n,..."string"==typeof i&&{requestState:i},...void 0!==s&&{_meta:s}}}if("complete"!==a)return{kind:"invalid",error:new lJ(lH.UnsupportedResultType,`Unsupported result type '${a}' for ${t}`,{resultType:a,method:t})};let n=function(){if(c)return c;let t=cl();return c={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema}}(),i=Object.hasOwn(n,t)?n[t]:void 0;if(void 0!==i){let a=i.safeParse(r);if(!a.success)return{kind:"invalid",error:new lJ(lH.InvalidResult,`Invalid result for ${t}: ${a.error}`,{method:t})}}let o={...r};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(t,r,a)=>(function(t,r){if(void 0===r)return t;let a=t._meta;return void 0===a?{...t,_meta:{[iK]:r}}:null===a||"object"!=typeof a||Array.isArray(a)||void 0!==a[iK]?t:{...t,_meta:{...a,[iK]:r}}})(function(t,r){var a,n;let i=r[cu];if("complete"!==r.resultType||!cc.includes(t)){let t;return void 0===i?r:(t={...r},delete t[cu],t)}let o=cp(r.ttlMs)?r.ttlMs:void 0!==(a=i)&&cp(a.ttlMs)?a.ttlMs:0,s=cm(r.cacheScope)?r.cacheScope:void 0!==(n=i)&&cm(n.cacheScope)?n.cacheScope:"private",l={...r,ttlMs:o,cacheScope:s};return delete l[cu],l}(t,function(t,r){let a=r.resultType;if(void 0===a)return{...r,resultType:"complete"};if("complete"===a||cS.includes(t))return r;throw new cg(cf.InternalError,`Handler for ${t} returned resultType '${String(a)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}(t,function(t,r){let a=r,n=!1,i=()=>(n||(a={...a},n=!0),a),o=r.tools;"tools/list"===t&&Array.isArray(o)&&o.some(t=>cj(t)&&"execution"in t)&&(i().tools=o.map(t=>{if(!cj(t)||!("execution"in t))return t;let r={...t};return delete r.execution,r}));let s=r.capabilities;if(cj(s)&&"tasks"in s){let t={...s};delete t.tasks,i().capabilities=t}return a}(t,r))),a),encodeErrorCode:t=>-32002===t?-32602:t,checkInboundEnvelope(t){if(void 0===t.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let r=cl().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!r.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${r.error.issues.map(t=>t.message).join("; ")}`}},cq="2026-07-28";function cA(t){return void 0!==t&&t>=lW?cN:cs}function cM(t){return void 0!==t.revision?cA(t.revision).era:"modern"===t.era?cN.era:cs.era}function cz(t){return cD.some(r=>r.hasRequestMethod(t))}function cL(t){return cD.some(r=>r.hasNotificationMethod(t))}function cZ(t){return"tasks/get"===t||"tasks/cancel"===t}let cD=[cs,cN];function cU(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function cV(t){if(!cU(t))return;let r=t._meta;return cU(r)?r:void 0}function cF(t){let r=cV(t);return void 0!==r&&iJ in r}function cH(t){let r=cV(t)?.[iJ];return"string"==typeof r?r:void 0}function cJ(t){return cA(cq).validateEnvelopeMeta(t)}var cB=((t,r)=>{let a={};for(var n in t)Z(a,n,{get:t[n],enumerable:!0});return r&&Z(a,Symbol.toStringTag,{value:"Module"}),a})({AnnotationsSchema:()=>oD,AudioContentSchema:()=>ss,BaseMetadataSchema:()=>of,BaseRequestParamsSchema:()=>i6,BlobResourceContentsSchema:()=>oL,BooleanSchemaSchema:()=>sU,CallToolRequestParamsSchema:()=>s$,CallToolRequestSchema:()=>sw,CallToolResultSchema:()=>sb,CancelTaskRequestSchema:()=>lv,CancelTaskResultSchema:()=>l_,CancelledNotificationParamsSchema:()=>od,CancelledNotificationSchema:()=>op,ClientCapabilitiesSchema:()=>oS,ClientNotificationSchema:()=>lS,ClientRequestSchema:()=>lb,ClientResultSchema:()=>l$,ClientTasksCapabilitySchema:()=>o_,CompatibilityCallToolResultSchema:()=>sS,CompleteRequestParamsSchema:()=>s8,CompleteRequestSchema:()=>le,CompleteResultSchema:()=>lt,ContentBlockSchema:()=>sd,CreateMessageRequestParamsSchema:()=>sz,CreateMessageRequestSchema:()=>sL,CreateMessageResultSchema:()=>sZ,CreateMessageResultWithToolsSchema:()=>sD,CreateTaskResultSchema:()=>lc,CursorSchema:()=>i2,DiscoverRequestSchema:()=>oP,DiscoverResultSchema:()=>oE,ElicitRequestFormParamsSchema:()=>s0,ElicitRequestParamsSchema:()=>s2,ElicitRequestSchema:()=>s9,ElicitRequestURLParamsSchema:()=>s1,ElicitResultSchema:()=>s6,ElicitationCompleteNotificationParamsSchema:()=>s4,ElicitationCompleteNotificationSchema:()=>s3,EmbeddedResourceSchema:()=>sc,EmptyResultSchema:()=>ou,EnumSchemaSchema:()=>sX,GetPromptRequestParamsSchema:()=>sa,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>sm,GetTaskPayloadRequestSchema:()=>lh,GetTaskPayloadResultSchema:()=>lf,GetTaskRequestSchema:()=>lp,GetTaskResultSchema:()=>lm,IconSchema:()=>om,IconsSchema:()=>oh,ImageContentSchema:()=>so,ImplementationSchema:()=>og,InitializeRequestParamsSchema:()=>o$,InitializeRequestSchema:()=>ow,InitializeResultSchema:()=>ok,InitializedNotificationSchema:()=>ox,JSONArraySchema:()=>i0,JSONObjectSchema:()=>iQ,JSONRPCErrorResponseSchema:()=>os,JSONRPCMessageSchema:()=>ol,JSONRPCNotificationSchema:()=>oi,JSONRPCRequestSchema:()=>on,JSONRPCResponseSchema:()=>oc,JSONRPCResultResponseSchema:()=>oo,JSONValueSchema:()=>iX,LegacyTitledEnumSchemaSchema:()=>sB,ListChangedOptionsBaseSchema:()=>sk,ListPromptsRequestSchema:()=>st,ListPromptsResultSchema:()=>sr,ListResourceTemplatesRequestSchema:()=>oJ,ListResourceTemplatesResultSchema:()=>oB,ListResourcesRequestSchema:()=>oF,ListResourcesResultSchema:()=>oH,ListRootsRequestSchema:()=>la,ListRootsResultSchema:()=>ln,ListTasksRequestSchema:()=>lg,ListTasksResultSchema:()=>ly,ListToolsRequestSchema:()=>sv,ListToolsResultSchema:()=>s_,LoggingLevelSchema:()=>sx,LoggingMessageNotificationParamsSchema:()=>sT,LoggingMessageNotificationSchema:()=>sj,ModelHintSchema:()=>sO,ModelPreferencesSchema:()=>sC,MultiSelectEnumSchemaSchema:()=>sY,NotificationSchema:()=>oe,NotificationsParamsSchema:()=>i8,NumberSchemaSchema:()=>sF,PaginatedRequestParamsSchema:()=>oI,PaginatedRequestSchema:()=>oN,PaginatedResultSchema:()=>oq,PingRequestSchema:()=>oT,PrimitiveSchemaDefinitionSchema:()=>sQ,ProgressNotificationParamsSchema:()=>oO,ProgressNotificationSchema:()=>oC,ProgressSchema:()=>oj,ProgressTokenSchema:()=>i1,PromptArgumentSchema:()=>o8,PromptListChangedNotificationSchema:()=>sh,PromptMessageSchema:()=>sp,PromptReferenceSchema:()=>s7,PromptSchema:()=>se,ReadResourceRequestParamsSchema:()=>oK,ReadResourceRequestSchema:()=>oG,ReadResourceResultSchema:()=>oW,RelatedTaskMetadataSchema:()=>i4,RequestIdSchema:()=>oa,RequestMetaSchema:()=>i3,RequestSchema:()=>i7,ResourceContentsSchema:()=>oA,ResourceLinkSchema:()=>su,ResourceListChangedNotificationSchema:()=>oY,ResourceRequestParamsSchema:()=>oK,ResourceSchema:()=>oU,ResourceTemplateReferenceSchema:()=>s5,ResourceTemplateSchema:()=>oV,ResourceUpdatedNotificationParamsSchema:()=>o5,ResourceUpdatedNotificationSchema:()=>o7,ResultMetaObjectSchema:()=>ot,ResultSchema:()=>or,RoleSchema:()=>oZ,RootSchema:()=>lr,RootsListChangedNotificationSchema:()=>li,SamplingContentSchema:()=>sq,SamplingMessageContentBlockSchema:()=>sA,SamplingMessageSchema:()=>sM,ServerCapabilitiesSchema:()=>oR,ServerNotificationSchema:()=>lR,ServerRequestSchema:()=>lw,ServerResultSchema:()=>lk,ServerTasksCapabilitySchema:()=>ob,SetLevelRequestParamsSchema:()=>sP,SetLevelRequestSchema:()=>sE,SingleSelectEnumSchemaSchema:()=>sK,StringSchemaSchema:()=>sV,SubscribeRequestParamsSchema:()=>oK,SubscribeRequestSchema:()=>oX,SubscriptionFilterSchema:()=>o0,SubscriptionsAcknowledgedNotificationParamsSchema:()=>o9,SubscriptionsAcknowledgedNotificationSchema:()=>o4,SubscriptionsListenRequestParamsSchema:()=>o1,SubscriptionsListenRequestSchema:()=>o2,SubscriptionsListenResultMetaSchema:()=>o3,SubscriptionsListenResultSchema:()=>o6,TaskAugmentedRequestParamsSchema:()=>i5,TaskCreationParamsSchema:()=>lo,TaskMetadataSchema:()=>i9,TaskSchema:()=>ll,TaskStatusNotificationParamsSchema:()=>lu,TaskStatusNotificationSchema:()=>ld,TaskStatusSchema:()=>ls,TextContentSchema:()=>si,TextResourceContentsSchema:()=>oM,TitledMultiSelectEnumSchemaSchema:()=>sW,TitledSingleSelectEnumSchemaSchema:()=>sJ,ToolAnnotationsSchema:()=>sf,ToolChoiceSchema:()=>sI,ToolExecutionSchema:()=>sg,ToolListChangedNotificationSchema:()=>sR,ToolResultContentSchema:()=>sN,ToolSchema:()=>sy,ToolUseContentSchema:()=>sl,UnsubscribeRequestParamsSchema:()=>oK,UnsubscribeRequestSchema:()=>oQ,UntitledMultiSelectEnumSchemaSchema:()=>sG,UntitledSingleSelectEnumSchemaSchema:()=>sH});let cK=t=>on.safeParse(t).success,cG=t=>oi.safeParse(t).success,cW=t=>oo.safeParse(t).success,cY=t=>os.safeParse(t).success,cX=t=>"object"==typeof t&&null!==t&&!Array.isArray(t)&&"input_required"===t.resultType,cQ="x-mcp-header",c0=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,c1=new Set(["string","integer","boolean","number"]);function c2(t){let r=[],a=new Map,n=(t,i,o)=>{if(null===t||"object"!=typeof t)return;if(cQ in t){if(!o||0===i.length)return`${c3(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 n=t[cQ];if("string"!=typeof n||0===n.length)return`${c3(i)}: x-mcp-header MUST be a non-empty string`;if(!c0.test(n))return`${c3(i)}: x-mcp-header '${n}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let s="string"==typeof t.type?t.type:void 0;if(void 0===s||!c1.has(s))return`${c3(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${s??"<none>"}`;let l=n.toLowerCase(),c=a.get(l);if(void 0!==c)return`x-mcp-header '${n}' is not case-insensitively unique (also declared as '${c}')`;a.set(l,n),r.push({path:i,headerName:n,type:s})}let s=t.properties;if(null!==s&&"object"==typeof s)for(let[t,r]of Object.entries(s)){let a=n(r,[...i,t],o);if(void 0!==a)return a}for(let r of c9){let a=t[r];if(void 0!==a)for(let t of Array.isArray(a)?a:null!==a&&"object"==typeof a&&c4.has(r)?Object.values(a):[a]){let a=n(t,[...i,`<${r}>`],!1);if(void 0!==a)return a}}},i=n(t,[],!0);return void 0===i?{valid:!0,declarations:r}:{valid:!1,reason:i}}let c9=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],c4=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function c3(t){return 0===t.length?"<root>":t.join(".")}let c6=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c5=/^-?\d+(\.\d+)?$/;function c7(t){if(!(t.startsWith("=?base64?")&&t.endsWith("?=")))return t;let r=t.slice(9,t.length-2);if(c6.test(r))try{let t=atob(r),a=new Uint8Array(t.length);for(let r=0;r<t.length;r++)a[r]=t.codePointAt(r);return new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{return}}function c8(t,r,a){return{kind:"reject",rung:"param-header-validation",cell:t,httpStatus:400,code:ue,message:`Bad Request: the request headers and body disagree: ${a}`,data:{mismatch:{header:r,body:a}},settled:!0}}let ue=-32020;cf.InvalidRequest,cf.UnsupportedProtocolVersion,cf.InvalidParams,cf.MethodNotFound,cf.InvalidParams,cf.MissingRequiredClientCapability;let ut={[cf.ParseError]:400,[cf.InvalidRequest]:400,[cf.MethodNotFound]:404,[cf.UnsupportedProtocolVersion]:400,[cf.MissingRequiredClientCapability]:400,[ue]:400};function ur(t,r,a,n,i){return{kind:"reject",rung:t,cell:r,httpStatus:a,code:n.code,message:n.message,...void 0!==n.data&&{data:n.data},settled:i}}function ua(t,r,a,n="era-classification"){return ur(n,t,400,new cg(ue,`Bad Request: the request headers and body disagree: ${a}`,{mismatch:{header:r,body:a}}),!0)}let un={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function ui(t){let r=0;for(;r<t.length;){let a=t.codePointAt(r);if(9!==a&&32!==a)break;r+=1}let a=t.length;for(;a>r;){let r=t.codePointAt(a-1);if(9!==r&&32!==r)break;a-=1}return 0===r&&a===t.length?t:t.slice(r,a)}function uo(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function us(t){return void 0===t?{era:"modern"}:{era:t>=lW?"modern":"legacy",revision:t}}function ul(t){return new Set(t.flatMap(t=>Object.keys(t.shape)))}function uc(t){if(null==t)return!1;let r=typeof t;return("object"===r||"function"===r)&&"~standard"in t&&"function"==typeof t["~standard"]?.validate}let uu=!1,ud="draft-2020-12";function up(t,r="input"){let a,n=t["~standard"];if(n.jsonSchema)a=n.jsonSchema[r]({target:ud});else if("zod"===n.vendor){if(!("_zod"in t))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");uu||(uu=!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.")),a=a8(t,{target:ud,io:r})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===r)return void 0!==a.type||!function t(r){if("properties"in r||"patternProperties"in r||"additionalProperties"in r||"required"in r)return!0;for(let a of["oneOf","anyOf","allOf"]){let n=r[a];if(Array.isArray(n)&&n.length>0)return n.every(r=>null!==r&&"object"==typeof r&&("object"===r.type||t(r)))}return!1}(a)?a:{type:"object",...a};if(void 0!==a.type&&"object"!==a.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(a.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...a}}async function um(t,r){let a=await t["~standard"].validate(r);return a.issues&&a.issues.length>0?{success:!1,error:a.issues.map(t=>t.path?.length?`${t.path.map(t=>String("object"==typeof t?t.key:t)).join(".")}: ${t.message}`:t.message).join(", ")}:{success:!0,data:a.value}}let uh=/\\\.\\d\{(\d+)\}/;function uf(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}let ug=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function uy(t){return ug.has(t)||t.startsWith("x-")}let uv=new Set(["$schema",...Object.keys(s0.shape.requestedSchema.shape)]),u_={string:ul([sV,sH,sJ,sB]),number:ul([sF]),integer:ul([sF]),boolean:ul([sU]),array:ul([sG,sW])},ub=new Set(sV.shape.format.unwrap().options);Object.assign(function(t){let r=void 0!==t.inputRequests&&Object.keys(t.inputRequests).length>0,a="string"==typeof t.requestState;if(!r&&!a)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==t.inputRequests&&{inputRequests:t.inputRequests},...void 0!==t.requestState&&{requestState:t.requestState}}},{elicit(t){try{return{method:"elicitation/create",params:function(t){var r;if(!uc(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};let a=t.requestedSchema["~standard"].vendor,n=function(t,r){let a={},n=[];for(let[i,o]of Object.entries(t))"properties"===i&&uf(o)?a[i]=Object.fromEntries(Object.entries(o).map(([t,a])=>[t,function(t,r,a,n){if(!uf(t))return t;let i="string"==typeof t.type&&Object.hasOwn(u_,t.type)?u_[t.type]:void 0;if(void 0===i)return t;let o={};for(let[l,c]of Object.entries(t))if(i.has(l)||uy(l))o[l]=c;else if("pattern"===l&&"string"===t.type&&"string"==typeof t.format)if(ub.has(t.format)){var s;"string"==typeof c&&(s=t.format,"zod"!==a||(function(t,r){let a;switch(t){case"email":a=[r9(nL,void 0)];break;case"uri":a=[r4(nU,void 0)];break;case"date":a=[r6(nA,void 0)];break;case"date-time":let n,i;n=uh.exec(r),i=[void 0,-1,0],n&&i.push(Number(n[1])),a=[!1,!0].flatMap(t=>[!1,!0].flatMap(r=>i.map(a=>r3(nq,{local:t,offset:r,precision:a}))))}return new Set(a.map(t=>{let r;return r=a8(t,{target:ud,io:"input"}),"string"==typeof r.pattern?r.pattern:void 0}).filter(t=>void 0!==t))})(s,c).has(c))||n.push(`${r}.${l}`)}else o[l]=c;else n.push(`${r}.${l}`);return o}(a,`properties.${t}`,r,n)])):uv.has(i)?a[i]=o:uy(i)||n.push(i);if(n.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return a}(function(t){try{return up(t,"input")}catch(r){let t=r instanceof Error?r.message:String(r);throw new cg(cf.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}(t.requestedSchema),a),i=(r=s0.shape.requestedSchema,n_(r,n));if(!i.success)throw new cg(cf.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(t,r){if(!uf(t.properties))return r;let a=Object.entries(t.properties).filter(([,t])=>!n_(sQ,t).success).map(([t])=>`properties.${t}`);return a.length>0?a.join(", "):r}(n,i.error.message)}`);let o=function t(r,a,n=""){return Array.isArray(r)&&Array.isArray(a)?r.flatMap((r,i)=>t(r,a[i],`${n}[${i}]`)):uf(r)&&uf(a)?Object.entries(r).flatMap(([r,i])=>{let o=n?`${n}.${r}`:r;return Object.prototype.hasOwnProperty.call(a,r)?t(i,a[r],o):uy(r)?[]:[o]}):[]}(n,i.data);if(o.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(i.data.required??[]).filter(t=>!Object.prototype.hasOwnProperty.call(i.data.properties,t));if(s.length>0)throw new cg(cf.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}(t)}}catch(t){throw t instanceof cg?TypeError(t.message,{cause:t}):t}},elicitUrl:t=>({method:"elicitation/create",params:{...t,mode:"url"}}),createMessage:t=>({method:"sampling/createMessage",params:t}),listRoots:()=>({method:"roots/list"})});let uS={},u$={};function uw(t,r){let a=t.slice(0,-6);uS[a]=r,u$[a]=t=>r.safeParse(t).success}for(let t of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])uw(t,cB[t]);for(let[t,r]of Object.entries({IdJagTokenExchangeResponseSchema:lC,OAuthClientInformationFullSchema:lM,OAuthClientInformationSchema:lA,OAuthClientMetadataSchema:lq,OAuthClientRegistrationErrorSchema:lz,OAuthErrorResponseSchema:lI,OAuthMetadataSchema:lE,OAuthProtectedResourceMetadataSchema:lP,OAuthTokenRevocationRequestSchema:lL,OAuthTokensSchema:lO,OpenIdProviderDiscoveryMetadataSchema:lj,OpenIdProviderMetadataSchema:lT}))uw(t,r);let uR=Object.freeze(uS);Object.freeze(u$);let uk=[iJ,iB,iG,iY],ux=["inputResponses","requestState"];function uP(t,r){let a=t.params;if(!uC(a))return{message:t,lifted:{}};let n=a._meta,i=uC(n)?uk.filter(t=>t in n):[],o="request"===r?ux.filter(t=>t in a):[];if(0===i.length&&0===o.length)return{message:t,lifted:{}};let s={},l={...a};if(i.length>0&&uC(n)){let t={},r={...n};for(let a of i)t[a]=n[a],delete r[a];s.envelope=t,Object.keys(r).length>0?l._meta=r:delete l._meta}for(let t of o)"inputResponses"===t&&(s.inputResponses=l[t]),"requestState"===t&&(s.requestState=l[t]),delete l[t];return{message:{...t,params:l},lifted:s}}function uE(t,r){let a=t.validateResult(r,void 0);if(a.ok||"not-in-era"!==a.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(a){let n=t.validateResult(r,a);return n.ok?{value:n.value}:{issues:[{message:"invalid"===n.reason?n.message:`not-in-era: ${r}`}]}}}}}let uT=(E=void 0,()=>E);function uj(t,r){return{...t,mcpReq:{...t.mcpReq,requestState:()=>r}}}var uO=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{u=(t,r)=>{t._negotiatedProtocolVersion=r}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(t){this._options=t,this._supportedProtocolVersions=t?.supportedProtocolVersions??iH,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){let r=this._outboundMetaEnvelope();if(void 0===r)return t;let a=t.params??{};return{...t,params:{...a,_meta:{...r,...a._meta}}}}_resolveNonCompleteResult(t,r){return Promise.reject(new lJ(lH.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${r.request.method}`,{resultType:t.kind,method:r.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){void 0!==t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,a,n,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let a=Date.now()-r.startTime;if(r.maxTotalTimeout&&a>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),new lJ(lH.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:a});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{try{r?.()}finally{this._onclose()}};let a=this.transport?.onerror;this._transport.onerror=t=>{a?.(t),this._onerror(t)};let n=this._transport?.onmessage;this._transport.onmessage=(t,r)=>{n?.(t,r),cW(t)||cY(t)?this._onresponse(t):cK(t)?this._onrequest(t,r):cG(t)?this._onnotification(t,r):this._onerror(Error(`Unknown message type: ${JSON.stringify(t)}`))},t.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let t=this._responseHandlers;for(let t of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(t.timeoutId);this._timeoutInfo.clear();let r=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let a=new lJ(lH.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of t.values())r(a);for(let t of r.values())t.abort(a)}}_onerror(t){this.onerror?.(t)}_onnotification(t,r){let{message:a}=uP(t,"notification"),n=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return;if(r?.classification!==void 0){let t=cM(r.classification);if(t!==n.era)return void this._onerror(Error(`Era mismatch on inbound notification '${a.method}': classified as ${t} but this instance serves ${n.era}`))}if(cL(a.method)&&!n.hasNotificationMethod(a.method))return;let i=this._notificationHandlers.get(a.method),o=this.fallbackNotificationHandler;(void 0!==i||void 0!==o)&&Promise.resolve().then(()=>void 0===i?o(a):i(a,n)).catch(t=>this._onerror(Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(t,r){var a;let{message:n,lifted:i}=uP(t,"request"),o=this._negotiatedWireCodec();if(r?.classification===void 0&&"drop"===this._shouldDropInbound(t))return void this._onerror(Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));let s=this._transport,l=(t,r,a)=>{let i={jsonrpc:"2.0",id:n.id,error:{code:t,message:r,...void 0!==a&&{data:a}}};s?.send(i).catch(t=>this._onerror(Error(`Failed to send an error response: ${t}`)))};if(r?.classification!==void 0){let t=cM(r.classification);if(t!==o.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${t} but this instance serves ${o.era}`));let a=r.classification.revision??t;l(cf.UnsupportedProtocolVersion,`Unsupported protocol version: ${a}`,{supported:this._supportedProtocolVersions,requested:a});return}}if(cz(n.method)&&!o.hasRequestMethod(n.method)&&!(cZ(n.method)&&this._customSchemaRequestMethods.has(n.method)))return void l(cf.MethodNotFound,"Method not found");let c=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(void 0===c)return void l(cf.MethodNotFound,"Method not found");let u=o.checkInboundEnvelope(i);if(void 0!==u)return void l(cf.InvalidParams,u);let d=(t,r)=>this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,{...r,relatedRequestId:n.id}),p=(t,r,a)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(t.method),t,r,{...a,relatedRequestId:n.id}),m=new AbortController;this._requestHandlerAbortControllers.set(n.id,m);let h=void 0===i.inputResponses?void 0:function(t){let r={},a=[];if(!uI(t))return{accepted:r,droppedKeys:a};for(let[n,i]of Object.entries(t)){if(!uI(i)||"method"in i||"result"in i){a.push(n);continue}r[n]=i}return{accepted:r,droppedKeys:a}}(i.inputResponses),f={sessionId:s?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==h&&{inputResponses:h.accepted},...void 0!==h&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:void 0===i.requestState?uT:(a=i.requestState,()=>a),signal:m.signal,send:(t,r,a)=>{let n=this._resolveOutboundCodec(t.method);if(this._assertOutboundRequestInEra(n,t.method),uc(r))return p(t,r,a);let i=uE(n,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return p(t,i,r)},notify:d},http:r?.authInfo?{authInfo:r.authInfo}:void 0},g=this.buildContext(f,r);Promise.resolve().then(()=>c(n,g)).then(async t=>{let r;if(m.signal.aborted)return;try{r=o.encodeResult(n.method,t,this._outboundServerInfo())}catch(t){this._onerror(Error(`Failed to encode result for ${n.method}: ${t}`)),l(cf.InternalError,"Internal error");return}let a={result:r,jsonrpc:"2.0",id:n.id};await s?.send(a)},async t=>{if(m.signal.aborted)return;let r=Number.isSafeInteger(t.code)?t.code:cf.InternalError,a={jsonrpc:"2.0",id:n.id,error:{code:o.encodeErrorCode(r),message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};await s?.send(a)}).catch(t=>this._onerror(Error(`Failed to send response: ${t}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===m&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(t){let{progressToken:r,...a}=t.params,n=Number(r),i=this._progressHandlers.get(n);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));let o=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(t){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),o(t);return}i(a)}_onresponse(t){let r=Number(t.id),a=this._responseHandlers.get(r);void 0===a?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`)):(this._responseHandlers.delete(r),this._cleanupTimeout(r),this._progressHandlers.delete(r),a(cW(t)?t:cg.fromError(t.error.code,t.error.message,t.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(t,r,a){let n=this._resolveOutboundCodec(t.method);if(uc(r))return cZ(t.method)||this._assertOutboundRequestInEra(n,t.method),this._requestWithSchemaViaCodec(n,t,r,a);this._assertOutboundRequestInEra(n,t.method);let i=uE(n,t.method);if(void 0===i)throw TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,t,i,r)}_negotiatedWireCodec(){return cA(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(void 0===this._negotiatedProtocolVersion){let r=function(t){switch(t){case"initialize":case"notifications/initialized":return cA(void 0);case"server/discover":return cA(cq);default:return}}(t);if(r)return r}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,r){if(cz(r)&&!t.hasRequestMethod(r))throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Method '${r}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r,era:t.era})}_requestWithSchema(t,r,a){let n=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(n,t.method),this._requestWithSchemaViaCodec(n,t,r,a)}_requestWithSchemaViaCodec(t,r,a,n){let i,o,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u}=n??{},d=Date.now();return new Promise((p,m)=>{let h=t=>{m(t)};if(!this._transport)return void h(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(r.method)}catch(t){h(t);return}if(n?.signal?.aborted){let t=n.signal.reason;throw t instanceof lJ?t:new lJ(lH.RequestTimeout,String(t))}let f=t.era===cq&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,g=this._requestMessageId++;o=g;let y={...r,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),y.params={...r.params,_meta:{...r.params?._meta,progressToken:g}});let v=this._envelopeOutbound(y),_=!1,b=t=>{_||(this._progressHandlers.delete(g),void 0===f?"initialize"!==r.method&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(t)}}),{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c}).catch(t=>this._onerror(Error(`Failed to send cancellation: ${t}`))):f.abort(),m(t instanceof lJ?t:new lJ(lH.RequestTimeout,String(t))))};this._responseHandlers.set(g,i=>{let o;if(!n?.signal?.aborted){if(_=!0,i instanceof Error)return m(i);try{o=t.decodeResult(r.method,i.result)}catch(t){return m(t instanceof Error?t:Error(String(t)))}if("invalid"===o.kind)return m(o.error);if("input_required"===o.kind){var s;return n?.allowInputRequired===!0?p({resultType:"input_required",inputRequests:(s=o).inputRequests,...void 0!==s.requestState&&{requestState:s.requestState},...void 0!==s._meta&&{_meta:s._meta}}):p(this._resolveNonCompleteResult(o,{codec:t,request:r,resultSchema:a,options:n,flowStartedAt:d,retry:(n,i)=>this._requestWithSchemaViaCodec(t,void 0===n?{method:r.method}:{method:r.method,params:n},a,i)}))}um(a,o.result).then(t=>{t.success?p(t.data):m(new lJ(lH.InvalidResult,`Invalid result for ${r.method}: ${t.error}`))},m)}}),i=()=>b(n?.signal?.reason),n?.signal?.addEventListener("abort",i,{once:!0});let S=n?.timeout??6e4;this._setupTimeout(g,S,n?.maxTotalTimeout,()=>b(new lJ(lH.RequestTimeout,"Request timed out",{timeout:S})),n?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:s,resumptionToken:l,onresumptiontoken:c,headers:u,requestSignal:f?.signal}).catch(t=>{this._progressHandlers.delete(g),m(t)})}).finally(()=>{i&&n?.signal?.removeEventListener("abort",i),void 0!==o&&(this._responseHandlers.delete(o),this._cleanupTimeout(o))})}async notification(t,r){return await this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,r)}async _notificationViaCodec(t,r,a){if(!this._transport)throw new lJ(lH.NotConnected,"Not connected");if(cL(r.method)&&!t.hasNotificationMethod(r.method))throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Notification '${r.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:r.method,era:t.era});this.assertNotificationCapability(r.method);let n=this._envelopeOutbound({jsonrpc:"2.0",...r});if((this._options?.debouncedNotificationMethods??[]).includes(r.method)&&!r.params&&a?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(r.method))return;this._pendingDebouncedNotifications.add(r.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(r.method),this._transport&&this._transport?.send(n,a).catch(t=>this._onerror(t))});return}await this._transport.send(n,a)}setRequestHandler(t,r,a){let n;if(this.assertRequestHandlerCapability(t),"function"==typeof r){if(!cz(t))throw TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(a,n)=>{let i=this._negotiatedWireCodec(),o=i.validateRequest(t,a);if(o.ok||"not-in-era"!==o.reason||(o=i.validateInputRequest(t,a)),!o.ok){if("not-in-era"===o.reason)throw new cg(cf.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(o.message)}return Promise.resolve(r(o.value,n))}}else if(a)n=async(n,i)=>{let o=await um(r.params,{...n.params});if(!o.success)throw new cg(cf.InvalidParams,`Invalid params for ${t}: ${o.error}`);return a(o.data,i)};else throw TypeError("setRequestHandler: handler is required");"function"==typeof r?this._customSchemaRequestMethods.delete(t):this._customSchemaRequestMethods.add(t),this._requestHandlers.set(t,this._wrapHandler(t,n))}_wrapHandler(t,r){return r}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r,a){if("function"==typeof r){if(!cL(t))throw TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(a,n)=>{let i=n.validateNotification(t,a);if(!i.ok){if("not-in-era"===i.reason)throw new cg(cf.InternalError,`No wire schema for ${t} in the resolved era`);throw Error(i.message)}return Promise.resolve(r(i.value))});return}if(!a)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async n=>{let i=await um(r.params,{...n.params});if(!i.success)throw new cg(cf.InvalidParams,`Invalid params for notification ${t}: ${i.error}`);await a(i.data,n)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function uC(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function uI(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}var uN=J(H(t=>{var r=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(t){this.parameters=Object.create(null),this.type=t}t.parse=function(t){if(!t)throw TypeError("argument string is required");var o,s,l,c="object"==typeof t?function(t){var r;if("function"==typeof t.getHeader?r=t.getHeader("content-type"):"object"==typeof t.headers&&(r=t.headers&&t.headers["content-type"]),"string"!=typeof r)throw TypeError("content-type header is missing from object");return r}(t):t;if("string"!=typeof c)throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),d=-1!==u?c.slice(0,u).trim():c.trim();if(!n.test(d))throw TypeError("invalid media type");var p=new i(d.toLowerCase());if(-1!==u){for(r.lastIndex=u;s=r.exec(c);){if(s.index!==u)throw TypeError("invalid parameter format");u+=s[0].length,o=s[1].toLowerCase(),34===(l=s[2]).charCodeAt(0)&&-1!==(l=l.slice(1,-1)).indexOf("\\")&&(l=l.replace(a,"$1")),p.parameters[o]=l}if(u!==c.length)throw TypeError("invalid parameter format")}return p}})(),1);function uq(t){if(t)try{return uN.parse(t).type}catch{let r=(t.split(";",1)[0]??"").trim().toLowerCase();if(""===r||t.slice(r.length).includes(","))return;return r}}function uA(t){return"application/json"===t||"application/json"===uq(t)}let uM=/^[A-Za-z0-9._-]{1,128}$/;function uz(t){let r=function(t){let r=[];if(0===t.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&r.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&r.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&r.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&r.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!uM.test(t)){let a=[...t].filter(t=>!/[A-Za-z0-9._-]/.test(t)).filter((t,r,a)=>a.indexOf(t)===r);return r.push(`Tool name contains invalid characters: ${a.map(t=>`"${t}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:r}}return{isValid:!0,warnings:r}}(t);var a=r.warnings;if(a.length>0){for(let r of(console.warn(`Tool name validation warning for "${t}":`),a))console.warn(` - ${r}`);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 r.isValid}var uL=class t{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,a){if(t.length>r)throw Error(`${a} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>"string"==typeof t?[]:t.names)}constructor(r){t.validateLength(r,1e6,"Template"),this.template=r,this.parts=this.parse(r)}toString(){return this.template}parse(r){let a=[],n="",i=0,o=0;for(;i<r.length;)if("{"===r[i]){n&&(a.push(n),n="");let s=r.indexOf("}",i);if(-1===s)throw Error("Unclosed template expression");if(++o>1e4)throw Error("Template contains too many expressions (max 10000)");let l=r.slice(i+1,s),c=this.getOperator(l),u=l.includes("*"),d=this.getNames(l),p=d[0];for(let r of d)t.validateLength(r,1e6,"Variable name");a.push({name:p,operator:c,names:d,exploded:u}),i=s+1}else n+=r[i],i++;return n&&a.push(n),a}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(r,a){return(t.validateLength(r,1e6,"Variable value"),"+"===a||"#"===a)?encodeURI(r):encodeURIComponent(r)}expandPart(t,r){if("?"===t.operator||"&"===t.operator){let a=t.names.map(a=>{let n=r[a];return void 0===n?"":`${a}=${Array.isArray(n)?n.map(r=>this.encodeValue(r,t.operator)).join(","):this.encodeValue(n.toString(),t.operator)}`}).filter(t=>t.length>0);return 0===a.length?"":("?"===t.operator?"?":"&")+a.join("&")}if(t.names.length>1){let a=t.names.map(t=>r[t]).filter(t=>void 0!==t);return 0===a.length?"":a.map(t=>Array.isArray(t)?t[0]:t).join(",")}let a=r[t.name];if(void 0===a)return"";let n=(Array.isArray(a)?a:[a]).map(r=>this.encodeValue(r,t.operator));switch(t.operator){case"":case"+":default:return n.join(",");case"#":return"#"+n.join(",");case".":return"."+n.join(".");case"/":return"/"+n.join("/")}}expand(t){let r="",a=!1;for(let n of this.parts){if("string"==typeof n){r+=n;continue}let i=this.expandPart(n,t);i&&(r+=("?"===n.operator||"&"===n.operator)&&a?i.replace("?","&"):i,("?"===n.operator||"&"===n.operator)&&(a=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(r){let a,n=[];for(let a of r.names)t.validateLength(a,1e6,"Variable name");if("?"===r.operator||"&"===r.operator){for(let t=0;t<r.names.length;t++){let a=r.names[t],i=0===t?"\\"+r.operator:"&";n.push({pattern:i+this.escapeRegExp(a)+"=([^&]+)",name:a})}return n}let i=r.name;switch(r.operator){case"":a=r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":a="(.+)";break;case".":a=String.raw`\.([^/,]+)`;break;case"/":a="/"+(r.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:a="([^/]+)"}return n.push({pattern:a,name:i}),n}match(r){t.validateLength(r,1e6,"URI");let a="^",n=[];for(let t of this.parts)if("string"==typeof t)a+=this.escapeRegExp(t);else for(let{pattern:r,name:i}of this.partToRegExp(t))a+=r,n.push({name:i,exploded:t.exploded});a+="$",t.validateLength(a,1e6,"Generated regex pattern");let i=new RegExp(a),o=r.match(i);if(!o)return null;let s={};for(let[t,r]of n.entries()){let{name:a,exploded:n}=r,i=o[t+1];s[a.replace("*","")]=n&&i.includes(",")?i.split(","):i}return s}};function uZ(t){if(void 0!==t){if(function(t){if("object"!=typeof t||null===t||uc(t))return!1;let r=Object.getPrototypeOf(t);return(r===Object.prototype||null===r)&&Object.values(t).every(t=>"object"==typeof t&&null!==t&&"_zod"in t)}(t))return iu(t);if("object"==typeof t&&null!==t&&!uc(t)&&Object.values(t).some(t=>"object"==typeof t&&null!==t&&!("_zod"in t)&&"_def"in t&&"string"==typeof t._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(!uc(t))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return t}}var uD=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;var r=class{};t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var a=class extends r{constructor(r){if(super(),!t.IDENTIFIER.test(r))throw Error("CodeGen: name must be a valid identifier");this.str=r}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};t.Name=a;var n=class extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return""===t||'""'===t}get str(){var t;return null!=(t=this._str)?t:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var t;return null!=(t=this._names)?t:this._names=this._items.reduce((t,r)=>(r instanceof a&&(t[r.str]=(t[r.str]||0)+1),t),{})}};function i(t,...r){let a=[t[0]],o=0;for(;o<r.length;)l(a,r[o]),a.push(t[++o]);return new n(a)}t._Code=n,t.nil=new n(""),t._=i;let o=new n("+");function s(t,...r){let i=[c(t[0])],u=0;for(;u<r.length;)i.push(o),l(i,r[u]),i.push(o,c(t[++u]));return function(t){let r=1;for(;r<t.length-1;){if(t[r]===o){var n,i;let o=(n=t[r-1],'""'===(i=t[r+1])?n:'""'===n?i:"string"==typeof n?i instanceof a||'"'!==n[n.length-1]?void 0:"string"!=typeof i?`${n.slice(0,-1)}${i}"`:'"'===i[0]?n.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||n instanceof a?void 0:`"${n}${i.slice(1)}`);if(void 0!==o){t.splice(r-1,3,o);continue}t[r++]="+"}r++}}(i),new n(i)}function l(t,r){var i;r instanceof n?t.push(...r._items):r instanceof a?t.push(r):t.push("number"==typeof(i=r)||"boolean"==typeof i||null===i?i:c(Array.isArray(i)?i.join(","):i))}function c(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=l,t.strConcat=function(t,r){return r.emptyStr()?t:t.emptyStr()?r:s`${t}${r}`},t.stringify=function(t){return new n(c(t))},t.safeStringify=c,t.getProperty=function(r){return"string"==typeof r&&t.IDENTIFIER.test(r)?new n(`.${r}`):i`[${r}]`},t.getEsmExportName=function(r){if("string"==typeof r&&t.IDENTIFIER.test(r))return new n(`${r}`);throw Error(`CodeGen: invalid export name: ${r}, use explicit $id name mapping`)},t.regexpCode=function(t){return new n(t.toString())}}),uU=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=uD();var a,n,i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}};(a=n||(t.UsedValueState=n={}))[a.Started=0]="Started",a[a.Completed=1]="Completed",t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};var o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof r.Name?t:this.name(t)}name(t){return new r.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,a;if((null==(a=null==(r=this._parent)?void 0:r._prefixes)?void 0:a.has(t))||this._prefixes&&!this._prefixes.has(t))throw Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};t.Scope=o;var s=class extends r.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:a,itemIndex:n}){this.value=t,this.scopePath=(0,r._)`.${new r.Name(a)}[${n}]`}};t.ValueScopeName=s;let l=(0,r._)`\n`;var c=class extends o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?l:r.nil}}get(){return this._scope}name(t){return new s(t,this._newName(t))}value(t,r){var a;if(void 0===r.ref)throw Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:i}=n,o=null!=(a=r.key)?a:r.ref,s=this._values[i];if(s){let t=s.get(o);if(t)return t}else s=this._values[i]=new Map;s.set(o,n);let l=this._scope[i]||(this._scope[i]=[]),c=l.length;return l[c]=r.ref,n.setValue(r,{property:i,itemIndex:c}),n}getValue(t,r){let a=this._values[t];if(a)return a.get(r)}scopeRefs(t,a=this._values){return this._reduceValues(a,a=>{if(void 0===a.scopePath)throw Error(`CodeGen: name "${a}" has no value`);return(0,r._)`${t}${a.scopePath}`})}scopeCode(t=this._values,r,a){return this._reduceValues(t,t=>{if(void 0===t.value)throw Error(`CodeGen: name "${t}" has no value`);return t.value.code},r,a)}_reduceValues(a,o,s={},l){let c=r.nil;for(let u in a){let d=a[u];if(!d)continue;let p=s[u]=s[u]||new Map;d.forEach(a=>{if(p.has(a))return;p.set(a,n.Started);let s=o(a);if(s){let n=this.opts.es5?t.varKinds.var:t.varKinds.const;c=(0,r._)`${c}${n} ${a} = ${s};${this.opts._n}`}else if(s=null==l?void 0:l(a))c=(0,r._)`${c}${s}${this.opts._n}`;else throw new i(a);p.set(a,n.Completed)})}return c}};t.ValueScope=c}),uV=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let r=uD(),a=uU();var n=uD();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var i=uU();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};var o=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},s=class extends o{constructor(t,r,a){super(),this.varKind=t,this.name=r,this.rhs=a}render({es5:t,_n:r}){let n=t?a.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,t,r)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}},l=class extends o{constructor(t,r,a){super(),this.lhs=t,this.rhs=r,this.sideEffects=a}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,a){if(!(this.lhs instanceof r.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,t,a),this}get names(){return j(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends l{constructor(t,r,a,n){super(t,a,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},u=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},d=class extends o{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},p=class extends o{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},m=class extends o{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=O(this.code,t,r),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}},h=class extends o{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,a)=>r+a.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let a=t[r].optimizeNodes();Array.isArray(a)?t.splice(r,1,...a):a?t[r]=a:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:a}=this,n=a.length;for(;n--;){let i=a[n];i.optimizeNames(t,r)||(function(t,r){for(let a in r)t[a]=(t[a]||0)-(r[a]||0)}(t,i.names),a.splice(n,1))}return a.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>T(t,r.names),{})}},f=class extends h{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},g=class extends h{},y=class extends f{};y.kind="else";var v=class t extends f{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let r=this.condition;if(!0===r)return this.nodes;let a=this.else;if(a){let t=a.optimizeNodes();a=this.else=Array.isArray(t)?new y(t):t}return a?!1===r?a instanceof t?a:a.nodes:this.nodes.length?this:new t(C(r),a instanceof t?[a]:a.nodes):!1!==r&&this.nodes.length?this:void 0}optimizeNames(t,r){var a;if(this.else=null==(a=this.else)?void 0:a.optimizeNames(t,r),super.optimizeNames(t,r)||this.else)return this.condition=O(this.condition,t,r),this}get names(){let t=super.names;return j(t,this.condition),this.else&&T(t,this.else.names),t}};v.kind="if";var _=class extends f{};_.kind="for";var b=class extends _{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=O(this.iteration,t,r),this}get names(){return T(super.names,this.iteration.names)}},S=class extends _{constructor(t,r,a,n){super(),this.varKind=t,this.name=r,this.from=a,this.to=n}render(t){let r=t.es5?a.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){return j(j(super.names,this.from),this.to)}},$=class extends _{constructor(t,r,a,n){super(),this.loop=t,this.varKind=r,this.name=a,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=O(this.iterable,t,r),this}get names(){return T(super.names,this.iterable.names)}},w=class extends f{constructor(t,r,a){super(),this.name=t,this.args=r,this.async=a}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};w.kind="func";var R=class extends h{render(t){return"return "+super.render(t)}};R.kind="return";var k=class extends f{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),null==(t=this.catch)||t.optimizeNodes(),null==(r=this.finally)||r.optimizeNodes(),this}optimizeNames(t,r){var a,n;return super.optimizeNames(t,r),null==(a=this.catch)||a.optimizeNames(t,r),null==(n=this.finally)||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&T(t,this.catch.names),this.finally&&T(t,this.finally.names),t}},x=class extends f{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};x.kind="catch";var P=class extends f{render(t){return"finally"+super.render(t)}};P.kind="finally";var E=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?"\n":""},this._extScope=t,this._scope=new a.Scope({parent:t}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,a,n){let i=this._scope.toName(r);return void 0!==a&&n&&(this._constants[i.str]=a),this._leafNode(new s(t,i,a)),i}const(t,r,n){return this._def(a.varKinds.const,t,r,n)}let(t,r,n){return this._def(a.varKinds.let,t,r,n)}var(t,r,n){return this._def(a.varKinds.var,t,r,n)}assign(t,r,a){return this._leafNode(new l(t,r,a))}add(r,a){return this._leafNode(new c(r,t.operators.ADD,a))}code(t){return"function"==typeof t?t():t!==r.nil&&this._leafNode(new m(t)),this}object(...t){let a=["{"];for(let[n,i]of t)a.length>1&&a.push(","),a.push(n),(n!==i||this.opts.es5)&&(a.push(":"),(0,r.addCodeArg)(a,i));return a.push("}"),new r._Code(a)}if(t,r,a){if(this._blockNode(new v(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new v(t))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(v,y)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new b(t),r)}forRange(t,r,n,i,o=this.opts.es5?a.varKinds.var:a.varKinds.let){let s=this._scope.toName(t);return this._for(new S(o,s,r,n),()=>i(s))}forOf(t,n,i,o=a.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let t=n instanceof r.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,r._)`${t}.length`,a=>{this.var(s,(0,r._)`${t}[${a}]`),i(s)})}return this._for(new $("of",o,s,n),()=>i(s))}forIn(t,n,i,o=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,r._)`Object.keys(${n})`,i);let s=this._scope.toName(t);return this._for(new $("in",o,s,n),()=>i(s))}endFor(){return this._endBlockNode(_)}label(t){return this._leafNode(new u(t))}break(t){return this._leafNode(new d(t))}return(t){let r=new R;if(this._blockNode(r),this.code(t),1!==r.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(R)}try(t,r,a){if(!r&&!a)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new k;if(this._blockNode(n),this.code(t),r){let t=this.name("e");this._currNode=n.catch=new x(t),r(t)}return a&&(this._currNode=n.finally=new P,this.code(a)),this._endBlockNode(x,P)}throw(t){return this._leafNode(new p(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(void 0===r)throw Error("CodeGen: not in self-balancing block");let a=this._nodes.length-r;if(a<0||void 0!==t&&a!==t)throw Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,a=r.nil,n,i){return this._blockNode(new w(t,a,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let a=this._currNode;if(a instanceof t||r&&a instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};function T(t,r){for(let a in r)t[a]=(t[a]||0)+(r[a]||0);return t}function j(t,a){return a instanceof r._CodeOrName?T(t,a.names):t}function O(t,a,n){var i;if(t instanceof r.Name)return o(t);if(!((i=t)instanceof r._Code&&i._items.some(t=>t instanceof r.Name&&1===a[t.str]&&void 0!==n[t.str])))return t;return new r._Code(t._items.reduce((t,a)=>(a instanceof r.Name&&(a=o(a)),a instanceof r._Code?t.push(...a._items):t.push(a),t),[]));function o(t){let r=n[t.str];return void 0===r||1!==a[t.str]?t:(delete a[t.str],r)}}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:(0,r._)`!${A(t)}`}t.CodeGen=E,t.not=C;let I=q(t.operators.AND);t.and=function(...t){return t.reduce(I)};let N=q(t.operators.OR);function q(t){return(a,n)=>a===r.nil?n:n===r.nil?a:(0,r._)`${A(a)} ${t} ${A(n)}`}function A(t){return t instanceof r.Name?t:(0,r._)`(${t})`}t.or=function(...t){return t.reduce(N)}}),uF=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let n=uV(),i=uD();function o(t,r=t.schema){let{opts:a,self:n}=t;if(!a.strictSchema||"boolean"==typeof r)return;let i=n.RULES.keywords;for(let a in r)i[a]||h(t,`unknown keyword: "${a}"`)}function s(t,r){if("boolean"==typeof t)return!t;for(let a in t)if(r[a])return!0;return!1}function l(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function c(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:t,mergeToName:r,mergeValues:a,resultToName:i}){return(o,s,l,c)=>{let u=void 0===l?s:l instanceof n.Name?(s instanceof n.Name?t(o,s,l):r(o,s,l),l):s instanceof n.Name?(r(o,l,s),s):a(s,l);return c!==n.Name||u instanceof n.Name?u:i(o,u)}}function d(t,r){if(!0===r)return t.var("props",!0);let a=t.var("props",(0,n._)`{}`);return void 0!==r&&p(t,a,r),a}function p(t,r,a){Object.keys(a).forEach(a=>t.assign((0,n._)`${r}${(0,n.getProperty)(a)}`,!0))}t.toHash=function(t){let r={};for(let a of t)r[a]=!0;return r},t.alwaysValidSchema=function(t,r){return"boolean"==typeof r?r:0===Object.keys(r).length||(o(t,r),!s(r,t.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=s,t.schemaHasRulesButRef=function(t,r){if("boolean"==typeof t)return!t;for(let a in t)if("$ref"!==a&&r.all[a])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},a,i,o){if(!o){if("number"==typeof a||"boolean"==typeof a)return a;if("string"==typeof a)return(0,n._)`${a}`}return(0,n._)`${t}${r}${(0,n.getProperty)(i)}`},t.unescapeFragment=function(t){return c(decodeURIComponent(t))},t.escapeFragment=function(t){return encodeURIComponent(l(t))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(t,r){if(Array.isArray(t))for(let a of t)r(a);else r(t)},t.mergeEvaluated={props:u({mergeNames:(t,r,a)=>t.if((0,n._)`${a} !== true && ${r} !== undefined`,()=>{t.if((0,n._)`${r} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,n._)`${a} || {}`).code((0,n._)`Object.assign(${a}, ${r})`))}),mergeToName:(t,r,a)=>t.if((0,n._)`${a} !== true`,()=>{!0===r?t.assign(a,!0):(t.assign(a,(0,n._)`${a} || {}`),p(t,a,r))}),mergeValues:(t,r)=>!0===t||{...t,...r},resultToName:d}),items:u({mergeNames:(t,r,a)=>t.if((0,n._)`${a} !== true && ${r} !== undefined`,()=>t.assign(a,(0,n._)`${r} === true ? true : ${a} > ${r} ? ${a} : ${r}`)),mergeToName:(t,r,a)=>t.if((0,n._)`${a} !== true`,()=>t.assign(a,!0===r||(0,n._)`${a} > ${r} ? ${a} : ${r}`)),mergeValues:(t,r)=>!0===t||Math.max(t,r),resultToName:(t,r)=>t.var("items",r)})},t.evaluatedPropsToName=d,t.setEvaluated=p;let m={};function h(t,r,a=t.opts.strictSchema){if(a){if(r=`strict mode: ${r}`,!0===a)throw Error(r);t.self.logger.warn(r)}}t.useFunc=function(t,r){return t.scopeValue("func",{ref:r,code:m[r.code]||(m[r.code]=new i._Code(r.code))})},(a=r||(t.Type=r={}))[a.Num=0]="Num",a[a.Str=1]="Str",t.getErrorPath=function(t,a,i){if(t instanceof n.Name){let o=a===r.Num;return i?o?(0,n._)`"[" + ${t} + "]"`:(0,n._)`"['" + ${t} + "']"`:o?(0,n._)`"/" + ${t}`:(0,n._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,n.getProperty)(t).toString():"/"+l(t)},t.checkStrictMode=h}),uH=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")}}),uJ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let r=uV(),a=uF(),n=uH();function i(t,a){let i=t.const("err",a);t.if((0,r._)`${n.default.vErrors} === null`,()=>t.assign(n.default.vErrors,(0,r._)`[${i}]`),(0,r._)`${n.default.vErrors}.push(${i})`),t.code((0,r._)`${n.default.errors}++`)}function o(t,a){let{gen:n,validateName:i,schemaEnv:o}=t;o.$async?n.throw((0,r._)`new ${t.ValidationError}(${a})`):(n.assign((0,r._)`${i}.errors`,a),n.return(!1))}t.keywordError={message:({keyword:t})=>(0,r.str)`must pass "${t}" keyword validation`},t.keyword$DataError={message:({keyword:t,schemaType:a})=>a?(0,r.str)`"${t}" keyword must be ${a} ($data)`:(0,r.str)`"${t}" keyword is invalid ($data)`},t.reportError=function(a,n=t.keywordError,s,c){let{it:u}=a,{gen:d,compositeRule:p,allErrors:m}=u,h=l(a,n,s);(null!=c?c:p||m)?i(d,h):o(u,(0,r._)`[${h}]`)},t.reportExtraError=function(r,a=t.keywordError,s){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c;i(u,l(r,a,s)),d||p||o(c,n.default.vErrors)},t.resetErrorsCount=function(t,a){t.assign(n.default.errors,a),t.if((0,r._)`${n.default.vErrors} !== null`,()=>t.if(a,()=>t.assign((0,r._)`${n.default.vErrors}.length`,a),()=>t.assign(n.default.vErrors,null)))},t.extendErrors=function({gen:t,keyword:a,schemaValue:i,data:o,errsCount:s,it:l}){if(void 0===s)throw Error("ajv implementation error");let c=t.name("err");t.forRange("i",s,n.default.errors,s=>{t.const(c,(0,r._)`${n.default.vErrors}[${s}]`),t.if((0,r._)`${c}.instancePath === undefined`,()=>t.assign((0,r._)`${c}.instancePath`,(0,r.strConcat)(n.default.instancePath,l.errorPath))),t.assign((0,r._)`${c}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(t.assign((0,r._)`${c}.schema`,i),t.assign((0,r._)`${c}.data`,o))})};let s={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(t,i,o){let{createErrors:l}=t.it;return!1===l?(0,r._)`{}`:function(t,i,o={}){let{gen:l,it:c}=t,u=[function({errorPath:t},{instancePath:i}){let o=i?(0,r.str)`${t}${(0,a.getErrorPath)(i,a.Type.Str)}`:t;return[n.default.instancePath,(0,r.strConcat)(n.default.instancePath,o)]}(c,o),function({keyword:t,it:{errSchemaPath:n}},{schemaPath:i,parentSchema:o}){let l=o?n:(0,r.str)`${n}/${t}`;return i&&(l=(0,r.str)`${l}${(0,a.getErrorPath)(i,a.Type.Str)}`),[s.schemaPath,l]}(t,o)];return function(t,{params:a,message:i},o){let{keyword:l,data:c,schemaValue:u,it:d}=t,{opts:p,propertyName:m,topSchemaRef:h,schemaPath:f}=d;o.push([s.keyword,l],[s.params,"function"==typeof a?a(t):a||(0,r._)`{}`]),p.messages&&o.push([s.message,"function"==typeof i?i(t):i]),p.verbose&&o.push([s.schema,u],[s.parentSchema,(0,r._)`${h}${f}`],[n.default.data,c]),m&&o.push([s.propertyName,m])}(t,i,u),l.object(...u)}(t,i,o)}}),uB=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let r=uJ(),a=uV(),n=uH(),i={message:"boolean schema is false"};function o(t,a){let{gen:n,data:o}=t;(0,r.reportError)({gen:n,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t},i,void 0,a)}t.topBoolOrEmptySchema=function(t){let{gen:r,schema:i,validateName:s}=t;!1===i?o(t,!1):"object"==typeof i&&!0===i.$async?r.return(n.default.data):(r.assign((0,a._)`${s}.errors`,null),r.return(!0))},t.boolOrEmptySchema=function(t,r){let{gen:a,schema:n}=t;!1===n?(a.var(r,!1),o(t)):a.var(r,!0)}}),uK=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(t){return"string"==typeof t&&r.has(t)},t.getRules=function(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}}),uG=H(t=>{function r(t,r){return r.rules.some(r=>a(t,r))}function a(t,r){var a;return void 0!==t[r.keyword]||(null==(a=r.definition.implements)?void 0:a.some(r=>void 0!==t[r]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:t,self:a},n){let i=a.RULES.types[n];return i&&!0!==i&&r(t,i)},t.shouldUseGroup=r,t.shouldUseRule=a}),uW=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let n=uK(),i=uG(),o=uJ(),s=uV(),l=uF();function c(t){let r=Array.isArray(t)?t:t?[t]:[];if(r.every(n.isJSONType))return r;throw Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=r||(t.DataType=r={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",t.getSchemaTypes=function(t){let r=c(t.type);if(r.includes("null")){if(!1===t.nullable)throw Error("type: null contradicts nullable: false")}else{if(!r.length&&void 0!==t.nullable)throw Error('"nullable" cannot be used without "type"');!0===t.nullable&&r.push("null")}return r},t.getJSONTypes=c,t.coerceAndCheckDataType=function(t,a){var n,o;let{gen:l,data:c,opts:d}=t,m=(n=a,(o=d.coerceTypes)?n.filter(t=>u.has(t)||"array"===o&&"array"===t):[]),f=a.length>0&&!(0===m.length&&1===a.length&&(0,i.schemaHasRulesForType)(t,a[0]));if(f){let n=p(a,c,d.strictNumbers,r.Wrong);l.if(n,()=>{m.length?function(t,r,a){let{gen:n,data:i,opts:o}=t,l=n.let("dataType",(0,s._)`typeof ${i}`),c=n.let("coerced",(0,s._)`undefined`);for(let t of("array"===o.coerceTypes&&n.if((0,s._)`${l} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,s._)`${i}[0]`).assign(l,(0,s._)`typeof ${i}`).if(p(r,i,o.strictNumbers),()=>n.assign(c,i))),n.if((0,s._)`${c} !== undefined`),a))(u.has(t)||"array"===t&&"array"===o.coerceTypes)&&function(t){switch(t){case"string":n.elseIf((0,s._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,s._)`"" + ${i}`).elseIf((0,s._)`${i} === null`).assign(c,(0,s._)`""`);return;case"number":n.elseIf((0,s._)`${l} == "boolean" || ${i} === null
|
|
56
|
+
|| (${l} == "string" && ${i} && ${i} == +${i})`).assign(c,(0,s._)`+${i}`);return;case"integer":n.elseIf((0,s._)`${l} === "boolean" || ${i} === null
|
|
57
|
+
|| (${l} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,(0,s._)`+${i}`);return;case"boolean":n.elseIf((0,s._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf((0,s._)`${i} === "true" || ${i} === 1`).assign(c,!0);return;case"null":n.elseIf((0,s._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(c,null);return;case"array":n.elseIf((0,s._)`${l} === "string" || ${l} === "number"
|
|
58
|
+
|| ${l} === "boolean" || ${i} === null`).assign(c,(0,s._)`[${i}]`)}}(t);n.else(),h(t),n.endIf(),n.if((0,s._)`${c} !== undefined`,()=>{n.assign(i,c),function({gen:t,parentData:r,parentDataProperty:a},n){t.if((0,s._)`${r} !== undefined`,()=>t.assign((0,s._)`${r}[${a}]`,n))}(t,c)})}(t,a,m):h(t)})}return f};let u=new Set(["string","number","integer","boolean","null"]);function d(t,a,n,i=r.Correct){let o,l=i===r.Correct?s.operators.EQ:s.operators.NEQ;switch(t){case"null":return(0,s._)`${a} ${l} null`;case"array":o=(0,s._)`Array.isArray(${a})`;break;case"object":o=(0,s._)`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":o=c((0,s._)`!(${a} % 1) && !isNaN(${a})`);break;case"number":o=c();break;default:return(0,s._)`typeof ${a} ${l} ${t}`}return i===r.Correct?o:(0,s.not)(o);function c(t=s.nil){return(0,s.and)((0,s._)`typeof ${a} == "number"`,t,n?(0,s._)`isFinite(${a})`:s.nil)}}function p(t,r,a,n){let i;if(1===t.length)return d(t[0],r,a,n);let o=(0,l.toHash)(t);if(o.array&&o.object){let t=(0,s._)`typeof ${r} != "object"`;i=o.null?t:(0,s._)`!${r} || ${t}`,delete o.null,delete o.array,delete o.object}else i=s.nil;for(let t in o.number&&delete o.integer,o)i=(0,s.and)(i,d(t,r,a,n));return i}t.checkDataType=d,t.checkDataTypes=p;let m={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>"string"==typeof t?(0,s._)`{type: ${t}}`:(0,s._)`{type: ${r}}`};function h(t){let r=function(t){let{gen:r,data:a,schema:n}=t,i=(0,l.schemaRefOrVal)(t,n,"type");return{gen:r,keyword:"type",data:a,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}(t);(0,o.reportError)(r,m)}t.reportTypeError=h}),uY=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let r=uV(),a=uF();function n(t,n,i){let{gen:o,compositeRule:s,data:l,opts:c}=t;if(void 0===i)return;let u=(0,r._)`${l}${(0,r.getProperty)(n)}`;if(s)return void(0,a.checkStrictMode)(t,`default is ignored for: ${u}`);let d=(0,r._)`${u} === undefined`;"empty"===c.useDefaults&&(d=(0,r._)`${d} || ${u} === null || ${u} === ""`),o.if(d,(0,r._)`${u} = ${(0,r.stringify)(i)}`)}t.assignDefaults=function(t,r){let{properties:a,items:i}=t.schema;if("object"===r&&a)for(let r in a)n(t,r,a[r].default);else"array"===r&&Array.isArray(i)&&i.forEach((r,a)=>n(t,a,r.default))}}),uX=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let r=uV(),a=uF(),n=uH(),i=uF();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,r._)`Object.prototype.hasOwnProperty`})}function s(t,a,n){return(0,r._)`${o(t)}.call(${a}, ${n})`}function l(t,a,n,i){let o=(0,r._)`${a}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(o,(0,r.not)(s(t,a,n))):o}function c(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}t.checkReportMissingProp=function(t,a){let{gen:n,data:i,it:o}=t;n.if(l(n,i,a,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,r._)`${a}`},!0),t.error()})},t.checkMissingProp=function({gen:t,data:a,it:{opts:n}},i,o){return(0,r.or)(...i.map(i=>(0,r.and)(l(t,a,i,n.ownProperties),(0,r._)`${o} = ${i}`)))},t.reportMissingProp=function(t,r){t.setParams({missingProperty:r},!0),t.error()},t.hasPropFunc=o,t.isOwnProperty=s,t.propertyInData=function(t,a,n,i){let o=(0,r._)`${a}${(0,r.getProperty)(n)} !== undefined`;return i?(0,r._)`${o} && ${s(t,a,n)}`:o},t.noPropertyInData=l,t.allSchemaProperties=c,t.schemaProperties=function(t,r){return c(r).filter(n=>!(0,a.alwaysValidSchema)(t,r[n]))},t.callValidateCode=function({schemaCode:t,data:a,it:{gen:i,topSchemaRef:o,schemaPath:s,errorPath:l},it:c},u,d,p){let m=p?(0,r._)`${t}, ${a}, ${o}${s}`:a,h=[[n.default.instancePath,(0,r.strConcat)(n.default.instancePath,l)],[n.default.parentData,c.parentData],[n.default.parentDataProperty,c.parentDataProperty],[n.default.rootData,n.default.rootData]];c.opts.dynamicRef&&h.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let f=(0,r._)`${m}, ${i.object(...h)}`;return d!==r.nil?(0,r._)`${u}.call(${d}, ${f})`:(0,r._)`${u}(${f})`};let u=(0,r._)`new RegExp`;t.usePattern=function({gen:t,it:{opts:a}},n){let o=a.unicodeRegExp?"u":"",{regExp:s}=a.code,l=s(n,o);return t.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,r._)`${"new RegExp"===s.code?u:(0,i.useFunc)(t,s)}(${n}, ${o})`})},t.validateArray=function(t){let{gen:n,data:i,keyword:o,it:s}=t,l=n.name("valid");if(s.allErrors){let t=n.let("valid",!0);return c(()=>n.assign(t,!1)),t}return n.var(l,!0),c(()=>n.break()),l;function c(s){let c=n.const("len",(0,r._)`${i}.length`);n.forRange("i",0,c,i=>{t.subschema({keyword:o,dataProp:i,dataPropType:a.Type.Num},l),n.if((0,r.not)(l),s)})}},t.validateUnion=function(t){let{gen:n,schema:i,keyword:o,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(t=>(0,a.alwaysValidSchema)(s,t))&&!s.opts.unevaluated)return;let l=n.let("valid",!1),c=n.name("_valid");n.block(()=>i.forEach((a,i)=>{let s=t.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);n.assign(l,(0,r._)`${l} || ${c}`),t.mergeValidEvaluated(s,c)||n.if((0,r.not)(l))})),t.result(l,()=>t.reset(),()=>t.error(!0))}}),uQ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let r=uV(),a=uH(),n=uX(),i=uJ();function o(t){let{gen:a,data:n,it:i}=t;a.if(i.parentData,()=>a.assign(n,(0,r._)`${i.parentData}[${i.parentDataProperty}]`))}function s(t,a,n){if(void 0===n)throw Error(`keyword "${a}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,r.stringify)(n)})}t.macroKeywordCode=function(t,a){let{gen:n,keyword:i,schema:o,parentSchema:l,it:c}=t,u=a.macro.call(c.self,o,l,c),d=s(n,i,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);let p=n.name("valid");t.subschema({schema:u,schemaPath:r.nil,errSchemaPath:`${c.errSchemaPath}/${i}`,topSchemaRef:d,compositeRule:!0},p),t.pass(p,()=>t.error(!0))},t.funcKeywordCode=function(t,l){var c;let{gen:u,keyword:d,schema:p,parentSchema:m,$data:h,it:f}=t;!function({schemaEnv:t},r){if(r.async&&!t.$async)throw Error("async keyword in sync schema")}(f,l);let g=s(u,d,!h&&l.compile?l.compile.call(f.self,p,m,f):l.validate),y=u.let("valid");function v(i=l.async?(0,r._)`await `:r.nil){let o=f.opts.passContext?a.default.this:a.default.self,s=!("compile"in l&&!h||!1===l.schema);u.assign(y,(0,r._)`${i}${(0,n.callValidateCode)(t,g,o,s)}`,l.modifying)}function _(t){var a;u.if((0,r.not)(null!=(a=l.valid)?a:y),t)}t.block$data(y,function(){if(!1===l.errors)v(),l.modifying&&o(t),_(()=>t.error());else{let n,s,c=l.async?(n=u.let("ruleErrs",null),u.try(()=>v((0,r._)`await `),t=>u.assign(y,!1).if((0,r._)`${t} instanceof ${f.ValidationError}`,()=>u.assign(n,(0,r._)`${t}.errors`),()=>u.throw(t))),n):(s=(0,r._)`${g}.errors`,u.assign(s,null),v(r.nil),s);l.modifying&&o(t),_(()=>(function(t,n){let{gen:o}=t;o.if((0,r._)`Array.isArray(${n})`,()=>{o.assign(a.default.vErrors,(0,r._)`${a.default.vErrors} === null ? ${n} : ${a.default.vErrors}.concat(${n})`).assign(a.default.errors,(0,r._)`${a.default.vErrors}.length`),(0,i.extendErrors)(t)},()=>t.error())})(t,c))}}),t.ok(null!=(c=l.valid)?c:y)},t.validSchemaType=function(t,r,a=!1){return!r.length||r.some(r=>"array"===r?Array.isArray(t):"object"===r?t&&"object"==typeof t&&!Array.isArray(t):typeof t==r||a&&void 0===t)},t.validateKeywordUsage=function({schema:t,opts:r,self:a,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw Error("ajv implementation error");let s=i.dependencies;if(null==s?void 0:s.some(r=>!Object.prototype.hasOwnProperty.call(t,r)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let t=`keyword "${o}" value is invalid at path "${n}": `+a.errorsText(i.validateSchema.errors);if("log"===r.validateSchema)a.logger.error(t);else throw Error(t)}}}),u0=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let r=uV(),a=uF();t.getSubschema=function(t,{keyword:n,schemaProp:i,schema:o,schemaPath:s,errSchemaPath:l,topSchemaRef:c}){if(void 0!==n&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){let o=t.schema[n];return void 0===i?{schema:o,schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${n}`}:{schema:o[i],schemaPath:(0,r._)`${t.schemaPath}${(0,r.getProperty)(n)}${(0,r.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${n}/${(0,a.escapeFragment)(i)}`}}if(void 0!==o){if(void 0===s||void 0===l||void 0===c)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:c,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(t,n,{dataProp:i,dataPropType:o,data:s,dataTypes:l,propertyName:c}){if(void 0!==s&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=n;if(void 0!==i){let{errorPath:s,dataPathArr:l,opts:c}=n;d(u.let("data",(0,r._)`${n.data}${(0,r.getProperty)(i)}`,!0)),t.errorPath=(0,r.str)`${s}${(0,a.getErrorPath)(i,o,c.jsPropertySyntax)}`,t.parentDataProperty=(0,r._)`${i}`,t.dataPathArr=[...l,t.parentDataProperty]}function d(r){t.data=r,t.dataLevel=n.dataLevel+1,t.dataTypes=[],n.definedProperties=new Set,t.parentData=n.data,t.dataNames=[...n.dataNames,r]}void 0!==s&&(d(s instanceof r.Name?s:u.let("data",s,!0)),void 0!==c&&(t.propertyName=c)),l&&(t.dataTypes=l)},t.extendSubschemaMode=function(t,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(t.compositeRule=n),void 0!==i&&(t.createErrors=i),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=r,t.jtdMetadata=a}}),u1=H((t,r)=>{r.exports=function t(r,a){if(r===a)return!0;if(r&&a&&"object"==typeof r&&"object"==typeof a){if(r.constructor!==a.constructor)return!1;if(Array.isArray(r)){if((n=r.length)!=a.length)return!1;for(i=n;0!=i--;)if(!t(r[i],a[i]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if((n=(o=Object.keys(r)).length)!==Object.keys(a).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,o[i]))return!1;for(i=n;0!=i--;){var n,i,o,s=o[i];if(!t(r[s],a[s]))return!1}return!0}return r!=r&&a!=a}}),u2=H((t,r)=>{var a=r.exports=function(t,r,n){"function"==typeof r&&(n=r,r={});var i="function"==typeof(n=r.cb||n)?n:n.pre||function(){};!function t(r,n,i,o,s,l,c,u,d,p){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var m in n(o,s,l,c,u,d,p),o){var h=o[m];if(Array.isArray(h)){if(m in a.arrayKeywords)for(var f=0;f<h.length;f++)t(r,n,i,h[f],s+"/"+m+"/"+f,l,s,m,o,f)}else if(m in a.propsKeywords){if(h&&"object"==typeof h)for(var g in h)t(r,n,i,h[g],s+"/"+m+"/"+g.replace(/~/g,"~0").replace(/\//g,"~1"),l,s,m,o,g)}else(m in a.keywords||r.allKeys&&!(m in a.skipKeywords))&&t(r,n,i,h,s+"/"+m,l,s,m,o)}i(o,s,l,c,u,d,p)}}(r,i,n.post||function(){},t,"",t)};a.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},a.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},a.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},a.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}}),u9=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let r=uF(),a=u1(),n=u2(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(t,a=!0){return"boolean"==typeof t||(!0===a?!function t(r){for(let a in r){if(o.has(a))return!0;let n=r[a];if(Array.isArray(n)&&n.some(t)||"object"==typeof n&&t(n))return!0}return!1}(t):!!a&&function t(a){let n=0;for(let o in a)if("$ref"===o||(n++,!i.has(o)&&("object"==typeof a[o]&&(0,r.eachItem)(a[o],r=>n+=t(r)),n===1/0)))return 1/0;return n}(t)<=a)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(t,r="",a){return!1!==a&&(r=u(r)),l(t,t.parse(r))}function l(t,r){return t.serialize(r).split("#")[0]+"#"}t.getFullPath=s,t._getFullPath=l;let c=/#\/?$/;function u(t){return t?t.replace(c,""):""}t.normalizeId=u,t.resolveUrl=function(t,r,a){return a=u(a),t.resolve(r,a)};let d=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(t,r){if("boolean"==typeof t)return{};let{schemaId:i,uriResolver:o}=this.opts,l=u(t[i]||r),c={"":l},p=s(o,l,!1),m={},h=new Set;return n(t,{allKeys:!0},(t,r,a,n)=>{if(void 0===n)return;let o=p+r,s=c[n];function l(r){let a=this.opts.uriResolver.resolve;if(r=u(s?a(s,r):r),h.has(r))throw g(r);h.add(r);let n=this.refs[r];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(t,n.schema,r):r!==u(o)&&("#"===r[0]?(f(t,m[r],r),m[r]=t):this.refs[r]=o),r}function y(t){if("string"==typeof t){if(!d.test(t))throw Error(`invalid anchor "${t}"`);l.call(this,`#${t}`)}}"string"==typeof t[i]&&(s=l.call(this,t[i])),y.call(this,t.$anchor),y.call(this,t.$dynamicAnchor),c[r]=s}),m;function f(t,r,n){if(void 0!==r&&!a(t,r))throw g(n)}function g(t){return Error(`reference "${t}" resolves to more than one schema`)}}}),u4=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let r=uB(),a=uW(),n=uG(),i=uW(),o=uY(),s=uQ(),l=u0(),c=uV(),u=uH(),d=u9(),p=uF(),m=uJ();function h({gen:t,validateName:r,schema:a,schemaEnv:n,opts:i},o){var s;i.code.es5?t.func(r,(0,c._)`${u.default.data}, ${u.default.valCxt}`,n.$async,()=>{var r,n;t.code((0,c._)`"use strict"; ${f(a,i)}`),r=t,n=i,r.if(u.default.valCxt,()=>{r.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),r.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),r.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),r.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),n.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{r.var(u.default.instancePath,(0,c._)`""`),r.var(u.default.parentData,(0,c._)`undefined`),r.var(u.default.parentDataProperty,(0,c._)`undefined`),r.var(u.default.rootData,u.default.data),n.dynamicRef&&r.var(u.default.dynamicAnchors,(0,c._)`{}`)}),t.code(o)}):t.func(r,(0,c._)`${u.default.data}, ${(s=i,(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${s.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`)}`,n.$async,()=>t.code(f(a,i)).code(o))}function f(t,r){let a="object"==typeof t&&t[r.schemaId];return a&&(r.code.source||r.code.process)?(0,c._)`/*# sourceURL=${a} */`:c.nil}function g({schema:t,self:r}){if("boolean"==typeof t)return!t;for(let a in t)if(r.RULES.all[a])return!0;return!1}function y(t){return"boolean"!=typeof t.schema}function v(t){(0,p.checkUnknownRules)(t),function(t){let{schema:r,errSchemaPath:a,opts:n,self:i}=t;r.$ref&&n.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(r,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}(t)}function _(t,r){if(t.opts.jtd)return S(t,[],!1,r);let n=(0,a.getSchemaTypes)(t.schema);S(t,n,!(0,a.coerceAndCheckDataType)(t,n),r)}function b({gen:t,schemaEnv:r,schema:a,errSchemaPath:n,opts:i}){let o=a.$comment;if(!0===i.$comment)t.code((0,c._)`${u.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){let a=(0,c.str)`${n}/$comment`,i=t.scopeValue("root",{ref:r.root});t.code((0,c._)`${u.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`)}}function S(t,r,a,o){var s,l,d,m;let{gen:h,schema:f,data:g,allErrors:y,opts:v,self:_}=t,{RULES:b}=_;if(f.$ref&&(v.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(f,b)))return void h.block(()=>x(t,"$ref",b.all.$ref.definition));function S(s){(0,n.shouldUseGroup)(f,s)&&(s.type?(h.if((0,i.checkDataType)(s.type,g,v.strictNumbers)),$(t,s),1===r.length&&r[0]===s.type&&a&&(h.else(),(0,i.reportTypeError)(t)),h.endIf()):$(t,s),y||h.if((0,c._)`${u.default.errors} === ${o||0}`))}v.jtd||(s=t,l=r,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(t,r){if(r.length){if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach(r=>{w(t.dataTypes,r)||R(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),function(t,r){let a=[];for(let n of t.dataTypes)w(r,n)?a.push(n):r.includes("integer")&&"number"===n&&a.push("integer");t.dataTypes=a}(t,r)}}(s,l),s.opts.allowUnionTypes||(d=s,(m=l).length>1&&!(2===m.length&&m.includes("null"))&&R(d,"use allowUnionTypes to allow union type keyword")),function(t,r){let a=t.self.RULES.all;for(let i in a){let o=a[i];if("object"==typeof o&&(0,n.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(t=>{var a,n;return a=r,n=t,a.includes(n)||"number"===n&&a.includes("integer")})&&R(t,`missing type "${a.join(",")}" for keyword "${i}"`)}}}(s,s.dataTypes))),h.block(()=>{for(let t of b.rules)S(t);S(b.post)})}function $(t,r){let{gen:a,schema:i,opts:{useDefaults:s}}=t;s&&(0,o.assignDefaults)(t,r.type),a.block(()=>{for(let a of r.rules)(0,n.shouldUseRule)(i,a)&&x(t,a.keyword,a.definition,r.type)})}function w(t,r){return t.includes(r)||"integer"===r&&t.includes("number")}function R(t,r){let a=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,p.checkStrictMode)(t,r,t.opts.strictTypes)}t.validateFunctionCode=function(t){y(t)&&(v(t),g(t))?function(t){let{schema:r,opts:a,gen:n}=t;h(t,()=>{a.$comment&&r.$comment&&b(t),function(t){let{schema:r,opts:a}=t;void 0!==r.default&&a.useDefaults&&a.strictSchema&&(0,p.checkStrictMode)(t,"default is ignored in the schema root")}(t),n.let(u.default.vErrors,null),n.let(u.default.errors,0),a.unevaluated&&function(t){let{gen:r,validateName:a}=t;t.evaluated=r.const("evaluated",(0,c._)`${a}.evaluated`),r.if((0,c._)`${t.evaluated}.dynamicProps`,()=>r.assign((0,c._)`${t.evaluated}.props`,(0,c._)`undefined`)),r.if((0,c._)`${t.evaluated}.dynamicItems`,()=>r.assign((0,c._)`${t.evaluated}.items`,(0,c._)`undefined`))}(t),_(t),function(t){let{gen:r,schemaEnv:a,validateName:n,ValidationError:i,opts:o}=t;a.$async?r.if((0,c._)`${u.default.errors} === 0`,()=>r.return(u.default.data),()=>r.throw((0,c._)`new ${i}(${u.default.vErrors})`)):(r.assign((0,c._)`${n}.errors`,u.default.vErrors),o.unevaluated&&function({gen:t,evaluated:r,props:a,items:n}){a instanceof c.Name&&t.assign((0,c._)`${r}.props`,a),n instanceof c.Name&&t.assign((0,c._)`${r}.items`,n)}(t),r.return((0,c._)`${u.default.errors} === 0`))}(t)})}(t):h(t,()=>(0,r.topBoolOrEmptySchema)(t))};var k=class{constructor(t,r,a){if((0,s.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(t,this.schema,a,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",T(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:!1!==r.errors)&&(this.errsCount=t.gen.const("_errs",u.default.errors))}result(t,r,a){this.failResult((0,c.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,c.not)(t),void 0,r)}fail(t){if(void 0===t){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,c._)`${r} !== undefined && (${(0,c.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?m.reportExtraError:m.reportError)(this,this.def.error,r)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,a=c.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=c.nil,r=c.nil){if(!this.$data)return;let{gen:a,schemaCode:n,schemaType:i,def:o}=this;a.if((0,c.or)((0,c._)`${n} === undefined`,r)),t!==c.nil&&a.assign(t,!0),(i.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==c.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:n,it:o}=this;return(0,c.or)(function(){if(a.length){if(!(r instanceof c.Name))throw Error("ajv implementation error");let t=Array.isArray(a)?a:[a];return(0,c._)`${(0,i.checkDataTypes)(t,r,o.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}(),function(){if(n.validateSchema){let a=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,c._)`!${a}(${r})`}return c.nil}())}subschema(t,a){let n=(0,l.getSubschema)(this.it,t);(0,l.extendSubschemaData)(n,this.it,t),(0,l.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return!function(t,a){if(y(t)&&(v(t),g(t)))return function(t,r){var a;let n,{schema:i,gen:o,opts:s}=t;s.$comment&&i.$comment&&b(t),(n=(a=t).schema[a.opts.schemaId])&&(a.baseId=(0,d.resolveUrl)(a.opts.uriResolver,a.baseId,n)),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw Error("async schema in sync schema")}(t);let l=o.const("_errs",u.default.errors);_(t,l),o.var(r,(0,c._)`${l} === ${u.default.errors}`)}(t,a);(0,r.boolOrEmptySchema)(t,a)}(i,a),i}mergeEvaluated(t,r){let{it:a,gen:n}=this;a.opts.unevaluated&&(!0!==a.props&&void 0!==t.props&&(a.props=p.mergeEvaluated.props(n,t.props,a.props,r)),!0!==a.items&&void 0!==t.items&&(a.items=p.mergeEvaluated.items(n,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:n}=this;if(a.opts.unevaluated&&(!0!==a.props||!0!==a.items))return n.if(r,()=>this.mergeEvaluated(t,c.Name)),!0}};function x(t,r,a,n){let i=new k(t,a,r);"code"in a?a.code(i,n):i.$data&&a.validate?(0,s.funcKeywordCode)(i,a):"macro"in a?(0,s.macroKeywordCode)(i,a):(a.compile||a.validate)&&(0,s.funcKeywordCode)(i,a)}t.KeywordCxt=k;let P=/^\/(?:[^~]|~0|~1)*$/,E=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(t,{dataLevel:r,dataNames:a,dataPathArr:n}){let i,o;if(""===t)return u.default.rootData;if("/"===t[0]){if(!P.test(t))throw Error(`Invalid JSON-pointer: ${t}`);i=t,o=u.default.rootData}else{let s=E.exec(t);if(!s)throw Error(`Invalid JSON-pointer: ${t}`);let c=+s[1];if("#"===(i=s[2])){if(c>=r)throw Error(l("property/index",c));return n[r-c]}if(c>r)throw Error(l("data",c));if(o=a[r-c],!i)return o}let s=o;for(let t of i.split("/"))t&&(o=(0,c._)`${o}${(0,c.getProperty)((0,p.unescapeJsonPointer)(t))}`,s=(0,c._)`${s} && ${o}`);return s;function l(t,a){return`Cannot access ${t} ${a} levels up, current level is ${r}`}}t.getData=T}),u3=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}}),u6=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u9();t.default=class extends Error{constructor(t,a,n,i){super(i||`can't resolve reference ${n} from id ${a}`),this.missingRef=(0,r.resolveUrl)(t,a,n),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(t,this.missingRef))}}}),u5=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let r=uV(),a=u3(),n=uH(),i=u9(),o=uF(),s=u4();var l=class{constructor(t){var r;let a;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(a=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!=(r=t.baseId)?r:(0,i.normalizeId)(null==a?void 0:a[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==a?void 0:a.$async,this.refs={}}};function c(t){let o,l,c=d.call(this,t);if(c)return c;let u=(0,i.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:p,lines:m}=this.opts.code,{ownProperties:h}=this.opts,f=new r.CodeGen(this.scope,{es5:p,lines:m,ownProperties:h});t.$async&&(o=f.scopeValue("Error",{ref:a.default,code:(0,r._)`require("ajv/dist/runtime/validation_error").default`}));let g=f.scopeName("validate");t.validateName=g;let y={gen:f,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,r.stringify)(t.schema)}:{ref:t.schema}),validateName:g,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:u,baseId:t.baseId||u,schemaPath:r.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,r._)`""`,opts:this.opts,self:this};try{this._compilations.add(t),(0,s.validateFunctionCode)(y),f.optimize(this.opts.code.optimize);let a=f.toString();l=`${f.scopeRefs(n.default.scope)}return ${a}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let i=Function(`${n.default.self}`,`${n.default.scope}`,l)(this,this.scope.get());if(this.scope.value(g,{ref:i}),i.errors=null,i.schema=t.schema,i.schemaEnv=t,t.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:g,validateCode:a,scopeValues:f._values}),this.opts.unevaluated){let{props:t,items:a}=y;i.evaluated={props:t instanceof r.Name?void 0:t,items:a instanceof r.Name?void 0:a,dynamicProps:t instanceof r.Name,dynamicItems:a instanceof r.Name},i.source&&(i.source.evaluated=(0,r.stringify)(i.evaluated))}return t.validate=i,t}catch(r){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),r}finally{this._compilations.delete(t)}}function u(t){return(0,i.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:c.call(this,t)}function d(t){for(let n of this._compilations){var r,a;if(r=n,a=t,r.schema===a.schema&&r.root===a.root&&r.baseId===a.baseId)return n}}function p(t,r){let a;for(;"string"==typeof(a=this.refs[r]);)r=a;return a||this.schemas[r]||m.call(this,t,r)}function m(t,r){let a=this.opts.uriResolver.parse(r),n=(0,i._getFullPath)(this.opts.uriResolver,a),o=(0,i.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return f.call(this,a,t);let s=(0,i.normalizeId)(n),u=this.refs[s]||this.schemas[s];if("string"==typeof u){let r=m.call(this,t,u);if("object"!=typeof(null==r?void 0:r.schema))return;return f.call(this,a,r)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||c.call(this,u),s===(0,i.normalizeId)(r)){let{schema:r}=u,{schemaId:a}=this.opts,n=r[a];return n&&(o=(0,i.resolveUrl)(this.opts.uriResolver,o,n)),new l({schema:r,schemaId:a,root:t,baseId:o})}return f.call(this,a,u)}}t.SchemaEnv=l,t.compileSchema=c,t.resolveRef=function(t,r,a){var n;a=(0,i.resolveUrl)(this.opts.uriResolver,r,a);let o=t.refs[a];if(o)return o;let s=p.call(this,t,a);if(void 0===s){let i=null==(n=t.localRefs)?void 0:n[a],{schemaId:o}=this.opts;i&&(s=new l({schema:i,schemaId:o,root:t,baseId:r}))}if(void 0!==s)return t.refs[a]=u.call(this,s)},t.getCompilingSchema=d,t.resolveSchema=m;let h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(t,{baseId:r,schema:a,root:n}){var s;let c;if((null==(s=t.fragment)?void 0:s[0])!=="/")return;for(let n of t.fragment.slice(1).split("/")){if("boolean"==typeof a)return;let t=a[(0,o.unescapeFragment)(n)];if(void 0===t)return;let s="object"==typeof(a=t)&&a[this.opts.schemaId];!h.has(n)&&s&&(r=(0,i.resolveUrl)(this.opts.uriResolver,r,s))}if("boolean"!=typeof a&&a.$ref&&!(0,o.schemaHasRulesButRef)(a,this.RULES)){let t=(0,i.resolveUrl)(this.opts.uriResolver,r,a.$ref);c=m.call(this,n,t)}let{schemaId:u}=this.opts;if((c=c||new l({schema:a,schemaId:u,root:n,baseId:r})).schema!==c.root.schema)return c}}),u7=H((t,r)=>{r.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),u8=H((t,r)=>{let a=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=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(t){let r="",a=0,n=0;for(n=0;n<t.length;n++)if(48!==(a=t[n].charCodeAt(0))){if(!(a>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[n];break}for(n+=1;n<t.length;n++){if(!((a=t[n].charCodeAt(0))>=48&&a<=57||a>=65&&a<=70||a>=97&&a<=102))return"";r+=t[n]}return r}function o(t){return t.length=0,!0}function s(t,r,a){if(t.length){let n=i(t);if(""===n)return a.error=!0,!1;r.push(n),t.length=0}return!0}function l(t){if(2>function(t,r){let a=0;for(let r=0;r<t.length;r++)":"===t[r]&&a++;return a}(t,":"))return{host:t,isIPV6:!1};let r=function(t){let r=0,a={error:!1,address:"",zone:""},n=[],l=[],c=!1,u=!1,d=s;for(let i=0;i<t.length;i++){let s=t[i];if("["!==s&&"]"!==s)if(":"===s){if(!0===c&&(u=!0),!d(l,n,a))break;if(++r>7){a.error=!0;break}i>0&&":"===t[i-1]&&(c=!0),n.push(":");continue}else if("%"===s){if(!d(l,n,a))break;d=o}else{l.push(s);continue}}return l.length&&(d===o?a.zone=l.join(""):u?n.push(l.join("")):n.push(i(l))),a.address=n.join(""),a}(t);if(r.error)return{host:t,isIPV6:!1};{let t=r.address,a=r.address;return r.zone&&(t+="%"+r.zone,a+="%25"+r.zone),{host:t,isIPV6:!0,escapedHost:a}}}r.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(t){let r=[];if(void 0!==t.userinfo&&(r.push(t.userinfo),r.push("@")),void 0!==t.host){let a=unescape(t.host);if(!n(a)){let r=l(a);a=!0===r.isIPV6?`[${r.escapedHost}]`:t.host}r.push(a)}return("number"==typeof t.port||"string"==typeof t.port)&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(t,r){let a=!0!==r?escape:unescape;return void 0!==t.scheme&&(t.scheme=a(t.scheme)),void 0!==t.userinfo&&(t.userinfo=a(t.userinfo)),void 0!==t.host&&(t.host=a(t.host)),void 0!==t.path&&(t.path=a(t.path)),void 0!==t.query&&(t.query=a(t.query)),void 0!==t.fragment&&(t.fragment=a(t.fragment)),t},removeDotSegments:function(t){let r=t,a=[],n=-1,i=0;for(;i=r.length;){if(1===i)if("."===r)break;else if("/"===r){a.push("/");break}else{a.push(r);break}if(2===i){if("."===r[0]){if("."===r[1])break;else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&("."===r[1]||"/"===r[1])){a.push("/");break}}else if(3===i&&"/.."===r){0!==a.length&&a.pop(),a.push("/");break}if("."===r[0]){if("."===r[1]){if("/"===r[2]){r=r.slice(3);continue}}else if("/"===r[1]){r=r.slice(2);continue}}else if("/"===r[0]&&"."===r[1]){if("/"===r[2]){r=r.slice(2);continue}else if("."===r[2]&&"/"===r[3]){r=r.slice(3),0!==a.length&&a.pop();continue}}if(-1===(n=r.indexOf("/",1))){a.push(r);break}a.push(r.slice(0,n)),r=r.slice(n)}return a.join("")},isIPv4:n,isUUID:a,normalizeIPv6:l,stringArrayToHexStripped:i}}),de=H((t,r)=>{let{isUUID:a}=u8(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function o(t){return!0===t.secure||!1!==t.secure&&!!t.scheme&&3===t.scheme.length&&("w"===t.scheme[0]||"W"===t.scheme[0])&&("s"===t.scheme[1]||"S"===t.scheme[1])&&("s"===t.scheme[2]||"S"===t.scheme[2])}function s(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function l(t){let r="https"===String(t.scheme).toLowerCase();return(t.port===(r?443:80)||""===t.port)&&(t.port=void 0),t.path||(t.path="/"),t}let c={scheme:"http",domainHost:!0,parse:s,serialize:l},u={scheme:"https",domainHost:c.domainHost,parse:s,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(t){return t.secure=o(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(t){if((t.port===(o(t)?443:80)||""===t.port)&&(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[r,a]=t.resourceName.split("?");t.path=r&&"/"!==r?r:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},m={http:c,https:u,ws:d,wss:p,urn:{scheme:"urn",parse:function(t,r){if(!t.path)return t.error="URN can not be parsed",t;let a=t.path.match(n);if(a){let n=r.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];let i=h(`${n}:${r.nid||t.nid}`);t.path=void 0,i&&(t=i.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(t,r){if(void 0===t.nid)throw Error("URN without nid cannot be serialized");let a=r.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=h(`${a}:${r.nid||n}`);i&&(t=i.serialize(t,r));let o=t,s=t.nss;return o.path=`${n||r.nid}:${s}`,r.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&a(t.uuid)||(t.error=t.error||"UUID is not valid."),t},serialize:function(t){return t.nss=(t.uuid||"").toLowerCase(),t},skipNormalize:!0}};function h(t){return t&&(m[t]||m[t.toLowerCase()])||void 0}Object.setPrototypeOf(m,null),r.exports={wsIsSecure:o,SCHEMES:m,isValidSchemeName:function(t){return -1!==i.indexOf(t)},getSchemeHandler:h}}),dt=H((t,r)=>{let{normalizeIPv6:a,removeDotSegments:n,recomposeAuthority:i,normalizeComponentEncoding:o,isIPv4:s,nonSimpleDomain:l}=u8(),{SCHEMES:c,getSchemeHandler:u}=de();function d(t,r,a,i){let o={};return i||(t=h(p(t,a),a),r=h(p(r,a),a)),!(a=a||{}).tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=n(r.path||""),o.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=n(r.path||""),o.query=r.query):(r.path?("/"===r.path[0]?o.path=n(r.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=n(o.path)),o.query=r.query):(o.path=t.path,void 0!==r.query?o.query=r.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=r.fragment,o}function p(t,r){let a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},r),s=[],l=u(o.scheme||a.scheme);l&&l.serialize&&l.serialize(a,o),void 0!==a.path&&(o.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==o.reference&&a.scheme&&s.push(a.scheme,":");let c=i(a);if(void 0!==c&&("suffix"!==o.reference&&s.push("//"),s.push(c),a.path&&"/"!==a.path[0]&&s.push("/")),void 0!==a.path){let t=a.path;o.absolutePath||l&&l.absolutePath||(t=n(t)),void 0===c&&"/"===t[0]&&"/"===t[1]&&(t="/%2F"+t.slice(2)),s.push(t)}return void 0!==a.query&&s.push("?",a.query),void 0!==a.fragment&&s.push("#",a.fragment),s.join("")}let m=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){let n=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;"suffix"===n.reference&&(t=n.scheme?n.scheme+":"+t:"//"+t);let c=t.match(m);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||"",i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(!1===s(i.host)){let t=a(i.host);i.host=t.host.toLowerCase(),o=t.isIPV6}else o=!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",n.reference&&"suffix"!==n.reference&&n.reference!==i.reference&&(i.error=i.error||"URI is not a "+n.reference+" reference.");let r=u(n.scheme||i.scheme);if(!n.unicodeSupport&&(!r||!r.unicodeSupport)&&i.host&&(n.domainHost||r&&r.domainHost)&&!1===o&&l(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(t){i.error=i.error||"Host's domain name can not be converted to ASCII: "+t}(!r||r&&!r.skipNormalize)&&(-1!==t.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)))),r&&r.parse&&r.parse(i,n)}else i.error=i.error||"URI can not be parsed.";return i}let f={SCHEMES:c,normalize:function(t,r){return"string"==typeof t?t=p(h(t,r),r):"object"==typeof t&&(t=h(p(t,r),r)),t},resolve:function(t,r,a){let n=a?Object.assign({scheme:"null"},a):{scheme:"null"},i=d(h(t,n),h(r,n),n,!0);return n.skipEscape=!0,p(i,n)},resolveComponent:d,equal:function(t,r,a){return"string"==typeof t?t=p(o(h(t=unescape(t),a),!0),{...a,skipEscape:!0}):"object"==typeof t&&(t=p(o(t,!0),{...a,skipEscape:!0})),"string"==typeof r?r=p(o(h(r=unescape(r),a),!0),{...a,skipEscape:!0}):"object"==typeof r&&(r=p(o(r,!0),{...a,skipEscape:!0})),t.toLowerCase()===r.toLowerCase()},serialize:p,parse:h};r.exports=f,r.exports.default=f,r.exports.fastUri=f}),dr=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt();r.code='require("ajv/dist/runtime/uri").default',t.default=r}),da=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var a=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});let n=u3(),i=u6(),o=uK(),s=u5(),l=uV(),c=u9(),u=uW(),d=uF(),p=u7(),m=dr(),h=(t,r)=>new RegExp(t,r);h.code="new RegExp";let f=["removeAdditional","useDefaults","coerceTypes"],g=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."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var _=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...function(t){var r,a,n,i,o,s,l,c,u,d,p,f,g,y,v,_,b,S,$,w,R,k,x,P,E;let T=t.strict,j=null==(r=t.code)?void 0:r.optimize,O=!0===j||void 0===j?1:j||0,C=null!=(n=null==(a=t.code)?void 0:a.regExp)?n:h,I=null!=(i=t.uriResolver)?i:m.default;return{strictSchema:null==(s=null!=(o=t.strictSchema)?o:T)||s,strictNumbers:null==(c=null!=(l=t.strictNumbers)?l:T)||c,strictTypes:null!=(d=null!=(u=t.strictTypes)?u:T)?d:"log",strictTuples:null!=(f=null!=(p=t.strictTuples)?p:T)?f:"log",strictRequired:null!=(y=null!=(g=t.strictRequired)?g:T)&&y,code:t.code?{...t.code,optimize:O,regExp:C}:{optimize:O,regExp:C},loopRequired:null!=(v=t.loopRequired)?v:200,loopEnum:null!=(_=t.loopEnum)?_:200,meta:null==(b=t.meta)||b,messages:null==(S=t.messages)||S,inlineRefs:null==($=t.inlineRefs)||$,schemaId:null!=(w=t.schemaId)?w:"$id",addUsedSchema:null==(R=t.addUsedSchema)||R,validateSchema:null==(k=t.validateSchema)||k,validateFormats:null==(x=t.validateFormats)||x,unicodeRegExp:null==(P=t.unicodeRegExp)||P,int32range:null==(E=t.int32range)||E,uriResolver:I}}(t)};const{es5:r,lines:a}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:g,es5:r,lines:a}),this.logger=function(t){if(!1===t)return x;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw Error("logger must implement log, warn and error methods")}(t.logger);const n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,y,t,"NOT SUPPORTED"),b.call(this,v,t,"DEPRECATED","warn"),this._metaOpts=k.call(this),t.formats&&w.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&R.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),$.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,n=p;"id"===a&&((n={...p}).id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[a],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[r]||t:void 0}validate(t,r){let a;if("string"==typeof t){if(!(a=this.getSchema(t)))throw Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let n=a(r);return"$async"in a||(this.errors=a.errors),n}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return n.call(this,t,r);async function n(t,r){await o.call(this,t.$schema);let a=this._addSchema(t,r);return a.validate||s.call(this,a)}async function o(t){t&&!this.getSchema(t)&&await n.call(this,{$ref:t},!0)}async function s(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof i.default))throw r;return l.call(this,r),await c.call(this,r.missingSchema),s.call(this,t)}}function l({missingSchema:t,missingRef:r}){if(this.refs[t])throw Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}async function c(t){let a=await u.call(this,t);this.refs[t]||await o.call(this,a.$schema),this.refs[t]||this.addSchema(a,t,r)}async function u(t){let r=this._loading[t];if(r)return r;try{return await (this._loading[t]=a(t))}finally{delete this._loading[t]}}}addSchema(t,r,a,n=this.opts.validateSchema){let i;if(Array.isArray(t)){for(let r of t)this.addSchema(r,void 0,a,n);return this}if("object"==typeof t){let{schemaId:r}=this.opts;if(void 0!==(i=t[r])&&"string"!=typeof i)throw Error(`schema ${r} must be string`)}return r=(0,c.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,n,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){let a;if("boolean"==typeof t)return!0;if(void 0!==(a=t.$schema)&&"string"!=typeof a)throw Error("$schema must be a string");if(!(a=a||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(a,t);if(!n&&r){let t="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(t);else throw Error(t)}return n}getSchema(t){let r;for(;"string"==typeof(r=S.call(this,t));)t=r;if(void 0===r){let{schemaId:a}=this.opts,n=new s.SchemaEnv({schema:{},schemaId:a});if(!(r=s.resolveSchema.call(this,n,t)))return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=S.call(this,t);return"object"==typeof r&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{this._cache.delete(t);let r=t[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let a;if("string"==typeof t)a=t,"object"==typeof r&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if("object"==typeof t&&void 0===r){if(Array.isArray(a=(r=t).keyword)&&!a.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(E.call(this,a,r),!r)return(0,d.eachItem)(a,t=>T.call(this,t)),this;O.call(this,r);let n={...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)};return(0,d.eachItem)(a,0===n.type.length?t=>T.call(this,t,n):t=>n.type.forEach(r=>T.call(this,t,n,r))),this}getKeyword(t){let r=this.RULES.all[t];return"object"==typeof r?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;for(let a of(delete r.keywords[t],delete r.all[t],r.rules)){let r=a.rules.findIndex(r=>r.keyword===t);r>=0&&a.rules.splice(r,1)}return this}addFormat(t,r){return"string"==typeof r&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:a="data"}={}){return t&&0!==t.length?t.map(t=>`${a}${t.instancePath} ${t.message}`).reduce((t,a)=>t+r+a):"No errors"}$dataMetaSchema(t,r){let a=this.RULES.all;for(let n of(t=JSON.parse(JSON.stringify(t)),r)){let r=n.split("/").slice(1),i=t;for(let t of r)i=i[t];for(let t in a){let r=a[t];if("object"!=typeof r)continue;let{$data:n}=r.definition,o=i[t];n&&o&&(i[t]=I(o))}}return t}_removeAllSchemas(t,r){for(let a in t){let n=t[a];(!r||r.test(a))&&("string"==typeof n?delete t[a]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[a]))}}_addSchema(t,r,a,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:l}=this.opts;if("object"==typeof t)o=t[l];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof t)throw Error("schema must be object or boolean");let u=this._cache.get(t);if(void 0!==u)return u;a=(0,c.normalizeId)(o||a);let d=c.getSchemaRefs.call(this,t,a);return u=new s.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:a,localRefs:d}),this._cache.set(u.schema,u),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=u),n&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):s.compileSchema.call(this,t),!t.validate)throw Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,t)}finally{this.opts=r}}};function b(t,r,a,n="error"){for(let i in t)i in r&&this.logger[n](`${a}: option ${i}. ${t[i]}`)}function S(t){return t=(0,c.normalizeId)(t),this.schemas[t]||this.refs[t]}function $(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let r in t)this.addSchema(t[r],r)}function w(){for(let t in this.opts.formats){let r=this.opts.formats[t];r&&this.addFormat(t,r)}}function R(t){if(Array.isArray(t))return void this.addVocabulary(t);for(let r in this.logger.warn("keywords option as map is deprecated, pass array"),t){let a=t[r];a.keyword||(a.keyword=r),this.addKeyword(a)}}function k(){let t={...this.opts};for(let r of f)delete t[r];return t}_.ValidationError=n.default,_.MissingRefError=i.default,t.default=_;let x={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function E(t,r){let{RULES:a}=this;if((0,d.eachItem)(t,t=>{if(a.keywords[t])throw Error(`Keyword ${t} is already defined`);if(!P.test(t))throw Error(`Keyword ${t} has invalid name`)}),r&&r.$data&&!("code"in r||"validate"in r))throw Error('$data keyword must have "code" or "validate" function')}function T(t,r,a){var n;let i=null==r?void 0:r.post;if(a&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:t})=>t===a);if(s||(s={type:a,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!r)return;let l={keyword:t,definition:{...r,type:(0,u.getJSONTypes)(r.type),schemaType:(0,u.getJSONTypes)(r.schemaType)}};r.before?j.call(this,s,l,r.before):s.rules.push(l),o.all[t]=l,null==(n=r.implements)||n.forEach(t=>this.addKeyword(t))}function j(t,r,a){let n=t.rules.findIndex(t=>t.keyword===a);n>=0?t.rules.splice(n,0,r):(t.rules.push(r),this.logger.warn(`rule ${a} is not defined`))}function O(t){let{metaSchema:r}=t;void 0!==r&&(t.$data&&this.opts.$data&&(r=I(r)),t.validateSchema=this.compile(r,!0))}let C={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(t){return{anyOf:[t,C]}}}),dn=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),di=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let r=u6(),a=uX(),n=uV(),i=uH(),o=u5(),s=uF();function l(t,r){let{gen:a}=t;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,n._)`${a.scopeValue("wrapper",{ref:r})}.validate`}function c(t,r,o,l){let{gen:c,it:u}=t,{allErrors:d,schemaEnv:p,opts:m}=u,h=m.passContext?i.default.this:n.nil;function f(t){let r=(0,n._)`${t}.errors`;c.assign(i.default.vErrors,(0,n._)`${i.default.vErrors} === null ? ${r} : ${i.default.vErrors}.concat(${r})`),c.assign(i.default.errors,(0,n._)`${i.default.vErrors}.length`)}function g(t){var r;if(!u.opts.unevaluated)return;let a=null==(r=null==o?void 0:o.validate)?void 0:r.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=s.mergeEvaluated.props(c,a.props,u.props));else{let r=c.var("props",(0,n._)`${t}.evaluated.props`);u.props=s.mergeEvaluated.props(c,r,u.props,n.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=s.mergeEvaluated.items(c,a.items,u.items));else{let r=c.var("items",(0,n._)`${t}.evaluated.items`);u.items=s.mergeEvaluated.items(c,r,u.items,n.Name)}}l?function(){if(!p.$async)throw Error("async schema referenced by sync schema");let i=c.let("valid");c.try(()=>{c.code((0,n._)`await ${(0,a.callValidateCode)(t,r,h)}`),g(r),d||c.assign(i,!0)},t=>{c.if((0,n._)`!(${t} instanceof ${u.ValidationError})`,()=>c.throw(t)),f(t),d||c.assign(i,!1)}),t.ok(i)}():t.result((0,a.callValidateCode)(t,r,h),()=>g(r),()=>f(r))}t.getValidate=l,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(t){var a,i;let s,u,d,{gen:p,schema:m,it:h}=t,{baseId:f,schemaEnv:g,validateName:y,opts:v,self:_}=h,{root:b}=g;if(("#"===m||"#/"===m)&&f===b.baseId){if(g===b)return c(t,y,g,g.$async);let r=p.scopeValue("root",{ref:b});return c(t,(0,n._)`${r}.validate`,b,b.$async)}let S=o.resolveRef.call(_,b,f,m);if(void 0===S)throw new r.default(h.opts.uriResolver,f,m);return S instanceof o.SchemaEnv?void c(t,l(t,a=S),a,a.$async):(i=S,s=p.scopeValue("schema",!0===v.code.source?{ref:i,code:(0,n.stringify)(i)}:{ref:i}),u=p.name("valid"),d=t.subschema({schema:i,dataTypes:[],schemaPath:n.nil,topSchemaRef:s,errSchemaPath:m},u),void(t.mergeEvaluated(d),t.ok(u)))}}}),ds=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dn(),a=di();t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,a.default]}),dl=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=r.operators,n={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.default={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must be ${n[t].okStr} ${a}`,params:({keyword:t,schemaCode:a})=>(0,r._)`{comparison: ${n[t].okStr}, limit: ${a}}`},code(t){let{keyword:a,data:i,schemaCode:o}=t;t.fail$data((0,r._)`${i} ${n[a].fail} ${o} || isNaN(${i})`)}}}),dc=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,r._)`{multipleOf: ${t}}`},code(t){let{gen:a,data:n,schemaCode:i,it:o}=t,s=o.opts.multipleOfPrecision,l=a.let("res"),c=s?(0,r._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,r._)`${l} !== parseInt(${l})`;t.fail$data((0,r._)`(${i} === 0 || (${l} = ${n}/${i}, ${c}))`)}}}),du=H(t=>{function r(t){let r,a=t.length,n=0,i=0;for(;i<a;)n++,(r=t.charCodeAt(i++))>=55296&&r<=56319&&i<a&&(64512&(r=t.charCodeAt(i)))==56320&&i++;return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'}),dd=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=du();t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxLength"===t?"more":"fewer"} than ${a} characters`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:i,data:o,schemaCode:s,it:l}=t,c="maxLength"===i?r.operators.GT:r.operators.LT,u=!1===l.opts.unicode?(0,r._)`${o}.length`:(0,r._)`${(0,a.useFunc)(t.gen,n.default)}(${o})`;t.fail$data((0,r._)`${u} ${c} ${s}`)}}}),dp=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uF(),n=uV();t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,n.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,n._)`{pattern: ${t}}`},code(t){let{gen:i,data:o,$data:s,schema:l,schemaCode:c,it:u}=t,d=u.opts.unicodeRegExp?"u":"";if(s){let{regExp:r}=u.opts.code,s="new RegExp"===r.code?(0,n._)`new RegExp`:(0,a.useFunc)(i,r),l=i.let("valid");i.try(()=>i.assign(l,(0,n._)`${s}(${c}, ${d}).test(${o})`),()=>i.assign(l,!1)),t.fail$data((0,n._)`!${l}`)}else{let a=(0,r.usePattern)(t,l);t.fail$data((0,n._)`!${a}.test(${o})`)}}}}),dm=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxProperties"===t?"more":"fewer"} than ${a} properties`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:i}=t,o="maxProperties"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`Object.keys(${n}).length ${o} ${i}`)}}}),dh=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uF();t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`},code(t){let{gen:i,schema:o,schemaCode:s,data:l,$data:c,it:u}=t,{opts:d}=u;if(!c&&0===o.length)return;let p=o.length>=d.loopRequired;if(u.allErrors?function(){if(p||c)t.block$data(a.nil,m);else for(let a of o)(0,r.checkReportMissingProp)(t,a)}():function(){let n=i.let("missing");if(p||c){let o=i.let("valid",!0);t.block$data(o,()=>{var c,u;return c=n,u=o,void(t.setParams({missingProperty:c}),i.forOf(c,s,()=>{i.assign(u,(0,r.propertyInData)(i,l,c,d.ownProperties)),i.if((0,a.not)(u),()=>{t.error(),i.break()})},a.nil))}),t.ok(o)}else i.if((0,r.checkMissingProp)(t,o,n)),(0,r.reportMissingProp)(t,n),i.else()}(),d.strictRequired){let r=t.parentSchema.properties,{definedProperties:a}=t.it;for(let t of o)if((null==r?void 0:r[t])===void 0&&!a.has(t)){let r=`required property "${t}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(u,r,u.opts.strictRequired)}}function m(){i.forOf("prop",s,a=>{t.setParams({missingProperty:a}),i.if((0,r.noPropertyInData)(i,l,a,d.ownProperties),()=>t.error())})}}}}),df=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:t,schemaCode:a})=>(0,r.str)`must NOT have ${"maxItems"===t?"more":"fewer"} than ${a} items`,params:({schemaCode:t})=>(0,r._)`{limit: ${t}}`},code(t){let{keyword:a,data:n,schemaCode:i}=t,o="maxItems"===a?r.operators.GT:r.operators.LT;t.fail$data((0,r._)`${n}.length ${o} ${i}`)}}}),dg=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u1();r.code='require("ajv/dist/runtime/equal").default',t.default=r}),dy=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uW(),a=uV(),n=uF(),i=dg();t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`},code(t){let{gen:o,data:s,$data:l,schema:c,parentSchema:u,schemaCode:d,it:p}=t;if(!l&&!c)return;let m=o.let("valid"),h=u.items?(0,r.getSchemaTypes)(u.items):[];t.block$data(m,function(){let l=o.let("i",(0,a._)`${s}.length`),c=o.let("j");t.setParams({i:l,j:c}),o.assign(m,!0),o.if((0,a._)`${l} > 1`,()=>(h.length>0&&!h.some(t=>"object"===t||"array"===t)?function(n,i){let l=o.name("item"),c=(0,r.checkDataTypes)(h,l,p.opts.strictNumbers,r.DataType.Wrong),u=o.const("indices",(0,a._)`{}`);o.for((0,a._)`;${n}--;`,()=>{o.let(l,(0,a._)`${s}[${n}]`),o.if(c,(0,a._)`continue`),h.length>1&&o.if((0,a._)`typeof ${l} == "string"`,(0,a._)`${l} += "_"`),o.if((0,a._)`typeof ${u}[${l}] == "number"`,()=>{o.assign(i,(0,a._)`${u}[${l}]`),t.error(),o.assign(m,!1).break()}).code((0,a._)`${u}[${l}] = ${n}`)})}:function(r,l){let c=(0,n.useFunc)(o,i.default),u=o.name("outer");o.label(u).for((0,a._)`;${r}--;`,()=>o.for((0,a._)`${l} = ${r}; ${l}--;`,()=>o.if((0,a._)`${c}(${s}[${r}], ${s}[${l}])`,()=>{t.error(),o.assign(m,!1).break(u)})))})(l,c))},(0,a._)`${d} === false`),t.ok(m)}}}),dv=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=dg();t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,r._)`{allowedValue: ${t}}`},code(t){let{gen:i,data:o,$data:s,schemaCode:l,schema:c}=t;s||c&&"object"==typeof c?t.fail$data((0,r._)`!${(0,a.useFunc)(i,n.default)}(${o}, ${l})`):t.fail((0,r._)`${c} !== ${o}`)}}}),d_=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=dg();t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,r._)`{allowedValues: ${t}}`},code(t){let i,o,{gen:s,data:l,$data:c,schema:u,schemaCode:d,it:p}=t;if(!c&&0===u.length)throw Error("enum must have non-empty array");let m=u.length>=p.opts.loopEnum,h=()=>null!=i?i:i=(0,a.useFunc)(s,n.default);if(m||c)o=s.let("valid"),t.block$data(o,function(){s.assign(o,!1),s.forOf("v",d,t=>s.if((0,r._)`${h()}(${l}, ${t})`,()=>s.assign(o,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let t=s.const("vSchema",d);o=(0,r.or)(...u.map((a,n)=>{var i,o;let s;return i=t,"object"==typeof(s=u[o=n])&&null!==s?(0,r._)`${h()}(${l}, ${i}[${o}])`:(0,r._)`${l} === ${s}`}))}t.pass(o)}}}),db=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dl(),a=dc(),n=dd(),i=dp(),o=dm(),s=dh(),l=df(),c=dy(),u=dv(),d=d_();t.default=[r.default,a.default,n.default,i.default,o.default,s.default,l.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default]}),dS=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let r=uV(),a=uF();function n(t,n){let{gen:i,schema:o,data:s,keyword:l,it:c}=t;c.items=!0;let u=i.const("len",(0,r._)`${s}.length`);if(!1===o)t.setParams({len:n.length}),t.pass((0,r._)`${u} <= ${n.length}`);else if("object"==typeof o&&!(0,a.alwaysValidSchema)(c,o)){let o=i.var("valid",(0,r._)`${u} <= ${n.length}`);i.if((0,r.not)(o),()=>{var s;return s=o,void i.forRange("i",n.length,u,n=>{t.subschema({keyword:l,dataProp:n,dataPropType:a.Type.Num},s),c.allErrors||i.if((0,r.not)(s),()=>i.break())})}),t.ok(o)}}t.validateAdditionalItems=n,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{parentSchema:r,it:i}=t,{items:o}=r;Array.isArray(o)?n(t,o):(0,a.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),d$=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let r=uV(),a=uF(),n=uX();function i(t,n,o=t.schema){let{gen:s,parentSchema:l,data:c,keyword:u,it:d}=t;(function(t){let{opts:r,errSchemaPath:i}=d,s=o.length,l=s===t.minItems&&(s===t.maxItems||!1===t[n]);if(r.strictTuples&&!l){let t=`"${u}" is ${s}-tuple, but minItems or maxItems/${n} are not specified or different at path "${i}"`;(0,a.checkStrictMode)(d,t,r.strictTuples)}})(l),d.opts.unevaluated&&o.length&&!0!==d.items&&(d.items=a.mergeEvaluated.items(s,o.length,d.items));let p=s.name("valid"),m=s.const("len",(0,r._)`${c}.length`);o.forEach((n,i)=>{(0,a.alwaysValidSchema)(d,n)||(s.if((0,r._)`${m} > ${i}`,()=>t.subschema({keyword:u,schemaProp:i,dataProp:i},p)),t.ok(p))})}t.validateTuple=i,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:r,it:o}=t;if(Array.isArray(r))return i(t,"additionalItems",r);o.items=!0,(0,a.alwaysValidSchema)(o,r)||t.ok((0,n.validateArray)(t))}}}),dw=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d$();t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,r.validateTuple)(t,"items")}}),dR=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=uX(),i=dS();t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{schema:r,parentSchema:o,it:s}=t,{prefixItems:l}=o;s.items=!0,(0,a.alwaysValidSchema)(s,r)||(l?(0,i.validateAdditionalItems)(t,l):t.ok((0,n.validateArray)(t)))}}}),dk=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:a}})=>void 0===a?(0,r.str)`must contain at least ${t} valid item(s)`:(0,r.str)`must contain at least ${t} and no more than ${a} valid item(s)`,params:({params:{min:t,max:a}})=>void 0===a?(0,r._)`{minContains: ${t}}`:(0,r._)`{minContains: ${t}, maxContains: ${a}}`},code(t){let n,i,{gen:o,schema:s,parentSchema:l,data:c,it:u}=t,{minContains:d,maxContains:p}=l;u.opts.next?(n=void 0===d?1:d,i=p):n=1;let m=o.const("len",(0,r._)`${c}.length`);if(t.setParams({min:n,max:i}),void 0===i&&0===n)return void(0,a.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&n>i){(0,a.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,a.alwaysValidSchema)(u,s)){let a=(0,r._)`${m} >= ${n}`;void 0!==i&&(a=(0,r._)`${a} && ${m} <= ${i}`),t.pass(a);return}u.items=!0;let h=o.name("valid");function f(){let t=o.name("_valid"),a=o.let("count",0);g(t,()=>o.if(t,()=>{var t;return t=a,void(o.code((0,r._)`${t}++`),void 0===i?o.if((0,r._)`${t} >= ${n}`,()=>o.assign(h,!0).break()):(o.if((0,r._)`${t} > ${i}`,()=>o.assign(h,!1).break()),1===n?o.assign(h,!0):o.if((0,r._)`${t} >= ${n}`,()=>o.assign(h,!0))))}))}function g(r,n){o.forRange("i",0,m,i=>{t.subschema({keyword:"contains",dataProp:i,dataPropType:a.Type.Num,compositeRule:!0},r),n()})}void 0===i&&1===n?g(h,()=>o.if(h,()=>o.break())):0===n?(o.let(h,!0),void 0!==i&&o.if((0,r._)`${c}.length > 0`,f)):(o.let(h,!1),f()),t.result(h,()=>t.reset())}}}),dx=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let r=uV(),a=uF(),n=uX();t.error={message:({params:{property:t,depsCount:a,deps:n}})=>(0,r.str)`must have ${1===a?"property":"properties"} ${n} when property ${t} is present`,params:({params:{property:t,depsCount:a,deps:n,missingProperty:i}})=>(0,r._)`{property: ${t},
|
|
59
|
+
missingProperty: ${i},
|
|
60
60
|
depsCount: ${a},
|
|
61
|
-
deps: ${i}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let i in t)"__proto__"!==i&&((Array.isArray(t[i])?r:a)[i]=t[i]);return[r,a]}(t);o(t,r),s(t,a)}};function o(t,a=t.schema){let{gen:n,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=n.let("missing");for(let o in a){let u=a[o];if(0===u.length)continue;let d=(0,i.propertyInData)(n,s,o,l.opts.ownProperties);t.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),l.allErrors?n.if(d,()=>{for(let r of u)(0,i.checkReportMissingProp)(t,r)}):(n.if((0,r._)`${d} && (${(0,i.checkMissingProp)(t,u,c)})`),(0,i.reportMissingProp)(t,c),n.else())}}function s(t,r=t.schema){let{gen:n,data:o,keyword:l,it:c}=t,u=n.name("valid");for(let s in r)(0,a.alwaysValidSchema)(c,r[s])||(n.if((0,i.propertyInData)(n,o,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>n.var(u,!0)),t.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=s,t.default=n}),d$=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t;if((0,a.alwaysValidSchema)(s,n))return;let l=i.name("valid");i.forIn("key",o,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),i.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||i.break()})}),t.ok(l)}}}),dw=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uB(),a=uz(),i=uZ(),n=uL();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:o,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:m}=d;if(d.props=!0,"all"!==m.removeAdditional&&(0,n.alwaysValidSchema)(d,s))return;let h=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function y(t){o.code((0,a._)`delete ${c}[${t}]`)}function g(r){if("all"===m.removeAdditional||m.removeAdditional&&!1===s)return void y(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||o.break();return}if("object"==typeof s&&!(0,n.alwaysValidSchema)(d,s)){let i=o.name("valid");"failing"===m.removeAdditional?(v(r,i,!1),o.if((0,a.not)(i),()=>{t.reset(),y(r)})):(v(r,i),p||o.if((0,a.not)(i),()=>o.break()))}}function v(r,a,i){let o={keyword:"additionalProperties",dataProp:r,dataPropType:n.Type.Str};!1===i&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}o.forIn("key",c,i=>{h.length||f.length?o.if(function(i){let s;if(h.length>8){let t=(0,n.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(o,t,i)}else s=h.length?(0,a.or)(...h.map(t=>(0,a._)`${i} === ${t}`)):a.nil;return f.length&&(s=(0,a.or)(s,...f.map(n=>(0,a._)`${(0,r.usePattern)(t,n)}.test(${i})`))),(0,a.not)(s)}(i),()=>g(i)):g(i)}),t.ok((0,a._)`${u} === ${i.default.errors}`)}}}),dR=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uQ(),a=uB(),i=uL(),n=dw();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&n.default.code(new r.KeywordCxt(u,n.default,"additionalProperties"));let d=(0,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=i.mergeEvaluated.props(o,(0,i.toHash)(d),u.props));let p=d.filter(t=>!(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let m=o.name("valid");for(let r of p){var h;(h=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[h].default)?f(r):(o.if((0,a.propertyInData)(o,c,r,u.opts.ownProperties)),f(r),u.allErrors||o.else().var(m,!0),o.endIf()),t.it.definedProperties.add(r),t.ok(m)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},m)}}}}),dk=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uB(),a=uz(),i=uL(),n=uL();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),m=p.filter(t=>(0,i.alwaysValidSchema)(u,s[t]));if(0===p.length||m.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=o.name("valid");!0===u.props||u.props instanceof a.Name||(u.props=(0,n.evaluatedPropsToName)(o,u.props));let{props:y}=u;for(let t of p)h&&function(t){for(let r in h)new RegExp(t).test(r)&&(0,i.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?g(t):(o.var(f,!0),g(t),o.if(f));function g(i){o.forIn("key",l,s=>{o.if((0,a._)`${(0,r.usePattern)(t,i)}.test(${s})`,()=>{let r=m.includes(i);r||t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:s,dataPropType:n.Type.Str},f),u.opts.unevaluated&&!0!==y?o.assign((0,a._)`${y}[${s}]`,!0):r||u.allErrors||o.if((0,a.not)(f),()=>o.break())})})}}}}),dx=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uL();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:i,it:n}=t;if((0,r.alwaysValidSchema)(n,i))return void t.fail();let o=a.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),dP=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uB().validateUnion,error:{message:"must match a schema in anyOf"}}}),dE=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:i,schema:n,parentSchema:o,it:s}=t;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;let l=i.let("valid",!1),c=i.let("passing",null),u=i.name("_valid");t.setParams({passing:c}),i.block(function(){n.forEach((n,o)=>{let d;(0,a.alwaysValidSchema)(s,n)?i.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&i.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${o}]`).else(),i.if(u,()=>{i.assign(l,!0),i.assign(c,o),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dT=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uL();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:i,it:n}=t;if(!Array.isArray(i))throw Error("ajv implementation error");let o=a.name("valid");i.forEach((a,i)=>{if((0,r.alwaysValidSchema)(n,a))return;let s=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(s)})}}}),dj=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL();function i(t,r){let i=t.schema[r];return void 0!==i&&!(0,a.alwaysValidSchema)(t,i)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let n,{gen:o,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=i(l,"then"),u=i(l,"else");if(!c&&!u)return;let d=o.let("valid",!0),p=o.name("_valid");if(n=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(n),t.reset(),c&&u){let r=o.let("ifClause");t.setParams({ifClause:r}),o.if(p,m("then",r),m("else",r))}else c?o.if(p,m("then")):o.if((0,r.not)(p),m("else"));function m(a,i){return()=>{let n=t.subschema({keyword:a},p);o.assign(d,p),t.mergeValidEvaluated(n,d),i?o.assign(i,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),dO=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uL();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:i}){void 0===a.if&&(0,r.checkStrictMode)(i,`"${t}" without "if" is ignored`)}}}),dC=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dy(),a=dv(),i=dg(),n=d_(),o=db(),s=dS(),l=d$(),c=dw(),u=dR(),d=dk(),p=dx(),m=dP(),h=dE(),f=dT(),y=dj(),g=dO();t.default=function(t=!1){let v=[p.default,m.default,h.default,f.default,y.default,g.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(a.default,n.default):v.push(r.default,i.default),v.push(o.default),v}}),dI=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let i,n,o,s,l,c,{gen:u,data:d,$data:p,schema:m,schemaCode:h,it:f}=t,{opts:y,errSchemaPath:g,schemaEnv:v,self:_}=f;y.validateFormats&&(p?(i=u.scopeValue("formats",{ref:_.formats,code:y.code.formats}),n=u.const("fDef",(0,r._)`${i}[${h}]`),o=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${n} == "object" && !(${n} instanceof RegExp)`,()=>u.assign(o,(0,r._)`${n}.type || "string"`).assign(s,(0,r._)`${n}.validate`),()=>u.assign(o,(0,r._)`"string"`).assign(s,n)),t.fail$data((0,r.or)(!1===y.strictSchema?r.nil:(0,r._)`${h} && !${s}`,(l=v.$async?(0,r._)`(${n}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${o} === ${a} && !${c}`)))):function(){var i;let n,o,s=_.formats[m];if(!s){if(!1===y.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${m}" ignored in schema at path "${g}"`}}if(!0===s)return;let[c,p,h]=(n=(i=s)instanceof RegExp?(0,r.regexpCode)(i):y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(m)}`:void 0,o=u.scopeValue("formats",{key:m,ref:i,code:n}),"object"!=typeof i||i instanceof RegExp?["string",i,o]:[i.type||"string",i.validate,(0,r._)`${o}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${h}(${d})`}return"function"==typeof p?(0,r._)`${h}(${d})`:(0,r._)`${h}.test(${d})`}())}())}}}),dN=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[dI().default]}),dq=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dA=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt(),a=df(),i=dC(),n=dN(),o=dq();t.default=[r.default,a.default,(0,i.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]}),dM=F(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),dz=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=dM(),i=u2(),n=u1(),o=uL();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:i}})=>(0,r._)`{error: ${t}, tag: ${i}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let m=c.propertyName;if("string"!=typeof m)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(m)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=i.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof i.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(d.opts.uriResolver,d.baseId,t)}let h=null==(t=null==u?void 0:u.properties)?void 0:t[m];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);s=s&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}(h,r)}if(!s)throw Error(`discriminator: "${m}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(m)}function c(t,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${m}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${f} === ${a}`),s.assign(h,function(a){let i=s.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:a},i);return t.mergeEvaluated(n,r.Name),i}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:f,tagName:m}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:f,tagName:m})),t.ok(h)}}}),dL=F((t,r)=>{r.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),dZ=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=u8(),i=dA(),n=dz(),o=dL(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=uQ();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uz();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=u0();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=u1();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),dD=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uz(),a=uZ(),i=u2(),n=de();function o(t,o){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[o]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(o)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:o}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=o.opts,p=new i.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return i.compileSchema.call(o,p),(0,n.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=o,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>o(t,t.schema)}}),dV=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uz(),a=uZ(),i=de();function n(t,n){let{gen:o,keyword:s,it:l}=t;if("#"!==n[0])throw Error(`"${s}" only supports hash fragment reference`);let c=n.slice(1);if(l.allErrors)u();else{let r=o.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let i=o.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);o.if(i,d(i,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>o.block(()=>{(0,i.callRef)(t,r),o.let(a,!0)}):()=>(0,i.callRef)(t,r)}}t.dynamicRef=n,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>n(t,t.schema)}}),dF=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dD(),a=uL();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dU=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dV();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dH=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dD(),a=dV(),i=dF(),n=dU();t.default=[r.default,a.default,i.default,n.default]}),dJ=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dS();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dB=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dS();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dK=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uL();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:i}){void 0===a.contains&&(0,r.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}}),dG=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=dB(),i=dK();t.default=[r.default,a.default,i.default]}),dW=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL(),i=uZ();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:n,schema:o,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(i){if(!1===o){t.setParams({unevaluatedProperty:i}),t.error(),u||n.break();return}if(!(0,a.alwaysValidSchema)(c,o)){let o=n.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:a.Type.Str},o),u||n.if((0,r.not)(o),()=>n.break())}}d instanceof r.Name?n.if((0,r._)`${d} !== true`,()=>n.forIn("key",s,t=>{var a,i;return n.if((a=d,i=t,(0,r._)`!${a} || !${a}[${i}]`),()=>p(t))})):!0!==d&&n.forIn("key",s,t=>void 0===d?p(t):n.if(function(t,a){let i=[];for(let n in t)!0===t[n]&&i.push((0,r._)`${a} !== ${n}`);return(0,r.and)(...i)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${i.default.errors}`)}}}),dY=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uz(),a=uL();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:i,schema:n,data:o,it:s}=t,l=s.items||0;if(!0===l)return;let c=i.const("len",(0,r._)`${o}.length`);if(!1===n)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof n&&!(0,a.alwaysValidSchema)(s,n)){let n=i.var("valid",(0,r._)`${c} <= ${l}`);i.if((0,r.not)(n),()=>{var o,u;return o=n,u=l,void i.forRange("i",u,c,n=>{t.subschema({keyword:"unevaluatedItems",dataProp:n,dataPropType:a.Type.Num},o),s.allErrors||i.if((0,r.not)(o),()=>i.break())})}),t.ok(n)}s.items=!0}}}),dX=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dW(),a=dY();t.default=[r.default,a.default]}),dQ=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),d0=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),d1=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),d2=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),d9=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),d4=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),d3=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),d6=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dQ(),a=d0(),i=d1(),n=d2(),o=d9(),s=d4(),l=d3(),c=["/properties"];t.default=function(t){return[r,a,i,n,u(this,o),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),d5=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=u8(),i=dA(),n=dH(),o=dG(),s=dX(),l=dz(),c=d6(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),i.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(o.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=uQ();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var m=uz();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=u0();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var f=u1();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),d8=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dt(),a=df(),i=dC(),n=dH(),o=dG(),s=dX(),l=dN(),c=dq();t.default=[n.default,r.default,a.default,(0,i.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,o.default,s.default]}),d7=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),pe=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),pt=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),pr=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),pa=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),pi=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),pn=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),po=F((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),ps=F(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d7(),a=pe(),i=pt(),n=pr(),o=pa(),s=pi(),l=pn(),c=po(),u=["/properties"];t.default=function(t){return[r,a,i,n,o,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),pl=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=u8(),i=d8(),n=dz(),o=ps(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(o.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=uQ();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uz();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=u0();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=u1();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),pc=F(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(n,o),time:r(l(!0),c),"date-time":r(p(!0),m),"iso-time":r(l(),u),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&y.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return g.lastIndex=0,g.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(t){var r;let n=a.exec(t);if(!n)return!1;let o=+n[1],s=+n[2],l=+n[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=o)%4==0&&(r%100!=0||r%400==0)?29:i[s])}function o(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let a=s.exec(r);if(!a)return!1;let i=+a[1],n=+a[2],o=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(i<=23&&n<=59&&o<60)return!0;let p=n-d*c,m=i-u*c-(p<0);return(23===m||-1===m)&&(59===p||-1===p)&&o<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+r).valueOf();if(a&&i)return a-i}function u(t,r){if(!(t&&r))return;let a=s.exec(t),i=s.exec(r);if(a&&i)return(t=a[1]+a[2]+a[3])>(r=i[1]+i[2]+i[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&n(a[0])&&r(a[1])}}function m(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),i=new Date(r).valueOf();if(a&&i)return a-i}function h(t,r){if(!(t&&r))return;let[a,i]=t.split(d),[n,s]=r.split(d),l=o(a,n);if(void 0!==l)return l||c(i,s)}let f=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),pu=F(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dZ(),a=uz(),i=a.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${n[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${n[t].okStr}, limit: ${r}}`},code(t){let i,o,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:m}=d;if(!p.validateFormats)return;let h=new r.KeywordCxt(d,m.RULES.all.format.definition,"format");function f(t){return(0,a._)`${t}.compare(${l}, ${c}) ${n[u].fail} 0`}h.$data?(i=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),o=s.const("fmt",(0,a._)`${i}[${h.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${o} != "object"`,(0,a._)`${o} instanceof RegExp`,(0,a._)`typeof ${o}.compare != "function"`,f(o)))):function(){let r=h.schema,i=m.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let n=s.scopeValue("formats",{key:r,ref:i,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(f(n))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),pd=F((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=pc(),i=pu(),n=uz(),o=new n.Name("fullFormats"),s=new n.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,o),t;let[n,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,o];return c(t,r.formats||a.formatNames,n,l),r.keywords&&(0,i.default)(t),t};function c(t,r,a,i){var o;for(let s of(null!=(o=t.opts.code).formats||(o.formats=(0,n._)`require("ajv-formats/dist/formats").${i}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let i=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!i)throw Error(`Unknown format "${t}"`);return i},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),pp=dZ(),pm=d5(),ph=pl();let pf=U(pd(),1).default;function py(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pf(r),r}var pg=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=py(ph.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(H.has(a))return"2020-12";if(J.has(a))return"2019-09";if(B.has(a)||K.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=py(pm.Ajv2019):this._ajvDraft7??=py(pp.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};pp.Ajv,require("node:process");let pv=Symbol.for("mcp.completable");function p_(t){return!!t&&"object"==typeof t&&pv in t}let pb=0x80000000-1;function pS(t,r){if(!Number.isFinite(t)||t<1)return;let a=setInterval(r,Math.min(t,pb));return a.unref?.(),a}var p$=class{_listeners=new Set;constructor(t){this.onerror=t}publish(t){for(let r of this._listeners)try{r(t)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}subscribe(t){this._listeners.add(t);let r=!0;return()=>{r&&(r=!1,this._listeners.delete(t))}}get listenerCount(){return this._listeners.size}};function pw(t,r,a){return Response.json({jsonrpc:"2.0",error:{code:r,message:a},id:t},{status:200})}function pR(t,r){return{method:t.method,params:{...t.params,_meta:{...t.params?._meta,[nK]:r}}}}function pk(t,r,a){if(null===a||"object"!=typeof a||"string"!=typeof a.method)throw new cp(cd.InternalError,`Handler for ${t} returned an invalid input request '${r}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let i=function(t){switch(t.method){case"elicitation/create":if(t.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let r=t.params;if(void 0!==r&&(void 0!==r.tools||void 0!==r.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(a);if(void 0===i)throw new cp(cd.InternalError,`Handler for ${t} returned an input request '${r}' of kind '${a.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:a,required:i}}function px(t,r){if("tools/call"===t)return{content:[{type:"text",text:r}],isError:!0};throw new cp(cd.InternalError,r)}var pP=class{constructor(t){this._host=t}async fulfill(t,r,a,i,n){let{maxRounds:o,roundTimeoutMs:s}=this._host,l=i.mcpReq.signal,c=n,u=0;for(;;){let n;if((u+=1)>o)return px(t,`Multi-round-trip request '${t}' still required input after ${o} rounds (inputRequired.maxRounds)`);let d=c.inputRequests,p=null!=d&&Object.keys(d).length>0,m="string"==typeof c.requestState?c.requestState:void 0;if(!p&&void 0===m)throw new cp(cd.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(p){let r=this._host.resolvedClientCapabilities(i),a=[];for(let[i,n]of Object.entries(d)){let{embedded:o,required:s}=pk(t,i,n);if("roots/list"!==o.method&&void 0===o.params)throw new cp(cd.InternalError,`Handler for ${t} returned an input request '${i}' of kind '${o.method}' without params`);if(void 0!==lH(s,r))return px(t,`Cannot request input '${i}' (${o.method}): the client on this 2025-era connection did not declare the required capability${void 0===r?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);a.push([i,o])}let o=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(l);try{let t={relatedRequestId:i.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:o.signal},r=await Promise.all(a.map(async([r,a])=>{try{return[r,await this._dispatchLeg(a,t)]}catch(t){throw o.abort(t),t}}));n=Object.fromEntries(r)}catch(r){if(l.aborted)throw r;return px(t,`Fulfilling input required by '${t}' failed: ${r instanceof Error?r.message:String(r)}`)}finally{o.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof lV?r.reason:new lV(lD.RequestTimeout,String(r.reason)));let i=setTimeout(()=>{r?.removeEventListener("abort",n),t()},250),n=()=>{clearTimeout(i),a(r?.reason instanceof lV?r.reason:new lV(lD.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",n,{once:!0})})}(0,l);let h={...i,mcpReq:{...i.mcpReq,inputResponses:n,droppedInputResponseKeys:void 0,requestState:function(t){return()=>t}(m)}};if(void 0!==m){let r=await this._host.verifyRequestState(m,h,t);void 0!==r&&(h=uk(h,r))}let f=await r(a,h);if(!cB(f))return f;c=f}}async _dispatchLeg(t,r){switch(t.method){case"elicitation/create":{let a=t.params;return"url"===a.mode&&void 0===a.elicitationId&&(a={...a,elicitationId:function(){let t=globalThis.crypto;if(t?.randomUUID!==void 0)return t.randomUUID();let r=new Uint8Array(16);t.getRandomValues(r),r[6]=15&r[6]|64,r[8]=63&r[8]|128;let a=[...r].map(t=>t.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}()}),await this._host.sendElicitation(a,r)}case"sampling/createMessage":return await this._host.sendSampling(t.params,r);case"roots/list":return await this._host.listRoots(t.params,r)}}};let pE=new Set(["tools/call","prompts/get","resources/read"]);var pT=class extends ux{_clientCapabilities;_clientVersion;static{d=(t,r)=>{void 0!==r.clientCapabilities&&(t._clientCapabilities=r.clientCapabilities),void 0!==r.clientInfo&&(t._clientVersion=r.clientInfo)},p=(t,r)=>{let a=r.filter(r=>!t._supportedProtocolVersions.includes(r));a.length>0&&(t._supportedProtocolVersions=[...t._supportedProtocolVersions,...a]),t.setRequestHandler("server/discover",()=>t._ondiscover())},m=t=>t._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pP({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:t=>this._inputRequestCapabilityView(t),verifyRequestState:(t,r,a)=>this._verifyRequestState(t,r,a),sendElicitation:(t,r)=>this._sendElicitationLeg(t,r,{validateAcceptedContent:!1}),sendSampling:(t,r)=>this.createMessage(t,r),listRoots:(t,r)=>this.listRoots(t,r)})}oninitialized;constructor(t,r){if(super(r),this._serverInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new pg,this._requestStateVerify=r?.requestState?.verify,this._inputRequiredServing=function(t){if(t?.maxRounds!==void 0&&(!Number.isInteger(t.maxRounds)||t.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${t.maxRounds})`);if(t?.roundTimeoutMs!==void 0&&(!Number.isFinite(t.roundTimeoutMs)||t.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${t.roundTimeoutMs})`);return{maxRounds:t?.maxRounds??8,roundTimeoutMs:t?.roundTimeoutMs??6e5,legacyShim:t?.legacyShim??!0}}(r?.inputRequired),r?.cacheHints!==void 0){for(const[t,a]of Object.entries(r.cacheHints))void 0!==a&&cu(a,`cacheHints['${t}']`);this._cacheHints=r.cacheHints}this.setRequestHandler("initialize",t=>this._oninitialize(t)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lK(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(t,r)=>{let a=r.sessionId||r.http?.req?.headers.get("mcp-session-id")||void 0,{level:i}=t.params,n=i_(sR,i);return n.success&&this._loggingLevels.set(a,n.data),{}})}buildContext(t,r){let a=t.http||r?.request||r?.closeSSEStream||r?.closeStandaloneSSEStream;return{...t,mcpReq:{...t.mcpReq,log:(r,a,i)=>{let n;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(n=t.mcpReq.envelope?.[nG]))return Promise.resolve()}else n=this._loggingLevels.get(t.sessionId)??this._loggingLevels.get(void 0);return void 0!==n&&this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n)?Promise.resolve():t.mcpReq.notify({method:"notifications/message",params:{level:r,data:a,logger:i}})},elicitInput:(t,r)=>this.elicitInput(t,r),requestSampling:(t,r)=>this.createMessage(t,r)},http:a?{...t.http,req:r?.request,closeSSE:r?.closeSSEStream,closeStandaloneSSE:r?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(sR.options.map((t,r)=>[t,r]));isMessageIgnored=(t,r)=>{let a=this._loggingLevels.get(r);return!!a&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(a)};registerCapabilities(t){if(this.transport)throw new lV(lD.AlreadyConnected,"Cannot register capabilities after connecting to transport");let r=!!this._capabilities.logging;this._capabilities=function(t,r){let a={...t};for(let t in r){let i=r[t];if(void 0===i)continue;let n=a[t];a[t]=uP(n)&&uP(i)?{...n,...i}:i}return a}(this._capabilities,t),!r&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(t,r){if("tools/call"!==t){let a=this._cacheHints?.[t],i=pE.has(t);return void 0!==a||i?async(n,o)=>{let s=i?await this._invokeInputRequiredCapableHandler(t,r,n,o):await r(n,o);if(cB(s)){if(!i)throw new cp(cd.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return void 0===a?s:cs(s,a)}:async(a,i)=>{let n=await r(a,i);if(cB(n))throw new cp(cd.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return n}}return async(t,a)=>{let i=cC(this._negotiatedProtocolVersion),n=i.validateRequest("tools/call",t);if(!n.ok)throw new cp("not-in-era"===n.reason?cd.InternalError:cd.InvalidParams,"not-in-era"===n.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${n.message}`);let o=await this._invokeInputRequiredCapableHandler("tools/call",r,t,a);if(cB(o))return o;let s=lY(o),l=i.validateResult("tools/call",s);if(!l.ok)throw new cp("not-in-era"===l.reason?cd.InternalError:cd.InvalidParams,"not-in-era"===l.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${l.message}`);return l.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lJ}async _invokeInputRequiredCapableHandler(t,r,a,i){let n,o=this._servedModernEra(),s=i.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cp(cd.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let l=i;if("string"==typeof s){let r=await this._verifyRequestState(s,i,t);void 0!==r&&(l=uk(i,r))}try{n=await r(a,l)}catch(t){if(t instanceof cp&&t.code===cd.UrlElicitationRequired){if(!o)throw t;throw new cp(cd.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 t}if(!cB(n))return n;if(!o){if(!this._inputRequiredServing.legacyShim)throw new cp(cd.InternalError,`Handler for ${t} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??nV}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(t,r,a,l,n)}let c=n.inputRequests,u=null!=c&&Object.keys(c).length>0,d="string"==typeof n.requestState;if(!u&&!d)throw new cp(cd.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let r=this._inputRequestCapabilityView(i);for(let[a,i]of Object.entries(c)){let{embedded:n,required:o}=pk(t,a,i),s=lH(o,r);if(void 0!==s)throw new cy({requiredCapabilities:s},`Cannot request input '${a}' (${n.method}): the request's client capabilities do not declare the required capability`)}}return n}async _verifyRequestState(t,r,a){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(t,r)}catch(t){throw this.onerror?.(Error(`requestState verification rejected ${a}: ${t instanceof Error?t.message:String(t)}`)),new cp(cd.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(t){return this._servedModernEra()?t.mcpReq.envelope?.[nB]:this._clientCapabilities}_assertPushApiInServedEra(t){if(this._servedModernEra())throw new lV(lD.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${t}' 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:t,era:"2026-07-28"})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new lV(lD.CapabilityNotSupported,`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lV(lD.CapabilityNotSupported,`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lV(lD.CapabilityNotSupported,`Client does not support listing roots (required for ${t})`)}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new lV(lD.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new lV(lD.CapabilityNotSupported,`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lV(lD.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new lV(lD.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new lV(lD.CapabilityNotSupported,`Client does not support URL elicitation (required for ${t})`)}}assertRequestHandlerCapability(t){switch(t){case"completion/complete":if(!this._capabilities.completions)throw new lV(lD.CapabilityNotSupported,`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lV(lD.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lV(lD.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new lV(lD.CapabilityNotSupported,`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lV(lD.CapabilityNotSupported,`Server does not support tools (required for ${t})`)}}async _oninitialize(t){let r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo;let a=this._supportedProtocolVersions.filter(t=>!(t>=lJ)),i=a.includes(r)?r:a[0]??nV;return this._negotiatedProtocolVersion=i,this.transport?.setProtocolVersion?.(i),{protocolVersion:i,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lK(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(t,r){return this._wireCodec().projectCallToolResult(t,r)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(t,r){if(this._assertPushApiInServedEra("sampling/createMessage"),(t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new lV(lD.CapabilityNotSupported,"Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages.at(-1),a=Array.isArray(r.content)?r.content:[r.content],i=a.some(t=>"tool_result"===t.type),n=t.messages.length>1?t.messages.at(-2):void 0,o=n?Array.isArray(n.content)?n.content:[n.content]:[],s=o.some(t=>"tool_use"===t.type);if(i){if(a.some(t=>"tool_result"!==t.type))throw new cp(cd.InvalidParams,"The last message must contain only tool_result content if any is present");if(!s)throw new cp(cd.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(s){let t=new Set(o.filter(t=>"tool_use"===t.type).map(t=>t.id)),r=new Set(a.filter(t=>"tool_result"===t.type).map(t=>t.toolUseId));if(t.size!==r.size||![...t].every(t=>r.has(t)))throw new cp(cd.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let a=!!(t.tools||t.toolChoice),i=await this.request({method:"sampling/createMessage",params:t},r),n=this._wireCodec().samplingResultVariant(a,i);if(!n.ok)throw new lV(lD.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===n.reason?n.message:n.reason}`);return n.value}async elicitInput(t,r){switch(this._assertPushApiInServedEra("elicitation/create"),t.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lV(lD.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lV(lD.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(t,r)}async _sendElicitationLeg(t,r,a){let i=t.mode??"form",n=a?.validateAcceptedContent??!0;switch(i){case"url":return this.request({method:"elicitation/create",params:t},r);case"form":{let a="form"===t.mode?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:a},r);if(n&&"accept"===i.action&&i.content&&a.requestedSchema)try{let t=this._jsonSchemaValidator.getValidator(a.requestedSchema)(i.content);if(!t.valid)throw new cp(cd.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(t){if(t instanceof cp)throw t;throw new cp(cd.InternalError,`Error validating elicitation response: ${t instanceof Error?t.message:String(t)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new lV(lD.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:t},r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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"})}},pj=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(t){let r=this._registeredTools[t];if(void 0!==r&&r.enabled){if(Object.hasOwn(this._toolInputSchemaJson,t))return this._toolInputSchemaJson[t];if(void 0===r.inputSchema)return pI;try{let a=us(r.inputSchema,"input");return this._toolInputSchemaJson[t]=a,a}catch{return}}}constructor(t,r){this.server=new pT(t,r),r?.capabilities?.tools&&this.setToolRequestHandlers(),r?.capabilities?.resources&&this.setResourceRequestHandlers(),r?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(t){return await this.server.connect(t)}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(([,t])=>t.enabled).map(([t,r])=>{let a={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?us(r.inputSchema,"input"):pI,annotations:r.annotations,icons:r.icons,execution:r.execution,_meta:r._meta};return r.outputSchema&&(a.outputSchema=us(r.outputSchema,"output")),a})})),this.server.setRequestHandler("tools/call",async(t,r)=>{let a=this._registeredTools[t.params.name];if(!a)throw new cp(cd.InvalidParams,`Tool ${t.params.name} not found`);if(!a.enabled)throw new cp(cd.InvalidParams,`Tool ${t.params.name} disabled`);try{let i=await this.validateToolInput(a,t.params.arguments,t.params.name),n=await this.executeToolHandler(a,i,r);if(await this.validateToolOutput(a,n,t.params.name),cB(n))return n;return this.server.projectCallToolResult(n,a.outputSchemaJson)}catch(t){if(t instanceof cp&&t.code===cd.UrlElicitationRequired)throw t;return this.createToolError(t instanceof Error?t.message:String(t))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,a){if(!t.inputSchema)return;let i=await ul(t.inputSchema,r??{});if(!i.success)throw new cp(cd.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${i.error}`);return i.data}async validateToolOutput(t,r,a){if(!t.outputSchema||cB(r)||r.isError)return;if(void 0===r.structuredContent)throw new cp(cd.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);let i=await ul(t.outputSchema,r.structuredContent);if(!i.success)throw new cp(cd.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${i.error}`)}async executeToolHandler(t,r,a){return t.executor(r,a)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async t=>{switch(t.params.ref.type){case"ref/prompt":if("ref/prompt"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`);return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":if("ref/resource"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`);return this.handleResourceCompletion(t,t.params.ref);default:throw new cp(cd.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let a=this._registeredPrompts[r.name];if(!a)throw new cp(cd.InvalidParams,`Prompt ${r.name} not found`);if(!a.enabled)throw new cp(cd.InvalidParams,`Prompt ${r.name} disabled`);if(!a.argsSchema)return pM;let i=pL(pz(a.argsSchema)?.[t.params.argument.name]);if(!p_(i))return pM;let n=i[pv]?.complete;return n?pA(await n(t.params.argument.value,t.params.context)):pM}async handleResourceCompletion(t,r){let a=Object.values(this._registeredResourceTemplates).find(t=>t.resourceTemplate.uriTemplate.toString()===r.uri);if(!a){if(this._registeredResources[r.uri])return pM;throw new cp(cd.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=a.resourceTemplate.completeCallback(t.params.argument.name);return i?pA(await i(t.params.argument.value,t.params.context)):pM}_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(t,r)=>{let a=Object.entries(this._registeredResources).filter(([t,r])=>r.enabled).map(([t,r])=>({uri:t,name:r.name,...r.metadata})),i=[];for(let t of Object.values(this._registeredResourceTemplates))if(t.resourceTemplate.listCallback)for(let a of(await t.resourceTemplate.listCallback(r)).resources)i.push({...t.metadata,...a});return{resources:[...a,...i]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler("resources/read",async(t,r)=>{let a;try{a=new URL(t.params.uri)}catch{throw new cp(cd.InvalidParams,`Resource URI ${t.params.uri} is invalid`,{uri:t.params.uri,reason:"invalid_uri"})}let i=this._registeredResources[a.toString()];if(i){if(!i.enabled)throw new cp(cd.InvalidParams,`Resource ${a} disabled`);return cs(await i.readCallback(a,r),i.cacheHint)}for(let t of Object.values(this._registeredResourceTemplates)){let i=t.resourceTemplate.uriTemplate.match(a.toString());if(i)return cs(await t.readCallback(a,i,r),t.cacheHint)}throw new cm(t.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(([,t])=>t.enabled).map(([t,r])=>{let a,i,n;return{name:t,title:r.title,description:r.description,arguments:r.argsSchema?(i=(a=us(r.argsSchema,"input")).properties||{},n=a.required||[],Object.entries(i).map(([t,r])=>({name:t,description:r?.description,required:n.includes(t)}))):void 0,icons:r.icons,_meta:r._meta}})})),this.server.setRequestHandler("prompts/get",async(t,r)=>{let a=this._registeredPrompts[t.params.name];if(!a)throw new cp(cd.InvalidParams,`Prompt ${t.params.name} not found`);if(!a.enabled)throw new cp(cd.InvalidParams,`Prompt ${t.params.name} disabled`);return a.handler(t.params.arguments,r)}),this._promptHandlersInitialized=!0)}registerResource(t,r,a,i){let n=a.cacheHint,o=a;if(void 0!==n){cu(n,`resource ${t}`);let r={...a};delete r.cacheHint,o=r}if("string"==typeof r){if(this._registeredResources[r])throw Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,a.title,r,o,i);return void 0!==n&&(s.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,a,i,n){let o={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:t=>{void 0!==t.uri&&t.uri!==a&&(delete this._registeredResources[a],t.uri&&(this._registeredResources[t.uri]=o)),void 0!==t.name&&(o.name=t.name),void 0!==t.title&&(o.title=t.title),void 0!==t.metadata&&(o.metadata=t.metadata),void 0!==t.callback&&(o.readCallback=t.callback),void 0!==t.enabled&&(o.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=o,o}_createRegisteredResourceTemplate(t,r,a,i,n){let o={resourceTemplate:a,title:r,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredResourceTemplates[t],r.name&&(this._registeredResourceTemplates[r.name]=o)),void 0!==r.title&&(o.title=r.title),void 0!==r.template&&(o.resourceTemplate=r.template),void 0!==r.metadata&&(o.metadata=r.metadata),void 0!==r.callback&&(o.readCallback=r.callback),void 0!==r.enabled&&(o.enabled=r.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=o;let s=a.uriTemplate.variableNames;return Array.isArray(s)&&s.some(t=>!!a.completeCallback(t))&&this.setCompletionRequestHandler(),o}_createRegisteredPrompt(t,r,a,i,n,o,s){let l=i,c=n,u={title:r,description:a,argsSchema:i,icons:o,_meta:s,handler:pq(t,i,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredPrompts[t],r.name&&(this._registeredPrompts[r.name]=u)),void 0!==r.title&&(u.title=r.title),void 0!==r.description&&(u.description=r.description),void 0!==r.icons&&(u.icons=r.icons),void 0!==r._meta&&(u._meta=r._meta);let a=!1;void 0!==r.argsSchema&&(u.argsSchema=r.argsSchema,l=r.argsSchema,a=!0),void 0!==r.callback&&(c=r.callback,a=!0),a&&(u.handler=pq(t,l,c)),void 0!==r.enabled&&(u.enabled=r.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[t]=u,i){let t=pz(i);t&&Object.values(t).some(t=>p_(pL(t)))&&this.setCompletionRequestHandler()}return u}_createRegisteredTool(t,r,a,i,n,o,s,l,c,u){if(uI(t),void 0!==i)try{let r=us(i,"input");this._toolInputSchemaJson[t]=r;let a=cY(r);a.valid||console.warn(`[mcp-sdk] tool '${t}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${a.reason}`)}catch{}let d=u,p={title:r,description:a,inputSchema:i,outputSchema:n,outputSchemaJson:pN(n),annotations:o,icons:s,execution:l,_meta:c,handler:u,executor:pC(i,u),enabled:!0,disable:()=>p.update({enabled:!1}),enable:()=>p.update({enabled:!0}),remove:()=>p.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&("string"==typeof r.name&&uI(r.name),delete this._registeredTools[t],delete this._toolInputSchemaJson[t],r.name&&(delete this._toolInputSchemaJson[r.name],this._registeredTools[r.name]=p,t=r.name)),void 0!==r.title&&(p.title=r.title),void 0!==r.description&&(p.description=r.description);let a=!1;void 0!==r.paramsSchema&&(p.inputSchema=r.paramsSchema,delete this._toolInputSchemaJson[t],a=!0),void 0!==r.callback&&(p.handler=r.callback,d=r.callback,a=!0),a&&(p.executor=pC(p.inputSchema,d)),void 0!==r.outputSchema&&(p.outputSchema=r.outputSchema,p.outputSchemaJson=pN(r.outputSchema)),void 0!==r.annotations&&(p.annotations=r.annotations),void 0!==r.icons&&(p.icons=r.icons),void 0!==r._meta&&(p._meta=r._meta),void 0!==r.enabled&&(p.enabled=r.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=p,this.setToolRequestHandlers(),this.sendToolListChanged(),p}registerTool(t,r,a){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:l,icons:c,_meta:u}=r;return this._createRegisteredTool(t,i,n,uq(o),uq(s),l,c,void 0,u,a)}registerPrompt(t,r,a){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:o,icons:s,_meta:l}=r,c=this._createRegisteredPrompt(t,i,n,uq(o),a,s,l);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},pO=class{_uriTemplate;constructor(t,r){this._callbacks=r,this._uriTemplate="string"==typeof t?new uN(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){return this._callbacks.complete?.[t]}};function pC(t,r){return t?async(t,a)=>r(t,a):async(t,a)=>r(a)}let pI={type:"object",properties:{}};function pN(t){if(void 0!==t)try{return us(t,"output")}catch{return}}function pq(t,r,a){return r?async(i,n)=>{let o=await ul(r,i);if(!o.success)throw new cp(cd.InvalidParams,`Invalid arguments for prompt ${t}: ${o.error}`);return a(o.data,n)}:async(t,r)=>a(r)}function pA(t){return{completion:{values:t.map(String).slice(0,100),total:t.length,hasMore:t.length>100}}}let pM={completion:{values:[],hasMore:!1}};function pz(t){if(t.shape&&"object"==typeof t.shape)return t.shape}function pL(t){return t?.type!=="optional"?t:t.def?.innerType??t}var pZ=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(t){this._classification=t.classification,this._responseMode=t.responseMode??"auto",this._keepAliveMs=t.keepAliveMs??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(t,r){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 a=r?.request?.signal;if(a?.aborted)throw await this.close(),new lV(lD.ConnectionClosed,"The request was aborted before it could be handled");let i={classification:this._classification,...r?.request!==void 0&&{request:r.request},...r?.authInfo!==void 0&&{authInfo:r.authInfo}};if(cF(t)){let r,n;this._requestId=t.id;let o=new Promise((t,a)=>{r=t,n=a});if(this._deferredResponse={promise:o,resolve:r,reject:n,settled:!1},void 0!==a){let t=()=>void this.close();a.addEventListener("abort",t,{once:!0}),this._abortCleanup=()=>a.removeEventListener("abort",t)}this._dispatchWindowOpen=!0;try{this.onmessage(t,i)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),o}return this.onmessage(t,i),new Response(null,{status:202})}async send(t,r){if(this._closed)return;let a=cH(t)||cJ(t),i=a?t.id:r?.relatedRequestId;if(void 0===this._requestId||void 0===i||i!==this._requestId){a&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(t.id)}`));return}if(a){if(this._terminalDelivered)return;this._terminalDelivered=!0;let r=cJ(t)?t.error.code:void 0,a=void 0!==r&&(this._dispatchWindowOpen||r===cd.MissingRequiredClientCapability)?c6[r]:void 0;if(void 0!==a&&void 0===this._sse){this.settleResponse(Response.json(t,{status:a,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(t),this.finalizeStream();return}this.settleResponse(Response.json(t,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(t))}writeCommentFrame(t){if(this._closed||void 0===this._sse||this._sse.closed)return;let r=t.split("\n").map(t=>`: ${t}`).join("\n");this.writeFrame(`${r}
|
|
61
|
+
deps: ${n}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(t){let[r,a]=function({schema:t}){let r={},a={};for(let n in t)"__proto__"!==n&&((Array.isArray(t[n])?r:a)[n]=t[n]);return[r,a]}(t);o(t,r),s(t,a)}};function o(t,a=t.schema){let{gen:i,data:s,it:l}=t;if(0===Object.keys(a).length)return;let c=i.let("missing");for(let o in a){let u=a[o];if(0===u.length)continue;let d=(0,n.propertyInData)(i,s,o,l.opts.ownProperties);t.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),l.allErrors?i.if(d,()=>{for(let r of u)(0,n.checkReportMissingProp)(t,r)}):(i.if((0,r._)`${d} && (${(0,n.checkMissingProp)(t,u,c)})`),(0,n.reportMissingProp)(t,c),i.else())}}function s(t,r=t.schema){let{gen:i,data:o,keyword:l,it:c}=t,u=i.name("valid");for(let s in r)(0,a.alwaysValidSchema)(c,r[s])||(i.if((0,n.propertyInData)(i,o,s,c.opts.ownProperties),()=>{let r=t.subschema({keyword:l,schemaProp:s},u);t.mergeValidEvaluated(r,u)},()=>i.var(u,!0)),t.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=s,t.default=i}),dP=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,r._)`{propertyName: ${t.propertyName}}`},code(t){let{gen:n,schema:i,data:o,it:s}=t;if((0,a.alwaysValidSchema)(s,i))return;let l=n.name("valid");n.forIn("key",o,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},l),n.if((0,r.not)(l),()=>{t.error(!0),s.allErrors||n.break()})}),t.ok(l)}}}),dE=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uH(),i=uF();t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`},code(t){let{gen:o,schema:s,parentSchema:l,data:c,errsCount:u,it:d}=t;if(!u)throw Error("ajv implementation error");let{allErrors:p,opts:m}=d;if(d.props=!0,"all"!==m.removeAdditional&&(0,i.alwaysValidSchema)(d,s))return;let h=(0,r.allSchemaProperties)(l.properties),f=(0,r.allSchemaProperties)(l.patternProperties);function g(t){o.code((0,a._)`delete ${c}[${t}]`)}function y(r){if("all"===m.removeAdditional||m.removeAdditional&&!1===s)return void g(r);if(!1===s){t.setParams({additionalProperty:r}),t.error(),p||o.break();return}if("object"==typeof s&&!(0,i.alwaysValidSchema)(d,s)){let n=o.name("valid");"failing"===m.removeAdditional?(v(r,n,!1),o.if((0,a.not)(n),()=>{t.reset(),g(r)})):(v(r,n),p||o.if((0,a.not)(n),()=>o.break()))}}function v(r,a,n){let o={keyword:"additionalProperties",dataProp:r,dataPropType:i.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(o,a)}o.forIn("key",c,n=>{h.length||f.length?o.if(function(n){let s;if(h.length>8){let t=(0,i.schemaRefOrVal)(d,l.properties,"properties");s=(0,r.isOwnProperty)(o,t,n)}else s=h.length?(0,a.or)(...h.map(t=>(0,a._)`${n} === ${t}`)):a.nil;return f.length&&(s=(0,a.or)(s,...f.map(i=>(0,a._)`${(0,r.usePattern)(t,i)}.test(${n})`))),(0,a.not)(s)}(n),()=>y(n)):y(n)}),t.ok((0,a._)`${u} === ${n.default.errors}`)}}}),dT=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=u4(),a=uX(),n=uF(),i=dE();t.default={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,parentSchema:l,data:c,it:u}=t;"all"===u.opts.removeAdditional&&void 0===l.additionalProperties&&i.default.code(new r.KeywordCxt(u,i.default,"additionalProperties"));let d=(0,a.allSchemaProperties)(s);for(let t of d)u.definedProperties.add(t);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=n.mergeEvaluated.props(o,(0,n.toHash)(d),u.props));let p=d.filter(t=>!(0,n.alwaysValidSchema)(u,s[t]));if(0===p.length)return;let m=o.name("valid");for(let r of p){var h;(h=r,u.opts.useDefaults&&!u.compositeRule&&void 0!==s[h].default)?f(r):(o.if((0,a.propertyInData)(o,c,r,u.opts.ownProperties)),f(r),u.allErrors||o.else().var(m,!0),o.endIf()),t.it.definedProperties.add(r),t.ok(m)}function f(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},m)}}}}),dj=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uX(),a=uV(),n=uF(),i=uF();t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:o,schema:s,data:l,parentSchema:c,it:u}=t,{opts:d}=u,p=(0,r.allSchemaProperties)(s),m=p.filter(t=>(0,n.alwaysValidSchema)(u,s[t]));if(0===p.length||m.length===p.length&&(!u.opts.unevaluated||!0===u.props))return;let h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=o.name("valid");!0===u.props||u.props instanceof a.Name||(u.props=(0,i.evaluatedPropsToName)(o,u.props));let{props:g}=u;for(let t of p)h&&function(t){for(let r in h)new RegExp(t).test(r)&&(0,n.checkStrictMode)(u,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}(t),u.allErrors?y(t):(o.var(f,!0),y(t),o.if(f));function y(n){o.forIn("key",l,s=>{o.if((0,a._)`${(0,r.usePattern)(t,n)}.test(${s})`,()=>{let r=m.includes(n);r||t.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:i.Type.Str},f),u.opts.unevaluated&&!0!==g?o.assign((0,a._)`${g}[${s}]`,!0):r||u.allErrors||o.if((0,a.not)(f),()=>o.break())})})}}}}),dO=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:a,schema:n,it:i}=t;if((0,r.alwaysValidSchema)(i,n))return void t.fail();let o=a.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}}}),dC=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uX().validateUnion,error:{message:"must match a schema in anyOf"}}}),dI=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,r._)`{passingSchemas: ${t.passing}}`},code(t){let{gen:n,schema:i,parentSchema:o,it:s}=t;if(!Array.isArray(i))throw Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;let l=n.let("valid",!1),c=n.let("passing",null),u=n.name("_valid");t.setParams({passing:c}),n.block(function(){i.forEach((i,o)=>{let d;(0,a.alwaysValidSchema)(s,i)?n.var(u,!0):d=t.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&n.if((0,r._)`${u} && ${l}`).assign(l,!1).assign(c,(0,r._)`[${c}, ${o}]`).else(),n.if(u,()=>{n.assign(l,!0),n.assign(c,o),d&&t.mergeEvaluated(d,r.Name)})})}),t.result(l,()=>t.reset(),()=>t.error(!0))}}}),dN=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:"allOf",schemaType:"array",code(t){let{gen:a,schema:n,it:i}=t;if(!Array.isArray(n))throw Error("ajv implementation error");let o=a.name("valid");n.forEach((a,n)=>{if((0,r.alwaysValidSchema)(i,a))return;let s=t.subschema({keyword:"allOf",schemaProp:n},o);t.ok(o),t.mergeEvaluated(s)})}}}),dq=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();function n(t,r){let n=t.schema[r];return void 0!==n&&!(0,a.alwaysValidSchema)(t,n)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,r.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,r._)`{failingKeyword: ${t.ifClause}}`},code(t){let i,{gen:o,parentSchema:s,it:l}=t;void 0===s.then&&void 0===s.else&&(0,a.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=n(l,"then"),u=n(l,"else");if(!c&&!u)return;let d=o.let("valid",!0),p=o.name("_valid");if(i=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p),t.mergeEvaluated(i),t.reset(),c&&u){let r=o.let("ifClause");t.setParams({ifClause:r}),o.if(p,m("then",r),m("else",r))}else c?o.if(p,m("then")):o.if((0,r.not)(p),m("else"));function m(a,n){return()=>{let i=t.subschema({keyword:a},p);o.assign(d,p),t.mergeValidEvaluated(i,d),n?o.assign(n,(0,r._)`${a}`):t.setParams({ifClause:a})}}t.pass(d,()=>t.error(!0))}}}),dA=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:a,it:n}){void 0===a.if&&(0,r.checkStrictMode)(n,`"${t}" without "if" is ignored`)}}}),dM=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dS(),a=dw(),n=d$(),i=dR(),o=dk(),s=dx(),l=dP(),c=dE(),u=dT(),d=dj(),p=dO(),m=dC(),h=dI(),f=dN(),g=dq(),y=dA();t.default=function(t=!1){let v=[p.default,m.default,h.default,f.default,g.default,y.default,l.default,c.default,s.default,u.default,d.default];return t?v.push(a.default,i.default):v.push(r.default,n.default),v.push(o.default),v}}),dz=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV();t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,r._)`{format: ${t}}`},code(t,a){let n,i,o,s,l,c,{gen:u,data:d,$data:p,schema:m,schemaCode:h,it:f}=t,{opts:g,errSchemaPath:y,schemaEnv:v,self:_}=f;g.validateFormats&&(p?(n=u.scopeValue("formats",{ref:_.formats,code:g.code.formats}),i=u.const("fDef",(0,r._)`${n}[${h}]`),o=u.let("fType"),s=u.let("format"),u.if((0,r._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(o,(0,r._)`${i}.type || "string"`).assign(s,(0,r._)`${i}.validate`),()=>u.assign(o,(0,r._)`"string"`).assign(s,i)),t.fail$data((0,r.or)(!1===g.strictSchema?r.nil:(0,r._)`${h} && !${s}`,(l=v.$async?(0,r._)`(${i}.async ? await ${s}(${d}) : ${s}(${d}))`:(0,r._)`${s}(${d})`,c=(0,r._)`(typeof ${s} == "function" ? ${l} : ${s}.test(${d}))`,(0,r._)`${s} && ${s} !== true && ${o} === ${a} && !${c}`)))):function(){var n;let i,o,s=_.formats[m];if(!s){if(!1===g.strictSchema)return _.logger.warn(l());throw Error(l());function l(){return`unknown format "${m}" ignored in schema at path "${y}"`}}if(!0===s)return;let[c,p,h]=(i=(n=s)instanceof RegExp?(0,r.regexpCode)(n):g.code.formats?(0,r._)`${g.code.formats}${(0,r.getProperty)(m)}`:void 0,o=u.scopeValue("formats",{key:m,ref:n,code:i}),"object"!=typeof n||n instanceof RegExp?["string",n,o]:[n.type||"string",n.validate,(0,r._)`${o}.validate`]);c===a&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!v.$async)throw Error("async format in sync schema");return(0,r._)`await ${h}(${d})`}return"function"==typeof p?(0,r._)`${h}(${d})`:(0,r._)`${h}.test(${d})`}())}())}}}),dL=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=[dz().default]}),dZ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),dD=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ds(),a=db(),n=dM(),i=dL(),o=dZ();t.default=[r.default,a.default,(0,n.default)(),i.default,o.metadataVocabulary,o.contentVocabulary]}),dU=H(t=>{var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"}),dV=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=dU(),n=u5(),i=u6(),o=uF();t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:a,tagName:n}})=>(0,r._)`{error: ${t}, tag: ${n}, tagValue: ${a}}`},code(t){let{gen:s,data:l,schema:c,parentSchema:u,it:d}=t,{oneOf:p}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let m=c.propertyName;if("string"!=typeof m)throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!p)throw Error("discriminator: requires oneOf keyword");let h=s.let("valid",!1),f=s.const("tag",(0,r._)`${l}${(0,r.getProperty)(m)}`);s.if((0,r._)`typeof ${f} == "string"`,()=>(function(){let l=function(){var t;let r={},a=l(u),s=!0;for(let r=0;r<p.length;r++){let u=p[r];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let t=u.$ref;if((u=n.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,t))instanceof n.SchemaEnv&&(u=u.schema),void 0===u)throw new i.default(d.opts.uriResolver,d.baseId,t)}let h=null==(t=null==u?void 0:u.properties)?void 0:t[m];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);s=s&&(a||l(u)),function(t,r){if(t.const)c(t.const,r);else if(t.enum)for(let a of t.enum)c(a,r);else throw Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}(h,r)}if(!s)throw Error(`discriminator: "${m}" must be required`);return r;function l({required:t}){return Array.isArray(t)&&t.includes(m)}function c(t,a){if("string"!=typeof t||t in r)throw Error(`discriminator: "${m}" values must be unique strings`);r[t]=a}}();for(let a in s.if(!1),l)s.elseIf((0,r._)`${f} === ${a}`),s.assign(h,function(a){let n=s.name("valid"),i=t.subschema({keyword:"oneOf",schemaProp:a},n);return t.mergeEvaluated(i,r.Name),n}(l[a]));s.else(),t.error(!1,{discrError:a.DiscrError.Mapping,tag:f,tagName:m}),s.endIf()})(),()=>t.error(!1,{discrError:a.DiscrError.Tag,tag:f,tagName:m})),t.ok(h)}}}),dF=H((t,r)=>{r.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),dH=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=da(),n=dD(),i=dV(),o=dF(),s=["/properties"],l="http://json-schema.org/draft-07/schema";var c=class extends a.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(t,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};t.Ajv=c,r.exports=t=c,r.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),dJ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;let r=uV(),a=uH(),n=u5(),i=di();function o(t,o){let{gen:s,it:l}=t;l.schemaEnv.root.dynamicAnchors[o]=!0;let c=(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(o)}`,u="#"===l.errSchemaPath?l.validateName:function(t){let{schemaEnv:r,schema:a,self:o}=t.it,{root:s,baseId:l,localRefs:c,meta:u}=r.root,{schemaId:d}=o.opts,p=new n.SchemaEnv({schema:a,schemaId:d,root:s,baseId:l,localRefs:c,meta:u});return n.compileSchema.call(o,p),(0,i.getValidate)(t,p)}(t);s.if((0,r._)`!${c}`,()=>s.assign(c,u))}t.dynamicAnchor=o,t.default={keyword:"$dynamicAnchor",schemaType:"string",code:t=>o(t,t.schema)}}),dB=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;let r=uV(),a=uH(),n=di();function i(t,i){let{gen:o,keyword:s,it:l}=t;if("#"!==i[0])throw Error(`"${s}" only supports hash fragment reference`);let c=i.slice(1);if(l.allErrors)u();else{let r=o.let("valid",!1);u(r),t.ok(r)}function u(t){if(l.schemaEnv.root.dynamicAnchors[c]){let n=o.let("_v",(0,r._)`${a.default.dynamicAnchors}${(0,r.getProperty)(c)}`);o.if(n,d(n,t),d(l.validateName,t))}else d(l.validateName,t)()}function d(r,a){return a?()=>o.block(()=>{(0,n.callRef)(t,r),o.let(a,!0)}):()=>(0,n.callRef)(t,r)}}t.dynamicRef=i,t.default={keyword:"$dynamicRef",schemaType:"string",code:t=>i(t,t.schema)}}),dK=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=uF();t.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,r.dynamicAnchor)(t,""):(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}}}),dG=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dB();t.default={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,r.dynamicRef)(t,t.schema)}}),dW=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dJ(),a=dB(),n=dK(),i=dG();t.default=[r.default,a.default,n.default,i.default]}),dY=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dx();t.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:t=>(0,r.validatePropertyDeps)(t)}}),dX=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dx();t.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,r.validateSchemaDeps)(t)}}),dQ=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uF();t.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:a,it:n}){void 0===a.contains&&(0,r.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}}}),d0=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=dY(),a=dX(),n=dQ();t.default=[r.default,a.default,n.default]}),d1=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF(),n=uH();t.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>(0,r._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(t){let{gen:i,schema:o,data:s,errsCount:l,it:c}=t;if(!l)throw Error("ajv implementation error");let{allErrors:u,props:d}=c;function p(n){if(!1===o){t.setParams({unevaluatedProperty:n}),t.error(),u||i.break();return}if(!(0,a.alwaysValidSchema)(c,o)){let o=i.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:n,dataPropType:a.Type.Str},o),u||i.if((0,r.not)(o),()=>i.break())}}d instanceof r.Name?i.if((0,r._)`${d} !== true`,()=>i.forIn("key",s,t=>{var a,n;return i.if((a=d,n=t,(0,r._)`!${a} || !${a}[${n}]`),()=>p(t))})):!0!==d&&i.forIn("key",s,t=>void 0===d?p(t):i.if(function(t,a){let n=[];for(let i in t)!0===t[i]&&n.push((0,r._)`${a} !== ${i}`);return(0,r.and)(...n)}(d,t),()=>p(t))),c.props=!0,t.ok((0,r._)`${l} === ${n.default.errors}`)}}}),d2=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=uV(),a=uF();t.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>(0,r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,r._)`{limit: ${t}}`},code(t){let{gen:n,schema:i,data:o,it:s}=t,l=s.items||0;if(!0===l)return;let c=n.const("len",(0,r._)`${o}.length`);if(!1===i)t.setParams({len:l}),t.fail((0,r._)`${c} > ${l}`);else if("object"==typeof i&&!(0,a.alwaysValidSchema)(s,i)){let i=n.var("valid",(0,r._)`${c} <= ${l}`);n.if((0,r.not)(i),()=>{var o,u;return o=i,u=l,void n.forRange("i",u,c,i=>{t.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:a.Type.Num},o),s.allErrors||n.if((0,r.not)(o),()=>n.break())})}),t.ok(i)}s.items=!0}}}),d9=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d1(),a=d2();t.default=[r.default,a.default]}),d4=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),d3=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),d6=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),d5=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),d7=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),d8=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),pe=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),pt=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=d4(),a=d3(),n=d6(),i=d5(),o=d7(),s=d8(),l=pe(),c=["/properties"];t.default=function(t){return[r,a,n,i,u(this,o),s,u(this,l)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function u(r,a){return t?r.$dataMetaSchema(a,c):a}}}),pr=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2019=void 0;let a=da(),n=dD(),i=dW(),o=d0(),s=d9(),l=dV(),c=pt(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),n.default.forEach(t=>this.addVocabulary(t)),this.addVocabulary(o.default),this.addVocabulary(s.default),this.opts.discriminator&&this.addKeyword(l.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(c.default.call(this,t),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};t.Ajv2019=d,r.exports=t=d,r.exports.Ajv2019=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var p=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var m=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var f=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),pa=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=ds(),a=db(),n=dM(),i=dW(),o=d0(),s=d9(),l=dL(),c=dZ();t.default=[i.default,r.default,a.default,(0,n.default)(!0),l.default,c.metadataVocabulary,c.contentVocabulary,o.default,s.default]}),pn=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),pi=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),po=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),ps=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),pl=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),pc=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),pu=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),pd=H((t,r)=>{r.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),pp=H(t=>{Object.defineProperty(t,"__esModule",{value:!0});let r=pn(),a=pi(),n=po(),i=ps(),o=pl(),s=pc(),l=pu(),c=pd(),u=["/properties"];t.default=function(t){return[r,a,n,i,o,d(this,s),l,d(this,c)].forEach(t=>this.addMetaSchema(t,void 0,!1)),this;function d(r,a){return t?r.$dataMetaSchema(a,u):a}}}),pm=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;let a=da(),n=pa(),i=dV(),o=pp(),s="https://json-schema.org/draft/2020-12/schema";var l=class extends a.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(o.default.call(this,t),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};t.Ajv2020=l,r.exports=t=l,r.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=u4();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=uV();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=u3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=u6();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),ph=H(t=>{function r(t,r){return{validate:t,compare:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,o),time:r(l(!0),c),"date-time":r(p(!0),m),"iso-time":r(l(),u),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&g.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(S.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return y.lastIndex=0,y.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=_&&t>=v}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(t){var r;let i=a.exec(t);if(!i)return!1;let o=+i[1],s=+i[2],l=+i[3];return s>=1&&s<=12&&l>=1&&l<=(2===s&&(r=o)%4==0&&(r%100!=0||r%400==0)?29:n[s])}function o(t,r){if(t&&r)return t>r?1:t<r?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(t){return function(r){let a=s.exec(r);if(!a)return!1;let n=+a[1],i=+a[2],o=+a[3],l=a[4],c="-"===a[5]?-1:1,u=+(a[6]||0),d=+(a[7]||0);if(u>23||d>59||t&&!l)return!1;if(n<=23&&i<=59&&o<60)return!0;let p=i-d*c,m=n-u*c-(p<0);return(23===m||-1===m)&&(59===p||-1===p)&&o<61}}function c(t,r){if(!(t&&r))return;let a=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+r).valueOf();if(a&&n)return a-n}function u(t,r){if(!(t&&r))return;let a=s.exec(t),n=s.exec(r);if(a&&n)return(t=a[1]+a[2]+a[3])>(r=n[1]+n[2]+n[3])?1:t<r?-1:0}let d=/t|\s/i;function p(t){let r=l(t);return function(t){let a=t.split(d);return 2===a.length&&i(a[0])&&r(a[1])}}function m(t,r){if(!(t&&r))return;let a=new Date(t).valueOf(),n=new Date(r).valueOf();if(a&&n)return a-n}function h(t,r){if(!(t&&r))return;let[a,n]=t.split(d),[i,s]=r.split(d),l=o(a,i);if(void 0!==l)return l||c(n,s)}let f=/\/|:/,g=/^(?:[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,v=-0x80000000,_=0x80000000-1;function b(){return!0}let S=/[^\\]\\Z/}),pf=H(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let r=dH(),a=uV(),n=a.operators,i={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}};t.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:t,schemaCode:r})=>(0,a.str)`should be ${i[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,a._)`{comparison: ${i[t].okStr}, limit: ${r}}`},code(t){let n,o,{gen:s,data:l,schemaCode:c,keyword:u,it:d}=t,{opts:p,self:m}=d;if(!p.validateFormats)return;let h=new r.KeywordCxt(d,m.RULES.all.format.definition,"format");function f(t){return(0,a._)`${t}.compare(${l}, ${c}) ${i[u].fail} 0`}h.$data?(n=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),o=s.const("fmt",(0,a._)`${n}[${h.schemaCode}]`),t.fail$data((0,a.or)((0,a._)`typeof ${o} != "object"`,(0,a._)`${o} instanceof RegExp`,(0,a._)`typeof ${o}.compare != "function"`,f(o)))):function(){let r=h.schema,n=m.formats[r];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw Error(`"${u}": format "${r}" does not define "compare" function`);let i=s.scopeValue("formats",{key:r,ref:n,code:p.code.formats?(0,a._)`${p.code.formats}${(0,a.getProperty)(r)}`:void 0});t.fail$data(f(i))}()},dependencies:["format"]},t.default=r=>(r.addKeyword(t.formatLimitDefinition),r)}),pg=H((t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=ph(),n=pf(),i=uV(),o=new i.Name("fullFormats"),s=new i.Name("fastFormats"),l=(t,r={keywords:!0})=>{if(Array.isArray(r))return c(t,r,a.fullFormats,o),t;let[i,l]="fast"===r.mode?[a.fastFormats,s]:[a.fullFormats,o];return c(t,r.formats||a.formatNames,i,l),r.keywords&&(0,n.default)(t),t};function c(t,r,a,n){var o;for(let s of(null!=(o=t.opts.code).formats||(o.formats=(0,i._)`require("ajv-formats/dist/formats").${n}`),r))t.addFormat(s,a[s])}l.get=(t,r="full")=>{let n=("fast"===r?a.fastFormats:a.fullFormats)[t];if(!n)throw Error(`Unknown format "${t}"`);return n},r.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l}),py=dH(),pv=pr(),p_=pm();let pb=J(pg(),1).default;function pS(t){let r=new t({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pb(r),r}var p$=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(t){this._userAjv=void 0!==t,this._ajv=t}get ajv(){return this._ajv??=pS(p_.Ajv2020)}_engineFor(t){if(this._userAjv)return this.ajv;let r=function(t,r){if(!("$schema"in t)||"string"!=typeof t.$schema)return"2020-12";let a=t.$schema.replace(/#$/,"");if(B.has(a))return"2020-12";if(K.has(a))return"2019-09";if(G.has(a)||W.has(a))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${r}`)}(t,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===r?this.ajv:"2019-09"===r?this._ajv2019??=pS(pv.Ajv2019):this._ajvDraft7??=pS(py.Ajv)}getValidator(t){let r=this._engineFor(t),a="$id"in t&&"string"==typeof t.$id?r.getSchema(t.$id)??r.compile(t):r.compile(t);return t=>a(t)?{valid:!0,data:t,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errorsText(a.errors)}}};py.Ajv,require("node:process");let pw=Symbol.for("mcp.completable");function pR(t){return!!t&&"object"==typeof t&&pw in t}let pk=0x80000000-1;function px(t,r){if(!Number.isFinite(t)||t<1)return;let a=setInterval(r,Math.min(t,pk));return a.unref?.(),a}var pP=class{_listeners=new Set;constructor(t){this.onerror=t}publish(t){for(let r of this._listeners)try{r(t)}catch(t){this.onerror?.(t instanceof Error?t:Error(String(t)))}}subscribe(t){this._listeners.add(t);let r=!0;return()=>{r&&(r=!1,this._listeners.delete(t))}}get listenerCount(){return this._listeners.size}};function pE(t,r,a){return Response.json({jsonrpc:"2.0",error:{code:r,message:a},id:t},{status:200})}function pT(t,r){return{method:t.method,params:{...t.params,_meta:{...t.params?._meta,[iW]:r}}}}function pj(t){return t.replaceAll(/[\\"]/g,String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g," ")}function pO(t,r,a,n){let i=`Bearer error="${pj(t)}", error_description="${pj(r)}"`;return a.length>0&&(i+=`, scope="${pj(a.join(" "))}"`),n&&(i+=`, resource_metadata="${pj(n)}"`),i}async function pC(t,r,a){for(let i of t){let t=await a({request:i,...void 0!==r&&{authInfo:r}});if(void 0!==t){if(null===t||"object"!=typeof t||!Array.isArray(t.scopes)||0===t.scopes.length)throw TypeError("scope challenge must contain at least one scope");for(let[r,a]of t.scopes.entries()){var n=`scope challenge scopes[${r}]`;if("string"!=typeof a||!/^[\u0021\u0023-\u005B\u005D-\u007E]+$/.test(a))throw TypeError(`${n} must satisfy the OAuth scope-token grammar`)}if(void 0!==t.errorDescription&&"string"!=typeof t.errorDescription)throw TypeError("scope challenge errorDescription must be a string");if(void 0!==t.errorDescription&&!/^[\u0020-\u0021\u0023-\u005B\u005D-\u007E]+$/.test(t.errorDescription))throw TypeError("scope challenge errorDescription must satisfy the RFC 6750 error-description grammar");return t}}}function pI(t){if(t?.resourceMetadataUrl!==void 0)return t.resourceMetadataUrl;if(t?.resource?.protocol==="https:"||t?.resource?.protocol==="http:"){var r,a;let n,i;return n=new URL(r=t.resource),i=(a=r.pathname).length>1&&a.endsWith("/")?a.slice(0,-1):a,n.pathname=`/.well-known/oauth-protected-resource${"/"===i?"":i}`,n.hash="",n.href}}function pN(t,r){return function(t,r){let{requiredScopes:a=[],resourceMetadataUrl:n}=r??{};if(!(t instanceof lF)){let t=new lF(lV.ServerError,"Internal Server Error");return Response.json(t.toResponseObject(),{status:500})}switch(t.code){case lV.InvalidToken:{let r=pO(t.code,t.message,a,n);return Response.json(t.toResponseObject(),{status:401,headers:{"WWW-Authenticate":r}})}case lV.InsufficientScope:{let r=pO(t.code,t.message,a,n);return Response.json(t.toResponseObject(),{status:403,headers:{"WWW-Authenticate":r}})}case lV.ServerError:return Response.json(t.toResponseObject(),{status:500});default:return Response.json(t.toResponseObject(),{status:400})}}(new lF(lV.InsufficientScope,t.errorDescription??"Insufficient scope"),{requiredScopes:[...t.scopes],resourceMetadataUrl:r})}function pq(t,r,a){if(null===a||"object"!=typeof a||"string"!=typeof a.method)throw new cg(cf.InternalError,`Handler for ${t} returned an invalid input request '${r}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=function(t){switch(t.method){case"elicitation/create":if(t.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let r=t.params;if(void 0!==r&&(void 0!==r.tools||void 0!==r.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(a);if(void 0===n)throw new cg(cf.InternalError,`Handler for ${t} returned an input request '${r}' of kind '${a.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:a,required:n}}function pA(t,r){if("tools/call"===t)return{content:[{type:"text",text:r}],isError:!0};throw new cg(cf.InternalError,r)}var pM=class{constructor(t){this._host=t}async fulfill(t,r,a,n,i){let{maxRounds:o,roundTimeoutMs:s}=this._host,l=n.mcpReq.signal,c=i,u=0;for(;;){let i;if((u+=1)>o)return pA(t,`Multi-round-trip request '${t}' still required input after ${o} rounds (inputRequired.maxRounds)`);let d=c.inputRequests,p=null!=d&&Object.keys(d).length>0,m="string"==typeof c.requestState?c.requestState:void 0;if(!p&&void 0===m)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(p){let r=this._host.resolvedClientCapabilities(n),a=[];for(let[n,i]of Object.entries(d)){let{embedded:o,required:s}=pq(t,n,i);if("roots/list"!==o.method&&void 0===o.params)throw new cg(cf.InternalError,`Handler for ${t} returned an input request '${n}' of kind '${o.method}' without params`);if(void 0!==lG(s,r))return pA(t,`Cannot request input '${n}' (${o.method}): the client on this 2025-era connection did not declare the required capability${void 0===r?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);a.push([n,o])}let o=function(t){let r=new AbortController,a=()=>r.abort(t?.reason);return t?.addEventListener("abort",a,{once:!0}),t?.aborted&&r.abort(t.reason),{signal:r.signal,abort:t=>r.abort(t),dispose:()=>t?.removeEventListener("abort",a)}}(l);try{let t={relatedRequestId:n.mcpReq.id,timeout:s,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:o.signal},r=await Promise.all(a.map(async([r,a])=>{try{return[r,await this._dispatchLeg(a,t)]}catch(t){throw o.abort(t),t}}));i=Object.fromEntries(r)}catch(r){if(l.aborted)throw r;return pA(t,`Fulfilling input required by '${t}' failed: ${r instanceof Error?r.message:String(r)}`)}finally{o.dispose()}}else await function(t,r){return new Promise((t,a)=>{if(r?.aborted)return void a(r.reason instanceof lJ?r.reason:new lJ(lH.RequestTimeout,String(r.reason)));let n=setTimeout(()=>{r?.removeEventListener("abort",i),t()},250),i=()=>{clearTimeout(n),a(r?.reason instanceof lJ?r.reason:new lJ(lH.RequestTimeout,String(r?.reason)))};r?.addEventListener("abort",i,{once:!0})})}(0,l);let h={...n,mcpReq:{...n.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(t){return()=>t}(m)}};if(void 0!==m){let r=await this._host.verifyRequestState(m,h,t);void 0!==r&&(h=uj(h,r))}let f=await r(a,h);if(!cX(f))return f;c=f}}async _dispatchLeg(t,r){switch(t.method){case"elicitation/create":{let a=t.params;return"url"===a.mode&&void 0===a.elicitationId&&(a={...a,elicitationId:function(){let t=globalThis.crypto;if(t?.randomUUID!==void 0)return t.randomUUID();let r=new Uint8Array(16);t.getRandomValues(r),r[6]=15&r[6]|64,r[8]=63&r[8]|128;let a=[...r].map(t=>t.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}()}),await this._host.sendElicitation(a,r)}case"sampling/createMessage":return await this._host.sendSampling(t.params,r);case"roots/list":return await this._host.listRoots(t.params,r)}}};let pz=new Set(["tools/call","prompts/get","resources/read"]);var pL=class extends uO{_clientCapabilities;_clientVersion;static{d=(t,r)=>{void 0!==r.clientCapabilities&&(t._clientCapabilities=r.clientCapabilities),void 0!==r.clientInfo&&(t._clientVersion=r.clientInfo)},p=(t,r)=>{let a=r.filter(r=>!t._supportedProtocolVersions.includes(r));a.length>0&&(t._supportedProtocolVersions=[...t._supportedProtocolVersions,...a]),t.setRequestHandler("server/discover",()=>t._ondiscover())},m=t=>t._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pM({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:t=>this._inputRequestCapabilityView(t),verifyRequestState:(t,r,a)=>this._verifyRequestState(t,r,a),sendElicitation:(t,r)=>this._sendElicitationLeg(t,r,{validateAcceptedContent:!1}),sendSampling:(t,r)=>this.createMessage(t,r),listRoots:(t,r)=>this.listRoots(t,r)})}oninitialized;constructor(t,r){if(super(r),this._serverInfo=t,this._capabilities=r?.capabilities?{...r.capabilities}:{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new p$,this._requestStateVerify=r?.requestState?.verify,this._inputRequiredServing=function(t){if(t?.maxRounds!==void 0&&(!Number.isInteger(t.maxRounds)||t.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${t.maxRounds})`);if(t?.roundTimeoutMs!==void 0&&(!Number.isFinite(t.roundTimeoutMs)||t.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${t.roundTimeoutMs})`);return{maxRounds:t?.maxRounds??8,roundTimeoutMs:t?.roundTimeoutMs??6e5,legacyShim:t?.legacyShim??!0}}(r?.inputRequired),r?.cacheHints!==void 0){for(const[t,a]of Object.entries(r.cacheHints))void 0!==a&&ch(a,`cacheHints['${t}']`);this._cacheHints=r.cacheHints}this.setRequestHandler("initialize",t=>this._oninitialize(t)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lX(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}async connect(t){if(void 0!==this.transport)throw new lJ(lH.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(t)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(t,r)=>{let a=r.sessionId||r.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=t.params,i=n_(sx,n);return i.success&&this._loggingLevels.set(a,i.data),{}})}buildContext(t,r){let a=t.http||r?.request||r?.closeSSEStream||r?.closeStandaloneSSEStream;return{...t,mcpReq:{...t.mcpReq,log:(r,a,n)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=t.mcpReq.envelope?.[iY]))return Promise.resolve()}else i=this._loggingLevels.get(t.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():t.mcpReq.notify({method:"notifications/message",params:{level:r,data:a,logger:n}})},elicitInput:(t,r)=>this.elicitInput(t,r),requestSampling:(t,r)=>this.createMessage(t,r)},http:a?{...t.http,req:r?.request,closeSSE:r?.closeSSEStream,closeStandaloneSSE:r?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(sx.options.map((t,r)=>[t,r]));isMessageIgnored=(t,r)=>{let a=this._loggingLevels.get(r);return!!a&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(a)};registerCapabilities(t){if(this.transport)throw new lJ(lH.AlreadyConnected,"Cannot register capabilities after connecting to transport");let r=!!this._capabilities.logging;this._capabilities=function(t,r){let a={...t};for(let t in r){let n=r[t];if(void 0===n)continue;let i=a[t];a[t]=uC(i)&&uC(n)?{...i,...n}:n}return a}(this._capabilities,t),!r&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(t,r){if("tools/call"!==t){let a=this._cacheHints?.[t],n=pz.has(t);return void 0!==a||n?async(i,o)=>{let s=n?await this._invokeInputRequiredCapableHandler(t,r,i,o):await r(i,o);if(cX(s)){if(!n)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return s}return void 0===a?s:cd(s,a)}:async(a,n)=>{let i=await r(a,n);if(cX(i))throw new cg(cf.InternalError,`Handler for ${t} 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(t,a)=>{let n=cA(this._negotiatedProtocolVersion),i=n.validateRequest("tools/call",t);if(!i.ok)throw new cg("not-in-era"===i.reason?cf.InternalError:cf.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let o=await this._invokeInputRequiredCapableHandler("tools/call",r,t,a);if(cX(o))return o;let s=l1(o),l=n.validateResult("tools/call",s);if(!l.ok)throw new cg("not-in-era"===l.reason?cf.InternalError:cf.InvalidParams,"not-in-era"===l.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${l.message}`);return l.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=lW}async _invokeInputRequiredCapableHandler(t,r,a,n){let i,o=this._servedModernEra(),s=n.mcpReq.requestState();if(void 0!==s&&"string"!=typeof s)throw new cg(cf.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let l=n;if("string"==typeof s){let r=await this._verifyRequestState(s,n,t);void 0!==r&&(l=uj(n,r))}try{i=await r(a,l)}catch(t){if(t instanceof cg&&t.code===cf.UrlElicitationRequired){if(!o)throw t;throw new cg(cf.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 t}if(!cX(i))return i;if(!o){if(!this._inputRequiredServing.legacyShim)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??iF}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(t,r,a,l,i)}let c=i.inputRequests,u=null!=c&&Object.keys(c).length>0,d="string"==typeof i.requestState;if(!u&&!d)throw new cg(cf.InternalError,`Handler for ${t} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let r=this._inputRequestCapabilityView(n);for(let[a,n]of Object.entries(c)){let{embedded:i,required:o}=pq(t,a,n),s=lG(o,r);if(void 0!==s)throw new cb({requiredCapabilities:s},`Cannot request input '${a}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(t,r,a){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(t,r)}catch(t){throw this.onerror?.(Error(`requestState verification rejected ${a}: ${t instanceof Error?t.message:String(t)}`)),new cg(cf.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(t){return this._servedModernEra()?t.mcpReq.envelope?.[iG]:this._clientCapabilities}_assertPushApiInServedEra(t){if(this._servedModernEra())throw new lJ(lH.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${t}' 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:t,era:"2026-07-28"})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new lJ(lH.CapabilityNotSupported,`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new lJ(lH.CapabilityNotSupported,`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new lJ(lH.CapabilityNotSupported,`Client does not support listing roots (required for ${t})`)}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new lJ(lH.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new lJ(lH.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,`Client does not support URL elicitation (required for ${t})`)}}assertRequestHandlerCapability(t){switch(t){case"completion/complete":if(!this._capabilities.completions)throw new lJ(lH.CapabilityNotSupported,`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new lJ(lH.CapabilityNotSupported,`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new lJ(lH.CapabilityNotSupported,`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new lJ(lH.CapabilityNotSupported,`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new lJ(lH.CapabilityNotSupported,`Server does not support tools (required for ${t})`)}}async _oninitialize(t){let r=t.params.protocolVersion;this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo;let a=this._supportedProtocolVersions.filter(t=>!(t>=lW)),n=a.includes(r)?r:a[0]??iF;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lX(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(t,r){return this._wireCodec().projectCallToolResult(t,r)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(t,r){if(this._assertPushApiInServedEra("sampling/createMessage"),(t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new lJ(lH.CapabilityNotSupported,"Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages.at(-1),a=Array.isArray(r.content)?r.content:[r.content],n=a.some(t=>"tool_result"===t.type),i=t.messages.length>1?t.messages.at(-2):void 0,o=i?Array.isArray(i.content)?i.content:[i.content]:[],s=o.some(t=>"tool_use"===t.type);if(n){if(a.some(t=>"tool_result"!==t.type))throw new cg(cf.InvalidParams,"The last message must contain only tool_result content if any is present");if(!s)throw new cg(cf.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(s){let t=new Set(o.filter(t=>"tool_use"===t.type).map(t=>t.id)),r=new Set(a.filter(t=>"tool_result"===t.type).map(t=>t.toolUseId));if(t.size!==r.size||![...t].every(t=>r.has(t)))throw new cg(cf.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let a=!!(t.tools||t.toolChoice),n=await this.request({method:"sampling/createMessage",params:t},r),i=this._wireCodec().samplingResultVariant(a,n);if(!i.ok)throw new lJ(lH.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(t,r){switch(this._assertPushApiInServedEra("elicitation/create"),t.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new lJ(lH.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(t,r)}async _sendElicitationLeg(t,r,a){let n=t.mode??"form",i=a?.validateAcceptedContent??!0;switch(n){case"url":return this.request({method:"elicitation/create",params:t},r);case"form":{let a="form"===t.mode?t:{...t,mode:"form"},n=await this.request({method:"elicitation/create",params:a},r);if(i&&"accept"===n.action&&n.content&&a.requestedSchema)try{let t=this._jsonSchemaValidator.getValidator(a.requestedSchema)(n.content);if(!t.valid)throw new cg(cf.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(t){if(t instanceof cg)throw t;throw new cg(cf.InternalError,`Error validating elicitation response: ${t instanceof Error?t.message:String(t)}`)}return n}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new lJ(lH.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:t},r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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"})}},pZ=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(t){let r=this._registeredTools[t];if(void 0!==r&&r.enabled){if(Object.hasOwn(this._toolInputSchemaJson,t))return this._toolInputSchemaJson[t];if(void 0===r.inputSchema)return pV;try{let a=up(r.inputSchema,"input");return this._toolInputSchemaJson[t]=a,a}catch{return}}}constructor(t,r){this.server=new pL(t,r),this._maxToolInputElements=function(t){if(void 0!==t&&t!==1/0){if("number"!=typeof t||Number.isNaN(t)||t<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(t)}`);return t}}(r?.maxToolInputElements),r?.capabilities?.tools&&this.setToolRequestHandlers(),r?.capabilities?.resources&&this.setResourceRequestHandlers(),r?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(t){return"object"==typeof t&&null!==t&&"setScopeChallengeResolver"in t&&"function"==typeof t.setScopeChallengeResolver&&t.setScopeChallengeResolver(t=>this.resolveScopeChallenge(t)),await this.server.connect(t)}async close(){await this.server.close()}resolveScopeChallenge=t=>{switch(t.request.method){case"tools/call":{let r=t.request.params?.name;if("string"!=typeof r)return;let a=this._registeredTools[r];if(void 0===a||!a.enabled)return;return a.scopeChallenge?.(t)}case"resources/read":{let r,a=t.request.params?.uri;if("string"!=typeof a)return;try{r=new URL(a)}catch{return}let n=this._registeredResources[r.toString()];if(void 0!==n)return n.enabled?n.scopeChallenge?.(t):void 0;for(let a of Object.values(this._registeredResourceTemplates))if(a.resourceTemplate.uriTemplate.match(r.toString()))return a.enabled?a.scopeChallenge?.(t):void 0;return}case"prompts/get":{let r=t.request.params?.name;if("string"!=typeof r)return;let a=this._registeredPrompts[r];if(void 0===a||!a.enabled)return;return a.scopeChallenge?.(t)}default:return}};_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(([,t])=>t.enabled).map(([t,r])=>{var a;let n,i,o={name:t,title:r.title,description:r.description,inputSchema:r.inputSchema?(a=t,(i=c2(n=up(r.inputSchema,"input"))).valid||console.warn(`[mcp-sdk] tool '${a}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${i.reason}`),n):pV,annotations:r.annotations,icons:r.icons,execution:r.execution,_meta:r._meta};return r.outputSchema&&(o.outputSchema=up(r.outputSchema,"output")),o})})),this.server.setRequestHandler("tools/call",async(t,r)=>{let a=this._registeredTools[t.params.name];if(!a)throw new cg(cf.InvalidParams,`Tool ${t.params.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Tool ${t.params.name} disabled`);try{let n=await this.validateToolInput(a,t.params.arguments,t.params.name),i=await this.executeToolHandler(a,n,r);if(await this.validateToolOutput(a,i,t.params.name),cX(i))return i;return this.server.projectCallToolResult(i,a.outputSchemaJson)}catch(t){if(t instanceof cg&&t.code===cf.UrlElicitationRequired)throw t;return this.createToolError(t instanceof Error?t.message:String(t))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,a){if(void 0!==this._maxToolInputElements&&function(t,r){let a=0,n=[t];for(;n.length>0;){let t=n.pop();if(null!==t&&"object"==typeof t)if(Array.isArray(t))for(let i of t){if(++a>r)return a;null!==i&&"object"==typeof i&&n.push(i)}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(++a>r)return a;let o=t[i];null!==o&&"object"==typeof o&&n.push(o)}}return a}(r,this._maxToolInputElements)>this._maxToolInputElements)throw new cg(cf.InvalidParams,`Invalid arguments for tool ${a}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!t.inputSchema)return;let n=await um(t.inputSchema,r??{});if(!n.success)throw new cg(cf.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${n.error}`);return n.data}async validateToolOutput(t,r,a){if(!t.outputSchema||cX(r)||r.isError)return;if(void 0===r.structuredContent)throw new cg(cf.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);let n=await um(t.outputSchema,r.structuredContent);if(!n.success)throw new cg(cf.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${n.error}`)}async executeToolHandler(t,r,a){return t.executor(r,a)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async t=>{switch(t.params.ref.type){case"ref/prompt":if("ref/prompt"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`);return this.handlePromptCompletion(t,t.params.ref);case"ref/resource":if("ref/resource"!==t.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`);return this.handleResourceCompletion(t,t.params.ref);default:throw new cg(cf.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let a=this._registeredPrompts[r.name];if(!a)throw new cg(cf.InvalidParams,`Prompt ${r.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Prompt ${r.name} disabled`);if(!a.argsSchema)return pB;let n=pG(pK(a.argsSchema)?.[t.params.argument.name]);if(!pR(n))return pB;let i=n[pw]?.complete;return i?pJ(await i(t.params.argument.value,t.params.context)):pB}async handleResourceCompletion(t,r){let a=Object.values(this._registeredResourceTemplates).find(t=>t.resourceTemplate.uriTemplate.toString()===r.uri);if(!a){if(this._registeredResources[r.uri])return pB;throw new cg(cf.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let n=a.resourceTemplate.completeCallback(t.params.argument.name);return n?pJ(await n(t.params.argument.value,t.params.context)):pB}_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(t,r)=>{let a=Object.entries(this._registeredResources).filter(([t,r])=>r.enabled).map(([t,r])=>({uri:t,name:r.name,...r.metadata})),n=[];for(let t of Object.values(this._registeredResourceTemplates))if(t.resourceTemplate.listCallback)for(let a of(await t.resourceTemplate.listCallback(r)).resources)n.push({...t.metadata,...a});return{resources:[...a,...n]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler("resources/read",async(t,r)=>{let a;try{a=new URL(t.params.uri)}catch{throw new cg(cf.InvalidParams,`Resource URI ${t.params.uri} is invalid`,{uri:t.params.uri,reason:"invalid_uri"})}let n=this._registeredResources[a.toString()];if(n){if(!n.enabled)throw new cg(cf.InvalidParams,`Resource ${a} disabled`);return cd(await n.readCallback(a,r),n.cacheHint)}for(let t of Object.values(this._registeredResourceTemplates)){let n=t.resourceTemplate.uriTemplate.match(a.toString());if(n){if(!t.enabled)throw new cg(cf.InvalidParams,`Resource template ${t.resourceTemplate.uriTemplate} disabled`);return cd(await t.readCallback(a,n,r),t.cacheHint)}}throw new cy(t.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(([,t])=>t.enabled).map(([t,r])=>{let a,n,i;return{name:t,title:r.title,description:r.description,arguments:r.argsSchema?(n=(a=up(r.argsSchema,"input")).properties||{},i=a.required||[],Object.entries(n).map(([t,r])=>({name:t,description:r?.description,required:i.includes(t)}))):void 0,icons:r.icons,_meta:r._meta}})})),this.server.setRequestHandler("prompts/get",async(t,r)=>{let a=this._registeredPrompts[t.params.name];if(!a)throw new cg(cf.InvalidParams,`Prompt ${t.params.name} not found`);if(!a.enabled)throw new cg(cf.InvalidParams,`Prompt ${t.params.name} disabled`);return a.handler(t.params.arguments,r)}),this._promptHandlersInitialized=!0)}registerResource(t,r,a,n){let{cacheHint:i,scopeChallenge:o,...s}=a;if(void 0!==i&&ch(i,`resource ${t}`),"string"==typeof r){if(this._registeredResources[r])throw Error(`Resource ${r} is already registered`);let l=this._createRegisteredResource(t,a.title,r,s,o,n);return void 0!==i&&(l.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let l=this._createRegisteredResourceTemplate(t,a.title,r,s,o,n);return void 0!==i&&(l.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}}_createRegisteredResource(t,r,a,n,i,o){let s={name:t,title:r,metadata:n,readCallback:o,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:t=>{void 0!==t.uri&&t.uri!==a&&(delete this._registeredResources[a],t.uri&&(this._registeredResources[t.uri]=s)),void 0!==t.name&&(s.name=t.name),void 0!==t.title&&(s.title=t.title),void 0!==t.metadata&&(s.metadata=t.metadata),void 0!==t.callback&&(s.readCallback=t.callback),void 0!==t.scopeChallenge&&(s.scopeChallenge=null===t.scopeChallenge?void 0:t.scopeChallenge),void 0!==t.enabled&&(s.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=s,s}_createRegisteredResourceTemplate(t,r,a,n,i,o){let s={resourceTemplate:a,title:r,metadata:n,readCallback:o,scopeChallenge:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredResourceTemplates[t],r.name&&(this._registeredResourceTemplates[r.name]=s)),void 0!==r.title&&(s.title=r.title),void 0!==r.template&&(s.resourceTemplate=r.template),void 0!==r.metadata&&(s.metadata=r.metadata),void 0!==r.callback&&(s.readCallback=r.callback),void 0!==r.scopeChallenge&&(s.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r.enabled&&(s.enabled=r.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let l=a.uriTemplate.variableNames;return Array.isArray(l)&&l.some(t=>!!a.completeCallback(t))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,a,n,i,o,s,l){let c=n,u=i,d={title:r,description:a,argsSchema:n,icons:o,scopeChallenge:s,_meta:l,handler:pH(t,n,i),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&(delete this._registeredPrompts[t],r.name&&(this._registeredPrompts[r.name]=d)),void 0!==r.title&&(d.title=r.title),void 0!==r.description&&(d.description=r.description),void 0!==r.icons&&(d.icons=r.icons),void 0!==r.scopeChallenge&&(d.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r._meta&&(d._meta=r._meta);let a=!1;void 0!==r.argsSchema&&(d.argsSchema=r.argsSchema,c=r.argsSchema,a=!0),void 0!==r.callback&&(u=r.callback,a=!0),a&&(d.handler=pH(t,c,u)),void 0!==r.enabled&&(d.enabled=r.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[t]=d,n){let t=pK(n);t&&Object.values(t).some(t=>pR(pG(t)))&&this.setCompletionRequestHandler()}return d}_createRegisteredTool(t,r,a,n,i,o,s,l,c,u,d){let p;uz(t);let m=d,h={title:r,description:a,inputSchema:n,outputSchema:i,get outputSchemaJson(){return p??=pF(h.outputSchema)},set outputSchemaJson(value){p=value},annotations:o,icons:s,execution:l,scopeChallenge:c,_meta:u,handler:d,executor:pU(n,d),enabled:!0,disable:()=>h.update({enabled:!1}),enable:()=>h.update({enabled:!0}),remove:()=>h.update({name:null}),update:r=>{void 0!==r.name&&r.name!==t&&("string"==typeof r.name&&uz(r.name),delete this._registeredTools[t],delete this._toolInputSchemaJson[t],r.name&&(delete this._toolInputSchemaJson[r.name],this._registeredTools[r.name]=h,t=r.name)),void 0!==r.title&&(h.title=r.title),void 0!==r.description&&(h.description=r.description);let a=!1;void 0!==r.paramsSchema&&(h.inputSchema=r.paramsSchema,delete this._toolInputSchemaJson[t],a=!0),void 0!==r.callback&&(h.handler=r.callback,m=r.callback,a=!0),a&&(h.executor=pU(h.inputSchema,m)),void 0!==r.outputSchema&&(h.outputSchema=r.outputSchema,h.outputSchemaJson=pF(r.outputSchema)),void 0!==r.annotations&&(h.annotations=r.annotations),void 0!==r.icons&&(h.icons=r.icons),void 0!==r.scopeChallenge&&(h.scopeChallenge=null===r.scopeChallenge?void 0:r.scopeChallenge),void 0!==r._meta&&(h._meta=r._meta),void 0!==r.enabled&&(h.enabled=r.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=h,this.setToolRequestHandlers(),this.sendToolListChanged(),h}registerTool(t,r,a){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:n,description:i,inputSchema:o,outputSchema:s,annotations:l,icons:c,scopeChallenge:u,_meta:d}=r;return this._createRegisteredTool(t,n,i,uZ(o),uZ(s),l,c,void 0,u,d,a)}registerPrompt(t,r,a){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:n,description:i,argsSchema:o,icons:s,scopeChallenge:l,_meta:c}=r,u=this._createRegisteredPrompt(t,n,i,uZ(o),a,s,l,c);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),u}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},pD=class{_uriTemplate;constructor(t,r){this._callbacks=r,this._uriTemplate="string"==typeof t?new uL(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){return this._callbacks.complete?.[t]}};function pU(t,r){return t?async(t,a)=>r(t,a):async(t,a)=>r(a)}let pV={type:"object",properties:{}};function pF(t){if(void 0!==t)try{return up(t,"output")}catch{return}}function pH(t,r,a){return r?async(n,i)=>{let o=await um(r,n??{});if(!o.success)throw new cg(cf.InvalidParams,`Invalid arguments for prompt ${t}: ${o.error}`);return a(o.data,i)}:async(t,r)=>a(r)}function pJ(t){return{completion:{values:t.map(String).slice(0,100),total:t.length,hasMore:t.length>100}}}let pB={completion:{values:[],hasMore:!1}};function pK(t){if(t.shape&&"object"==typeof t.shape)return t.shape}function pG(t){return t?.type!=="optional"?t:t.def?.innerType??t}var pW=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(t){this._classification=t.classification,this._responseMode=t.responseMode??"auto",this._keepAliveMs=t.keepAliveMs??15e3}async start(){if(this._started)throw Error("PerRequestHTTPServerTransport is already started");this._started=!0}async handleMessage(t,r){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 a=r?.request?.signal;if(a?.aborted)throw await this.close(),new lJ(lH.ConnectionClosed,"The request was aborted before it could be handled");let n={classification:this._classification,...r?.request!==void 0&&{request:r.request},...r?.authInfo!==void 0&&{authInfo:r.authInfo}};if(cK(t)){let r,i;this._requestId=t.id;let o=new Promise((t,a)=>{r=t,i=a});if(this._deferredResponse={promise:o,resolve:r,reject:i,settled:!1},void 0!==a){let t=()=>void this.close();a.addEventListener("abort",t,{once:!0}),this._abortCleanup=()=>a.removeEventListener("abort",t)}this._dispatchWindowOpen=!0;try{this.onmessage(t,n)}finally{this._dispatchWindowOpen=!1}return"sse"!==this._responseMode||this._closed||this._deferredResponse.settled||this.upgradeToSse(),o}return this.onmessage(t,n),new Response(null,{status:202})}async send(t,r){if(this._closed)return;let a=cW(t)||cY(t),n=a?t.id:r?.relatedRequestId;if(void 0===this._requestId||void 0===n||n!==this._requestId){a&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(t.id)}`));return}if(a){if(this._terminalDelivered)return;this._terminalDelivered=!0;let r=cY(t)?t.error.code:void 0,a=void 0!==r&&(this._dispatchWindowOpen||r===cf.MissingRequiredClientCapability)?ut[r]:void 0;if(void 0!==a&&void 0===this._sse){this.settleResponse(Response.json(t,{status:a,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(t),this.finalizeStream();return}this.settleResponse(Response.json(t,{status:200,headers:{"Content-Type":"application/json"}})),queueMicrotask(()=>void this.close());return}"json"!==this._responseMode&&(void 0===this._sse&&this.upgradeToSse(),this.writeMessageFrame(t))}writeCommentFrame(t){if(this._closed||void 0===this._sse||this._sse.closed)return;let r=t.split("\n").map(t=>`: ${t}`).join("\n");this.writeFrame(`${r}
|
|
62
62
|
|
|
63
|
-
`)}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
|
|
63
|
+
`)}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 lJ(lH.ConnectionClosed,"Connection closed before a response was produced"))),this.onclose?.()}}settleResponse(t){void 0===this._deferredResponse||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(t))}upgradeToSse(){let t,r=new ReadableStream({start:r=>{t=r},cancel:()=>{this.close()}});this._sse={controller:t,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=px(this._keepAliveMs,()=>this.writeCommentFrame("keepalive")),this.settleResponse(new Response(r,{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(t){this.writeFrame(`event: message
|
|
64
64
|
data: ${JSON.stringify(t)}
|
|
65
65
|
|
|
66
|
-
`)}writeFrame(t){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(t))}catch(t){this.onerror?.(Error(`Failed to write to the response stream: ${t}`))}}};async function
|
|
66
|
+
`)}writeFrame(t){if(void 0!==this._sse&&!this._sse.closed)try{this._sse.controller.enqueue(this._sse.encoder.encode(t))}catch(t){this.onerror?.(Error(`Failed to write to the response stream: ${t}`))}}};async function pY(t,r,a){let n=new pW({classification:a.classification,...void 0!==a.responseMode&&{responseMode:a.responseMode},...void 0!==a.keepAliveMs&&{keepAliveMs:a.keepAliveMs}});return await t.connect(n),n.handleMessage(r,{...void 0!==a.request&&{request:a.request},...void 0!==a.authInfo&&{authInfo:a.authInfo}})}function pX(t){return`Payload Too Large: Request body must not exceed ${t} bytes`}function pQ(t){if(void 0===t)return 4194304;if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(t)}`);return t}async function p0(t,r=4194304){if(Number(t.headers.get("content-length"))>r)return{tooLarge:!0};if(null===t.body)return{tooLarge:!1,text:""};let a=t.body.getReader(),n=new TextDecoder,i=0,o="";try{for(;;){let{done:t,value:s}=await a.read();if(t)break;if((i+=s.byteLength)>r)return{tooLarge:!0};o+=n.decode(s,{stream:!0})}}finally{a.releaseLock()}return{tooLarge:!1,text:o+n.decode()}}var p1=class{sessionIdGenerator;_started=!1;_hasHandledRequest=!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;_maxRequestBodySize;_scopeChallengeResolver;sessionId;onclose;onerror;onmessage;constructor(t={}){this.sessionIdGenerator=t.sessionIdGenerator,this._enableJsonResponse=t.enableJsonResponse??!1,this._eventStore=t.eventStore,this._onsessioninitialized=t.onsessioninitialized,this._onsessionclosed=t.onsessionclosed,this._allowedHosts=t.allowedHosts,this._allowedOrigins=t.allowedOrigins,this._enableDnsRebindingProtection=t.enableDnsRebindingProtection??!1,this._retryInterval=t.retryInterval,this._supportedProtocolVersions=t.supportedProtocolVersions??iH,this._keepAliveMs=t.keepAliveMs??15e3,this._maxRequestBodySize=pQ(t.maxRequestBodySize)}startKeepAlive(t,r){if(this._closed)return;let a=px(this._keepAliveMs,()=>{try{t.enqueue(r.encode(": keepalive\n\n"))}catch{void 0!==a&&clearInterval(a)}});return a}setScopeChallengeResolver(t){this._scopeChallengeResolver=t}async start(){if(this._started)throw Error("Transport already started");this._started=!0}setSupportedProtocolVersions(t){this._supportedProtocolVersions=t}createJsonErrorResponse(t,r,a,n){let i={code:r,message:a};return n?.data!==void 0&&(i.data=n.data),Response.json({jsonrpc:"2.0",error:i,id:null},{status:t,headers:{"Content-Type":"application/json",...n?.headers}})}async _checkScopeChallenge(t,r){if(!this._scopeChallengeResolver)return;let a=await pC(t.filter(t=>cK(t)),r,this._scopeChallengeResolver);return void 0===a?void 0:pN(a,pI(r))}validateRequestHeaders(t){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=t.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let t=`Invalid Host header: ${r}`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(403,-32e3,t)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=t.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let t=`Invalid Origin header: ${r}`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(403,-32e3,t)}}}}async handleRequest(t,r){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!this.sessionIdGenerator&&this._hasHandledRequest)throw Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let a=this.validateRequestHeaders(t);if(a)return a;switch(t.method){case"POST":return this.handlePostRequest(t,r);case"GET":return this.handleGetRequest(t);case"DELETE":return this.handleDeleteRequest(t);default:return this.handleUnsupportedRequest()}}supportsEmptySSEData(t){return this._supportedProtocolVersions.includes(t)&&t>="2025-11-25"}async writePrimingEvent(t,r,a,n){if(!this._eventStore||!this.supportsEmptySSEData(n))return;let i=await this._eventStore.storeEvent(a,{}),o=`id: ${i}
|
|
67
67
|
data:
|
|
68
68
|
|
|
69
|
-
`;void 0!==this._retryInterval&&(o=`id: ${
|
|
69
|
+
`;void 0!==this._retryInterval&&(o=`id: ${i}
|
|
70
70
|
retry: ${this._retryInterval}
|
|
71
71
|
data:
|
|
72
72
|
|
|
73
|
-
`),t.enqueue(r.encode(o))}async handleGetRequest(t){let r,a;if(!t.headers.get("accept")?.includes("text/event-stream"))return this.onerror?.(Error("Not Acceptable: Client must accept text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept text/event-stream");let
|
|
74
|
-
`;return
|
|
75
|
-
`),
|
|
76
|
-
|
|
77
|
-
`,t.enqueue(r.encode(n)),!0}catch(t){return this.onerror?.(t),!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(t,r){try{let a,i,n,o,s=t.headers.get("accept");if(!s?.includes("application/json")||!s.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(!uO(t.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(r?.parsedBody===void 0)try{a=await t.json()}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else a=r.parsedBody;try{i=Array.isArray(a)?a.map(t=>oo.parse(t)):[oo.parse(a)]}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let l=i.some(t=>oS.safeParse(t).success);if(l){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(i.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(!l){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!i.some(t=>cF(t))){for(let a of i)this.onmessage?.(a,{authInfo:r?.authInfo,request:t});return new Response(null,{status:202})}let c=crypto.randomUUID(),u=i.find(t=>oS.safeParse(t).success),d=u?u.params.protocolVersion:t.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(a=>{for(let t of(this._streamMapping.set(c,{resolveJson:a,cleanup:()=>{this._streamMapping.delete(c)}}),i))cF(t)&&this._requestToStreamMapping.set(t.id,c);for(let a of i)this.onmessage?.(a,{authInfo:r?.authInfo,request:t})});let p=new TextEncoder,m=new ReadableStream({start:t=>{n=t},cancel:()=>{void 0!==o&&clearInterval(o),this._streamMapping.get(c)?.controller===n&&this._streamMapping.delete(c)}}),h={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let t of(void 0!==this.sessionId&&(h["mcp-session-id"]=this.sessionId),i))cF(t)&&(this._streamMapping.set(c,{controller:n,encoder:p,cleanup:()=>{void 0!==o&&clearInterval(o),this._streamMapping.delete(c);try{n.close()}catch{}}}),this._requestToStreamMapping.set(t.id,c));for(let a of(await this.writePrimingEvent(n,p,c,d),i)){let i,n;cF(a)&&this._eventStore&&this.supportsEmptySSEData(d)&&(i=()=>{this.closeSSEStream(a.id)},n=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(a,{authInfo:r?.authInfo,request:t,closeSSEStream:i,closeStandaloneSSEStream:n})}return this._streamMapping.get(c)?.controller===n&&(o=this.startKeepAlive(n,p)),new Response(m,{status:200,headers:h})}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(t)})}}async handleDeleteRequest(t){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(t){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 r=t.headers.get("mcp-session-id");return r?r!==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(t){let r=t.headers.get("mcp-protocol-version");if(null!==r&&!this._supportedProtocolVersions.includes(r)){let t=`Bad Request: Unsupported protocol version: ${r} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(400,-32e3,t)}}async close(){if(!this._closed){for(let{cleanup:t}of(this._closed=!0,this._streamMapping.values()))t();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(t){let r=this._requestToStreamMapping.get(t);if(!r)return;let a=this._streamMapping.get(r);a&&a.cleanup()}closeStandaloneSSEStream(){let t=this._streamMapping.get(this._standaloneSseStreamId);t&&t.cleanup()}async send(t,r){let a=r?.relatedRequestId;if((cH(t)||cJ(t))&&(a=t.id),void 0===a){let r;if(cH(t)||cJ(t))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(r=await this._eventStore.storeEvent(this._standaloneSseStreamId,t));let a=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===a)return;a.controller&&a.encoder&&(void 0===r||!a.replayedEventIds?.has(r))&&this.writeSSEEvent(a.controller,a.encoder,t,r);return}let i=this._requestToStreamMapping.get(a);if(!i)throw Error(`No connection established for request ID: ${String(a)}`);let n=this._streamMapping.get(i);if(!this._enableJsonResponse){let r;this._eventStore&&(r=await this._eventStore.storeEvent(i,t),n=this._streamMapping.get(i)),n?.controller&&n?.encoder&&(void 0===r||!n.replayedEventIds?.has(r))&&this.writeSSEEvent(n.controller,n.encoder,t,r)}if(cH(t)||cJ(t)){this._requestResponseMap.set(a,t);let r=[...this._requestToStreamMapping.entries()].filter(([t,r])=>r===i).map(([t])=>t);if(r.every(t=>this._requestResponseMap.has(t))){if(!n){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(a)}`);if(!this._eventStore){for(let t of(this.onerror?.(Error(`Response for request ID ${String(a)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),r))this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}if(this._enableJsonResponse&&n.resolveJson){let t={"Content-Type":"application/json"};void 0!==this.sessionId&&(t["mcp-session-id"]=this.sessionId);let a=r.map(t=>this._requestResponseMap.get(t));1===a.length?n.resolveJson(Response.json(a[0],{status:200,headers:t})):n.resolveJson(Response.json(a,{status:200,headers:t})),n.cleanup()}else n.cleanup();for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t)}}}};function pF(t){if(null===t||"object"!=typeof t||Array.isArray(t))return null;let{method:r,id:a}=t;return"string"!=typeof r?null:"string"==typeof a||"number"==typeof a?a:null}function pU(t,r,a,i,n=null){return Response.json({jsonrpc:"2.0",error:{code:r,message:a,...void 0!==i&&{data:i}},id:n},{status:t})}function pH(t,r=null){return pU(t.httpStatus,t.code,t.message,t.data,r)}function pJ(t){return t instanceof Error?t:Error(String(t))}function pB(t=null){return pU(500,-32603,"Internal server error",void 0,t)}async function pK(t,r,a=!0){let i,n=t.method.toUpperCase(),o=r,s=t,l=!1;if("POST"===n){if(void 0===o){let r;a&&(s=t.clone());try{r=await t.text()}catch{return{step:"unreadable-body"}}try{i=0===r.length?void 0:JSON.parse(r)}catch{l=!0}l||void 0===i||(o=i)}else i=o;if(l||void 0===i)return{step:"no-json-body",forwardRequest:s}}return{step:"classified",outcome:function(t){if("POST"!==(t={...t,...void 0!==t.protocolVersionHeader&&{protocolVersionHeader:ue(t.protocolVersionHeader)},...void 0!==t.mcpMethodHeader&&{mcpMethodHeader:ue(t.mcpMethodHeader)},...void 0!==t.mcpNameHeader&&{mcpNameHeader:ue(t.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let r=t.body;if(Array.isArray(r)){if(0===r.length)return c5("jsonrpc-shape","empty-batch",400,new cp(cd.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let t of r){if(cL(ut(t)?t.params:void 0))return c5("jsonrpc-shape","batch-with-modern-element",400,new cp(cd.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(cF(t)||cU(t)||cH(t)||cJ(t)))return c5("jsonrpc-shape","batch-with-invalid-element",400,new cp(cd.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return cH(r)||cJ(r)?{kind:"legacy",reason:"response"}:ut(r)&&cF(r)?function(t,r){let a=r.params,i=r.method,n=t.protocolVersionHeader,o=void 0!==n&&n>=lJ;if("initialize"===i&&!function(t){if(!cL(t))return!1;let r=cZ(t);if(void 0===r||!(r>=lJ))return!1;let a=cz(t);return void 0!==a&&0===cD(a).length}(a)){if(o)return c8("initialize-with-modern-header",n,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let t=ut(a)&&"string"==typeof a.protocolVersion?a.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==t&&{requestedVersion:t}}}if(cL(a)){let o=cz(a),s=(void 0===o?[]:cD(o))[0];if(void 0!==s)return c5("envelope","envelope-invalid",400,new cp(cd.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${s.key}: ${s.problem}`,{envelope:s}),!0);let l=cZ(a);return void 0!==n&&void 0!==l&&n!==l?c8("header-body-version-mismatch",n,`the body envelope names protocol version ${l} but the MCP-Protocol-Version header names ${n}`):void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==i?c8("method-header-mismatch",t.mcpMethodHeader,`the body names method ${i} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:r,classification:ur(l)}}if(o){let t=cz(a),r=cD(t??{}).filter(t=>"missing"===t.problem).map(t=>t.key),i=void 0===t?["_meta"]:r.length>0?r:[nU];return c5("envelope","modern-header-without-claim",400,new cp(cd.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${n}, but the request is missing the required per-request envelope key(s): ${i.join(", ")}`,{envelope:{missing:i}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==n&&{requestedVersion:n}}}(t,r):ut(r)&&cU(r)?function(t,r){let a=r.params,i=r.method,n=t.protocolVersionHeader,o=void 0!==n&&n>=lJ;if(cL(a)){let o=cZ(a);if(void 0===o){let t=cz(a),r=(void 0===t?[]:cD(t)).find(t=>t.key===nU)??{key:nU,problem:"expected a protocol version string"};return c5("envelope","notification-envelope-invalid",400,new cp(cd.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${r.key}: ${r.problem}`,{envelope:r}),!0)}if(void 0!==n&&n!==o)return c8("notification-header-body-version-mismatch",n,`the notification envelope names protocol version ${o} but the MCP-Protocol-Version header names ${n}`);let s=ur(o);return"modern"===s.era&&void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==i?c8("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${i} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:s}}return o?void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==i?c8("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${i} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:{era:"modern",revision:n}}:{kind:"legacy",reason:"notification",...void 0!==n&&{requestedVersion:n}}}(t,r):c5("jsonrpc-shape","invalid-json-rpc-body",400,new cp(cd.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:n,protocolVersionHeader:t.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:t.headers.get("mcp-method")??void 0,mcpNameHeader:t.headers.get("mcp-name")??void 0,...void 0!==i&&{body:i}}),body:i,parsedBody:o,forwardRequest:s}}let pG=Symbol("Let zodToJsonSchema decide on which parser to use"),pW={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"};(P=I||(I={})).assertEqual=t=>{},P.assertIs=function(t){},P.assertNever=function(t){throw Error()},P.arrayToEnum=t=>{let r={};for(let a of t)r[a]=a;return r},P.getValidEnumValues=t=>{let r=P.objectKeys(t).filter(r=>"number"!=typeof t[t[r]]),a={};for(let i of r)a[i]=t[i];return P.objectValues(a)},P.objectValues=t=>P.objectKeys(t).map(function(r){return t[r]}),P.objectKeys="function"==typeof Object.keys?t=>Object.keys(t):t=>{let r=[];for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push(a);return r},P.find=(t,r)=>{for(let a of t)if(r(a))return a},P.isInteger="function"==typeof Number.isInteger?t=>Number.isInteger(t):t=>"number"==typeof t&&Number.isFinite(t)&&Math.floor(t)===t,P.joinValues=function(t,r=" | "){return t.map(t=>"string"==typeof t?`'${t}'`:t).join(r)},P.jsonStringifyReplacer=(t,r)=>"bigint"==typeof r?r.toString():r,(N||(N={})).mergeShapes=(t,r)=>({...t,...r});let pY=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pX=t=>{switch(typeof t){case"undefined":return pY.undefined;case"string":return pY.string;case"number":return Number.isNaN(t)?pY.nan:pY.number;case"boolean":return pY.boolean;case"function":return pY.function;case"bigint":return pY.bigint;case"symbol":return pY.symbol;case"object":if(Array.isArray(t))return pY.array;if(null===t)return pY.null;if(t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch)return pY.promise;if("undefined"!=typeof Map&&t instanceof Map)return pY.map;if("undefined"!=typeof Set&&t instanceof Set)return pY.set;if("undefined"!=typeof Date&&t instanceof Date)return pY.date;return pY.object;default:return pY.unknown}},pQ=I.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 p0 extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(t){return t.message},a={_errors:[]},i=t=>{for(let n of t.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)a._errors.push(r(n));else{let t=a,i=0;for(;i<n.path.length;){let a=n.path[i],o=i===n.path.length-1;if("_errors"===a){o&&t._errors.push(r(n)),i++;continue}Object.prototype.hasOwnProperty.call(t,a)||("__proto__"===a?Object.defineProperty(t,a,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):t[a]={_errors:[]}),t=t[a],o&&t._errors.push(r(n)),i++}}};return i(this),a}static assert(t){if(!(t instanceof p0))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(t=t=>t.message){let r=Object.create(null),a=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else a.push(t(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}}p0.create=t=>new p0(t);let p1=(t,r)=>{let a;switch(t.code){case pQ.invalid_type:a=t.received===pY.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case pQ.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,I.jsonStringifyReplacer)}`;break;case pQ.unrecognized_keys:a=`Unrecognized key(s) in object: ${I.joinValues(t.keys,", ")}`;break;case pQ.invalid_union:a="Invalid input";break;case pQ.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${I.joinValues(t.options)}`;break;case pQ.invalid_enum_value:a=`Invalid enum value. Expected ${I.joinValues(t.options)}, received '${t.received}'`;break;case pQ.invalid_arguments:a="Invalid function arguments";break;case pQ.invalid_return_type:a="Invalid function return type";break;case pQ.invalid_date:a="Invalid date";break;case pQ.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:I.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case pQ.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case pQ.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case pQ.custom:a="Invalid input";break;case pQ.invalid_intersection_types:a="Intersection results could not be merged";break;case pQ.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case pQ.not_finite:a="Number must be finite";break;default:a=r.defaultError,I.assertNever(t)}return{message:a}};(E=q||(q={})).errToObj=t=>"string"==typeof t?{message:t}:t||{},E.toString=t=>"string"==typeof t?t:t?.message;let p2=t=>{let{data:r,path:a,errorMaps:i,issueData:n}=t,o=[...a,...n.path||[]],s={...n,path:o};if(void 0!==n.message)return{...n,path:o,message:n.message};let l="";for(let t of i.filter(t=>!!t).slice().reverse())l=t(s,{data:r,defaultError:l}).message;return{...n,path:o,message:l}};function p9(t,r){let a=p2({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,p1,void 0].filter(t=>!!t)});t.common.issues.push(a)}class p4{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let i of r){if("aborted"===i.status)return p3;"dirty"===i.status&&t.dirty(),a.push(i.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let t of r){let r=await t.key,i=await t.value;a.push({key:r,value:i})}return p4.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let i of r){let{key:r,value:n}=i;if("aborted"===r.status||"aborted"===n.status)return p3;"dirty"===r.status&&t.dirty(),"dirty"===n.status&&t.dirty(),"__proto__"!==r.value&&(void 0!==n.value||i.alwaysSet)&&(a[r.value]=n.value)}return{status:t.value,value:a}}}let p3=Object.freeze({status:"aborted"}),p6=t=>({status:"dirty",value:t}),p5=t=>({status:"valid",value:t}),p8=t=>"undefined"!=typeof Promise&&t instanceof Promise;class p7{constructor(t,r,a,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=i}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 me=(t,r)=>{if("valid"===r.status)return{success:!0,data:r.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new p0(t.common.issues);return this._error=r,this._error}}};function mt(t){if(!t)return{};let{errorMap:r,invalid_type_error:a,required_error:i,description:n}=t;if(r&&(a||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return r?{errorMap:r,description:n}:{errorMap:(r,n)=>{let{message:o}=t;return"invalid_enum_value"===r.code?{message:o??n.defaultError}:void 0===n.data?{message:o??i??n.defaultError}:"invalid_type"!==r.code?{message:n.defaultError}:{message:o??a??n.defaultError}},description:n}}class mr{get description(){return this._def.description}_getType(t){return pX(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:pX(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new p4,ctx:{common:t.parent.common,data:t.data,parsedType:pX(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(p8(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){return Promise.resolve(this._parse(t))}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pX(t)},i=this._parseSync({data:t,path:a.path,parent:a});return me(a,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pX(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return"valid"===a.status?{value:a.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(t=>"valid"===t.status?{value:t.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pX(t)},i=this._parse({data:t,path:a.path,parent:a});return me(a,await (p8(i)?i:Promise.resolve(i)))}refine(t,r){return this._refinement((a,i)=>{let n=t(a),o=()=>i.addIssue({code:pQ.custom,..."string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(a):r});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(t=>!!t||(o(),!1)):!!n||(o(),!1)})}refinement(t,r){return this._refinement((a,i)=>!!t(a)||(i.addIssue("function"==typeof r?r(a,i):r),!1))}_refinement(t){return new mG({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:t=>this["~validate"](t)}}optional(){return mW.create(this,this._def)}nullable(){return mY.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mC.create(this)}promise(){return mK.create(this,this._def)}or(t){return mN.create([this,t],this._def)}and(t){return mM.create(this,t,this._def)}transform(t){return new mG({...mt(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:t}})}default(t){return new mX({...mt(this._def),innerType:this,defaultValue:"function"==typeof t?t:()=>t,typeName:A.ZodDefault})}brand(){return new m1({typeName:A.ZodBranded,type:this,...mt(this._def)})}catch(t){return new mQ({...mt(this._def),innerType:this,catchValue:"function"==typeof t?t:()=>t,typeName:A.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return m2.create(this,t)}readonly(){return m9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let ma=/^c[^\s-]{8,}$/i,mi=/^[0-9a-z]+$/,mn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mo=/^[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,ms=/^[a-z0-9_-]{21}$/i,ml=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mc=/^[-+]?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)?)??$/,mu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,md=/^(?:(?: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])$/,mp=/^(?:(?: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])$/,mm=/^(([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]))$/,mh=/^(([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])$/,mf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,my=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mg="((\\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])))",mv=RegExp(`^${mg}$`);function m_(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:null==t.precision&&(r=`${r}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${a}`}class mb extends mr{_parse(t){var r,a,i,n;let o;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pY.string){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.string,received:r.parsedType}),p3}let s=new p4;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(p9(o=this._getOrReturnCtx(t,o),{code:pQ.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)t.data.length>l.value&&(p9(o=this._getOrReturnCtx(t,o),{code:pQ.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let r=t.data.length>l.value,a=t.data.length<l.value;(r||a)&&(o=this._getOrReturnCtx(t,o),r?p9(o,{code:pQ.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):a&&p9(o,{code:pQ.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)mu.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"email",code:pQ.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)h||(h=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),h.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"emoji",code:pQ.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)mo.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"uuid",code:pQ.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)ms.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"nanoid",code:pQ.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)ma.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"cuid",code:pQ.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)mi.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"cuid2",code:pQ.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)mn.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"ulid",code:pQ.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{p9(o=this._getOrReturnCtx(t,o),{validation:"url",code:pQ.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"regex",code:pQ.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(t){let r=`${mg}T${m_(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${a.join("|")})`,RegExp(`^${r}$`)})(l).test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?mv.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${m_(l)}$`).test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{code:pQ.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?mc.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"duration",code:pQ.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&md.test(r)||("v6"===a||!a)&&mm.test(r))&&1&&(p9(o=this._getOrReturnCtx(t,o),{validation:"ip",code:pQ.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(t,r){if(!ml.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let i=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(i));if("object"!=typeof n||null===n||"typ"in n&&n?.typ!=="JWT"||!n.alg||r&&n.alg!==r)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(p9(o=this._getOrReturnCtx(t,o),{validation:"jwt",code:pQ.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(n=l.version)||!n)&&mp.test(i)||("v6"===n||!n)&&mh.test(i))&&1&&(p9(o=this._getOrReturnCtx(t,o),{validation:"cidr",code:pQ.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?mf.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"base64",code:pQ.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?my.test(t.data)||(p9(o=this._getOrReturnCtx(t,o),{validation:"base64url",code:pQ.invalid_string,message:l.message}),s.dirty()):I.assertNever(l);return{status:s.value,value:t.data}}_regex(t,r,a){return this.refinement(r=>t.test(r),{validation:r,code:pQ.invalid_string,...q.errToObj(a)})}_addCheck(t){return new mb({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...q.errToObj(t)})}datetime(t){return"string"==typeof t?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:void 0===t?.precision?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return"string"==typeof t?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:void 0===t?.precision?null:t?.precision,...q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...q.errToObj(r)})}nonempty(t){return this.min(1,q.errToObj(t))}trim(){return new mb({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new mb({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new mb({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>"datetime"===t.kind)}get isDate(){return!!this._def.checks.find(t=>"date"===t.kind)}get isTime(){return!!this._def.checks.find(t=>"time"===t.kind)}get isDuration(){return!!this._def.checks.find(t=>"duration"===t.kind)}get isEmail(){return!!this._def.checks.find(t=>"email"===t.kind)}get isURL(){return!!this._def.checks.find(t=>"url"===t.kind)}get isEmoji(){return!!this._def.checks.find(t=>"emoji"===t.kind)}get isUUID(){return!!this._def.checks.find(t=>"uuid"===t.kind)}get isNANOID(){return!!this._def.checks.find(t=>"nanoid"===t.kind)}get isCUID(){return!!this._def.checks.find(t=>"cuid"===t.kind)}get isCUID2(){return!!this._def.checks.find(t=>"cuid2"===t.kind)}get isULID(){return!!this._def.checks.find(t=>"ulid"===t.kind)}get isIP(){return!!this._def.checks.find(t=>"ip"===t.kind)}get isCIDR(){return!!this._def.checks.find(t=>"cidr"===t.kind)}get isBase64(){return!!this._def.checks.find(t=>"base64"===t.kind)}get isBase64url(){return!!this._def.checks.find(t=>"base64url"===t.kind)}get minLength(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}mb.create=t=>new mb({checks:[],typeName:A.ZodString,coerce:t?.coerce??!1,...mt(t)});class mS extends mr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){let r;if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pY.number){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.number,received:r.parsedType}),p3}let a=new p4;for(let i of this._def.checks)"int"===i.kind?I.isInteger(t.data)||(p9(r=this._getOrReturnCtx(t,r),{code:pQ.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):"multipleOf"===i.kind?0!==function(t,r){let a=(t.toString().split(".")[1]||"").length,i=(r.toString().split(".")[1]||"").length,n=a>i?a:i;return Number.parseInt(t.toFixed(n).replace(".",""))%Number.parseInt(r.toFixed(n).replace(".",""))/10**n}(t.data,i.value)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(p9(r=this._getOrReturnCtx(t,r),{code:pQ.not_finite,message:i.message}),a.dirty()):I.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,a,i){return new mS({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:q.toString(i)}]})}_addCheck(t){return new mS({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&I.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks)if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;else"min"===a.kind?(null===r||a.value>r)&&(r=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value);return Number.isFinite(r)&&Number.isFinite(t)}}mS.create=t=>new mS({checks:[],typeName:A.ZodNumber,coerce:t?.coerce||!1,...mt(t)});class m$ extends mr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){let r;if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pY.bigint)return this._getInvalidInput(t);let a=new p4;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?t.data<i.value:t.data<=i.value)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"max"===i.kind?(i.inclusive?t.data>i.value:t.data>=i.value)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):I.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.bigint,received:r.parsedType}),p3}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,a,i){return new m$({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:q.toString(i)}]})}_addCheck(t){return new m$({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}m$.create=t=>new m$({checks:[],typeName:A.ZodBigInt,coerce:t?.coerce??!1,...mt(t)});class mw extends mr{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pY.boolean){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.boolean,received:r.parsedType}),p3}return p5(t.data)}}mw.create=t=>new mw({typeName:A.ZodBoolean,coerce:t?.coerce||!1,...mt(t)});class mR extends mr{_parse(t){let r;if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pY.date){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.date,received:r.parsedType}),p3}if(Number.isNaN(t.data.getTime()))return p9(this._getOrReturnCtx(t),{code:pQ.invalid_date}),p3;let a=new p4;for(let i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(p9(r=this._getOrReturnCtx(t,r),{code:pQ.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):I.assertNever(i);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new mR({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:q.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return null!=t?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return null!=t?new Date(t):null}}mR.create=t=>new mR({checks:[],coerce:t?.coerce||!1,typeName:A.ZodDate,...mt(t)});class mk extends mr{_parse(t){if(this._getType(t)!==pY.symbol){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.symbol,received:r.parsedType}),p3}return p5(t.data)}}mk.create=t=>new mk({typeName:A.ZodSymbol,...mt(t)});class mx extends mr{_parse(t){if(this._getType(t)!==pY.undefined){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.undefined,received:r.parsedType}),p3}return p5(t.data)}}mx.create=t=>new mx({typeName:A.ZodUndefined,...mt(t)});class mP extends mr{_parse(t){if(this._getType(t)!==pY.null){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.null,received:r.parsedType}),p3}return p5(t.data)}}mP.create=t=>new mP({typeName:A.ZodNull,...mt(t)});class mE extends mr{constructor(){super(...arguments),this._any=!0}_parse(t){return p5(t.data)}}mE.create=t=>new mE({typeName:A.ZodAny,...mt(t)});class mT extends mr{constructor(){super(...arguments),this._unknown=!0}_parse(t){return p5(t.data)}}mT.create=t=>new mT({typeName:A.ZodUnknown,...mt(t)});class mj extends mr{_parse(t){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.never,received:r.parsedType}),p3}}mj.create=t=>new mj({typeName:A.ZodNever,...mt(t)});class mO extends mr{_parse(t){if(this._getType(t)!==pY.undefined){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.void,received:r.parsedType}),p3}return p5(t.data)}}mO.create=t=>new mO({typeName:A.ZodVoid,...mt(t)});class mC extends mr{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),i=this._def;if(r.parsedType!==pY.array)return p9(r,{code:pQ.invalid_type,expected:pY.array,received:r.parsedType}),p3;if(null!==i.exactLength){let t=r.data.length>i.exactLength.value,n=r.data.length<i.exactLength.value;(t||n)&&(p9(r,{code:t?pQ.too_big:pQ.too_small,minimum:n?i.exactLength.value:void 0,maximum:t?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(null!==i.minLength&&r.data.length<i.minLength.value&&(p9(r,{code:pQ.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),null!==i.maxLength&&r.data.length>i.maxLength.value&&(p9(r,{code:pQ.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((t,a)=>i.type._parseAsync(new p7(r,t,r.path,a)))).then(t=>p4.mergeArray(a,t));let n=[...r.data].map((t,a)=>i.type._parseSync(new p7(r,t,r.path,a)));return p4.mergeArray(a,n)}get element(){return this._def.type}min(t,r){return new mC({...this._def,minLength:{value:t,message:q.toString(r)}})}max(t,r){return new mC({...this._def,maxLength:{value:t,message:q.toString(r)}})}length(t,r){return new mC({...this._def,exactLength:{value:t,message:q.toString(r)}})}nonempty(t){return this.min(1,t)}}mC.create=(t,r)=>new mC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...mt(r)});class mI extends mr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let t=this._def.shape(),r=I.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==pY.object){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.object,received:r.parsedType}),p3}let{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof mj&&"strip"===this._def.unknownKeys))for(let t in a.data)n.includes(t)||o.push(t);let s=[];for(let t of n){let r=i[t],n=a.data[t];s.push({key:{status:"valid",value:t},value:r._parse(new p7(a,n,a.path,t)),alwaysSet:t in a.data})}if(this._def.catchall instanceof mj){let t=this._def.unknownKeys;if("passthrough"===t)for(let t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===t)o.length>0&&(p9(a,{code:pQ.unrecognized_keys,keys:o}),r.dirty());else if("strip"===t);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let t=this._def.catchall;for(let r of o){let i=a.data[r];s.push({key:{status:"valid",value:r},value:t._parse(new p7(a,i,a.path,r)),alwaysSet:r in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let t=[];for(let r of s){let a=await r.key,i=await r.value;t.push({key:a,value:i,alwaysSet:r.alwaysSet})}return t}).then(t=>p4.mergeObjectSync(r,t)):p4.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return q.errToObj,new mI({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return"unrecognized_keys"===r.code?{message:q.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new mI({...this._def,unknownKeys:"strip"})}passthrough(){return new mI({...this._def,unknownKeys:"passthrough"})}extend(t){return new mI({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new mI({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:A.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new mI({...this._def,catchall:t})}pick(t){let r={};for(let a of I.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new mI({...this._def,shape:()=>r})}omit(t){let r={};for(let a of I.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new mI({...this._def,shape:()=>r})}deepPartial(){return function t(r){if(r instanceof mI){let a={};for(let i in r.shape){let n=r.shape[i];a[i]=mW.create(t(n))}return new mI({...r._def,shape:()=>a})}if(r instanceof mC)return new mC({...r._def,type:t(r.element)});if(r instanceof mW)return mW.create(t(r.unwrap()));if(r instanceof mY)return mY.create(t(r.unwrap()));if(r instanceof mz)return mz.create(r.items.map(r=>t(r)));else return r}(this)}partial(t){let r={};for(let a of I.objectKeys(this.shape)){let i=this.shape[a];t&&!t[a]?r[a]=i:r[a]=i.optional()}return new mI({...this._def,shape:()=>r})}required(t){let r={};for(let a of I.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let t=this.shape[a];for(;t instanceof mW;)t=t._def.innerType;r[a]=t}return new mI({...this._def,shape:()=>r})}keyof(){return mH(I.objectKeys(this.shape))}}mI.create=(t,r)=>new mI({shape:()=>t,unknownKeys:"strip",catchall:mj.create(),typeName:A.ZodObject,...mt(r)}),mI.strictCreate=(t,r)=>new mI({shape:()=>t,unknownKeys:"strict",catchall:mj.create(),typeName:A.ZodObject,...mt(r)}),mI.lazycreate=(t,r)=>new mI({shape:t,unknownKeys:"strip",catchall:mj.create(),typeName:A.ZodObject,...mt(r)});class mN extends mr{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;if(r.common.async)return Promise.all(a.map(async t=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await t._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(function(t){for(let r of t)if("valid"===r.result.status)return r.result;for(let a of t)if("dirty"===a.result.status)return r.common.issues.push(...a.ctx.common.issues),a.result;let a=t.map(t=>new p0(t.ctx.common.issues));return p9(r,{code:pQ.invalid_union,unionErrors:a}),p3});{let t,i=[];for(let n of a){let a={...r,common:{...r.common,issues:[]},parent:null},o=n._parseSync({data:r.data,path:r.path,parent:a});if("valid"===o.status)return o;"dirty"!==o.status||t||(t={result:o,ctx:a}),a.common.issues.length&&i.push(a.common.issues)}if(t)return r.common.issues.push(...t.ctx.common.issues),t.result;let n=i.map(t=>new p0(t));return p9(r,{code:pQ.invalid_union,unionErrors:n}),p3}}get options(){return this._def.options}}mN.create=(t,r)=>new mN({options:t,typeName:A.ZodUnion,...mt(r)});let mq=t=>{if(t instanceof mF)return mq(t.schema);if(t instanceof mG)return mq(t.innerType());if(t instanceof mU)return[t.value];if(t instanceof mJ)return t.options;if(t instanceof mB)return I.objectValues(t.enum);else if(t instanceof mX)return mq(t._def.innerType);else if(t instanceof mx)return[void 0];else if(t instanceof mP)return[null];else if(t instanceof mW)return[void 0,...mq(t.unwrap())];else if(t instanceof mY)return[null,...mq(t.unwrap())];else if(t instanceof m1)return mq(t.unwrap());else if(t instanceof m9)return mq(t.unwrap());else if(t instanceof mQ)return mq(t._def.innerType);else return[]};class mA extends mr{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pY.object)return p9(r,{code:pQ.invalid_type,expected:pY.object,received:r.parsedType}),p3;let a=this.discriminator,i=r.data[a],n=this.optionsMap.get(i);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(p9(r,{code:pQ.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),p3)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let i=new Map;for(let a of r){let r=mq(a.shape[t]);if(!r.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let n of r){if(i.has(n))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,a)}}return new mA({typeName:A.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...mt(a)})}}class mM extends mr{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=(t,i)=>{if("aborted"===t.status||"aborted"===i.status)return p3;let n=function t(r,a){let i=pX(r),n=pX(a);if(r===a)return{valid:!0,data:r};if(i===pY.object&&n===pY.object){let i=I.objectKeys(a),n=I.objectKeys(r).filter(t=>-1!==i.indexOf(t)),o={...r,...a};for(let i of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,n)){if("__proto__"===i)continue;let n=t(r[i],a[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(i===pY.array&&n===pY.array){if(r.length!==a.length)return{valid:!1};let i=[];for(let n=0;n<r.length;n++){let o=t(r[n],a[n]);if(!o.valid)return{valid:!1};i.push(o.data)}return{valid:!0,data:i}}if(i===pY.date&&n===pY.date&&+r==+a)return{valid:!0,data:r};return{valid:!1}}(t.value,i.value);return n.valid?(("dirty"===t.status||"dirty"===i.status)&&r.dirty(),{status:r.value,value:n.data}):(p9(a,{code:pQ.invalid_intersection_types}),p3)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([t,r])=>i(t,r)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}mM.create=(t,r,a)=>new mM({left:t,right:r,typeName:A.ZodIntersection,...mt(a)});class mz extends mr{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pY.array)return p9(a,{code:pQ.invalid_type,expected:pY.array,received:a.parsedType}),p3;if(a.data.length<this._def.items.length)return p9(a,{code:pQ.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p3;!this._def.rest&&a.data.length>this._def.items.length&&(p9(a,{code:pQ.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...a.data].map((t,r)=>{let i=this._def.items[r]||this._def.rest;return i?i._parse(new p7(a,t,a.path,r)):null}).filter(t=>!!t);return a.common.async?Promise.all(i).then(t=>p4.mergeArray(r,t)):p4.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new mz({...this._def,rest:t})}}mz.create=(t,r)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new mz({items:t,typeName:A.ZodTuple,rest:null,...mt(r)})};class mL extends mr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pY.object)return p9(a,{code:pQ.invalid_type,expected:pY.object,received:a.parsedType}),p3;let i=[],n=this._def.keyType,o=this._def.valueType;for(let t in a.data)i.push({key:n._parse(new p7(a,t,a.path,t)),value:o._parse(new p7(a,a.data[t],a.path,t)),alwaysSet:t in a.data});return a.common.async?p4.mergeObjectAsync(r,i):p4.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,a){return new mL(r instanceof mr?{keyType:t,valueType:r,typeName:A.ZodRecord,...mt(a)}:{keyType:mb.create(),valueType:t,typeName:A.ZodRecord,...mt(r)})}}class mZ extends mr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pY.map)return p9(a,{code:pQ.invalid_type,expected:pY.map,received:a.parsedType}),p3;let i=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([t,r],o)=>({key:i._parse(new p7(a,t,a.path,[o,"key"])),value:n._parse(new p7(a,r,a.path,[o,"value"]))}));if(a.common.async){let t=new Map;return Promise.resolve().then(async()=>{for(let a of o){let i=await a.key,n=await a.value;if("aborted"===i.status||"aborted"===n.status)return p3;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}})}{let t=new Map;for(let a of o){let i=a.key,n=a.value;if("aborted"===i.status||"aborted"===n.status)return p3;("dirty"===i.status||"dirty"===n.status)&&r.dirty(),t.set(i.value,n.value)}return{status:r.value,value:t}}}}mZ.create=(t,r,a)=>new mZ({valueType:r,keyType:t,typeName:A.ZodMap,...mt(a)});class mD extends mr{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==pY.set)return p9(a,{code:pQ.invalid_type,expected:pY.set,received:a.parsedType}),p3;let i=this._def;null!==i.minSize&&a.data.size<i.minSize.value&&(p9(a,{code:pQ.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),null!==i.maxSize&&a.data.size>i.maxSize.value&&(p9(a,{code:pQ.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let n=this._def.valueType;function o(t){let a=new Set;for(let i of t){if("aborted"===i.status)return p3;"dirty"===i.status&&r.dirty(),a.add(i.value)}return{status:r.value,value:a}}let s=[...a.data.values()].map((t,r)=>n._parse(new p7(a,t,a.path,r)));return a.common.async?Promise.all(s).then(t=>o(t)):o(s)}min(t,r){return new mD({...this._def,minSize:{value:t,message:q.toString(r)}})}max(t,r){return new mD({...this._def,maxSize:{value:t,message:q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}mD.create=(t,r)=>new mD({valueType:t,minSize:null,maxSize:null,typeName:A.ZodSet,...mt(r)});class mV extends mr{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==pY.function)return p9(r,{code:pQ.invalid_type,expected:pY.function,received:r.parsedType}),p3;function a(t,a){return p2({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,p1,p1].filter(t=>!!t),issueData:{code:pQ.invalid_arguments,argumentsError:a}})}function i(t,a){return p2({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,p1,p1].filter(t=>!!t),issueData:{code:pQ.invalid_return_type,returnTypeError:a}})}let n={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof mK){let t=this;return p5(async function(...r){let s=new p0([]),l=await t._def.args.parseAsync(r,n).catch(t=>{throw s.addIssue(a(r,t)),s}),c=await Reflect.apply(o,this,l);return await t._def.returns._def.type.parseAsync(c,n).catch(t=>{throw s.addIssue(i(c,t)),s})})}{let t=this;return p5(function(...r){let s=t._def.args.safeParse(r,n);if(!s.success)throw new p0([a(r,s.error)]);let l=Reflect.apply(o,this,s.data),c=t._def.returns.safeParse(l,n);if(!c.success)throw new p0([i(l,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new mV({...this._def,args:mz.create(t).rest(mT.create())})}returns(t){return new mV({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new mV({args:t||mz.create([]).rest(mT.create()),returns:r||mT.create(),typeName:A.ZodFunction,...mt(a)})}}class mF extends mr{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}mF.create=(t,r)=>new mF({getter:t,typeName:A.ZodLazy,...mt(r)});class mU extends mr{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return p9(r,{received:r.data,code:pQ.invalid_literal,expected:this._def.value}),p3}return{status:"valid",value:t.data}}get value(){return this._def.value}}function mH(t,r){return new mJ({values:t,typeName:A.ZodEnum,...mt(r)})}mU.create=(t,r)=>new mU({value:t,typeName:A.ZodLiteral,...mt(r)});class mJ extends mr{_parse(t){if("string"!=typeof t.data){let r=this._getOrReturnCtx(t),a=this._def.values;return p9(r,{expected:I.joinValues(a),received:r.parsedType,code:pQ.invalid_type}),p3}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return p9(r,{received:r.data,code:pQ.invalid_enum_value,options:a}),p3}return p5(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return mJ.create(t,{...this._def,...r})}exclude(t,r=this._def){return mJ.create(this.options.filter(r=>!t.includes(r)),{...this._def,...r})}}mJ.create=mH;class mB extends mr{_parse(t){let r=I.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==pY.string&&a.parsedType!==pY.number){let t=I.objectValues(r);return p9(a,{expected:I.joinValues(t),received:a.parsedType,code:pQ.invalid_type}),p3}if(this._cache||(this._cache=new Set(I.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let t=I.objectValues(r);return p9(a,{received:a.data,code:pQ.invalid_enum_value,options:t}),p3}return p5(t.data)}get enum(){return this._def.values}}mB.create=(t,r)=>new mB({values:t,typeName:A.ZodNativeEnum,...mt(r)});class mK extends mr{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);return r.parsedType!==pY.promise&&!1===r.common.async?(p9(r,{code:pQ.invalid_type,expected:pY.promise,received:r.parsedType}),p3):p5((r.parsedType===pY.promise?r.data:Promise.resolve(r.data)).then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}}mK.create=(t,r)=>new mK({type:t,typeName:A.ZodPromise,...mt(r)});class mG extends mr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),i=this._def.effect||null,n={addIssue:t=>{p9(a,t),t.fatal?r.abort():r.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let t=i.transform(a.data,n);if(a.common.async)return Promise.resolve(t).then(async t=>{if("aborted"===r.value)return p3;let i=await this._def.schema._parseAsync({data:t,path:a.path,parent:a});return"aborted"===i.status?p3:"dirty"===i.status||"dirty"===r.value?p6(i.value):i});{if("aborted"===r.value)return p3;let i=this._def.schema._parseSync({data:t,path:a.path,parent:a});return"aborted"===i.status?p3:"dirty"===i.status||"dirty"===r.value?p6(i.value):i}}if("refinement"===i.type){let t=t=>{let r=i.refinement(t,n);if(a.common.async)return Promise.resolve(r);if(r instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?p3:("dirty"===a.status&&r.dirty(),t(a.value).then(()=>({status:r.value,value:a.value}))));{let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===i.status?p3:("dirty"===i.status&&r.dirty(),t(i.value),{status:r.value,value:i.value})}}if("transform"===i.type)if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"valid"!==t.status?p3:Promise.resolve(i.transform(t.value,n)).then(t=>({status:r.value,value:t})));else{let t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if("valid"!==t.status)return p3;let o=i.transform(t.value,n);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}I.assertNever(i)}}mG.create=(t,r,a)=>new mG({schema:t,typeName:A.ZodEffects,effect:r,...mt(a)}),mG.createWithPreprocess=(t,r,a)=>new mG({schema:r,effect:{type:"preprocess",transform:t},typeName:A.ZodEffects,...mt(a)});class mW extends mr{_parse(t){return this._getType(t)===pY.undefined?p5(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mW.create=(t,r)=>new mW({innerType:t,typeName:A.ZodOptional,...mt(r)});class mY extends mr{_parse(t){return this._getType(t)===pY.null?p5(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mY.create=(t,r)=>new mY({innerType:t,typeName:A.ZodNullable,...mt(r)});class mX extends mr{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===pY.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}mX.create=(t,r)=>new mX({innerType:t,typeName:A.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...mt(r)});class mQ extends mr{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return p8(i)?i.then(t=>({status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new p0(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new p0(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}mQ.create=(t,r)=>new mQ({innerType:t,typeName:A.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...mt(r)});class m0 extends mr{_parse(t){if(this._getType(t)!==pY.nan){let r=this._getOrReturnCtx(t);return p9(r,{code:pQ.invalid_type,expected:pY.nan,received:r.parsedType}),p3}return{status:"valid",value:t.data}}}m0.create=t=>new m0({typeName:A.ZodNaN,...mt(t)}),Symbol("zod_brand");class m1 extends mr{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}}class m2 extends mr{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?p3:"dirty"===t.status?(r.dirty(),p6(t.value)):this._def.out._parseAsync({data:t.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?p3:"dirty"===t.status?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(t,r){return new m2({in:t,out:r,typeName:A.ZodPipeline})}}class m9 extends mr{_parse(t){let r=this._def.innerType._parse(t),a=t=>("valid"===t.status&&(t.value=Object.freeze(t.value)),t);return p8(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}}m9.create=(t,r)=>new m9({innerType:t,typeName:A.ZodReadonly,...mt(r)}),mI.lazycreate,(T=A||(A={})).ZodString="ZodString",T.ZodNumber="ZodNumber",T.ZodNaN="ZodNaN",T.ZodBigInt="ZodBigInt",T.ZodBoolean="ZodBoolean",T.ZodDate="ZodDate",T.ZodSymbol="ZodSymbol",T.ZodUndefined="ZodUndefined",T.ZodNull="ZodNull",T.ZodAny="ZodAny",T.ZodUnknown="ZodUnknown",T.ZodNever="ZodNever",T.ZodVoid="ZodVoid",T.ZodArray="ZodArray",T.ZodObject="ZodObject",T.ZodUnion="ZodUnion",T.ZodDiscriminatedUnion="ZodDiscriminatedUnion",T.ZodIntersection="ZodIntersection",T.ZodTuple="ZodTuple",T.ZodRecord="ZodRecord",T.ZodMap="ZodMap",T.ZodSet="ZodSet",T.ZodFunction="ZodFunction",T.ZodLazy="ZodLazy",T.ZodLiteral="ZodLiteral",T.ZodEnum="ZodEnum",T.ZodEffects="ZodEffects",T.ZodNativeEnum="ZodNativeEnum",T.ZodOptional="ZodOptional",T.ZodNullable="ZodNullable",T.ZodDefault="ZodDefault",T.ZodCatch="ZodCatch",T.ZodPromise="ZodPromise",T.ZodBranded="ZodBranded",T.ZodPipeline="ZodPipeline",T.ZodReadonly="ZodReadonly",mb.create,mS.create,m0.create,m$.create,mw.create,mR.create,mk.create,mx.create,mP.create,mE.create,mT.create,mj.create,mO.create,mC.create,mI.create,mI.strictCreate,mN.create,mA.create,mM.create,mz.create,mL.create,mZ.create,mD.create,mV.create,mF.create,mU.create,mJ.create,mB.create,mK.create,mG.create,mW.create,mY.create,mG.createWithPreprocess,m2.create;let m4=(t,r)=>{let a=0;for(;a<t.length&&a<r.length&&t[a]===r[a];a++);return[(t.length-a).toString(),...r.slice(a)].join("/")};function m3(t){if("openAi"!==t.target)return{};let r=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===t.$refStrategy?m4(r,t.currentPath):r.join("/")}}function m6(t,r,a,i){i?.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[r]:a})}function m5(t,r,a,i,n){t[r]=a,m6(t,r,i,n)}function m8(t,r){return h_(t.type._def,r)}let m7=/^[cC][^\s-]{8,}$/,he=/^[0-9a-z]+$/,ht=/^[0-9A-HJKMNP-TV-Z]{26}$/,hr=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ha=()=>(void 0===w&&(w=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),w),hi=/^(?:(?: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])$/,hn=/^(([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])$/,ho=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hl=/^[a-zA-Z0-9_-]{21}$/,hc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function hu(t,r){let a={type:"string"};if(t.checks)for(let i of t.checks)switch(i.kind){case"min":m5(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r);break;case"max":m5(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"email":switch(r.emailStrategy){case"format:email":hm(a,"email",i.message,r);break;case"format:idn-email":hm(a,"idn-email",i.message,r);break;case"pattern:zod":hh(a,hr,i.message,r)}break;case"url":hm(a,"uri",i.message,r);break;case"uuid":hm(a,"uuid",i.message,r);break;case"regex":hh(a,i.regex,i.message,r);break;case"cuid":hh(a,m7,i.message,r);break;case"cuid2":hh(a,he,i.message,r);break;case"startsWith":hh(a,RegExp(`^${hd(i.value,r)}`),i.message,r);break;case"endsWith":hh(a,RegExp(`${hd(i.value,r)}$`),i.message,r);break;case"datetime":hm(a,"date-time",i.message,r);break;case"date":hm(a,"date",i.message,r);break;case"time":hm(a,"time",i.message,r);break;case"duration":hm(a,"duration",i.message,r);break;case"length":m5(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,i.value):i.value,i.message,r),m5(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,i.value):i.value,i.message,r);break;case"includes":hh(a,RegExp(hd(i.value,r)),i.message,r);break;case"ip":"v6"!==i.version&&hm(a,"ipv4",i.message,r),"v4"!==i.version&&hm(a,"ipv6",i.message,r);break;case"base64url":hh(a,hs,i.message,r);break;case"jwt":hh(a,hc,i.message,r);break;case"cidr":"v6"!==i.version&&hh(a,hi,i.message,r),"v4"!==i.version&&hh(a,hn,i.message,r);break;case"emoji":hh(a,ha(),i.message,r);break;case"ulid":hh(a,ht,i.message,r);break;case"base64":switch(r.base64Strategy){case"format:binary":hm(a,"binary",i.message,r);break;case"contentEncoding:base64":m5(a,"contentEncoding","base64",i.message,r);break;case"pattern:zod":hh(a,ho,i.message,r)}break;case"nanoid":hh(a,hl,i.message,r)}return a}function hd(t,r){return"escape"===r.patternStrategy?function(t){let r="";for(let a=0;a<t.length;a++)hp.has(t[a])||(r+="\\"),r+=t[a];return r}(t):t}let hp=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function hm(t,r,a,i){t.format||t.anyOf?.some(t=>t.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&i.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.anyOf.push({format:r,...a&&i.errorMessages&&{errorMessage:{format:a}}})):m5(t,"format",r,a,i)}function hh(t,r,a,i){t.pattern||t.allOf?.some(t=>t.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&i.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.allOf.push({pattern:hf(r,i),...a&&i.errorMessages&&{errorMessage:{pattern:a}}})):m5(t,"pattern",hf(r,i),a,i)}function hf(t,r){if(!r.applyRegexFlags||!t.flags)return t.source;let a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=a.i?t.source.toLowerCase():t.source,n="",o=!1,s=!1,l=!1;for(let t=0;t<i.length;t++){if(o){n+=i[t],o=!1;continue}if(a.i){if(s){if(i[t].match(/[a-z]/)){l?(n+=i[t],n+=`${i[t-2]}-${i[t]}`.toUpperCase(),l=!1):"-"===i[t+1]&&i[t+2]?.match(/[a-z]/)?(n+=i[t],l=!0):n+=`${i[t]}${i[t].toUpperCase()}`;continue}}else if(i[t].match(/[a-z]/)){n+=`[${i[t]}${i[t].toUpperCase()}]`;continue}}if(a.m){if("^"===i[t]){n+=`(^|(?<=[\r
|
|
78
|
-
]))`;continue}else if("$"===
|
|
79
|
-
]))`;continue}}if(a.s&&"."===
|
|
80
|
-
`:`[${
|
|
81
|
-
]`;continue}n+=i[t],"\\"===i[t]?o=!0:s&&"]"===i[t]?s=!1:s||"["!==i[t]||(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${r.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function hy(t,r){if("openAi"===r.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===r.target&&t.keyType?._def.typeName===A.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((a,i)=>({...a,[i]:h_(t.valueType._def,{...r,currentPath:[...r.currentPath,"properties",i]})??m3(r)}),{}),additionalProperties:r.rejectedAdditionalProperties};let a={type:"object",additionalProperties:h_(t.valueType._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]})??r.allowedAdditionalProperties};if("openApi3"===r.target)return a;if(t.keyType?._def.typeName===A.ZodString&&t.keyType._def.checks?.length){let{type:i,...n}=hu(t.keyType._def,r);return{...a,propertyNames:n}}if(t.keyType?._def.typeName===A.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===A.ZodBranded&&t.keyType._def.type._def.typeName===A.ZodString&&t.keyType._def.type._def.checks?.length){let{type:i,...n}=m8(t.keyType._def,r);return{...a,propertyNames:n}}return a}let hg={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},hv=(t,r)=>{let a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((t,a)=>h_(t._def,{...r,currentPath:[...r.currentPath,"anyOf",`${a}`]})).filter(t=>!!t&&(!r.strictUnions||"object"==typeof t&&Object.keys(t).length>0));return a.length?{anyOf:a}:void 0};function h_(t,r,a=!1){let i=r.seen.get(t);if(r.override){let n=r.override?.(t,r,i,a);if(n!==pG)return n}if(i&&!a){let t=hb(i,r);if(void 0!==t)return t}let n={def:t,path:r.currentPath,jsonSchema:void 0};r.seen.set(t,n);let o=((t,r,a)=>{switch(r){case A.ZodString:return hu(t,a);case A.ZodNumber:let i={type:"number"};if(!t.checks)return i;for(let r of t.checks)switch(r.kind){case"int":i.type="integer",m6(i,"type",r.message,a);break;case"min":"jsonSchema7"===a.target?r.inclusive?m5(i,"minimum",r.value,r.message,a):m5(i,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(i.exclusiveMinimum=!0),m5(i,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?m5(i,"maximum",r.value,r.message,a):m5(i,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(i.exclusiveMaximum=!0),m5(i,"maximum",r.value,r.message,a));break;case"multipleOf":m5(i,"multipleOf",r.value,r.message,a)}return i;case A.ZodObject:return function(t,r){let a="openAi"===r.target,i={type:"object",properties:{}},n=[],o=t.shape();for(let t in o){let s=o[t];if(void 0===s||void 0===s._def)continue;let l=function(t){try{return t.isOptional()}catch{return!0}}(s);l&&a&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),l=!1);let c=h_(s._def,{...r,currentPath:[...r.currentPath,"properties",t],propertyPath:[...r.currentPath,"properties",t]});void 0!==c&&(i.properties[t]=c,l||n.push(t))}n.length&&(i.required=n);let s=function(t,r){if("ZodNever"!==t.catchall._def.typeName)return h_(t.catchall._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return r.allowedAdditionalProperties;case"strict":return r.rejectedAdditionalProperties;case"strip":return"strict"===r.removeAdditionalStrategy?r.allowedAdditionalProperties:r.rejectedAdditionalProperties}}(t,r);return void 0!==s&&(i.additionalProperties=s),i}(t,a);case A.ZodBigInt:let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":"jsonSchema7"===a.target?r.inclusive?m5(n,"minimum",r.value,r.message,a):m5(n,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(n.exclusiveMinimum=!0),m5(n,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?m5(n,"maximum",r.value,r.message,a):m5(n,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(n.exclusiveMaximum=!0),m5(n,"maximum",r.value,r.message,a));break;case"multipleOf":m5(n,"multipleOf",r.value,r.message,a)}return n;case A.ZodBoolean:return{type:"boolean"};case A.ZodDate:return function t(r,a,i){let n=i??a.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,n)=>t(r,a,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var o=r,s=a;let l={type:"integer",format:"unix-time"};if("openApi3"===s.target)return l;for(let t of o.checks)switch(t.kind){case"min":m5(l,"minimum",t.value,t.message,s);break;case"max":m5(l,"maximum",t.value,t.message,s)}return l}}(t,a);case A.ZodUndefined:return{not:m3(a)};case A.ZodNull:return"openApi3"===a.target?{enum:["null"],nullable:!0}:{type:"null"};case A.ZodArray:let o;return o={type:"array"},t.type?._def&&t.type?._def?.typeName!==A.ZodAny&&(o.items=h_(t.type._def,{...a,currentPath:[...a.currentPath,"items"]})),t.minLength&&m5(o,"minItems",t.minLength.value,t.minLength.message,a),t.maxLength&&m5(o,"maxItems",t.maxLength.value,t.maxLength.message,a),t.exactLength&&(m5(o,"minItems",t.exactLength.value,t.exactLength.message,a),m5(o,"maxItems",t.exactLength.value,t.exactLength.message,a)),o;case A.ZodUnion:case A.ZodDiscriminatedUnion:if("openApi3"===a.target)return hv(t,a);let s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(t=>t._def.typeName in hg&&(!t._def.checks||!t._def.checks.length))){let t=s.reduce((t,r)=>{let a=hg[r._def.typeName];return a&&!t.includes(a)?[...t,a]:t},[]);return{type:t.length>1?t:t[0]}}if(s.every(t=>"ZodLiteral"===t._def.typeName&&!t.description)){let t=s.reduce((t,r)=>{let a=typeof r._def.value;switch(a){case"string":case"number":case"boolean":return[...t,a];case"bigint":return[...t,"integer"];case"object":if(null===r._def.value)return[...t,"null"];default:return t}},[]);if(t.length===s.length){let r=t.filter((t,r,a)=>a.indexOf(t)===r);return{type:r.length>1?r:r[0],enum:s.reduce((t,r)=>t.includes(r._def.value)?t:[...t,r._def.value],[])}}}else if(s.every(t=>"ZodEnum"===t._def.typeName))return{type:"string",enum:s.reduce((t,r)=>[...t,...r._def.values.filter(r=>!t.includes(r))],[])};return hv(t,a);case A.ZodIntersection:let l,c,u;return l=[h_(t.left._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),h_(t.right._def,{...a,currentPath:[...a.currentPath,"allOf","1"]})].filter(t=>!!t),c="jsonSchema2019-09"===a.target?{unevaluatedProperties:!1}:void 0,u=[],l.forEach(t=>{if((!("type"in t)||"string"!==t.type)&&"allOf"in t)u.push(...t.allOf),void 0===t.unevaluatedProperties&&(c=void 0);else{let r=t;if("additionalProperties"in t&&!1===t.additionalProperties){let{additionalProperties:a,...i}=t;r=i}else c=void 0;u.push(r)}}),u.length?{allOf:u,...c}:void 0;case A.ZodTuple:return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((t,r)=>h_(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[]),additionalItems:h_(t.rest._def,{...a,currentPath:[...a.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((t,r)=>h_(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[])};case A.ZodRecord:return hy(t,a);case A.ZodLiteral:let d;return"bigint"!=(d=typeof t.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(t.value)?"array":"object"}:"openApi3"===a.target?{type:"bigint"===d?"integer":d,enum:[t.value]}:{type:"bigint"===d?"integer":d,const:t.value};case A.ZodEnum:return{type:"string",enum:Array.from(t.values)};case A.ZodNativeEnum:let p,m,h;return p=t.values,{type:1===(h=Array.from(new Set((m=Object.keys(t.values).filter(t=>"number"!=typeof p[p[t]]).map(t=>p[t])).map(t=>typeof t)))).length?"string"===h[0]?"string":"number":["string","number"],enum:m};case A.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return"openApi3"===a.target?{type:hg[t.innerType._def.typeName],nullable:!0}:{type:[hg[t.innerType._def.typeName],"null"]};if("openApi3"===a.target){let r=h_(t.innerType._def,{...a,currentPath:[...a.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let f=h_(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case A.ZodOptional:if(a.currentPath.toString()===a.propertyPath?.toString())return h_(t.innerType._def,a);let y=h_(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","1"]});return y?{anyOf:[{not:m3(a)},y]}:m3(a);case A.ZodMap:if("record"===a.mapStrategy)return hy(t,a);return{type:"array",maxItems:125,items:{type:"array",items:[h_(t.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||m3(a),h_(t.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||m3(a)],minItems:2,maxItems:2}};case A.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:h_(t.valueType._def,{...a,currentPath:[...a.currentPath,"items"]})},t.minSize&&m5(g,"minItems",t.minSize.value,t.minSize.message,a),t.maxSize&&m5(g,"maxItems",t.maxSize.value,t.maxSize.message,a),g;case A.ZodLazy:return()=>t.getter()._def;case A.ZodPromise:return h_(t.type._def,a);case A.ZodNaN:case A.ZodNever:return"openAi"===a.target?void 0:{not:m3({...a,currentPath:[...a.currentPath,"not"]})};case A.ZodEffects:return"input"===a.effectStrategy?h_(t.schema._def,a):m3(a);case A.ZodAny:case A.ZodUnknown:return m3(a);case A.ZodDefault:return{...h_(t.innerType._def,a),default:t.defaultValue()};case A.ZodBranded:return m8(t,a);case A.ZodReadonly:case A.ZodCatch:return h_(t.innerType._def,a);case A.ZodPipeline:if("input"===a.pipeStrategy)return h_(t.in._def,a);if("output"===a.pipeStrategy)return h_(t.out._def,a);let v=h_(t.in._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),_=h_(t.out._def,{...a,currentPath:[...a.currentPath,"allOf",v?"1":"0"]});return{allOf:[v,_].filter(t=>void 0!==t)};case A.ZodFunction:case A.ZodVoid:case A.ZodSymbol:default:return}})(t,t.typeName,r),s="function"==typeof o?h_(o(),r):o;if(s&&hS(t,r,s),r.postProcess){let a=r.postProcess(s,t,r);return n.jsonSchema=s,a}return n.jsonSchema=s,s}let hb=(t,r)=>{switch(r.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:m4(r.currentPath,t.path)};case"none":case"seen":if(t.path.length<r.currentPath.length&&t.path.every((t,a)=>r.currentPath[a]===t))return console.warn(`Recursive reference detected at ${r.currentPath.join("/")}! Defaulting to any`),m3(r);return"seen"===r.$refStrategy?m3(r):void 0}},hS=(t,r,a)=>(t.description&&(a.description=t.description,r.markdownDescription&&(a.markdownDescription=t.description)),a);function h$(t,r={}){let{strict:a=!1}=r,i=Object.entries(t),n=t=>({target:r})=>{let n={},o=[];for(let[a,s]of i)n[a]=function(t,r,a){let i=t["~standard"];if(i.jsonSchema)return i.jsonSchema[a]({target:r});if("zod"===t["~standard"].vendor&&!("_zod"in t)&&"_def"in t){let a=((t,r)=>{let a,i,n=(i=void 0!==(a="string"==typeof r?{...pW,name:r}:{...pW,...r}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,flags:{hasReferencedOpenAiAnyType:!1},currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([t,r])=>[r._def,{def:r._def,path:[...a.basePath,a.definitionPath,t],jsonSchema:void 0}]))}),o="object"==typeof r&&r.definitions?Object.entries(r.definitions).reduce((t,[r,a])=>({...t,[r]:h_(a._def,{...n,currentPath:[...n.basePath,n.definitionPath,r]},!0)??m3(n)}),{}):void 0,s="string"==typeof r?r:r?.nameStrategy==="title"?void 0:r?.name,l=h_(t._def,void 0===s?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1)??m3(n),c="object"==typeof r&&void 0!==r.name&&"title"===r.nameStrategy?r.name:void 0;void 0!==c&&(l.title=c),n.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[n.openAiAnyTypeName]||(o[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let u=void 0===s?o?{...l,[n.definitionPath]:o}:l:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:l}};return"jsonSchema7"===n.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===n.target||"openAi"===n.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),u})(t,{$refStrategy:"none",target:"openapi-3.0"===r?"openApi3":"jsonSchema7"});return delete a.$schema,a}if("zod"===i.vendor&&"_zod"in t)try{let r=a5(t);return delete r.$schema,r}catch(t){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${t instanceof Error?t.message:String(t)}`)}throw Error(`Schema library "${i.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".`)}(s,r,t),!function(t,r){if("function"!=typeof t.safeParse)return!1;try{let a=t.safeParse(void 0);return a.success&&("input"===r||void 0===a.data)}catch{return!1}}(s,t)&&o.push(a);let s={type:"object",properties:n};return o.length>0&&(s.required=o),a&&(s.additionalProperties=!1),s},o=async r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{issues:[{message:"Expected an object."}]};let n={},o=[];for(let[t,a]of i){let i=await a["~standard"].validate(r[t]);if(i.issues)for(let r of i.issues)o.push({message:r.message,path:[t,...r.path??[]]});else(t in r||void 0!==i.value)&&(n[t]=i.value)}if(a)for(let a of Object.keys(r))a in t||o.push({message:`Unrecognized key: "${a}"`,path:[a]});return o.length>0?{issues:o}:{value:n}};return{shape:t,"~standard":{version:1,vendor:"xmcp",validate:o,jsonSchema:{input:n("input"),output:n("output")}}}}let hw=require("async_hooks"),hR=(t,r)=>{globalThis[t]=r},hk=t=>globalThis[t];function hx({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),i=Symbol.for(`xmcp-context-${t}-fallback-store`);if(hk(a))return hk(a);let n=new hw.AsyncLocalStorage,o=globalThis[i]??{current:null};hR(i,o);let s={provider:(t,a)=>(r&&(o.current=t),n.run(t,a)),getContext:()=>{let a=n.getStore();if(a)return a;if(r&&o.current)return o.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let i=n.getStore()??(r?o.current:null);if(!i)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(i,a)}};return hR(a,s),s}let hP=hx({name:"http-request-context"}),hE=hP.setContext,hT=hP.getContext,hj=hP.provider,hO=hx({name:"client-info-context"});hO.setContext;let hC=hO.getContext;hO.provider;let hI=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),hN=t=>{if(!hI(t)||"string"!=typeof t.name||"string"!=typeof t.version)return;let r={name:t.name,version:t.version};return"string"==typeof t.title&&(r.title=t.title),"string"==typeof t.websiteUrl&&(r.websiteUrl=t.websiteUrl),"string"==typeof t.description&&(r.description=t.description),r},hq=t=>{if(t&&"initialize"===t.method&&hI(t.params))return hN(t.params.clientInfo)},hA=(t,r)=>{let a=r.toLowerCase();for(let[r,i]of Object.entries(t)){if(r.toLowerCase()!==a)continue;let t=Array.isArray(i)?i[0]:i;if("string"!=typeof t)break;let n=t.trim();return n.length>0?n:void 0}},hM=new Set(["message","mode","requestedSchema"]),hz=new Set(["elicitationId","message","mode","url"]),hL=new Set(["properties","required","type"]),hZ=new Set(["default","description","format","maxLength","minLength","title","type"]),hD=new Set(["default","description","enum","enumNames","title","type"]),hV=new Set(["default","description","title","type"]),hF=new Set(["default","description","maximum","minimum","title","type"]),hU=new Set(["date","date-time","email","uri"]);async function hH(t,r,a){let i=function(t){let r=t.mode??"form";if("url"===r)return function(t){let r;hB(t,"Elicitation request must be a plain object."),hJ(t,hz,"URL elicitation"),hK(t.message,"URL elicitation requires a string message."),hG(t.elicitationId,"URL elicitation requires a non-empty elicitationId."),hG(t.url,"URL elicitation requires a non-empty URL.");try{r=new URL(t.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(t),t;if("form"!==r)throw Error(`Unsupported elicitation mode "${String(t.mode)}". Expected "form" or "url".`);return function(t){hB(t,"Elicitation request must be a plain object."),hJ(t,hM,"Form elicitation"),hK(t.message,"Form elicitation requires a string message.");let r=t.requestedSchema;if(hB(r,"Form elicitation requires a flat object schema."),hJ(r,hL,"Form elicitation schema"),"object"!==r.type)throw Error('Form elicitation schema must use type "object".');for(let[t,a]of(hB(r.properties,"Form elicitation schema requires a properties object."),Object.entries(r.properties)))!function(t,r){if(hB(r,`Form elicitation field "${t}" must be a plain object.`),hW(r.title,`Form elicitation field "${t}" title must be a string.`),hW(r.description,`Form elicitation field "${t}" description must be a string.`),"string"===r.type&&"enum"in r){var a,i;if(hJ(r,hD,`Form elicitation field "${t}"`),hX(r.enum,`Form elicitation field "${t}" enum values must be strings.`),a=r.enumNames,i=`Form elicitation field "${t}" enumNames must be strings.`,void 0!==a&&hX(a,i),void 0!==r.enumNames&&r.enumNames.length!==r.enum.length)throw Error(`Form elicitation field "${t}" enumNames length must match enum length.`);if(hW(r.default,`Form elicitation field "${t}" default must be a string.`),void 0!==r.default&&!r.enum.includes(r.default))throw Error(`Form elicitation field "${t}" default must be one of its enum values.`);return}if("string"===r.type&&!("enum"in r)){hJ(r,hZ,`Form elicitation field "${t}"`),hY(r.minLength,`Form elicitation field "${t}" minLength must be a number.`),hY(r.maxLength,`Form elicitation field "${t}" maxLength must be a number.`),hW(r.default,`Form elicitation field "${t}" default must be a string.`);let a=r.format;if(hW(a,`Form elicitation field "${t}" format must be a string.`),void 0!==a&&!hU.has(a))throw Error(`Form elicitation field "${t}" format must be one of: ${Array.from(hU).join(", ")}.`);return}if("boolean"===r.type){if(hJ(r,hV,`Form elicitation field "${t}"`),void 0!==r.default&&"boolean"!=typeof r.default)throw Error(`Form elicitation field "${t}" default must be a boolean.`);return}if("number"===r.type||"integer"===r.type){hJ(r,hF,`Form elicitation field "${t}"`),hY(r.minimum,`Form elicitation field "${t}" minimum must be a number.`),hY(r.maximum,`Form elicitation field "${t}" maximum must be a number.`),hY(r.default,`Form elicitation field "${t}" default must be a number.`);return}throw Error(`Form elicitation field "${t}" uses unsupported type "${String(r.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(t,a);if(void 0!==r.required){if(!Array.isArray(r.required)||r.required.some(t=>"string"!=typeof t))throw Error("Form elicitation schema required fields must be a string array.");for(let t of r.required)if(!(t in r.properties))throw Error(`Form elicitation schema required field "${t}" is not defined in properties.`)}}(t),{...t,mode:"form"}}(r);try{let r=await t.mcpReq.elicitInput(i,a);return{...r,content:r.content??void 0}}catch(t){if(t instanceof lV&&t.code===lD.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 t}}function hJ(t,r,a){let i=Object.keys(t).filter(t=>!r.has(t));if(0!==i.length)throw Error(`${a} includes unsupported key(s): ${i.join(", ")}.`)}function hB(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}function hK(t,r){if("string"!=typeof t)throw Error(r)}function hG(t,r){if("string"!=typeof t||0===t.trim().length)throw Error(r)}function hW(t,r){if(void 0!==t&&"string"!=typeof t)throw Error(r)}function hY(t,r){if(void 0!==t&&"number"!=typeof t)throw Error(r)}function hX(t,r){if(!Array.isArray(t)||t.some(t=>"string"!=typeof t))throw Error(r)}let hQ=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),h0=new Set(["task","toolChoice","tools"]),h1=new Set(["text","image","audio"]);async function h2(t,r,a){let i=function(t){h9(t,"Sampling request must be a plain object.");let r=Object.keys(t),a=r.filter(t=>h0.has(t));if(a.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${a.join(", ")}.`);let i=r.filter(t=>!hQ.has(t));if(i.length>0)throw Error(`Sampling request includes unsupported key(s): ${i.join(", ")}.`);if(!Array.isArray(t.messages)||0===t.messages.length)throw Error("Sampling requires at least one message.");for(let[r,a]of t.messages.entries())!function(t,r){if(h9(r,`Sampling message at index ${t} must be a plain object.`),"user"!==r.role&&"assistant"!==r.role)throw Error(`Sampling message at index ${t} requires role "user" or "assistant".`);let a=r.content;h9(a,`Sampling message at index ${t} requires a content object.`);let i=a.type;if("string"!=typeof i||!h1.has(i))throw Error(`Sampling message at index ${t} uses unsupported content type "${String(i)}". Supported types are text, image, and audio.`);if("text"===i&&"string"!=typeof a.text)throw Error(`Sampling message at index ${t} requires string text content.`);if(("image"===i||"audio"===i)&&("string"!=typeof a.data||"string"!=typeof a.mimeType))throw Error(`Sampling message at index ${t} requires base64 data and a mimeType.`)}(r,a);if("number"!=typeof t.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return t}(r);try{return await t.mcpReq.requestSampling(i,a)}catch(t){if(t instanceof lV&&t.code===lD.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 t}}function h9(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}let h4={text:t=>"string"!=typeof t.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:t=>"string"!=typeof t.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:t=>"string"!=typeof t.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:t=>"string"!=typeof t.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof t.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==t.title&&"string"!=typeof t.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==t.description&&"string"!=typeof t.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==t.mimeType&&"string"!=typeof t.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function h3(t){if(!t||"object"!=typeof t)return{valid:!1,error:"Content must be an object"};if("string"!=typeof t.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==t._meta&&(null===t._meta||"object"!=typeof t._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let r=h4[t.type];return r?r(t):{valid:!0}}function h6(t,r,a,i){if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`Tool "${a}" ${i}: expected a plain object.`);let n=new Set(Object.keys(r)),o=Object.keys(t).filter(t=>!n.has(t));if(o.length>0)throw Error(`Tool "${a}" ${i}: unrecognized key(s): ${o.join(", ")}`);for(let[n,o]of Object.entries(r))try{o.parse(t[n])}catch(t){throw Error(`Tool "${a}" ${i}: ${t?.message??`invalid field "${n}"`}`)}}function h5(t){return!!(t&&"object"==typeof t&&Object.keys(t).some(t=>t.startsWith("ui/")))}function h8(t){let r=t.mcpReq.envelope,a=hN(r?.[nH]);if(!a)try{let t,r=hT();a=r.clientInfo??(t=r.headers,hN({name:hA(t,"x-mcp-client-name"),version:hA(t,"x-mcp-client-version"),title:hA(t,"x-mcp-client-title"),websiteUrl:hA(t,"x-mcp-client-website-url"),description:hA(t,"x-mcp-client-description")}))}catch{}if(!a)try{a=hC().clientInfo}catch{}return a}function h7(t){return t.endsWith(".tsx")}let fe=new class{add(t,r){this.resources.set(t,r)}getAll(){return this.resources}clear(){this.resources.clear()}has(t){return this.resources.has(t)}constructor(){!function(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a}(this,"resources",new Map)}};function ft(t){let r={};return!function t(a,i=""){if(a&&"object"==typeof a)for(let[n,o]of Object.entries(a)){let a=i?`${i}/${n}`:n;!o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp?r[a]=o:t(o,a)}}(t),r}let fr=["ui/resourceUri","resourceUri","visibility"],fa=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"],fi=hx({name:"request-context",fallback:!1});function fn(t){let r=[...t];return(t,a,i)=>(function(t,r,a){let i,n=new Map;if(t.http){let t=hT(),r=Object.fromEntries(Object.entries(t.headers).map(([t,r])=>[t,Array.isArray(r)?Object.freeze([...r]):r]));i=Object.freeze({id:t.id,headers:Object.freeze(r)})}return fi.provider(Object.freeze({clientInfo:r?Object.freeze({...r}):void 0,http:i,signal:t.mcpReq.signal,set(t,r){n.set(t,r)},get:t=>n.get(t),async progress(r,a){let i=t.mcpReq._meta?.progressToken;void 0!==i&&await t.mcpReq.notify({method:"notifications/progress",params:{progressToken:i,progress:r,...void 0===a?{}:{total:a}}})},log:(r,a)=>t.mcpReq.log(r,a)}),a)})(a,h8(a),async()=>{if(0===r.length)return i();let a=Object.freeze({...function(){try{return fi.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),method:t.method,params:Object.freeze({...t.params})}),n=-1,o=async t=>{if(t<=n)throw Error("MCP middleware next() can only be called once");n=t;let s=r[t];return s?s(a,()=>o(t+1)):i()};return o(0)})}let fo=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function fs(t){let{tags:r,enabled:a,...i}=t;return{...i,_meta:void 0===r?i._meta:{...i._meta,"xmcp/tags":r}}}function fl(t){return"object"==typeof t&&null!==t&&Object.entries(t).every(([t,r])=>"string"==typeof t&&"object"==typeof r&&null!==r&&"parse"in r&&"function"==typeof r.parse)}function fc(t){return(t.split("/").pop()||t).replace(/\.[^/.]+$/,"")}function fu(t,r,a){return t.names?.includes(r)===!0||t.tags?.some(t=>a.includes(t))===!0}function fd(t,r){return r?new Map([...t].filter(([t,{metadata:a}])=>{if(a?.enabled===!1)return!1;let i=a?.name??fc(t),n=a?.tags??[];return(!r.include||fu(r.include,i,n))&&(!r.exclude||!fu(r.exclude,i,n))})):t}function fp(t){return Error(`[xmcp] Invalid prompt file: ${t}
|
|
82
|
-
-> Default export must be a prompt handler function.`)}async function
|
|
83
|
-
-> ${a}`)});let
|
|
84
|
-
-> Default export must be a resource handler function.`)}async function
|
|
85
|
-
-> ${a}`)});let
|
|
86
|
-
-> Default export must be a tool handler function.`)}async function
|
|
87
|
-
-> ${a}`)});let
|
|
73
|
+
`),t.enqueue(r.encode(o))}async handleGetRequest(t){let r,a;if(!t.headers.get("accept")?.includes("text/event-stream"))return this.onerror?.(Error("Not Acceptable: Client must accept text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept text/event-stream");let n=this.validateSession(t);if(n)return n;let i=this.validateProtocolVersion(t);if(i)return i;if(this._eventStore){let r=t.headers.get("last-event-id");if(r)return this.replayEvents(r)}if(void 0!==this._streamMapping.get(this._standaloneSseStreamId))return this.onerror?.(Error("Conflict: Only one SSE stream is allowed per session")),this.createJsonErrorResponse(409,-32e3,"Conflict: Only one SSE stream is allowed per session");let o=new TextEncoder,s=new ReadableStream({start:t=>{r=t},cancel:()=>{void 0!==a&&clearInterval(a),this._streamMapping.get(this._standaloneSseStreamId)?.controller===r&&this._streamMapping.delete(this._standaloneSseStreamId)}}),l={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};return void 0!==this.sessionId&&(l["mcp-session-id"]=this.sessionId),this._streamMapping.set(this._standaloneSseStreamId,{controller:r,encoder:o,cleanup:()=>{void 0!==a&&clearInterval(a),this._streamMapping.delete(this._standaloneSseStreamId);try{r.close()}catch{}}}),a=this.startKeepAlive(r,o),new Response(s,{headers:l})}async replayEvents(t){if(!this._eventStore)return this.onerror?.(Error("Event store not configured")),this.createJsonErrorResponse(400,-32e3,"Event store not configured");try{let r,a,n,i;if(this._eventStore.getStreamIdForEventId){if(!(r=await this._eventStore.getStreamIdForEventId(t)))return this.onerror?.(Error("Invalid event ID format")),this.createJsonErrorResponse(400,-32e3,"Invalid event ID format");if(void 0!==this._streamMapping.get(r))return this.onerror?.(Error("Conflict: Stream already has an active connection")),this.createJsonErrorResponse(409,-32e3,"Conflict: Stream already has an active connection")}let o={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};void 0!==this.sessionId&&(o["mcp-session-id"]=this.sessionId);let s=new TextEncoder,l=!1,c=new ReadableStream({start:t=>{a=t},cancel:()=>{l=!0,void 0!==n&&clearInterval(n),void 0!==i&&this._streamMapping.get(i)?.controller===a&&this._streamMapping.delete(i)}}),u=new Set;if(i=await this._eventStore.replayEventsAfter(t,{send:async(t,r)=>{if(u.add(t),!this.writeSSEEvent(a,s,r,t))try{a.close()}catch{}}}),this._closed||l){try{a.close()}catch{}return this.createJsonErrorResponse(404,-32001,"Session not found")}if(this._streamMapping.get(i)?.cleanup(),this._streamMapping.set(i,{controller:a,encoder:s,replayedEventIds:u,cleanup:()=>{void 0!==n&&clearInterval(n),this._streamMapping.delete(i);try{a.close()}catch{}}}),i!==this._standaloneSseStreamId&&![...this._requestToStreamMapping.values()].includes(i)){this._streamMapping.delete(i);try{a.close()}catch{}}return this._streamMapping.get(i)?.controller===a&&(n=this.startKeepAlive(a,s)),new Response(c,{headers:o})}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(500,-32e3,"Error replaying events")}}writeSSEEvent(t,r,a,n){try{let i=`event: message
|
|
74
|
+
`;return n&&(i+=`id: ${n}
|
|
75
|
+
`),i+=`data: ${JSON.stringify(a)}
|
|
76
|
+
|
|
77
|
+
`,t.enqueue(r.encode(i)),!0}catch(t){return this.onerror?.(t),!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(t,r){try{let a,n,i,o,s,l=t.headers.get("accept");if(!l?.includes("application/json")||!l.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(!uA(t.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(r?.parsedBody===void 0)try{let r=await p0(t,this._maxRequestBodySize);if(r.tooLarge){let t=pX(this._maxRequestBodySize);return this.onerror?.(Error(t)),this.createJsonErrorResponse(413,-32e3,t)}a=JSON.parse(r.text)}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}else a=r.parsedBody;if(Array.isArray(a)&&a.length>100)return this.onerror?.(Error("Invalid Request: Batch must not exceed 100 messages")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Batch must not exceed 100 messages");try{n=Array.isArray(a)?a.map(t=>ol.parse(t)):[ol.parse(a)]}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");let c=n.some(t=>ow.safeParse(t).success);if(c){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(n.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(!c){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a}if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");try{i=await this._checkScopeChallenge(n,r?.authInfo)}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(500,-32603,"Internal server error")}if(i)return i;if(!n.some(t=>cK(t))){for(let a of n)this.onmessage?.(a,{authInfo:r?.authInfo,request:t});return new Response(null,{status:202})}let u=crypto.randomUUID(),d=n.find(t=>ow.safeParse(t).success),p=d?d.params.protocolVersion:t.headers.get("mcp-protocol-version")??"2025-03-26";if(this._enableJsonResponse)return new Promise(a=>{for(let t of(this._streamMapping.set(u,{resolveJson:a,cleanup:()=>{this._streamMapping.delete(u)}}),n))cK(t)&&this._requestToStreamMapping.set(t.id,u);for(let a of n)this.onmessage?.(a,{authInfo:r?.authInfo,request:t})});let m=new TextEncoder,h=new ReadableStream({start:t=>{o=t},cancel:()=>{void 0!==s&&clearInterval(s),this._streamMapping.get(u)?.controller===o&&this._streamMapping.delete(u)}}),f={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(let t of(void 0!==this.sessionId&&(f["mcp-session-id"]=this.sessionId),n))cK(t)&&(this._streamMapping.set(u,{controller:o,encoder:m,cleanup:()=>{void 0!==s&&clearInterval(s),this._streamMapping.delete(u);try{o.close()}catch{}}}),this._requestToStreamMapping.set(t.id,u));for(let a of(await this.writePrimingEvent(o,m,u,p),n)){let n,i;cK(a)&&this._eventStore&&this.supportsEmptySSEData(p)&&(n=()=>{this.closeSSEStream(a.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(a,{authInfo:r?.authInfo,request:t,closeSSEStream:n,closeStandaloneSSEStream:i})}return this._streamMapping.get(u)?.controller===o&&(s=this.startKeepAlive(o,m)),new Response(h,{status:200,headers:f})}catch(t){return this.onerror?.(t),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(t)})}}async handleDeleteRequest(t){let r=this.validateSession(t);if(r)return r;let a=this.validateProtocolVersion(t);if(a)return a;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(t){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 r=t.headers.get("mcp-session-id");return r?r!==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(t){let r=t.headers.get("mcp-protocol-version");if(null!==r&&!this._supportedProtocolVersions.includes(r)){let t=`Bad Request: Unsupported protocol version: ${r} (supported versions: ${this._supportedProtocolVersions.join(", ")})`;return this.onerror?.(Error(t)),this.createJsonErrorResponse(400,-32e3,t)}}async close(){if(!this._closed){for(let{cleanup:t}of(this._closed=!0,this._streamMapping.values()))t();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(t){let r=this._requestToStreamMapping.get(t);if(!r)return;let a=this._streamMapping.get(r);a&&a.cleanup()}closeStandaloneSSEStream(){let t=this._streamMapping.get(this._standaloneSseStreamId);t&&t.cleanup()}async send(t,r){let a=r?.relatedRequestId;if((cW(t)||cY(t))&&(a=t.id),void 0===a){let r;if(cW(t)||cY(t))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");this._eventStore&&(r=await this._eventStore.storeEvent(this._standaloneSseStreamId,t));let a=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===a)return;a.controller&&a.encoder&&(void 0===r||!a.replayedEventIds?.has(r))&&this.writeSSEEvent(a.controller,a.encoder,t,r);return}let n=this._requestToStreamMapping.get(a);if(!n)throw Error(`No connection established for request ID: ${String(a)}`);let i=this._streamMapping.get(n);if(!this._enableJsonResponse){let r;this._eventStore&&(r=await this._eventStore.storeEvent(n,t),i=this._streamMapping.get(n)),i?.controller&&i?.encoder&&(void 0===r||!i.replayedEventIds?.has(r))&&this.writeSSEEvent(i.controller,i.encoder,t,r)}if(cW(t)||cY(t)){this._requestResponseMap.set(a,t);let r=[...this._requestToStreamMapping.entries()].filter(([t,r])=>r===n).map(([t])=>t);if(r.every(t=>this._requestResponseMap.has(t))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(a)}`);if(!this._eventStore){for(let t of(this.onerror?.(Error(`Response for request ID ${String(a)} is undeliverable: per-request stream is disconnected and no eventStore is configured`)),r))this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t);return}if(this._enableJsonResponse&&i.resolveJson){let t={"Content-Type":"application/json"};void 0!==this.sessionId&&(t["mcp-session-id"]=this.sessionId);let a=r.map(t=>this._requestResponseMap.get(t));1===a.length?i.resolveJson(Response.json(a[0],{status:200,headers:t})):i.resolveJson(Response.json(a,{status:200,headers:t})),i.cleanup()}else i.cleanup();for(let t of r)this._requestResponseMap.delete(t),this._requestToStreamMapping.delete(t)}}}};function p2(t){if(null===t||"object"!=typeof t||Array.isArray(t))return null;let{method:r,id:a}=t;return"string"!=typeof r?null:"string"==typeof a||"number"==typeof a?a:null}function p9(t,r,a,n,i=null){return Response.json({jsonrpc:"2.0",error:{code:r,message:a,...void 0!==n&&{data:n}},id:i},{status:t})}function p4(t,r=null){return p9(t.httpStatus,t.code,t.message,t.data,r)}function p3(t){return t instanceof Error?t:Error(String(t))}function p6(t=null){return p9(500,-32603,"Internal server error",void 0,t)}function p5(t){if(void 0!==t.transport)throw Error("The factory returned an instance that is still serving another request. Return a new instance for each request.")}function p7(t){return{protocolVersionHeader:t.headers.get("mcp-protocol-version")??void 0,mcpMethodHeader:t.headers.get("mcp-method")??void 0,mcpNameHeader:t.headers.get("mcp-name")??void 0}}async function p8(t,r,a=!0,n=4194304){let i,o=t.method.toUpperCase(),s=r,l=t,c=!1;if("POST"===o){if(void 0===s){let r;a&&(l=t.clone());try{let a=await p0(t,n);if(a.tooLarge)return{step:"body-too-large"};r=a.text}catch{return{step:"unreadable-body"}}try{i=0===r.length?void 0:JSON.parse(r)}catch{c=!0}c||void 0===i||(s=i)}else i=s;if(c||void 0===i)return{step:"no-json-body",forwardRequest:l}}return{step:"classified",outcome:function(t){if("POST"!==(t={...t,...void 0!==t.protocolVersionHeader&&{protocolVersionHeader:ui(t.protocolVersionHeader)},...void 0!==t.mcpMethodHeader&&{mcpMethodHeader:ui(t.mcpMethodHeader)},...void 0!==t.mcpNameHeader&&{mcpNameHeader:ui(t.mcpNameHeader)}}).httpMethod.toUpperCase())return{kind:"legacy",reason:"http-method"};let r=t.body;if(Array.isArray(r)){if(0===r.length)return ur("jsonrpc-shape","empty-batch",400,new cg(cf.InvalidRequest,"Bad Request: empty JSON-RPC batch"),!0);for(let t of r){if(cF(uo(t)?t.params:void 0))return ur("jsonrpc-shape","batch-with-modern-element",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later"),!0);if(!(cK(t)||cG(t)||cW(t)||cY(t)))return ur("jsonrpc-shape","batch-with-invalid-element",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batch contains an invalid message"),!0)}return{kind:"legacy",reason:"batch"}}return cW(r)||cY(r)?{kind:"legacy",reason:"response"}:uo(r)&&cK(r)?function(t,r){let a=r.params,n=r.method,i=t.protocolVersionHeader,o=void 0!==i&&i>=lW;if("initialize"===n&&!function(t){if(!cF(t))return!1;let r=cH(t);if(void 0===r||!(r>=lW))return!1;let a=cV(t);return void 0!==a&&0===cJ(a).length}(a)){if(o)return ua("initialize-with-modern-header",i,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let t=uo(a)&&"string"==typeof a.protocolVersion?a.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==t&&{requestedVersion:t}}}if(cF(a)){let o=cV(a),s=(void 0===o?[]:cJ(o))[0];if(void 0!==s)return ur("envelope","envelope-invalid",400,new cg(cf.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${s.key}: ${s.problem}`,{envelope:s}),!0);let l=cH(a);return void 0!==i&&void 0!==l&&i!==l?ua("header-body-version-mismatch",i,`the body envelope names protocol version ${l} but the MCP-Protocol-Version header names ${i}`):void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("method-header-mismatch",t.mcpMethodHeader,`the body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"request",message:r,classification:us(l)}}if(o){let t=cV(a),r=cJ(t??{}).filter(t=>"missing"===t.problem).map(t=>t.key),n=void 0===t?["_meta"]:r.length>0?r:[iJ];return ur("envelope","modern-header-without-claim",400,new cg(cf.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${n.join(", ")}`,{envelope:{missing:n}}),!0)}return{kind:"legacy",reason:"no-claim",...void 0!==i&&{requestedVersion:i}}}(t,r):uo(r)&&cG(r)?function(t,r){let a=r.params,n=r.method,i=t.protocolVersionHeader,o=void 0!==i&&i>=lW;if(cF(a)){let o=cH(a);if(void 0===o){let t=cV(a),r=(void 0===t?[]:cJ(t)).find(t=>t.key===iJ)??{key:iJ,problem:"expected a protocol version string"};return ur("envelope","notification-envelope-invalid",400,new cg(cf.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${r.key}: ${r.problem}`,{envelope:r}),!0)}if(void 0!==i&&i!==o)return ua("notification-header-body-version-mismatch",i,`the notification envelope names protocol version ${o} but the MCP-Protocol-Version header names ${i}`);let s=us(o);return"modern"===s.era&&void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:s}}return o?void 0!==t.mcpMethodHeader&&t.mcpMethodHeader!==n?ua("notification-method-header-mismatch",t.mcpMethodHeader,`the notification body names method ${n} but the Mcp-Method header names ${t.mcpMethodHeader}`):{kind:"modern",messageKind:"notification",message:r,classification:{era:"modern",revision:i}}:{kind:"legacy",reason:"notification",...void 0!==i&&{requestedVersion:i}}}(t,r):ur("jsonrpc-shape","invalid-json-rpc-body",400,new cg(cf.InvalidRequest,"Bad Request: the request body is not a valid JSON-RPC message"),!0)}({httpMethod:o,...p7(t),...void 0!==i&&{body:i}}),body:i,parsedBody:s,forwardRequest:l}}let me=require("async_hooks"),mt=(t,r)=>{globalThis[t]=r},mr=t=>globalThis[t];function ma({name:t,fallback:r=!0}){let a=Symbol.for(`xmcp-context-${t}`),n=Symbol.for(`xmcp-context-${t}-fallback-store`);if(mr(a))return mr(a);let i=new me.AsyncLocalStorage,o=globalThis[n]??{current:null};mt(n,o);let s={provider:(t,a)=>(r&&(o.current=t),i.run(t,a)),getContext:()=>{let a=i.getStore();if(a)return a;if(r&&o.current)return o.current;throw Error(`getContext() can only be used within the ${t} context.`)},setContext:a=>{let n=i.getStore()??(r?o.current:null);if(!n)throw Error(`setContext() can only be used within the ${t} context.`);Object.assign(n,a)}};return mt(a,s),s}let mn=ma({name:"http-request-context"}),mi=mn.setContext,mo=mn.getContext,ms=mn.provider,ml=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),mc=t=>{if(!ml(t)||"string"!=typeof t.name||"string"!=typeof t.version)return;let r={name:t.name,version:t.version};return"string"==typeof t.title&&(r.title=t.title),"string"==typeof t.websiteUrl&&(r.websiteUrl=t.websiteUrl),"string"==typeof t.description&&(r.description=t.description),r},mu=t=>{if(t&&"initialize"===t.method&&ml(t.params))return mc(t.params.clientInfo)},md=(t,r)=>{let a=r.toLowerCase();for(let[r,n]of Object.entries(t)){if(r.toLowerCase()!==a)continue;let t=Array.isArray(n)?n[0]:n;if("string"!=typeof t)break;let i=t.trim();return i.length>0?i:void 0}};function mp(t){let{tags:r,enabled:a,...n}=t;return{...n,_meta:void 0===r?n._meta:{...n._meta,"xmcp/tags":r}}}let mm=new class{add(t,r){this.resources.set(t,r)}getAll(){return this.resources}clear(){this.resources.clear()}has(t){return this.resources.has(t)}constructor(){!function(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a}(this,"resources",new Map)}},mh=ma({name:"request-context",fallback:!1}),mf=ma({name:"client-info-context"});mf.setContext;let mg=mf.getContext;mf.provider;let my=new Set(["message","mode","requestedSchema"]),mv=new Set(["elicitationId","message","mode","url"]),m_=new Set(["properties","required","type"]),mb=new Set(["default","description","format","maxLength","minLength","title","type"]),mS=new Set(["default","description","enum","enumNames","title","type"]),m$=new Set(["default","description","title","type"]),mw=new Set(["default","description","maximum","minimum","title","type"]),mR=new Set(["date","date-time","email","uri"]);async function mk(t,r,a){let n=function(t){let r=t.mode??"form";if("url"===r)return function(t){let r;mP(t,"Elicitation request must be a plain object."),mx(t,mv,"URL elicitation"),mE(t.message,"URL elicitation requires a string message."),mT(t.elicitationId,"URL elicitation requires a non-empty elicitationId."),mT(t.url,"URL elicitation requires a non-empty URL.");try{r=new URL(t.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==r.protocol&&"https:"!==r.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(t),t;if("form"!==r)throw Error(`Unsupported elicitation mode "${String(t.mode)}". Expected "form" or "url".`);return function(t){mP(t,"Elicitation request must be a plain object."),mx(t,my,"Form elicitation"),mE(t.message,"Form elicitation requires a string message.");let r=t.requestedSchema;if(mP(r,"Form elicitation requires a flat object schema."),mx(r,m_,"Form elicitation schema"),"object"!==r.type)throw Error('Form elicitation schema must use type "object".');for(let[t,a]of(mP(r.properties,"Form elicitation schema requires a properties object."),Object.entries(r.properties)))!function(t,r){if(mP(r,`Form elicitation field "${t}" must be a plain object.`),mj(r.title,`Form elicitation field "${t}" title must be a string.`),mj(r.description,`Form elicitation field "${t}" description must be a string.`),"string"===r.type&&"enum"in r){var a,n;if(mx(r,mS,`Form elicitation field "${t}"`),mC(r.enum,`Form elicitation field "${t}" enum values must be strings.`),a=r.enumNames,n=`Form elicitation field "${t}" enumNames must be strings.`,void 0!==a&&mC(a,n),void 0!==r.enumNames&&r.enumNames.length!==r.enum.length)throw Error(`Form elicitation field "${t}" enumNames length must match enum length.`);if(mj(r.default,`Form elicitation field "${t}" default must be a string.`),void 0!==r.default&&!r.enum.includes(r.default))throw Error(`Form elicitation field "${t}" default must be one of its enum values.`);return}if("string"===r.type&&!("enum"in r)){mx(r,mb,`Form elicitation field "${t}"`),mO(r.minLength,`Form elicitation field "${t}" minLength must be a number.`),mO(r.maxLength,`Form elicitation field "${t}" maxLength must be a number.`),mj(r.default,`Form elicitation field "${t}" default must be a string.`);let a=r.format;if(mj(a,`Form elicitation field "${t}" format must be a string.`),void 0!==a&&!mR.has(a))throw Error(`Form elicitation field "${t}" format must be one of: ${Array.from(mR).join(", ")}.`);return}if("boolean"===r.type){if(mx(r,m$,`Form elicitation field "${t}"`),void 0!==r.default&&"boolean"!=typeof r.default)throw Error(`Form elicitation field "${t}" default must be a boolean.`);return}if("number"===r.type||"integer"===r.type){mx(r,mw,`Form elicitation field "${t}"`),mO(r.minimum,`Form elicitation field "${t}" minimum must be a number.`),mO(r.maximum,`Form elicitation field "${t}" maximum must be a number.`),mO(r.default,`Form elicitation field "${t}" default must be a number.`);return}throw Error(`Form elicitation field "${t}" uses unsupported type "${String(r.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(t,a);if(void 0!==r.required){if(!Array.isArray(r.required)||r.required.some(t=>"string"!=typeof t))throw Error("Form elicitation schema required fields must be a string array.");for(let t of r.required)if(!(t in r.properties))throw Error(`Form elicitation schema required field "${t}" is not defined in properties.`)}}(t),{...t,mode:"form"}}(r);try{let r=await t.mcpReq.elicitInput(n,a);return{...r,content:r.content??void 0}}catch(t){if(t instanceof lJ&&t.code===lH.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 t}}function mx(t,r,a){let n=Object.keys(t).filter(t=>!r.has(t));if(0!==n.length)throw Error(`${a} includes unsupported key(s): ${n.join(", ")}.`)}function mP(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}function mE(t,r){if("string"!=typeof t)throw Error(r)}function mT(t,r){if("string"!=typeof t||0===t.trim().length)throw Error(r)}function mj(t,r){if(void 0!==t&&"string"!=typeof t)throw Error(r)}function mO(t,r){if(void 0!==t&&"number"!=typeof t)throw Error(r)}function mC(t,r){if(!Array.isArray(t)||t.some(t=>"string"!=typeof t))throw Error(r)}let mI=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),mN=new Set(["task","toolChoice","tools"]),mq=new Set(["text","image","audio"]);async function mA(t,r,a){let n=function(t){mM(t,"Sampling request must be a plain object.");let r=Object.keys(t),a=r.filter(t=>mN.has(t));if(a.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${a.join(", ")}.`);let n=r.filter(t=>!mI.has(t));if(n.length>0)throw Error(`Sampling request includes unsupported key(s): ${n.join(", ")}.`);if(!Array.isArray(t.messages)||0===t.messages.length)throw Error("Sampling requires at least one message.");for(let[r,a]of t.messages.entries())!function(t,r){if(mM(r,`Sampling message at index ${t} must be a plain object.`),"user"!==r.role&&"assistant"!==r.role)throw Error(`Sampling message at index ${t} requires role "user" or "assistant".`);let a=r.content;mM(a,`Sampling message at index ${t} requires a content object.`);let n=a.type;if("string"!=typeof n||!mq.has(n))throw Error(`Sampling message at index ${t} uses unsupported content type "${String(n)}". Supported types are text, image, and audio.`);if("text"===n&&"string"!=typeof a.text)throw Error(`Sampling message at index ${t} requires string text content.`);if(("image"===n||"audio"===n)&&("string"!=typeof a.data||"string"!=typeof a.mimeType))throw Error(`Sampling message at index ${t} requires base64 data and a mimeType.`)}(r,a);if("number"!=typeof t.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return t}(r);try{return await t.mcpReq.requestSampling(n,a)}catch(t){if(t instanceof lJ&&t.code===lH.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 t}}function mM(t,r){if("object"!=typeof t||null===t||Array.isArray(t))throw Error(r)}let mz={text:t=>"string"!=typeof t.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:t=>"string"!=typeof t.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:t=>"string"!=typeof t.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof t.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:t=>"string"!=typeof t.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof t.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==t.title&&"string"!=typeof t.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==t.description&&"string"!=typeof t.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==t.mimeType&&"string"!=typeof t.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function mL(t){if(!t||"object"!=typeof t)return{valid:!1,error:"Content must be an object"};if("string"!=typeof t.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==t._meta&&(null===t._meta||"object"!=typeof t._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let r=mz[t.type];return r?r(t):{valid:!0}}function mZ(t,r,a,n){if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`Tool "${a}" ${n}: expected a plain object.`);let i=new Set(Object.keys(r)),o=Object.keys(t).filter(t=>!i.has(t));if(o.length>0)throw Error(`Tool "${a}" ${n}: unrecognized key(s): ${o.join(", ")}`);for(let[i,o]of Object.entries(r))try{o.parse(t[i])}catch(t){throw Error(`Tool "${a}" ${n}: ${t?.message??`invalid field "${i}"`}`)}}function mD(t){return!!(t&&"object"==typeof t&&Object.keys(t).some(t=>t.startsWith("ui/")))}function mU(t){let r=t.mcpReq.envelope,a=mc(r?.[iB]);if(!a)try{let t,r=mo();a=r.clientInfo??(t=r.headers,mc({name:md(t,"x-mcp-client-name"),version:md(t,"x-mcp-client-version"),title:md(t,"x-mcp-client-title"),websiteUrl:md(t,"x-mcp-client-website-url"),description:md(t,"x-mcp-client-description")}))}catch{}if(!a)try{a=mg().clientInfo}catch{}return a}function mV(t){let r=[...t];return(t,a,n)=>(function(t,r,a){let n,i=new Map;if(t.http){let t=mo(),r=Object.fromEntries(Object.entries(t.headers).map(([t,r])=>[t,Array.isArray(r)?Object.freeze([...r]):r]));n=Object.freeze({id:t.id,headers:Object.freeze(r)})}return mh.provider(Object.freeze({clientInfo:r?Object.freeze({...r}):void 0,http:n,authInfo:t.http?.authInfo,signal:t.mcpReq.signal,set(t,r){i.set(t,r)},get:t=>i.get(t),async progress(r,a){let n=t.mcpReq._meta?.progressToken;void 0!==n&&await t.mcpReq.notify({method:"notifications/progress",params:{progressToken:n,progress:r,...void 0===a?{}:{total:a}}})},log:(r,a)=>t.mcpReq.log(r,a)}),a)})(a,mU(a),async()=>{if(0===r.length)return n();let a=Object.freeze({...function(){try{return mh.getContext()}catch{throw Error("getRequestContext() can only be used while handling an MCP request.")}}(),...t,params:Object.freeze({...t.params})}),i=-1,o=async t=>{if(t<=i)throw Error("MCP middleware next() can only be called once");i=t;let s=r[t];return s?s(a,()=>o(t+1)):n()};return o(0)})}let mF=new Set(["tools/list","prompts/get","prompts/list","resources/read","resources/list","resources/templates/list","completion/complete"]);function mH(t){return t.endsWith(".tsx")}let mJ=Symbol("Let zodToJsonSchema decide on which parser to use"),mB={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"};(T=q||(q={})).assertEqual=t=>{},T.assertIs=function(t){},T.assertNever=function(t){throw Error()},T.arrayToEnum=t=>{let r={};for(let a of t)r[a]=a;return r},T.getValidEnumValues=t=>{let r=T.objectKeys(t).filter(r=>"number"!=typeof t[t[r]]),a={};for(let n of r)a[n]=t[n];return T.objectValues(a)},T.objectValues=t=>T.objectKeys(t).map(function(r){return t[r]}),T.objectKeys="function"==typeof Object.keys?t=>Object.keys(t):t=>{let r=[];for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&r.push(a);return r},T.find=(t,r)=>{for(let a of t)if(r(a))return a},T.isInteger="function"==typeof Number.isInteger?t=>Number.isInteger(t):t=>"number"==typeof t&&Number.isFinite(t)&&Math.floor(t)===t,T.joinValues=function(t,r=" | "){return t.map(t=>"string"==typeof t?`'${t}'`:t).join(r)},T.jsonStringifyReplacer=(t,r)=>"bigint"==typeof r?r.toString():r,(A||(A={})).mergeShapes=(t,r)=>({...t,...r});let mK=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mG=t=>{switch(typeof t){case"undefined":return mK.undefined;case"string":return mK.string;case"number":return Number.isNaN(t)?mK.nan:mK.number;case"boolean":return mK.boolean;case"function":return mK.function;case"bigint":return mK.bigint;case"symbol":return mK.symbol;case"object":if(Array.isArray(t))return mK.array;if(null===t)return mK.null;if(t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch)return mK.promise;if("undefined"!=typeof Map&&t instanceof Map)return mK.map;if("undefined"!=typeof Set&&t instanceof Set)return mK.set;if("undefined"!=typeof Date&&t instanceof Date)return mK.date;return mK.object;default:return mK.unknown}},mW=q.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 mY extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(t){return t.message},a={_errors:[]},n=t=>{for(let i of t.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)a._errors.push(r(i));else{let t=a,n=0;for(;n<i.path.length;){let a=i.path[n],o=n===i.path.length-1;if("_errors"===a){o&&t._errors.push(r(i)),n++;continue}Object.prototype.hasOwnProperty.call(t,a)||("__proto__"===a?Object.defineProperty(t,a,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):t[a]={_errors:[]}),t=t[a],o&&t._errors.push(r(i)),n++}}};return n(this),a}static assert(t){if(!(t instanceof mY))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(t=t=>t.message){let r=Object.create(null),a=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];r[a]=r[a]||[],r[a].push(t(n))}else a.push(t(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}}mY.create=t=>new mY(t);let mX=(t,r)=>{let a;switch(t.code){case mW.invalid_type:a=t.received===mK.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case mW.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case mW.unrecognized_keys:a=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case mW.invalid_union:a="Invalid input";break;case mW.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case mW.invalid_enum_value:a=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case mW.invalid_arguments:a="Invalid function arguments";break;case mW.invalid_return_type:a="Invalid function return type";break;case mW.invalid_date:a="Invalid date";break;case mW.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:q.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case mW.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case mW.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case mW.custom:a="Invalid input";break;case mW.invalid_intersection_types:a="Intersection results could not be merged";break;case mW.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case mW.not_finite:a="Number must be finite";break;default:a=r.defaultError,q.assertNever(t)}return{message:a}};(j=M||(M={})).errToObj=t=>"string"==typeof t?{message:t}:t||{},j.toString=t=>"string"==typeof t?t:t?.message;let mQ=t=>{let{data:r,path:a,errorMaps:n,issueData:i}=t,o=[...a,...i.path||[]],s={...i,path:o};if(void 0!==i.message)return{...i,path:o,message:i.message};let l="";for(let t of n.filter(t=>!!t).slice().reverse())l=t(s,{data:r,defaultError:l}).message;return{...i,path:o,message:l}};function m0(t,r){let a=mQ({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mX,void 0].filter(t=>!!t)});t.common.issues.push(a)}class m1{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,r){let a=[];for(let n of r){if("aborted"===n.status)return m2;"dirty"===n.status&&t.dirty(),a.push(n.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let t of r){let r=await t.key,n=await t.value;a.push({key:r,value:n})}return m1.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let n of r){let{key:r,value:i}=n;if("aborted"===r.status||"aborted"===i.status)return m2;"dirty"===r.status&&t.dirty(),"dirty"===i.status&&t.dirty(),"__proto__"!==r.value&&(void 0!==i.value||n.alwaysSet)&&(a[r.value]=i.value)}return{status:t.value,value:a}}}let m2=Object.freeze({status:"aborted"}),m9=t=>({status:"dirty",value:t}),m4=t=>({status:"valid",value:t}),m3=t=>"undefined"!=typeof Promise&&t instanceof Promise;class m6{constructor(t,r,a,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=n}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 m5=(t,r)=>{if("valid"===r.status)return{success:!0,data:r.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new mY(t.common.issues);return this._error=r,this._error}}};function m7(t){if(!t)return{};let{errorMap:r,invalid_type_error:a,required_error:n,description:i}=t;if(r&&(a||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return r?{errorMap:r,description:i}:{errorMap:(r,i)=>{let{message:o}=t;return"invalid_enum_value"===r.code?{message:o??i.defaultError}:void 0===i.data?{message:o??n??i.defaultError}:"invalid_type"!==r.code?{message:i.defaultError}:{message:o??a??i.defaultError}},description:i}}class m8{get description(){return this._def.description}_getType(t){return mG(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new m1,ctx:{common:t.parent.common,data:t.data,parsedType:mG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(m3(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(t){return Promise.resolve(this._parse(t))}parse(t,r){let a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)},n=this._parseSync({data:t,path:a.path,parent:a});return m5(a,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return"valid"===a.status?{value:a.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(t=>"valid"===t.status?{value:t.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mG(t)},n=this._parse({data:t,path:a.path,parent:a});return m5(a,await (m3(n)?n:Promise.resolve(n)))}refine(t,r){return this._refinement((a,n)=>{let i=t(a),o=()=>n.addIssue({code:mW.custom,..."string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(a):r});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(t=>!!t||(o(),!1)):!!i||(o(),!1)})}refinement(t,r){return this._refinement((a,n)=>!!t(a)||(n.addIssue("function"==typeof r?r(a,n):r),!1))}_refinement(t){return new hJ({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:t=>this["~validate"](t)}}optional(){return hB.create(this,this._def)}nullable(){return hK.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hT.create(this)}promise(){return hH.create(this,this._def)}or(t){return hO.create([this,t],this._def)}and(t){return hN.create(this,t,this._def)}transform(t){return new hJ({...m7(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){return new hG({...m7(this._def),innerType:this,defaultValue:"function"==typeof t?t:()=>t,typeName:z.ZodDefault})}brand(){return new hX({typeName:z.ZodBranded,type:this,...m7(this._def)})}catch(t){return new hW({...m7(this._def),innerType:this,catchValue:"function"==typeof t?t:()=>t,typeName:z.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return hQ.create(this,t)}readonly(){return h0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let he=/^c[^\s-]{8,}$/i,ht=/^[0-9a-z]+$/,hr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ha=/^[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,hn=/^[a-z0-9_-]{21}$/i,hi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ho=/^[-+]?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)?)??$/,hs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hl=/^(?:(?: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])$/,hc=/^(?:(?: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])$/,hu=/^(([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]))$/,hd=/^(([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])$/,hp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hm=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hh="((\\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])))",hf=RegExp(`^${hh}$`);function hg(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:null==t.precision&&(r=`${r}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${a}`}class hy extends m8{_parse(t){var r,a,n,i;let o;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==mK.string){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.string,received:r.parsedType}),m2}let s=new m1;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(m0(o=this._getOrReturnCtx(t,o),{code:mW.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("max"===l.kind)t.data.length>l.value&&(m0(o=this._getOrReturnCtx(t,o),{code:mW.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),s.dirty());else if("length"===l.kind){let r=t.data.length>l.value,a=t.data.length<l.value;(r||a)&&(o=this._getOrReturnCtx(t,o),r?m0(o,{code:mW.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):a&&m0(o,{code:mW.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),s.dirty())}else if("email"===l.kind)hs.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"email",code:mW.invalid_string,message:l.message}),s.dirty());else if("emoji"===l.kind)h||(h=RegExp("^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),h.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"emoji",code:mW.invalid_string,message:l.message}),s.dirty());else if("uuid"===l.kind)ha.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"uuid",code:mW.invalid_string,message:l.message}),s.dirty());else if("nanoid"===l.kind)hn.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"nanoid",code:mW.invalid_string,message:l.message}),s.dirty());else if("cuid"===l.kind)he.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"cuid",code:mW.invalid_string,message:l.message}),s.dirty());else if("cuid2"===l.kind)ht.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"cuid2",code:mW.invalid_string,message:l.message}),s.dirty());else if("ulid"===l.kind)hr.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"ulid",code:mW.invalid_string,message:l.message}),s.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{m0(o=this._getOrReturnCtx(t,o),{validation:"url",code:mW.invalid_string,message:l.message}),s.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"regex",code:mW.invalid_string,message:l.message}),s.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),s.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{startsWith:l.value},message:l.message}),s.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:{endsWith:l.value},message:l.message}),s.dirty()):"datetime"===l.kind?(function(t){let r=`${hh}T${hg(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${a.join("|")})`,RegExp(`^${r}$`)})(l).test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"datetime",message:l.message}),s.dirty()):"date"===l.kind?hf.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"date",message:l.message}),s.dirty()):"time"===l.kind?RegExp(`^${hg(l)}$`).test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{code:mW.invalid_string,validation:"time",message:l.message}),s.dirty()):"duration"===l.kind?ho.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"duration",code:mW.invalid_string,message:l.message}),s.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&hl.test(r)||("v6"===a||!a)&&hu.test(r))&&1&&(m0(o=this._getOrReturnCtx(t,o),{validation:"ip",code:mW.invalid_string,message:l.message}),s.dirty())):"jwt"===l.kind?!function(t,r){if(!hi.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||r&&i.alg!==r)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(m0(o=this._getOrReturnCtx(t,o),{validation:"jwt",code:mW.invalid_string,message:l.message}),s.dirty()):"cidr"===l.kind?(n=t.data,!(("v4"===(i=l.version)||!i)&&hc.test(n)||("v6"===i||!i)&&hd.test(n))&&1&&(m0(o=this._getOrReturnCtx(t,o),{validation:"cidr",code:mW.invalid_string,message:l.message}),s.dirty())):"base64"===l.kind?hp.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"base64",code:mW.invalid_string,message:l.message}),s.dirty()):"base64url"===l.kind?hm.test(t.data)||(m0(o=this._getOrReturnCtx(t,o),{validation:"base64url",code:mW.invalid_string,message:l.message}),s.dirty()):q.assertNever(l);return{status:s.value,value:t.data}}_regex(t,r,a){return this.refinement(r=>t.test(r),{validation:r,code:mW.invalid_string,...M.errToObj(a)})}_addCheck(t){return new hy({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...M.errToObj(t)})}url(t){return this._addCheck({kind:"url",...M.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...M.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...M.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...M.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...M.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...M.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...M.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...M.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...M.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...M.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...M.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...M.errToObj(t)})}datetime(t){return"string"==typeof t?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:void 0===t?.precision?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...M.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return"string"==typeof t?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:void 0===t?.precision?null:t?.precision,...M.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...M.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...M.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...M.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...M.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...M.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...M.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...M.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...M.errToObj(r)})}nonempty(t){return this.min(1,M.errToObj(t))}trim(){return new hy({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hy({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hy({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>"datetime"===t.kind)}get isDate(){return!!this._def.checks.find(t=>"date"===t.kind)}get isTime(){return!!this._def.checks.find(t=>"time"===t.kind)}get isDuration(){return!!this._def.checks.find(t=>"duration"===t.kind)}get isEmail(){return!!this._def.checks.find(t=>"email"===t.kind)}get isURL(){return!!this._def.checks.find(t=>"url"===t.kind)}get isEmoji(){return!!this._def.checks.find(t=>"emoji"===t.kind)}get isUUID(){return!!this._def.checks.find(t=>"uuid"===t.kind)}get isNANOID(){return!!this._def.checks.find(t=>"nanoid"===t.kind)}get isCUID(){return!!this._def.checks.find(t=>"cuid"===t.kind)}get isCUID2(){return!!this._def.checks.find(t=>"cuid2"===t.kind)}get isULID(){return!!this._def.checks.find(t=>"ulid"===t.kind)}get isIP(){return!!this._def.checks.find(t=>"ip"===t.kind)}get isCIDR(){return!!this._def.checks.find(t=>"cidr"===t.kind)}get isBase64(){return!!this._def.checks.find(t=>"base64"===t.kind)}get isBase64url(){return!!this._def.checks.find(t=>"base64url"===t.kind)}get minLength(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}hy.create=t=>new hy({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...m7(t)});class hv extends m8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){let r;if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==mK.number){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.number,received:r.parsedType}),m2}let a=new m1;for(let n of this._def.checks)"int"===n.kind?q.isInteger(t.data)||(m0(r=this._getOrReturnCtx(t,r),{code:mW.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):"min"===n.kind?(n.inclusive?t.data<n.value:t.data<=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):"max"===n.kind?(n.inclusive?t.data>n.value:t.data>=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):"multipleOf"===n.kind?0!==function(t,r){let a=(t.toString().split(".")[1]||"").length,n=(r.toString().split(".")[1]||"").length,i=a>n?a:n;return Number.parseInt(t.toFixed(i).replace(".",""))%Number.parseInt(r.toFixed(i).replace(".",""))/10**i}(t.data,n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(t.data)||(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_finite,message:n.message}),a.dirty()):q.assertNever(n);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,M.toString(r))}gt(t,r){return this.setLimit("min",t,!1,M.toString(r))}lte(t,r){return this.setLimit("max",t,!0,M.toString(r))}lt(t,r){return this.setLimit("max",t,!1,M.toString(r))}setLimit(t,r,a,n){return new hv({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:M.toString(n)}]})}_addCheck(t){return new hv({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:M.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:M.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:M.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&q.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks)if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;else"min"===a.kind?(null===r||a.value>r)&&(r=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value);return Number.isFinite(r)&&Number.isFinite(t)}}hv.create=t=>new hv({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...m7(t)});class h_ extends m8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){let r;if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==mK.bigint)return this._getInvalidInput(t);let a=new m1;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?t.data<n.value:t.data<=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):"max"===n.kind?(n.inclusive?t.data>n.value:t.data>=n.value)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):"multipleOf"===n.kind?t.data%n.value!==BigInt(0)&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):q.assertNever(n);return{status:a.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.bigint,received:r.parsedType}),m2}gte(t,r){return this.setLimit("min",t,!0,M.toString(r))}gt(t,r){return this.setLimit("min",t,!1,M.toString(r))}lte(t,r){return this.setLimit("max",t,!0,M.toString(r))}lt(t,r){return this.setLimit("max",t,!1,M.toString(r))}setLimit(t,r,a,n){return new h_({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:M.toString(n)}]})}_addCheck(t){return new h_({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:M.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return t}}h_.create=t=>new h_({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...m7(t)});class hb extends m8{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==mK.boolean){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.boolean,received:r.parsedType}),m2}return m4(t.data)}}hb.create=t=>new hb({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...m7(t)});class hS extends m8{_parse(t){let r;if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==mK.date){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.date,received:r.parsedType}),m2}if(Number.isNaN(t.data.getTime()))return m0(this._getOrReturnCtx(t),{code:mW.invalid_date}),m2;let a=new m1;for(let n of this._def.checks)"min"===n.kind?t.data.getTime()<n.value&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):"max"===n.kind?t.data.getTime()>n.value&&(m0(r=this._getOrReturnCtx(t,r),{code:mW.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):q.assertNever(n);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new hS({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:M.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:M.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)"min"===r.kind&&(null===t||r.value>t)&&(t=r.value);return null!=t?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)"max"===r.kind&&(null===t||r.value<t)&&(t=r.value);return null!=t?new Date(t):null}}hS.create=t=>new hS({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...m7(t)});class h$ extends m8{_parse(t){if(this._getType(t)!==mK.symbol){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.symbol,received:r.parsedType}),m2}return m4(t.data)}}h$.create=t=>new h$({typeName:z.ZodSymbol,...m7(t)});class hw extends m8{_parse(t){if(this._getType(t)!==mK.undefined){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.undefined,received:r.parsedType}),m2}return m4(t.data)}}hw.create=t=>new hw({typeName:z.ZodUndefined,...m7(t)});class hR extends m8{_parse(t){if(this._getType(t)!==mK.null){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.null,received:r.parsedType}),m2}return m4(t.data)}}hR.create=t=>new hR({typeName:z.ZodNull,...m7(t)});class hk extends m8{constructor(){super(...arguments),this._any=!0}_parse(t){return m4(t.data)}}hk.create=t=>new hk({typeName:z.ZodAny,...m7(t)});class hx extends m8{constructor(){super(...arguments),this._unknown=!0}_parse(t){return m4(t.data)}}hx.create=t=>new hx({typeName:z.ZodUnknown,...m7(t)});class hP extends m8{_parse(t){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.never,received:r.parsedType}),m2}}hP.create=t=>new hP({typeName:z.ZodNever,...m7(t)});class hE extends m8{_parse(t){if(this._getType(t)!==mK.undefined){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.void,received:r.parsedType}),m2}return m4(t.data)}}hE.create=t=>new hE({typeName:z.ZodVoid,...m7(t)});class hT extends m8{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),n=this._def;if(r.parsedType!==mK.array)return m0(r,{code:mW.invalid_type,expected:mK.array,received:r.parsedType}),m2;if(null!==n.exactLength){let t=r.data.length>n.exactLength.value,i=r.data.length<n.exactLength.value;(t||i)&&(m0(r,{code:t?mW.too_big:mW.too_small,minimum:i?n.exactLength.value:void 0,maximum:t?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&r.data.length<n.minLength.value&&(m0(r,{code:mW.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&r.data.length>n.maxLength.value&&(m0(r,{code:mW.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((t,a)=>n.type._parseAsync(new m6(r,t,r.path,a)))).then(t=>m1.mergeArray(a,t));let i=[...r.data].map((t,a)=>n.type._parseSync(new m6(r,t,r.path,a)));return m1.mergeArray(a,i)}get element(){return this._def.type}min(t,r){return new hT({...this._def,minLength:{value:t,message:M.toString(r)}})}max(t,r){return new hT({...this._def,maxLength:{value:t,message:M.toString(r)}})}length(t,r){return new hT({...this._def,exactLength:{value:t,message:M.toString(r)}})}nonempty(t){return this.min(1,t)}}hT.create=(t,r)=>new hT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...m7(r)});class hj extends m8{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let t=this._def.shape(),r=q.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==mK.object){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.object,received:r.parsedType}),m2}let{status:r,ctx:a}=this._processInputParams(t),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof hP&&"strip"===this._def.unknownKeys))for(let t in a.data)i.includes(t)||o.push(t);let s=[];for(let t of i){let r=n[t],i=a.data[t];s.push({key:{status:"valid",value:t},value:r._parse(new m6(a,i,a.path,t)),alwaysSet:t in a.data})}if(this._def.catchall instanceof hP){let t=this._def.unknownKeys;if("passthrough"===t)for(let t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===t)o.length>0&&(m0(a,{code:mW.unrecognized_keys,keys:o}),r.dirty());else if("strip"===t);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let t=this._def.catchall;for(let r of o){let n=a.data[r];s.push({key:{status:"valid",value:r},value:t._parse(new m6(a,n,a.path,r)),alwaysSet:r in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let t=[];for(let r of s){let a=await r.key,n=await r.value;t.push({key:a,value:n,alwaysSet:r.alwaysSet})}return t}).then(t=>m1.mergeObjectSync(r,t)):m1.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(t){return M.errToObj,new hj({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return"unrecognized_keys"===r.code?{message:M.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new hj({...this._def,unknownKeys:"strip"})}passthrough(){return new hj({...this._def,unknownKeys:"passthrough"})}extend(t){return new hj({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new hj({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new hj({...this._def,catchall:t})}pick(t){let r={};for(let a of q.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new hj({...this._def,shape:()=>r})}omit(t){let r={};for(let a of q.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new hj({...this._def,shape:()=>r})}deepPartial(){return function t(r){if(r instanceof hj){let a={};for(let n in r.shape){let i=r.shape[n];a[n]=hB.create(t(i))}return new hj({...r._def,shape:()=>a})}if(r instanceof hT)return new hT({...r._def,type:t(r.element)});if(r instanceof hB)return hB.create(t(r.unwrap()));if(r instanceof hK)return hK.create(t(r.unwrap()));if(r instanceof hq)return hq.create(r.items.map(r=>t(r)));else return r}(this)}partial(t){let r={};for(let a of q.objectKeys(this.shape)){let n=this.shape[a];t&&!t[a]?r[a]=n:r[a]=n.optional()}return new hj({...this._def,shape:()=>r})}required(t){let r={};for(let a of q.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let t=this.shape[a];for(;t instanceof hB;)t=t._def.innerType;r[a]=t}return new hj({...this._def,shape:()=>r})}keyof(){return hU(q.objectKeys(this.shape))}}hj.create=(t,r)=>new hj({shape:()=>t,unknownKeys:"strip",catchall:hP.create(),typeName:z.ZodObject,...m7(r)}),hj.strictCreate=(t,r)=>new hj({shape:()=>t,unknownKeys:"strict",catchall:hP.create(),typeName:z.ZodObject,...m7(r)}),hj.lazycreate=(t,r)=>new hj({shape:t,unknownKeys:"strip",catchall:hP.create(),typeName:z.ZodObject,...m7(r)});class hO extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;if(r.common.async)return Promise.all(a.map(async t=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await t._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(function(t){for(let r of t)if("valid"===r.result.status)return r.result;for(let a of t)if("dirty"===a.result.status)return r.common.issues.push(...a.ctx.common.issues),a.result;let a=t.map(t=>new mY(t.ctx.common.issues));return m0(r,{code:mW.invalid_union,unionErrors:a}),m2});{let t,n=[];for(let i of a){let a={...r,common:{...r.common,issues:[]},parent:null},o=i._parseSync({data:r.data,path:r.path,parent:a});if("valid"===o.status)return o;"dirty"!==o.status||t||(t={result:o,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(t)return r.common.issues.push(...t.ctx.common.issues),t.result;let i=n.map(t=>new mY(t));return m0(r,{code:mW.invalid_union,unionErrors:i}),m2}}get options(){return this._def.options}}hO.create=(t,r)=>new hO({options:t,typeName:z.ZodUnion,...m7(r)});let hC=t=>{if(t instanceof hZ)return hC(t.schema);if(t instanceof hJ)return hC(t.innerType());if(t instanceof hD)return[t.value];if(t instanceof hV)return t.options;if(t instanceof hF)return q.objectValues(t.enum);else if(t instanceof hG)return hC(t._def.innerType);else if(t instanceof hw)return[void 0];else if(t instanceof hR)return[null];else if(t instanceof hB)return[void 0,...hC(t.unwrap())];else if(t instanceof hK)return[null,...hC(t.unwrap())];else if(t instanceof hX)return hC(t.unwrap());else if(t instanceof h0)return hC(t.unwrap());else if(t instanceof hW)return hC(t._def.innerType);else return[]};class hI extends m8{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==mK.object)return m0(r,{code:mW.invalid_type,expected:mK.object,received:r.parsedType}),m2;let a=this.discriminator,n=r.data[a],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(m0(r,{code:mW.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m2)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let n=new Map;for(let a of r){let r=hC(a.shape[t]);if(!r.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of r){if(n.has(i))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);n.set(i,a)}}return new hI({typeName:z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...m7(a)})}}class hN extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=(t,n)=>{if("aborted"===t.status||"aborted"===n.status)return m2;let i=function t(r,a){let n=mG(r),i=mG(a);if(r===a)return{valid:!0,data:r};if(n===mK.object&&i===mK.object){let n=q.objectKeys(a),i=q.objectKeys(r).filter(t=>-1!==n.indexOf(t)),o={...r,...a};for(let n of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===n)continue;let i=t(r[n],a[n]);if(!i.valid)return{valid:!1};o[n]=i.data}return{valid:!0,data:o}}if(n===mK.array&&i===mK.array){if(r.length!==a.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let o=t(r[i],a[i]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}if(n===mK.date&&i===mK.date&&+r==+a)return{valid:!0,data:r};return{valid:!1}}(t.value,n.value);return i.valid?(("dirty"===t.status||"dirty"===n.status)&&r.dirty(),{status:r.value,value:i.data}):(m0(a,{code:mW.invalid_intersection_types}),m2)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([t,r])=>n(t,r)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}hN.create=(t,r,a)=>new hN({left:t,right:r,typeName:z.ZodIntersection,...m7(a)});class hq extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.array)return m0(a,{code:mW.invalid_type,expected:mK.array,received:a.parsedType}),m2;if(a.data.length<this._def.items.length)return m0(a,{code:mW.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m2;!this._def.rest&&a.data.length>this._def.items.length&&(m0(a,{code:mW.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...a.data].map((t,r)=>{let n=this._def.items[r]||this._def.rest;return n?n._parse(new m6(a,t,a.path,r)):null}).filter(t=>!!t);return a.common.async?Promise.all(n).then(t=>m1.mergeArray(r,t)):m1.mergeArray(r,n)}get items(){return this._def.items}rest(t){return new hq({...this._def,rest:t})}}hq.create=(t,r)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new hq({items:t,typeName:z.ZodTuple,rest:null,...m7(r)})};class hA extends m8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.object)return m0(a,{code:mW.invalid_type,expected:mK.object,received:a.parsedType}),m2;let n=[],i=this._def.keyType,o=this._def.valueType;for(let t in a.data)n.push({key:i._parse(new m6(a,t,a.path,t)),value:o._parse(new m6(a,a.data[t],a.path,t)),alwaysSet:t in a.data});return a.common.async?m1.mergeObjectAsync(r,n):m1.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,a){return new hA(r instanceof m8?{keyType:t,valueType:r,typeName:z.ZodRecord,...m7(a)}:{keyType:hy.create(),valueType:t,typeName:z.ZodRecord,...m7(r)})}}class hM extends m8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.map)return m0(a,{code:mW.invalid_type,expected:mK.map,received:a.parsedType}),m2;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([t,r],o)=>({key:n._parse(new m6(a,t,a.path,[o,"key"])),value:i._parse(new m6(a,r,a.path,[o,"value"]))}));if(a.common.async){let t=new Map;return Promise.resolve().then(async()=>{for(let a of o){let n=await a.key,i=await a.value;if("aborted"===n.status||"aborted"===i.status)return m2;("dirty"===n.status||"dirty"===i.status)&&r.dirty(),t.set(n.value,i.value)}return{status:r.value,value:t}})}{let t=new Map;for(let a of o){let n=a.key,i=a.value;if("aborted"===n.status||"aborted"===i.status)return m2;("dirty"===n.status||"dirty"===i.status)&&r.dirty(),t.set(n.value,i.value)}return{status:r.value,value:t}}}}hM.create=(t,r,a)=>new hM({valueType:r,keyType:t,typeName:z.ZodMap,...m7(a)});class hz extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==mK.set)return m0(a,{code:mW.invalid_type,expected:mK.set,received:a.parsedType}),m2;let n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(m0(a,{code:mW.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(m0(a,{code:mW.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(t){let a=new Set;for(let n of t){if("aborted"===n.status)return m2;"dirty"===n.status&&r.dirty(),a.add(n.value)}return{status:r.value,value:a}}let s=[...a.data.values()].map((t,r)=>i._parse(new m6(a,t,a.path,r)));return a.common.async?Promise.all(s).then(t=>o(t)):o(s)}min(t,r){return new hz({...this._def,minSize:{value:t,message:M.toString(r)}})}max(t,r){return new hz({...this._def,maxSize:{value:t,message:M.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}hz.create=(t,r)=>new hz({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...m7(r)});class hL extends m8{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==mK.function)return m0(r,{code:mW.invalid_type,expected:mK.function,received:r.parsedType}),m2;function a(t,a){return mQ({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mX,mX].filter(t=>!!t),issueData:{code:mW.invalid_arguments,argumentsError:a}})}function n(t,a){return mQ({data:t,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mX,mX].filter(t=>!!t),issueData:{code:mW.invalid_return_type,returnTypeError:a}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof hH){let t=this;return m4(async function(...r){let s=new mY([]),l=await t._def.args.parseAsync(r,i).catch(t=>{throw s.addIssue(a(r,t)),s}),c=await Reflect.apply(o,this,l);return await t._def.returns._def.type.parseAsync(c,i).catch(t=>{throw s.addIssue(n(c,t)),s})})}{let t=this;return m4(function(...r){let s=t._def.args.safeParse(r,i);if(!s.success)throw new mY([a(r,s.error)]);let l=Reflect.apply(o,this,s.data),c=t._def.returns.safeParse(l,i);if(!c.success)throw new mY([n(l,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new hL({...this._def,args:hq.create(t).rest(hx.create())})}returns(t){return new hL({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,a){return new hL({args:t||hq.create([]).rest(hx.create()),returns:r||hx.create(),typeName:z.ZodFunction,...m7(a)})}}class hZ extends m8{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}hZ.create=(t,r)=>new hZ({getter:t,typeName:z.ZodLazy,...m7(r)});class hD extends m8{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return m0(r,{received:r.data,code:mW.invalid_literal,expected:this._def.value}),m2}return{status:"valid",value:t.data}}get value(){return this._def.value}}function hU(t,r){return new hV({values:t,typeName:z.ZodEnum,...m7(r)})}hD.create=(t,r)=>new hD({value:t,typeName:z.ZodLiteral,...m7(r)});class hV extends m8{_parse(t){if("string"!=typeof t.data){let r=this._getOrReturnCtx(t),a=this._def.values;return m0(r,{expected:q.joinValues(a),received:r.parsedType,code:mW.invalid_type}),m2}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return m0(r,{received:r.data,code:mW.invalid_enum_value,options:a}),m2}return m4(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return hV.create(t,{...this._def,...r})}exclude(t,r=this._def){return hV.create(this.options.filter(r=>!t.includes(r)),{...this._def,...r})}}hV.create=hU;class hF extends m8{_parse(t){let r=q.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==mK.string&&a.parsedType!==mK.number){let t=q.objectValues(r);return m0(a,{expected:q.joinValues(t),received:a.parsedType,code:mW.invalid_type}),m2}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let t=q.objectValues(r);return m0(a,{received:a.data,code:mW.invalid_enum_value,options:t}),m2}return m4(t.data)}get enum(){return this._def.values}}hF.create=(t,r)=>new hF({values:t,typeName:z.ZodNativeEnum,...m7(r)});class hH extends m8{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);return r.parsedType!==mK.promise&&!1===r.common.async?(m0(r,{code:mW.invalid_type,expected:mK.promise,received:r.parsedType}),m2):m4((r.parsedType===mK.promise?r.data:Promise.resolve(r.data)).then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}}hH.create=(t,r)=>new hH({type:t,typeName:z.ZodPromise,...m7(r)});class hJ extends m8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:t=>{m0(a,t),t.fatal?r.abort():r.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let t=n.transform(a.data,i);if(a.common.async)return Promise.resolve(t).then(async t=>{if("aborted"===r.value)return m2;let n=await this._def.schema._parseAsync({data:t,path:a.path,parent:a});return"aborted"===n.status?m2:"dirty"===n.status||"dirty"===r.value?m9(n.value):n});{if("aborted"===r.value)return m2;let n=this._def.schema._parseSync({data:t,path:a.path,parent:a});return"aborted"===n.status?m2:"dirty"===n.status||"dirty"===r.value?m9(n.value):n}}if("refinement"===n.type){let t=t=>{let r=n.refinement(t,i);if(a.common.async)return Promise.resolve(r);if(r instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?m2:("dirty"===a.status&&r.dirty(),t(a.value).then(()=>({status:r.value,value:a.value}))));{let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?m2:("dirty"===n.status&&r.dirty(),t(n.value),{status:r.value,value:n.value})}}if("transform"===n.type)if(!1!==a.common.async)return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"valid"!==t.status?m2:Promise.resolve(n.transform(t.value,i)).then(t=>({status:r.value,value:t})));else{let t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if("valid"!==t.status)return m2;let o=n.transform(t.value,i);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}q.assertNever(n)}}hJ.create=(t,r,a)=>new hJ({schema:t,typeName:z.ZodEffects,effect:r,...m7(a)}),hJ.createWithPreprocess=(t,r,a)=>new hJ({schema:r,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...m7(a)});class hB extends m8{_parse(t){return this._getType(t)===mK.undefined?m4(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}hB.create=(t,r)=>new hB({innerType:t,typeName:z.ZodOptional,...m7(r)});class hK extends m8{_parse(t){return this._getType(t)===mK.null?m4(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}hK.create=(t,r)=>new hK({innerType:t,typeName:z.ZodNullable,...m7(r)});class hG extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===mK.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}hG.create=(t,r)=>new hG({innerType:t,typeName:z.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...m7(r)});class hW extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return m3(n)?n.then(t=>({status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new mY(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new mY(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}hW.create=(t,r)=>new hW({innerType:t,typeName:z.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...m7(r)});class hY extends m8{_parse(t){if(this._getType(t)!==mK.nan){let r=this._getOrReturnCtx(t);return m0(r,{code:mW.invalid_type,expected:mK.nan,received:r.parsedType}),m2}return{status:"valid",value:t.data}}}hY.create=t=>new hY({typeName:z.ZodNaN,...m7(t)}),Symbol("zod_brand");class hX extends m8{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}}class hQ extends m8{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let t=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?m2:"dirty"===t.status?(r.dirty(),m9(t.value)):this._def.out._parseAsync({data:t.value,path:a.path,parent:a})})();{let t=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?m2:"dirty"===t.status?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:a.path,parent:a})}}static create(t,r){return new hQ({in:t,out:r,typeName:z.ZodPipeline})}}class h0 extends m8{_parse(t){let r=this._def.innerType._parse(t),a=t=>("valid"===t.status&&(t.value=Object.freeze(t.value)),t);return m3(r)?r.then(t=>a(t)):a(r)}unwrap(){return this._def.innerType}}h0.create=(t,r)=>new h0({innerType:t,typeName:z.ZodReadonly,...m7(r)}),hj.lazycreate,(O=z||(z={})).ZodString="ZodString",O.ZodNumber="ZodNumber",O.ZodNaN="ZodNaN",O.ZodBigInt="ZodBigInt",O.ZodBoolean="ZodBoolean",O.ZodDate="ZodDate",O.ZodSymbol="ZodSymbol",O.ZodUndefined="ZodUndefined",O.ZodNull="ZodNull",O.ZodAny="ZodAny",O.ZodUnknown="ZodUnknown",O.ZodNever="ZodNever",O.ZodVoid="ZodVoid",O.ZodArray="ZodArray",O.ZodObject="ZodObject",O.ZodUnion="ZodUnion",O.ZodDiscriminatedUnion="ZodDiscriminatedUnion",O.ZodIntersection="ZodIntersection",O.ZodTuple="ZodTuple",O.ZodRecord="ZodRecord",O.ZodMap="ZodMap",O.ZodSet="ZodSet",O.ZodFunction="ZodFunction",O.ZodLazy="ZodLazy",O.ZodLiteral="ZodLiteral",O.ZodEnum="ZodEnum",O.ZodEffects="ZodEffects",O.ZodNativeEnum="ZodNativeEnum",O.ZodOptional="ZodOptional",O.ZodNullable="ZodNullable",O.ZodDefault="ZodDefault",O.ZodCatch="ZodCatch",O.ZodPromise="ZodPromise",O.ZodBranded="ZodBranded",O.ZodPipeline="ZodPipeline",O.ZodReadonly="ZodReadonly",hy.create,hv.create,hY.create,h_.create,hb.create,hS.create,h$.create,hw.create,hR.create,hk.create,hx.create,hP.create,hE.create,hT.create,hj.create,hj.strictCreate,hO.create,hI.create,hN.create,hq.create,hA.create,hM.create,hz.create,hL.create,hZ.create,hD.create,hV.create,hF.create,hH.create,hJ.create,hB.create,hK.create,hJ.createWithPreprocess,hQ.create;let h1=(t,r)=>{let a=0;for(;a<t.length&&a<r.length&&t[a]===r[a];a++);return[(t.length-a).toString(),...r.slice(a)].join("/")};function h2(t){if("openAi"!==t.target)return{};let r=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===t.$refStrategy?h1(r,t.currentPath):r.join("/")}}function h9(t,r,a,n){n?.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[r]:a})}function h4(t,r,a,n,i){t[r]=a,h9(t,r,n,i)}function h3(t,r){return fg(t.type._def,r)}let h6=/^[cC][^\s-]{8,}$/,h5=/^[0-9a-z]+$/,h7=/^[0-9A-HJKMNP-TV-Z]{26}$/,h8=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,fe=()=>(void 0===w&&(w=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),w),ft=/^(?:(?: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])$/,fr=/^(([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])$/,fa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fi=/^[a-zA-Z0-9_-]{21}$/,fo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function fs(t,r){let a={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":h4(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,r);break;case"max":h4(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,r);break;case"email":switch(r.emailStrategy){case"format:email":fu(a,"email",n.message,r);break;case"format:idn-email":fu(a,"idn-email",n.message,r);break;case"pattern:zod":fd(a,h8,n.message,r)}break;case"url":fu(a,"uri",n.message,r);break;case"uuid":fu(a,"uuid",n.message,r);break;case"regex":fd(a,n.regex,n.message,r);break;case"cuid":fd(a,h6,n.message,r);break;case"cuid2":fd(a,h5,n.message,r);break;case"startsWith":fd(a,RegExp(`^${fl(n.value,r)}`),n.message,r);break;case"endsWith":fd(a,RegExp(`${fl(n.value,r)}$`),n.message,r);break;case"datetime":fu(a,"date-time",n.message,r);break;case"date":fu(a,"date",n.message,r);break;case"time":fu(a,"time",n.message,r);break;case"duration":fu(a,"duration",n.message,r);break;case"length":h4(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,r),h4(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,r);break;case"includes":fd(a,RegExp(fl(n.value,r)),n.message,r);break;case"ip":"v6"!==n.version&&fu(a,"ipv4",n.message,r),"v4"!==n.version&&fu(a,"ipv6",n.message,r);break;case"base64url":fd(a,fn,n.message,r);break;case"jwt":fd(a,fo,n.message,r);break;case"cidr":"v6"!==n.version&&fd(a,ft,n.message,r),"v4"!==n.version&&fd(a,fr,n.message,r);break;case"emoji":fd(a,fe(),n.message,r);break;case"ulid":fd(a,h7,n.message,r);break;case"base64":switch(r.base64Strategy){case"format:binary":fu(a,"binary",n.message,r);break;case"contentEncoding:base64":h4(a,"contentEncoding","base64",n.message,r);break;case"pattern:zod":fd(a,fa,n.message,r)}break;case"nanoid":fd(a,fi,n.message,r)}return a}function fl(t,r){return"escape"===r.patternStrategy?function(t){let r="";for(let a=0;a<t.length;a++)fc.has(t[a])||(r+="\\"),r+=t[a];return r}(t):t}let fc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fu(t,r,a,n){t.format||t.anyOf?.some(t=>t.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.anyOf.push({format:r,...a&&n.errorMessages&&{errorMessage:{format:a}}})):h4(t,"format",r,a,n)}function fd(t,r,a,n){t.pattern||t.allOf?.some(t=>t.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,0===Object.keys(t.errorMessage).length&&delete t.errorMessage)),t.allOf.push({pattern:fp(r,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):h4(t,"pattern",fp(r,n),a,n)}function fp(t,r){if(!r.applyRegexFlags||!t.flags)return t.source;let a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=a.i?t.source.toLowerCase():t.source,i="",o=!1,s=!1,l=!1;for(let t=0;t<n.length;t++){if(o){i+=n[t],o=!1;continue}if(a.i){if(s){if(n[t].match(/[a-z]/)){l?(i+=n[t],i+=`${n[t-2]}-${n[t]}`.toUpperCase(),l=!1):"-"===n[t+1]&&n[t+2]?.match(/[a-z]/)?(i+=n[t],l=!0):i+=`${n[t]}${n[t].toUpperCase()}`;continue}}else if(n[t].match(/[a-z]/)){i+=`[${n[t]}${n[t].toUpperCase()}]`;continue}}if(a.m){if("^"===n[t]){i+=`(^|(?<=[\r
|
|
78
|
+
]))`;continue}else if("$"===n[t]){i+=`($|(?=[\r
|
|
79
|
+
]))`;continue}}if(a.s&&"."===n[t]){i+=s?`${n[t]}\r
|
|
80
|
+
`:`[${n[t]}\r
|
|
81
|
+
]`;continue}i+=n[t],"\\"===n[t]?o=!0:s&&"]"===n[t]?s=!1:s||"["!==n[t]||(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${r.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return i}function fm(t,r){if("openAi"===r.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===r.target&&t.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((a,n)=>({...a,[n]:fg(t.valueType._def,{...r,currentPath:[...r.currentPath,"properties",n]})??h2(r)}),{}),additionalProperties:r.rejectedAdditionalProperties};let a={type:"object",additionalProperties:fg(t.valueType._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]})??r.allowedAdditionalProperties};if("openApi3"===r.target)return a;if(t.keyType?._def.typeName===z.ZodString&&t.keyType._def.checks?.length){let{type:n,...i}=fs(t.keyType._def,r);return{...a,propertyNames:i}}if(t.keyType?._def.typeName===z.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===z.ZodBranded&&t.keyType._def.type._def.typeName===z.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...i}=h3(t.keyType._def,r);return{...a,propertyNames:i}}return a}let fh={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},ff=(t,r)=>{let a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((t,a)=>fg(t._def,{...r,currentPath:[...r.currentPath,"anyOf",`${a}`]})).filter(t=>!!t&&(!r.strictUnions||"object"==typeof t&&Object.keys(t).length>0));return a.length?{anyOf:a}:void 0};function fg(t,r,a=!1){let n=r.seen.get(t);if(r.override){let i=r.override?.(t,r,n,a);if(i!==mJ)return i}if(n&&!a){let t=fy(n,r);if(void 0!==t)return t}let i={def:t,path:r.currentPath,jsonSchema:void 0};r.seen.set(t,i);let o=((t,r,a)=>{switch(r){case z.ZodString:return fs(t,a);case z.ZodNumber:let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",h9(n,"type",r.message,a);break;case"min":"jsonSchema7"===a.target?r.inclusive?h4(n,"minimum",r.value,r.message,a):h4(n,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(n.exclusiveMinimum=!0),h4(n,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?h4(n,"maximum",r.value,r.message,a):h4(n,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(n.exclusiveMaximum=!0),h4(n,"maximum",r.value,r.message,a));break;case"multipleOf":h4(n,"multipleOf",r.value,r.message,a)}return n;case z.ZodObject:return function(t,r){let a="openAi"===r.target,n={type:"object",properties:{}},i=[],o=t.shape();for(let t in o){let s=o[t];if(void 0===s||void 0===s._def)continue;let l=function(t){try{return t.isOptional()}catch{return!0}}(s);l&&a&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),l=!1);let c=fg(s._def,{...r,currentPath:[...r.currentPath,"properties",t],propertyPath:[...r.currentPath,"properties",t]});void 0!==c&&(n.properties[t]=c,l||i.push(t))}i.length&&(n.required=i);let s=function(t,r){if("ZodNever"!==t.catchall._def.typeName)return fg(t.catchall._def,{...r,currentPath:[...r.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return r.allowedAdditionalProperties;case"strict":return r.rejectedAdditionalProperties;case"strip":return"strict"===r.removeAdditionalStrategy?r.allowedAdditionalProperties:r.rejectedAdditionalProperties}}(t,r);return void 0!==s&&(n.additionalProperties=s),n}(t,a);case z.ZodBigInt:let i={type:"integer",format:"int64"};if(!t.checks)return i;for(let r of t.checks)switch(r.kind){case"min":"jsonSchema7"===a.target?r.inclusive?h4(i,"minimum",r.value,r.message,a):h4(i,"exclusiveMinimum",r.value,r.message,a):(r.inclusive||(i.exclusiveMinimum=!0),h4(i,"minimum",r.value,r.message,a));break;case"max":"jsonSchema7"===a.target?r.inclusive?h4(i,"maximum",r.value,r.message,a):h4(i,"exclusiveMaximum",r.value,r.message,a):(r.inclusive||(i.exclusiveMaximum=!0),h4(i,"maximum",r.value,r.message,a));break;case"multipleOf":h4(i,"multipleOf",r.value,r.message,a)}return i;case z.ZodBoolean:return{type:"boolean"};case z.ZodDate:return function t(r,a,n){let i=n??a.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,i)=>t(r,a,n))};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 o=r,s=a;let l={type:"integer",format:"unix-time"};if("openApi3"===s.target)return l;for(let t of o.checks)switch(t.kind){case"min":h4(l,"minimum",t.value,t.message,s);break;case"max":h4(l,"maximum",t.value,t.message,s)}return l}}(t,a);case z.ZodUndefined:return{not:h2(a)};case z.ZodNull:return"openApi3"===a.target?{enum:["null"],nullable:!0}:{type:"null"};case z.ZodArray:let o;return o={type:"array"},t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(o.items=fg(t.type._def,{...a,currentPath:[...a.currentPath,"items"]})),t.minLength&&h4(o,"minItems",t.minLength.value,t.minLength.message,a),t.maxLength&&h4(o,"maxItems",t.maxLength.value,t.maxLength.message,a),t.exactLength&&(h4(o,"minItems",t.exactLength.value,t.exactLength.message,a),h4(o,"maxItems",t.exactLength.value,t.exactLength.message,a)),o;case z.ZodUnion:case z.ZodDiscriminatedUnion:if("openApi3"===a.target)return ff(t,a);let s=t.options instanceof Map?Array.from(t.options.values()):t.options;if(s.every(t=>t._def.typeName in fh&&(!t._def.checks||!t._def.checks.length))){let t=s.reduce((t,r)=>{let a=fh[r._def.typeName];return a&&!t.includes(a)?[...t,a]:t},[]);return{type:t.length>1?t:t[0]}}if(s.every(t=>"ZodLiteral"===t._def.typeName&&!t.description)){let t=s.reduce((t,r)=>{let a=typeof r._def.value;switch(a){case"string":case"number":case"boolean":return[...t,a];case"bigint":return[...t,"integer"];case"object":if(null===r._def.value)return[...t,"null"];default:return t}},[]);if(t.length===s.length){let r=t.filter((t,r,a)=>a.indexOf(t)===r);return{type:r.length>1?r:r[0],enum:s.reduce((t,r)=>t.includes(r._def.value)?t:[...t,r._def.value],[])}}}else if(s.every(t=>"ZodEnum"===t._def.typeName))return{type:"string",enum:s.reduce((t,r)=>[...t,...r._def.values.filter(r=>!t.includes(r))],[])};return ff(t,a);case z.ZodIntersection:let l,c,u;return l=[fg(t.left._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),fg(t.right._def,{...a,currentPath:[...a.currentPath,"allOf","1"]})].filter(t=>!!t),c="jsonSchema2019-09"===a.target?{unevaluatedProperties:!1}:void 0,u=[],l.forEach(t=>{if((!("type"in t)||"string"!==t.type)&&"allOf"in t)u.push(...t.allOf),void 0===t.unevaluatedProperties&&(c=void 0);else{let r=t;if("additionalProperties"in t&&!1===t.additionalProperties){let{additionalProperties:a,...n}=t;r=n}else c=void 0;u.push(r)}}),u.length?{allOf:u,...c}:void 0;case z.ZodTuple:return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((t,r)=>fg(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[]),additionalItems:fg(t.rest._def,{...a,currentPath:[...a.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((t,r)=>fg(t._def,{...a,currentPath:[...a.currentPath,"items",`${r}`]})).reduce((t,r)=>void 0===r?t:[...t,r],[])};case z.ZodRecord:return fm(t,a);case z.ZodLiteral:let d;return"bigint"!=(d=typeof t.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(t.value)?"array":"object"}:"openApi3"===a.target?{type:"bigint"===d?"integer":d,enum:[t.value]}:{type:"bigint"===d?"integer":d,const:t.value};case z.ZodEnum:return{type:"string",enum:Array.from(t.values)};case z.ZodNativeEnum:let p,m,h;return p=t.values,{type:1===(h=Array.from(new Set((m=Object.keys(t.values).filter(t=>"number"!=typeof p[p[t]]).map(t=>p[t])).map(t=>typeof t)))).length?"string"===h[0]?"string":"number":["string","number"],enum:m};case z.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return"openApi3"===a.target?{type:fh[t.innerType._def.typeName],nullable:!0}:{type:[fh[t.innerType._def.typeName],"null"]};if("openApi3"===a.target){let r=fg(t.innerType._def,{...a,currentPath:[...a.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let f=fg(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case z.ZodOptional:if(a.currentPath.toString()===a.propertyPath?.toString())return fg(t.innerType._def,a);let g=fg(t.innerType._def,{...a,currentPath:[...a.currentPath,"anyOf","1"]});return g?{anyOf:[{not:h2(a)},g]}:h2(a);case z.ZodMap:if("record"===a.mapStrategy)return fm(t,a);return{type:"array",maxItems:125,items:{type:"array",items:[fg(t.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||h2(a),fg(t.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||h2(a)],minItems:2,maxItems:2}};case z.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:fg(t.valueType._def,{...a,currentPath:[...a.currentPath,"items"]})},t.minSize&&h4(y,"minItems",t.minSize.value,t.minSize.message,a),t.maxSize&&h4(y,"maxItems",t.maxSize.value,t.maxSize.message,a),y;case z.ZodLazy:return()=>t.getter()._def;case z.ZodPromise:return fg(t.type._def,a);case z.ZodNaN:case z.ZodNever:return"openAi"===a.target?void 0:{not:h2({...a,currentPath:[...a.currentPath,"not"]})};case z.ZodEffects:return"input"===a.effectStrategy?fg(t.schema._def,a):h2(a);case z.ZodAny:case z.ZodUnknown:return h2(a);case z.ZodDefault:return{...fg(t.innerType._def,a),default:t.defaultValue()};case z.ZodBranded:return h3(t,a);case z.ZodReadonly:case z.ZodCatch:return fg(t.innerType._def,a);case z.ZodPipeline:if("input"===a.pipeStrategy)return fg(t.in._def,a);if("output"===a.pipeStrategy)return fg(t.out._def,a);let v=fg(t.in._def,{...a,currentPath:[...a.currentPath,"allOf","0"]}),_=fg(t.out._def,{...a,currentPath:[...a.currentPath,"allOf",v?"1":"0"]});return{allOf:[v,_].filter(t=>void 0!==t)};case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:default:return}})(t,t.typeName,r),s="function"==typeof o?fg(o(),r):o;if(s&&fv(t,r,s),r.postProcess){let a=r.postProcess(s,t,r);return i.jsonSchema=s,a}return i.jsonSchema=s,s}let fy=(t,r)=>{switch(r.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:h1(r.currentPath,t.path)};case"none":case"seen":if(t.path.length<r.currentPath.length&&t.path.every((t,a)=>r.currentPath[a]===t))return console.warn(`Recursive reference detected at ${r.currentPath.join("/")}! Defaulting to any`),h2(r);return"seen"===r.$refStrategy?h2(r):void 0}},fv=(t,r,a)=>(t.description&&(a.description=t.description,r.markdownDescription&&(a.markdownDescription=t.description)),a);function f_(t,r={}){let{strict:a=!1}=r,n=Object.entries(t),i=t=>({target:r})=>{let i={},o=[];for(let[a,s]of n)i[a]=function(t,r,a){let n=t["~standard"];if(n.jsonSchema)return n.jsonSchema[a]({target:r});if("zod"===t["~standard"].vendor&&!("_zod"in t)&&"_def"in t){let a=((t,r)=>{let a,n,i=(n=void 0!==(a="string"==typeof r?{...mB,name:r}:{...mB,...r}).name?[...a.basePath,a.definitionPath,a.name]:a.basePath,{...a,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(a.definitions).map(([t,r])=>[r._def,{def:r._def,path:[...a.basePath,a.definitionPath,t],jsonSchema:void 0}]))}),o="object"==typeof r&&r.definitions?Object.entries(r.definitions).reduce((t,[r,a])=>({...t,[r]:fg(a._def,{...i,currentPath:[...i.basePath,i.definitionPath,r]},!0)??h2(i)}),{}):void 0,s="string"==typeof r?r:r?.nameStrategy==="title"?void 0:r?.name,l=fg(t._def,void 0===s?i:{...i,currentPath:[...i.basePath,i.definitionPath,s]},!1)??h2(i),c="object"==typeof r&&void 0!==r.name&&"title"===r.nameStrategy?r.name:void 0;void 0!==c&&(l.title=c),i.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[i.openAiAnyTypeName]||(o[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let u=void 0===s?o?{...l,[i.definitionPath]:o}:l:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,s].join("/"),[i.definitionPath]:{...o,[s]:l}};return"jsonSchema7"===i.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),u})(t,{$refStrategy:"none",target:"openapi-3.0"===r?"openApi3":"jsonSchema7"});return delete a.$schema,a}if("zod"===n.vendor&&"_zod"in t)try{let r=a8(t);return delete r.$schema,r}catch(t){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${t instanceof Error?t.message:String(t)}`)}throw Error(`Schema library "${n.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".`)}(s,r,t),!function(t,r){if("function"!=typeof t.safeParse)return!1;try{let a=t.safeParse(void 0);return a.success&&("input"===r||void 0===a.data)}catch{return!1}}(s,t)&&o.push(a);let s={type:"object",properties:i};return o.length>0&&(s.required=o),a&&(s.additionalProperties=!1),s},o=async r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{issues:[{message:"Expected an object."}]};let i={},o=[];for(let[t,a]of n){let n=await a["~standard"].validate(r[t]);if(n.issues)for(let r of n.issues)o.push({message:r.message,path:[t,...r.path??[]]});else(t in r||void 0!==n.value)&&(i[t]=n.value)}if(a)for(let a of Object.keys(r))a in t||o.push({message:`Unrecognized key: "${a}"`,path:[a]});return o.length>0?{issues:o}:{value:i}};return{shape:t,"~standard":{version:1,vendor:"xmcp",validate:o,jsonSchema:{input:i("input"),output:i("output")}}}}function fb(t){let r={};return!function t(a,n=""){if(a&&"object"==typeof a)for(let[i,o]of Object.entries(a)){let a=n?`${n}/${i}`:i;!o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp?r[a]=o:t(o,a)}}(t),r}let fS=["ui/resourceUri","resourceUri","visibility"],f$=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function fw(t){return"object"==typeof t&&null!==t&&Object.entries(t).every(([t,r])=>"string"==typeof t&&"object"==typeof r&&null!==r&&"parse"in r&&"function"==typeof r.parse)}function fR(t){return(t.split("/").pop()||t).replace(/\.[^/.]+$/,"")}function fk(t,r,a){return t.names?.includes(r)===!0||t.tags?.some(t=>a.includes(t))===!0}function fx(t,r){return r?new Map([...t].filter(([t,{metadata:a}])=>{if(a?.enabled===!1)return!1;let n=a?.name??fR(t),i=a?.tags??[];return(!r.include||fk(r.include,n,i))&&(!r.exclude||!fk(r.exclude,n,i))})):t}function fP(t){return Error(`[xmcp] Invalid prompt file: ${t}
|
|
82
|
+
-> Default export must be a prompt handler function.`)}async function fE(t){let r=new Map,a=[];for(let n of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),n=function(t,r){if("object"!=typeof t||null===t)throw fP(r);let a=Object.keys(t),n=t.default,i=a.filter(t=>"__esModule"!==t);if(0===a.length||1===i.length&&"default"===i[0]&&"object"==typeof n&&null!==n&&0===Object.keys(n).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw fP(r);return"valid"}(a,t);return"empty"===n?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===n?{skipped:!0,issue:{path:t,message:"File does not export a default prompt handler."}}:{skipped:!1,path:t,promptModule:a}})))){if(n.skipped){a.push(n.issue);continue}r.set(n.path,n.promptModule)}return{promptModules:r,skippedPrompts:a}}let fT=function(t=console){let r="";return a=>{let n=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(n===r||(r=n,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load prompt file: ${r}
|
|
83
|
+
-> ${a}`)});let i=a.length;t.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function fj(t){return Error(`[xmcp] Invalid resource file: ${t}
|
|
84
|
+
-> Default export must be a resource handler function.`)}async function fO(t){let r=new Map,a=[];for(let n of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),n=function(t,r){if("object"!=typeof t||null===t)throw fj(r);let a=Object.keys(t),n=t.default,i=a.filter(t=>"__esModule"!==t);if(0===a.length||1===i.length&&"default"===i[0]&&"object"==typeof n&&null!==n&&0===Object.keys(n).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw fj(r);return"valid"}(a,t);return"empty"===n?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===n?{skipped:!0,issue:{path:t,message:"File does not export a default resource handler."}}:{skipped:!1,path:t,resourceModule:a}})))){if(n.skipped){a.push(n.issue);continue}r.set(n.path,n.resourceModule)}return{resourceModules:r,skippedResources:a}}let fC=function(t=console){let r="";return a=>{let n=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(n===r||(r=n,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load resource file: ${r}
|
|
85
|
+
-> ${a}`)});let i=a.length;t.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function fI(t){let r=t.replace(/\\/g,"/");if(!r)throw Error("Invalid tool path: path is empty");let a=r.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:r,baseName:a}}function fN(t){let r=t.split("/").filter(t=>""!==t),a=r.findIndex(t=>t.match(/^\(.+\)$/));if(-1===a)return null;let n=r[r.length-1];if(n&&n.match(/^\[.+\]\.ts$/))return null;let i=r[a].slice(1,-1),o=r.slice(a+1),s=o[o.length-1];if(s&&s.includes(".")){let t=s.split(".")[0];"index"!==t?o[o.length-1]=t:o.pop()}let l=[],c=[],u=o.map(t=>{if(!t.match(/^\[.+\]$/))return c.push(t),t;{let r=t.slice(1,-1);return l.push(r),`{${r}}`}}),d=`${i}://${u.join("/")}`,p=l.length>0?"template":"direct";return{filePath:t,uriTemplate:d,scheme:i,parameters:l,pathSegments:c,type:p}}function fq(t){return Error(`[xmcp] Invalid tool file: ${t}
|
|
86
|
+
-> Default export must be a tool handler function.`)}async function fA(t){let r=new Map,a=[];for(let n of(await Promise.all(Object.entries(t).map(async([t,r])=>{let a=await r(),n=function(t,r){if("object"!=typeof t||null===t)throw fq(r);let a=Object.keys(t),n=t.default,i=a.filter(t=>"__esModule"!==t);if(0===a.length||1===i.length&&"default"===i[0]&&"object"==typeof n&&null!==n&&0===Object.keys(n).length)return"empty";if(!("default"in t)||void 0===t.default)return"missing-default";if("function"!=typeof t.default)throw fq(r);return"valid"}(a,t);return"empty"===n?{skipped:!0,issue:{path:t,message:"File is empty."}}:"missing-default"===n?{skipped:!0,issue:{path:t,message:"File does not export a default tool handler."}}:{skipped:!1,path:t,toolModule:a}})))){if(n.skipped){a.push(n.issue);continue}r.set(n.path,n.toolModule)}return{toolModules:r,skippedTools:a}}let fM=function(t=console){let r="";return a=>{let n=a.map(({path:t,message:r})=>`${t}:${r}`).sort().join("|");if(n===r||(r=n,0===a.length))return;a.forEach(({path:r,message:a})=>{t.warn(`[xmcp] Failed to load tool file: ${r}
|
|
87
|
+
-> ${a}`)});let i=a.length;t.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),fz=INJECTED_TOOLS,fL=INJECTED_PROMPTS,fZ=INJECTED_RESOURCES,fD=SERVER_INFO;async function fU(t,r,n,i){let o=await INJECTED_MIDDLEWARE?.(),s=function(t){if(void 0===t)return[];let r=Array.isArray(t)?[...t]:[t];if(!r.every(t=>"function"==typeof t))throw Error("src/middleware.ts must export mcp as a function or an array of functions");return r}(o?.mcp),l="undefined"!=typeof OBSERVABILITY_CONFIG&&OBSERVABILITY_CONFIG.enabled?function(t=t=>console.error(t)){let r=new Map,a=[];function n(r){try{t(JSON.stringify({"@timestamp":new Date().toISOString(),...r}))}catch{}}return{middleware:async(t,i)=>{let o,s,l;if("tools/call"!==t.method&&"prompts/get"!==t.method&&"resources/read"!==t.method)return i();try{s=performance.now(),o={log:{level:"info"},...function(t){let r=t.http?.headers.traceparent;if("string"!=typeof r)return{};let a=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/.exec(r);return!a||"ff"===a[1]||/^0+$/.test(a[2])||/^0+$/.test(a[3])||"00"===a[1]&&void 0!==a[5]?{}:{trace:{id:a[2]},parent:{id:a[3]}}}(t),transaction:{id:crypto.randomUUID()},...t.http?{http:{request:{id:t.http.id}}}:{},xmcp:{method:t.method,component:"resources/read"===t.method?function(t){try{let n=new URL(t).href;return r.get(n)??a.find(({template:t})=>t.uriTemplate.match(n))?.name??"unknown"}catch{return"unknown"}}(t.params.uri):t.params.name}}}catch{return i()}n({...o,event:{kind:"event",category:["api"],type:["start"],action:"execution.start"}});let c="unknown";try{let r=await i();try{c=t.signal.aborted?"cancelled":cX(r)?"input_required":"isError"in r&&!0===r.isError?"failure":"success","failure"===c&&(l={message:"Operation returned an error result"})}catch{}return r}catch(r){throw l={message:"cancelled"==(c=t.signal.aborted?"cancelled":"failure")?"Operation cancelled":"Operation threw an exception"},r}finally{try{n({...o,log:{level:"failure"===c?"error":"info"},event:{kind:"event",category:["api"],type:["end"],action:"execution.end",duration:Math.round((performance.now()-s)*1e6),outcome:"success"===c?"success":"failure"===c?"failure":"unknown"},xmcp:{...o.xmcp,status:c},...l?{error:l}:{}})}catch{}}},registerResource(t,n){try{"string"==typeof n?r.set(new URL(n).href,t):a.push({name:t,template:n})}catch{}}}}():void 0;l&&s.unshift(l.middleware),mm.clear();let c="undefined"==typeof COMPONENTS_CONFIG?void 0:COMPONENTS_CONFIG;return!function(t,r,a){let n=t.server,i=n.setRequestHandler,o=mV(r);n.setRequestHandler=(t,...r)=>{if(mF.has(t)&&1===r.length&&"function"==typeof r[0]){let t=r[0];r[0]=(r,a)=>o({method:r.method,params:r.params??{}},a,()=>t(r,a))}Reflect.apply(i,n,[t,...r])};try{a()}finally{n.setRequestHandler=i}}(t,s,()=>{var o,u;!function(t,r,a=[]){r.forEach((r,n)=>{var i,o;let s,l,c,u,d={name:fR(n),description:"No description provided"},{default:p,metadata:m,schema:h,outputSchema:f}=r;if("object"==typeof m&&null!==m&&Object.assign(d,m),!1===d.enabled)return;if("function"==typeof p&&"__x402"in p){let t=global.__XMCP_X402_REGISTRY;t&&t.set(d.name,p.__x402)}let g={};if(fw(h)?g=h:null!=h&&console.warn(`Invalid schema for tool "${d.name}" at ${n}. Expected Record<string, z.ZodType>`),null!=f)if(fw(f))s=f;else throw Error(`Invalid outputSchema for tool "${d.name}" at ${n}. Expected Record<string, z.ZodType>`);d.annotations={...d.annotations??{}},void 0===d.annotations.title&&(d.annotations.title=d.name),d._meta={...mp(d)._meta};let y=mH(n),v=!!(i=d._meta)&&"object"==typeof i&&"ui"in i&&"object"==typeof i.ui||y,_=d._meta;if(v){let t=`ui://app/${d.name}.html`;d._meta.ui||(d._meta.ui={}),d._meta.ui.resourceUri||(d._meta.ui.resourceUri=t);let r=function(t){let r={},a={};if(t.ui&&"object"==typeof t.ui){let n=t.ui,i={},o={};for(let[t,r]of Object.entries(n))fS.includes(t)?i[t]=r:f$.includes(t)?o[t]=r:i[t]=r;Object.keys(i).length>0&&(r.ui=i),Object.keys(o).length>0&&(a.ui=o)}for(let[a,n]of Object.entries(t))"ui"!==a&&(r[a]=n);return{toolMeta:r,resourceMeta:a}}(_);_=r.toolMeta;let a=r.resourceMeta;a.ui=a.ui||{},a.ui.csp=a.ui.csp||{},a.ui.csp.resourceDomains=a.ui.csp.resourceDomains||[],a.ui.csp.resourceDomains.includes("https://esm.sh")||a.ui.csp.resourceDomains.push("https://esm.sh"),mm.add(d.name,{name:d.name,uri:t,handler:p,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:y?n:void 0})}let b=fb(_),S=v?b:void 0;l=mH(n)&&v?async(t,r)=>({content:[{type:"text",text:""}],_meta:S,structuredContent:{args:t}}):function(t,r,a,n="unknown-tool"){return async(i,o)=>{let s,l,c=t(i,(s=mU(o),l=function(t){if(!t)return;let r={};return t.headers.forEach((t,a)=>{r[a]=t}),r}(o.http?.req),{signal:o.mcpReq.signal,authInfo:o.http?.authInfo,sessionId:o.sessionId,_meta:o.mcpReq._meta,requestId:o.mcpReq.id,requestInfo:l?{headers:l}:void 0,clientInfo:s,sendNotification:t=>o.mcpReq.notify(t),sendRequest:(t,r,a)=>o.mcpReq.send(t,r,a),elicit:(t,r)=>mk(o,t,r),sample:(t,r)=>mA(o,t,r),inputResponses:o.mcpReq.inputResponses,requestState:o.mcpReq.requestState}));if(c instanceof Promise&&(c=await c),cX(c))return c;if("string"==typeof c||"number"==typeof c){if(a){let t=Object.entries(a);if(1===t.length){let[r,a]=t[0];try{return a.parse(c),{content:[{type:"text",text:"number"==typeof c?`${c}`:c}],structuredContent:{[r]:c}}}catch{}}}return mD(r)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:r}:{content:[{type:"text",text:"number"==typeof c?`${c}`:c}]}}if(!a||!c||"object"!=typeof c||Array.isArray(c)||"structuredContent"in c||"content"in c&&Array.isArray(c.content)||"_meta"in c||"isError"in c||(mZ(c,a,n,"returned data that does not match outputSchema"),c={structuredContent:c}),c&&"object"==typeof c&&"_meta"in c&&!("content"in c)&&!("structuredContent"in c)){let t=c._meta;if(mD(t))return{content:[{type:"text",text:""}],_meta:t}}if(!c||"object"!=typeof c){let t=null===c?"null":typeof c,r=void 0===c?"undefined":null===c?"null":"object"==typeof c?JSON.stringify(c,null,2):String(c);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${t}: ${r}
|
|
88
88
|
|
|
89
89
|
Expected CallToolResult format:
|
|
90
90
|
{
|
|
@@ -134,7 +134,7 @@ Or both for backwards compatibility:
|
|
|
134
134
|
{
|
|
135
135
|
content: [{ type: "text", text: "fallback" }],
|
|
136
136
|
structuredContent: { your: "data" }
|
|
137
|
-
}`)}if(p&&!u&&!d){let{isError:t,...r}=c,a=Object.keys(r).length>0?`Tool execution failed: ${JSON.stringify(r)}`:"Tool execution failed";c.content=[{type:"text",text:a}],u=!0}if(a&&d&&!p&&
|
|
137
|
+
}`)}if(p&&!u&&!d){let{isError:t,...r}=c,a=Object.keys(r).length>0?`Tool execution failed: ${JSON.stringify(r)}`:"Tool execution failed";c.content=[{type:"text",text:a}],u=!0}if(a&&d&&!p&&mZ(c.structuredContent,a,n,"returned structuredContent that does not match outputSchema"),!u&&d&&(c.content=[{type:"text",text:JSON.stringify(c.structuredContent)}],u=!0),u)for(let t=0;t<c.content.length;t++){let r=c.content[t],a=mL(r);if(!a.valid)throw Error(`Invalid content item at index ${t}: ${a.error}
|
|
138
138
|
|
|
139
139
|
Content item: ${JSON.stringify(r,null,2)}
|
|
140
140
|
|
|
@@ -151,7 +151,7 @@ Expected format:
|
|
|
151
151
|
key: "value",
|
|
152
152
|
nested: { data: "here" }
|
|
153
153
|
}
|
|
154
|
-
}`)}}return c}}(
|
|
154
|
+
}`)}}return c}}(p,S,s,d.name);let $={title:d.annotations?.title,description:d.description,inputSchema:f_(g),outputSchema:s?f_(s,{strict:!0}):void 0,annotations:d.annotations,icons:d.icons,_meta:b};t.registerTool(d.name,$,(o={name:d.name,description:$.description,annotations:$.annotations,icons:$.icons,tags:d.tags,_meta:$._meta},c=mV(a),u=Object.freeze({metadata:function t(r,a=new WeakMap){if(null===r||"object"!=typeof r)return r;let n=Object.getPrototypeOf(r);if(!Array.isArray(r)&&n!==Object.prototype&&null!==n)return r;if(a.has(r))return a.get(r);let i=Array.isArray(r)?[]:Object.create(n);for(let[n,o]of(a.set(r,i),Object.entries(r)))Object.defineProperty(i,n,{value:t(o,a),enumerable:!0,configurable:!0,writable:!0});return Object.freeze(i)}(o)}),(t,r)=>c({method:"tools/call",params:{name:u.metadata.name,arguments:t},tool:u},r,()=>l(t,r))))})}(t,fx(r,c),s),fx(n,c).forEach((r,a)=>{let n=fR(a),i={name:n,title:n,description:"No description provided"},o={},{default:s,metadata:l,schema:c}=r;if("object"==typeof l&&null!==l&&Object.assign(i,l),!1===i.enabled)return;let u=function(t,r="assistant"){return async(a,n)=>{let i,o=t(a,n);if(o instanceof Promise&&(o=await o),Array.isArray(o)||null!==o&&"object"==typeof o&&"messages"in o){let t=Array.isArray(o)?{messages:o}:o,r=await uR.GetPromptResult["~standard"].validate(t);if(r.issues){let t=r.issues.map(t=>{let r=t.path?.map(t=>"object"==typeof t?t.key:t).join(".");return`${r||"result"}: ${t.message}`});throw Error(`Invalid prompt result: ${t.join("; ")}`)}return t}if("string"==typeof o||"number"==typeof o)i={type:"text",text:"number"==typeof o?`${o}`:o};else{let t=mL(o);if(t.valid)i=o;else{let r=null===o?"null":typeof o,a=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Prompt handler must return a PromptContent object, string, number, PromptMessage[], or GetPromptResult. Got ${r}: ${a}
|
|
155
155
|
|
|
156
156
|
Validation error: ${t.error}
|
|
157
157
|
|
|
@@ -164,7 +164,7 @@ Expected formats:
|
|
|
164
164
|
- Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
165
165
|
- Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
166
166
|
- Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
|
|
167
|
-
- All content types support an optional "_meta" object property`)}}if("user"!==r&&"assistant"!==r)throw Error(`Invalid role: ${r}`);return{messages:[{role:r,content:
|
|
167
|
+
- All content types support an optional "_meta" object property`)}}if("user"!==r&&"assistant"!==r)throw Error(`Invalid role: ${r}`);return{messages:[{role:r,content:i}]}}}(s,i.role||"assistant");fw(c)?Object.assign(o,c):null!=c&&console.warn(`Invalid schema for prompt "${i.name}" at ${a}. Expected Record<string, z.ZodType>`),t.registerPrompt(i.name,{title:i.title,description:i.description,icons:i.icons,_meta:mp(i)._meta,argsSchema:f_(o)},u)}),o=fx(i,c),u=l?.registerResource,[...mm.getAll()].forEach(([r,n])=>{let i=n.mimeType||"text/html;profile=mcp-app",o=n?._meta?fb(n._meta):void 0,s={name:n.name,description:`Auto-generated resource for ${n.name} tool`,mimeType:n.mimeType,_meta:o},l=async(t,r)=>{if(n.mimeType&&n.toolPath)try{var o;let t,r,s=(o=n.toolPath,IS_CLOUDFLARE?function(t){let{normalizedPath:r,baseName:a}=fI(t),n=5381;for(let t=0;t<r.length;t++)n=Math.imul(n,33)+r.charCodeAt(t)>>>0;let i=n.toString(16).slice(0,6).padStart(6,"0");return`${a}_${i}`}(o):function(t){let{normalizedPath:r,baseName:n}=fI(t),i=a(6982).createHash("md5").update(r).digest("hex").slice(0,6);return`${n}_${i}`}(o)),l=function(t){if(INJECTED_CLIENT_BUNDLES)return INJECTED_CLIENT_BUNDLES[t]||null;if(!IS_CLOUDFLARE)try{let r=a(9896),n=a(6928);for(let a of[n.join(process.cwd(),"dist","client"),n.join(process.cwd(),"client")]){let i=n.join(a,`${t}.bundle.js`),o=n.join(a,`${t}.bundle.css`);if(r.existsSync(i)){let t,a=r.readFileSync(i,"utf-8");return r.existsSync(o)&&(t=r.readFileSync(o,"utf-8")),{js:a,css:t}}}}catch{}return null}(s);if(!l)throw Error(`React client bundle not found for "${n.name}" (bundle: "${s}").
|
|
168
168
|
React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
|
|
169
169
|
Please re-run the build so the framework can regenerate the bundle.`);let c=l.js,u=l.css,d=(t=`
|
|
170
170
|
<script type="module">
|
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:
|
|
222
|
+
</html>`);return{contents:[{uri:n.uri,text:d,mimeType:i,_meta:n._meta}]}}catch(t){throw console.error(`React failed for ${n.name}:`,t),t}let s=n.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:n.uri,text:s,mimeType:i,_meta:n._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:n.uri,text:"",mimeType:i,_meta:n._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:n.uri,text:t.text,mimeType:i,_meta:n._meta}]}}return{contents:[{uri:n.uri,text:"",mimeType:i,_meta:n._meta}]}};u?.(n.name,n.uri),t.registerResource(n.name,n.uri,s,l)}),o.forEach((r,a)=>{let n={name:fR(a),description:"No description provided"},{default:i,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(n,o),!1===n.enabled)return;let c={};fw(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${n.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=fN(a);if(!d)return void console.warn(`Skipping resource "${n.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;n.mimeType&&n.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let n=fN(r);if(!n)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,i)=>{let o=t(function(t,r,a){let n={},i={};if(0===r.parameters.length)return i;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],i=r.match(/^\{(.+)\}$/);i&&(n[i[1]]=a)}for(let t of r.parameters){let r=n[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){i[t]=r;continue}try{i[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return i}(r.href,n,a),i);if(o instanceof Promise&&(o=await o),cX(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -228,10 +228,10 @@ Expected ReadResourceResult format:
|
|
|
228
228
|
{ uri: "resource://uri", mimeType: "application/json", text: "json content" },
|
|
229
229
|
{ uri: "resource://uri", blob: base64data }
|
|
230
230
|
]
|
|
231
|
-
}`)}return o.contents.forEach(t=>{t.uri||(t.uri=r.href)}),o}}(
|
|
231
|
+
}`)}return o.contents.forEach(t=>{t.uri||(t.uri=r.href)}),o}}(i,a,c);if("direct"===d.type)u?.(n.name,p),t.registerResource(n.name,p,mp(n),m);else{let r=Object.create(null);for(let t of d.parameters)l&&Object.hasOwn(l,t)&&(r[t]=l[t]);let a=new pD(p,{list:void 0,complete:r}),o=async(t,r,a)=>{let n={};for(let t of d.parameters){let a=r[t],i=c[t];if(void 0===a)throw Error(`Missing required parameter: ${t}. Available variables: ${Object.keys(r)}`);i?n[t]=i.parse(a):n[t]=a}let o=i(n,a);return o instanceof Promise&&(o=await o),"string"==typeof o?{contents:[{uri:t.href,text:o}]}:o};u?.(n.name,a),t.registerResource(n.name,a,mp(n),o)}})}),t}async function fV(){let{toolModules:t,skippedTools:r}=await fA(fz);return fM(r),t}async function fF(){let{promptModules:t,skippedPrompts:r}=await fE(fL);return fT(r),t}async function fH(){let{resourceModules:t,skippedResources:r}=await fO(fZ);return fC(r),t}let fJ={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*","Access-Control-Max-Age":"86400"};function fB(t,r,a,n,i){let o=new URL(t.url).origin,s=`${o}/.well-known/oauth-protected-resource`;return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:i,message:a},id:null}),{status:n,headers:{"WWW-Authenticate":`Bearer error="${r}", error_description="${a}", resource_metadata="${s}"`,"Content-Type":"application/json"}})}function fK(t,r){return async a=>{var n,i;let o,{verifyToken:s,required:l=!1,requiredScopes:c}=r,u=function(t){let r=t.headers.get("Authorization"),[a,n]=r?.split(" ")||[];return a?.toLowerCase()==="bearer"?n:void 0}(a);try{o=await s(a,u)}catch(t){return console.error("[MCP Auth] Error verifying token:",t),fB(a,"invalid_token","Invalid token",401,-32001)}return l&&!o?fB(a,"invalid_token","No authorization provided",401,-32001):o?void 0!==(n=o).expiresAt&&n.expiresAt<Date.now()/1e3?fB(a,"invalid_token","Token has expired",401,-32001):c?.length&&(i=o,!c.every(t=>i.scopes.includes(t)))?fB(a,"insufficient_scope","Insufficient scope",403,-32002):(a.auth=o,t(a)):t(a)}}function fG(t){return r=>{let a;return new Response(JSON.stringify({resource:((a=new URL(r.url)).pathname=a.pathname.replace(/^\/\.well-known\/[^\/]+/,""),"/"===a.pathname?a.toString().replace(/\/$/,""):a.toString()),authorization_servers:t.authorizationServers}),{headers:{...fJ,"Cache-Control":"max-age=3600","Content-Type":"application/json"}})}}function fW(t){return new Response(null,{status:200,headers:fJ})}let fY=function(t,r={}){var a;let{legacy:n,onerror:i,responseMode:o}=r,s=pQ(r.maxRequestBodySize);if("function"==typeof n)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 l=new Set,c=!1,h=t=>{try{i?.(t)}catch{}},f=r.bus??new pP(h),g={toolsChanged:()=>f.publish({kind:"tools_list_changed"}),promptsChanged:()=>f.publish({kind:"prompts_list_changed"}),resourcesChanged:()=>f.publish({kind:"resources_list_changed"}),resourceUpdated:t=>f.publish({kind:"resource_updated",uri:t})},y=function(t){let{bus:r,onerror:a}=t,n=t.maxSubscriptions??1024,i=t.keepAliveMs??15e3,o=new Set;return{serve:function(t,s,l,c){var u,d,p;let m,h,f,g,y,v,_;if(o.size>=n)return a?.(Error(`subscriptions/listen refused: subscription limit reached (${n})`)),pE(t.id,-32603,"Subscription limit reached");let b=(u=t,(y=cA(cq).validateRequest("subscriptions/listen",u)).ok?y.value.params?.notifications:void 0);if(void 0===b)return pE(t.id,-32602,"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter");let S=(d=b,p=l,v={},_=t=>void 0===p||!0===t,!0===d.toolsListChanged&&_(p?.tools?.listChanged)&&(v.toolsListChanged=!0),!0===d.promptsListChanged&&_(p?.prompts?.listChanged)&&(v.promptsListChanged=!0),!0===d.resourcesListChanged&&_(p?.resources?.listChanged)&&(v.resourcesListChanged=!0),void 0!==d.resourceSubscriptions&&d.resourceSubscriptions.length>0&&_(p?.resources?.subscribe)&&(v.resourceSubscriptions=[...d.resourceSubscriptions]),v),$=t.id,w=new TextEncoder,R=!1,k=t=>{if(!R)try{m.enqueue(w.encode(t))}catch(t){a?.(t instanceof Error?t:Error(String(t)))}},x=(t,r)=>{k(`event: message
|
|
232
232
|
data: ${JSON.stringify({jsonrpc:"2.0",method:t,params:r})}
|
|
233
233
|
|
|
234
234
|
`)},P=t=>{if(!R){t&&k(`event: message
|
|
235
|
-
data: ${JSON.stringify({jsonrpc:"2.0",id:$,result:{resultType:"complete",_meta:{[
|
|
235
|
+
data: ${JSON.stringify({jsonrpc:"2.0",id:$,result:{resultType:"complete",_meta:{[iW]:$,[iK]:c}}})}
|
|
236
236
|
|
|
237
|
-
`),R=!0;try{h?.()}catch(t){a?.(t instanceof Error?t:Error(String(t)))}void 0!==f&&clearInterval(f),y?.(),o.delete(P);try{m.close()}catch{}}},E=new ReadableStream({start(t){m=t;let a=pR({method:"notifications/subscriptions/acknowledged",params:{notifications:S}},$);x(a.method,a.params),h=r.subscribe(t=>{if(R||!function(t,r){switch(r.kind){case"tools_list_changed":return!0===t.toolsListChanged;case"prompts_list_changed":return!0===t.promptsListChanged;case"resources_list_changed":return!0===t.resourcesListChanged;case"resource_updated":return void 0!==t.resourceSubscriptions&&t.resourceSubscriptions.includes(r.uri)}}(S,t))return;let r=pR(function(t){switch(t.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:t.uri}}}}(t),$);x(r.method,r.params)}),f=pS(n,()=>k(": keepalive\n\n")),o.add(P)},cancel(){P(!1)}});if(void 0!==s)if(s.aborted)P(!1);else{let t=()=>P(!1);s.addEventListener("abort",t,{once:!0}),y=()=>s.removeEventListener("abort",t)}return new Response(E,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let t of o)t(!0)},get openCount(){return o.size}}}({bus:h,maxSubscriptions:r.maxSubscriptions??1024,keepAliveMs:r.keepAliveMs??15e3,onerror:c});"json"===o&&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 g="reject"===i?void 0:(a=r.keepAliveMs,async(r,i)=>{if("POST"!==r.method.toUpperCase())return pU(405,-32e3,"Method not allowed.");try{let n=await t({era:"legacy",...i?.authInfo!==void 0&&{authInfo:i.authInfo},requestInfo:r}),o=new pV({sessionIdGenerator:void 0,...void 0!==a&&{keepAliveMs:a}});await n.connect(o);let s=()=>{o.close().catch(()=>{}),n.close().catch(()=>{})};r.signal?.addEventListener("abort",s,{once:!0});let l=await o.handleRequest(r,{...i?.authInfo!==void 0&&{authInfo:i.authInfo},...i?.parsedBody!==void 0&&{parsedBody:i.parsedBody}});if(null===l.body||"text/event-stream"!==uj(l.headers.get("content-type")))return s(),l;let c=l.body.getReader(),u=!1,d=()=>{u||(u=!0,s())},p=new ReadableStream({pull:async t=>{try{let{done:r,value:a}=await c.read();if(r){d(),t.close();return}void 0!==a&&t.enqueue(a)}catch(r){d(),t.error(r)}},cancel:t=>(d(),c.cancel(t).catch(()=>{}))});return new Response(p,{status:l.status,statusText:l.statusText,headers:l.headers})}catch(t){try{c?.(pJ(t))}catch{}return pB(pF(i?.parsedBody))}});async function v(a,i,n){var l,h;let f=a.classification.revision;if(void 0===f||!lB.includes(f)){let t=new cf({supported:[...lB],requested:f??"unknown"});return c(t),pU(400,t.code,t.message,t.data,pF(a.message))}let g=function(t,r){if("request"!==r.messageKind)return;let a=r.message.method;if(void 0===t.mcpMethodHeader)return c8("method-header-missing","(missing)",`the body names method ${a} but the required Mcp-Method header is absent`,"standard-header-validation");let i=Object.hasOwn(c7,a)?c7[a]:void 0;if(void 0===i)return;let n=r.message.params?.[i],o="string"==typeof n?n:void 0;if(void 0===t.mcpNameHeader){if(void 0===o)return;return c8("name-header-missing","(missing)",`the body carries params.${i}="${o}" but the required Mcp-Name header is absent`,"standard-header-validation")}let s=ue(t.mcpNameHeader),l=c9(s);return void 0===l?c8("name-header-invalid-encoding",s,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==o&&l!==o?c8("name-header-mismatch",s,`the body carries params.${i}="${o}" but the Mcp-Name header names "${l}"`,"standard-header-validation"):void 0}({httpMethod:i.method,mcpMethodHeader:i.headers.get("mcp-method")??void 0,mcpNameHeader:i.headers.get("mcp-name")??void 0},a);if(void 0!==g)return c(Error(`Rejected inbound request (${g.cell}): ${g.message}`)),pH(g,pF(a.message));let v="request"===a.messageKind?cz(a.message.params):void 0,_=v?.[nB];if("request"===a.messageKind){let t=Object.hasOwn(lF,l=a.message.method)?lF[l]:void 0;if(void 0!==t){let r=lH(t,_);if(void 0!==r){let t=new cy({requiredCapabilities:r});return c(t),pU(c6[t.code]??400,t.code,t.message,t.data,a.message.id)}}}let b=await t({era:"modern",...void 0!==n&&{authInfo:n},requestInfo:i}),S=b instanceof pj?b.server:b;if("request"===a.messageKind&&"subscriptions/listen"===a.message.method){let t=S.getCapabilities(),r=m(S);return b.close().catch(c),y.serve(a.message,i.signal,t,r)}if("request"===a.messageKind&&"tools/call"===a.message.method&&b instanceof pj){let t=a.message.params,r="string"==typeof t?.name?t.name:void 0,n=void 0===r?void 0:b.toolInputSchemaJson(r);if(void 0!==n){let r=cY(n);if(r.valid&&r.declarations.length>0){let n=function(t,r,a){for(let i of t){let t=`Mcp-Param-${i.headerName}`,n=a.get(t),o=function(t,r){let a=t;for(let t of r){if(null===a||"object"!=typeof a)return;a=a[t]}return a}(r,i.path);if(null==o)continue;let s=function(t){if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t){if(!Number.isFinite(t)||Number.isInteger(t)&&!Number.isSafeInteger(t))return;return String(t)}}(o);if(void 0===s)continue;if(null===n)return c4("param-header-missing",t,`the body carries ${c0(i.path)}=${JSON.stringify(o)} but the ${t} header is absent`);let l=c9(n);if(void 0===l)return c4("param-header-invalid-encoding",t,`the ${t} header carries an invalid Base64 sentinel value`);if(!(("integer"===i.type||"number"===i.type)&&c2.test(l)&&"number"==typeof o?Number(l)===o:l===s))return c4("param-header-mismatch",t,`the ${t} header decodes to ${JSON.stringify(l)} but the body carries ${c0(i.path)}=${JSON.stringify(o)}`)}}(r.declarations,t?.arguments,i.headers);if(void 0!==n)return b.close().catch(c),c(Error(`Rejected inbound request (${n.cell}): ${n.message}`)),pH(n,a.message.id)}}}u(S,f),p(S,lB),void 0!==v&&(h={clientInfo:v[nH],clientCapabilities:_},d(S,h));let $=S.onclose;s.add(S),S.onclose=()=>{s.delete(S),$?.()};try{let t=await pD(b,a.message,{classification:a.classification,request:i,...void 0!==n&&{authInfo:n},...void 0!==o&&{responseMode:o},...void 0!==r.keepAliveMs&&{keepAliveMs:r.keepAliveMs}});return"notification"===a.messageKind&&queueMicrotask(()=>void S.close().catch(()=>{})),t}catch(t){if(t instanceof lV&&t.code===lD.ConnectionClosed)return new Response(null,{status:499});return await S.close().catch(()=>{}),s.delete(S),c(pJ(t)),pB(pF(a.message))}}async function _(t,r,a,i){if(void 0!==g)return g(r,{...void 0!==a&&{authInfo:a},...void 0!==i&&{parsedBody:i}});let n=function(t,r){switch(t.reason){case"http-method":return c5("http-method","modern-only-method-not-allowed",405,new cp(-32e3,"Method not allowed."),!0);case"batch":return c5("jsonrpc-shape","modern-only-batch-not-supported",400,new cp(cd.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return c5("jsonrpc-shape","modern-only-response-post",400,new cp(cd.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let a=t.requestedVersion;return c5("era-classification","modern-only-missing-envelope",400,void 0===a?new cp(cd.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...r]}):new cf({supported:[...r],requested:a}),!0)}}}(t,lB);return void 0===n?new Response(null,{status:202}):(c(Error(`Rejected 2025-era request on a modern-only endpoint (${n.cell}): ${n.message}`)),pH(n,pF(i)))}async function b(t,r){let a=r?.authInfo;if("POST"===t.method.toUpperCase()&&!uO(t.headers.get("content-type")))return c(Error("Unsupported Media Type: Content-Type must be application/json")),pU(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let i=await pK(t,r?.parsedBody);if("unreadable-body"===i.step)return pU(400,-32700,"Parse error: the request body could not be read");if("no-json-body"===i.step)return void 0!==g?g(i.forwardRequest,{...void 0!==a&&{authInfo:a}}):pU(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:n,body:o,parsedBody:s,forwardRequest:l}=i;try{switch(n.kind){case"reject":return c(Error(`Rejected inbound request (${n.cell}): ${n.message}`)),pH(n,pF(o));case"modern":return await v(n,t,a);case"legacy":return await _(n,l,a,s)}}catch(t){return c(pJ(t)),pB(pF(o))}}return{fetch:async(t,r)=>{if(l)throw Error("This MCP handler has been closed");try{return await b(t,r)}catch(t){return c(pJ(t)),pB(pF(r?.parsedBody))}},notify:f,bus:h,close:async()=>{l=!0,y.closeAll();let t=[...s].map(t=>t.close().catch(()=>{}));s.clear(),await Promise.all(t)}}}(fO,{legacy:"stateless"});async function fL(t){return hj({id:(0,fC.randomUUID)(),headers:Object.fromEntries(t.headers.entries()),clientInfo:void 0},async()=>{try{let r;return"POST"===t.method&&(r=await t.json().catch(()=>void 0),hE({clientInfo:(t=>{for(let r of Array.isArray(t)?t:[t]){let t=hq(r);if(t)return t}})(r)})),await fz.fetch(t,{authInfo:t.auth,parsedBody:r})}catch(t){return console.error("[Next.js MCP] Error handling MCP request:",t),Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}})}function fZ(t){let r=new URL(t.url),a=r.hostname.split(".").reverse().join("."),i={$schema:"https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",name:`${a}/mcp`,version:SERVER_INFO.version,description:TEMPLATE_CONFIG.description,title:TEMPLATE_CONFIG.name,remotes:[{type:"streamable-http",url:`${r.origin}${HTTP_CONFIG.endpoint}`}]};return TEMPLATE_CONFIG.icons?.length&&(i.icons=TEMPLATE_CONFIG.icons),Response.json(i,{headers:{"Content-Type":"application/mcp-server-card+json","Cache-Control":"public, max-age=3600, must-revalidate","Access-Control-Allow-Origin":"*"}})}})(),i})());
|
|
237
|
+
`),R=!0;try{h?.()}catch(t){a?.(t instanceof Error?t:Error(String(t)))}void 0!==f&&clearInterval(f),g?.(),o.delete(P);try{m.close()}catch{}}},E=new ReadableStream({start(t){m=t;let a=pT({method:"notifications/subscriptions/acknowledged",params:{notifications:S}},$);(x(a.method,a.params),0===Object.keys(S).length)?P(!0):(h=r.subscribe(t=>{if(R||!function(t,r){switch(r.kind){case"tools_list_changed":return!0===t.toolsListChanged;case"prompts_list_changed":return!0===t.promptsListChanged;case"resources_list_changed":return!0===t.resourcesListChanged;case"resource_updated":return void 0!==t.resourceSubscriptions&&t.resourceSubscriptions.includes(r.uri)}}(S,t))return;let r=pT(function(t){switch(t.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:t.uri}}}}(t),$);x(r.method,r.params)}),f=px(i,()=>k(": keepalive\n\n")),o.add(P))},cancel(){P(!1)}});if(void 0!==s)if(s.aborted)P(!1);else{let t=()=>P(!1);s.addEventListener("abort",t,{once:!0}),g=()=>s.removeEventListener("abort",t)}return new Response(E,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})},closeAll(){for(let t of o)t(!0)},get openCount(){return o.size}}}({bus:f,maxSubscriptions:r.maxSubscriptions??1024,keepAliveMs:r.keepAliveMs??15e3,onerror:h});"json"===o&&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 v="reject"===n?void 0:(a=r.keepAliveMs,async(r,n)=>{if("POST"!==r.method.toUpperCase())return p9(405,-32e3,"Method not allowed.");try{let i=await t({era:"legacy",...n?.authInfo!==void 0&&{authInfo:n.authInfo},requestInfo:r}),o=new p1({sessionIdGenerator:void 0,...void 0!==a&&{keepAliveMs:a},...void 0!==s&&{maxRequestBodySize:s}});await i.connect(o);let l=()=>{o.close().catch(()=>{}),i.close().catch(()=>{})};r.signal?.addEventListener("abort",l,{once:!0});let c=await o.handleRequest(r,{...n?.authInfo!==void 0&&{authInfo:n.authInfo},...n?.parsedBody!==void 0&&{parsedBody:n.parsedBody}});if(null===c.body||"text/event-stream"!==uq(c.headers.get("content-type")))return l(),c;let u=c.body.getReader(),d=!1,p=()=>{d||(d=!0,l())},m=new ReadableStream({pull:async t=>{try{let{done:r,value:a}=await u.read();if(r){p(),t.close();return}void 0!==a&&t.enqueue(a)}catch(r){p(),t.error(r)}},cancel:t=>(p(),u.cancel(t).catch(()=>{}))});return new Response(m,{status:c.status,statusText:c.statusText,headers:c.headers})}catch(t){try{h?.(p3(t))}catch{}return p6(p2(n?.parsedBody))}});async function _(a,n,i){var s,c;let f=a.classification.revision;if(void 0===f||!lY.includes(f)){let t=new c_({supported:[...lY],requested:f??"unknown"});return h(t),p9(400,t.code,t.message,t.data,p2(a.message))}let g=function(t,r){if("request"!==r.messageKind)return;let a=r.message.method;if(void 0===t.protocolVersionHeader){let t=r.classification.revision;return ua("version-header-missing","(missing)",void 0===t?"the body carries a modern per-request envelope but the required MCP-Protocol-Version header is absent":`the body envelope names protocol version ${t} but the required MCP-Protocol-Version header is absent`,"standard-header-validation")}if(void 0===t.mcpMethodHeader)return ua("method-header-missing","(missing)",`the body names method ${a} but the required Mcp-Method header is absent`,"standard-header-validation");let n=function(t,r){let a=Object.hasOwn(un,t)?un[t]:void 0;if(void 0===a)return;let n=uo(r)?r[a]:void 0;return{field:a,value:"string"==typeof n?n:void 0}}(a,r.message.params);if(void 0===n)return;let{field:i,value:o}=n;if(void 0===t.mcpNameHeader){if(void 0===o)return;return ua("name-header-missing","(missing)",`the body carries params.${i}="${o}" but the required Mcp-Name header is absent`,"standard-header-validation")}let s=ui(t.mcpNameHeader),l=c7(s);return void 0===l?ua("name-header-invalid-encoding",s,"the Mcp-Name header carries an invalid Base64 sentinel value","standard-header-validation"):void 0!==o&&l!==o?ua("name-header-mismatch",s,`the body carries params.${i}="${o}" but the Mcp-Name header names "${l}"`,"standard-header-validation"):void 0}({httpMethod:n.method,...p7(n)},a);if(void 0!==g)return h(Error(`Rejected inbound request (${g.cell}): ${g.message}`)),p4(g,p2(a.message));let v="request"===a.messageKind?cV(a.message.params):void 0,_=v?.[iG];if("request"===a.messageKind){let t=Object.hasOwn(lB,s=a.message.method)?lB[s]:void 0;if(void 0!==t){let r=lG(t,_);if(void 0!==r){let t=new cb({requiredCapabilities:r});return h(t),p9(ut[t.code]??400,t.code,t.message,t.data,a.message.id)}}}let b=await t({era:"modern",...void 0!==i&&{authInfo:i},requestInfo:n}),S=b instanceof pZ?b.server:b;if(p5(S),"request"===a.messageKind&&"subscriptions/listen"===a.message.method){let t=S.getCapabilities(),r=m(S);return b.close().catch(h),y.serve(a.message,n.signal,t,r)}if("request"===a.messageKind&&"tools/call"===a.message.method&&b instanceof pZ){let t=a.message.params,r="string"==typeof t?.name?t.name:void 0,i=void 0===r?void 0:b.toolInputSchemaJson(r);if(void 0!==i){let r=c2(i);if(r.valid&&r.declarations.length>0){let i=function(t,r,a){for(let n of t){let t=`Mcp-Param-${n.headerName}`,i=a.get(t),o=function(t,r){let a=t;for(let t of r){if(null===a||"object"!=typeof a)return;a=a[t]}return a}(r,n.path);if(null==o)continue;let s=function(t){if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t){if(!Number.isFinite(t)||Number.isInteger(t)&&!Number.isSafeInteger(t))return;return String(t)}}(o);if(void 0===s)continue;if(null===i)return c8("param-header-missing",t,`the body carries ${c3(n.path)}=${JSON.stringify(o)} but the ${t} header is absent`);let l=c7(i);if(void 0===l)return c8("param-header-invalid-encoding",t,`the ${t} header carries an invalid Base64 sentinel value`);if(!(("integer"===n.type||"number"===n.type)&&c5.test(l)&&"number"==typeof o?Number(l)===o:l===s))return c8("param-header-mismatch",t,`the ${t} header decodes to ${JSON.stringify(l)} but the body carries ${c3(n.path)}=${JSON.stringify(o)}`)}}(r.declarations,t?.arguments,n.headers);if(void 0!==i)return b.close().catch(h),h(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),p4(i,a.message.id)}}}if("request"===a.messageKind&&b instanceof pZ)try{let t=await pC([a.message],i,t=>b.resolveScopeChallenge(t));if(void 0!==t)return b.close().catch(h),pN(t,pI(i))}catch(t){return b.close().catch(h),h(p3(t)),p6(a.message.id)}p5(S),u(S,f),p(S,lY),void 0!==v&&(c={clientInfo:v[iB],clientCapabilities:_},d(S,c));let $=S.onclose;l.add(S);let w=()=>{l.delete(S),S.onclose===w&&(S.onclose=$),$?.()};S.onclose=w;try{let t=await pY(b,a.message,{classification:a.classification,request:n,...void 0!==i&&{authInfo:i},...void 0!==o&&{responseMode:o},...void 0!==r.keepAliveMs&&{keepAliveMs:r.keepAliveMs}});return"notification"===a.messageKind&&queueMicrotask(()=>void S.close().catch(()=>{})),t}catch(t){if(t instanceof lJ&&t.code===lH.ConnectionClosed)return new Response(null,{status:499});return await S.close().catch(()=>{}),l.delete(S),h(p3(t)),p6(p2(a.message))}}async function b(t,r,a,n){if(void 0!==v)return v(r,{...void 0!==a&&{authInfo:a},...void 0!==n&&{parsedBody:n}});let i=function(t,r){switch(t.reason){case"http-method":return ur("http-method","modern-only-method-not-allowed",405,new cg(-32e3,"Method not allowed."),!0);case"batch":return ur("jsonrpc-shape","modern-only-batch-not-supported",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return ur("jsonrpc-shape","modern-only-response-post",400,new cg(cf.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let a=t.requestedVersion;return ur("era-classification","modern-only-missing-envelope",400,void 0===a?new cg(cf.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...r]}):new c_({supported:[...r],requested:a}),!0)}}}(t,lY);return void 0===i?new Response(null,{status:202}):(h(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),p4(i,p2(n)))}async function S(t,r){let a=r?.authInfo;if("POST"===t.method.toUpperCase()&&!uA(t.headers.get("content-type")))return h(Error("Unsupported Media Type: Content-Type must be application/json")),p9(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let n=await p8(t,r?.parsedBody,!0,s);if("unreadable-body"===n.step)return p9(400,-32700,"Parse error: the request body could not be read");if("body-too-large"===n.step)return p9(413,-32e3,pX(s));if("no-json-body"===n.step)return void 0!==v?v(n.forwardRequest,{...void 0!==a&&{authInfo:a}}):p9(400,-32700,"Parse error: the request body is not valid JSON");let{outcome:i,body:o,parsedBody:l,forwardRequest:c}=n;try{switch(i.kind){case"reject":return h(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),p4(i,p2(o));case"modern":return await _(i,t,a);case"legacy":return await b(i,c,a,l)}}catch(t){return h(p3(t)),p6(p2(o))}}return{fetch:async(t,r)=>{if(c)throw Error("This MCP handler has been closed");try{return await S(t,r)}catch(t){return h(p3(t)),p6(p2(r?.parsedBody))}},notify:g,bus:f,close:async()=>{c=!0,y.closeAll();let t=[...l].map(t=>t.close().catch(()=>{}));l.clear(),await Promise.all(t)}}}(async function t(){let t=fV(),r=fF(),a=fH(),[n,i,o]=await Promise.all([t,r,a]),{instructions:s,...l}=fD,c=new pZ(l,{instructions:s});return await fU(c,n,i,o),c},{legacy:"stateless",maxSubscriptions:HTTP_CONFIG.maxSubscriptions});async function fX(t){return ms({id:(0,R.randomUUID)(),headers:Object.fromEntries(t.headers.entries()),clientInfo:void 0},async()=>{try{let r;return"POST"===t.method&&(r=await t.json().catch(()=>void 0),mi({clientInfo:(t=>{for(let r of Array.isArray(t)?t:[t]){let t=mu(r);if(t)return t}})(r)})),await fY.fetch(t,{authInfo:t.auth,parsedBody:r})}catch(t){return console.error("[Next.js MCP] Error handling MCP request:",t),Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null},{status:500})}})}function fQ(t){let r=new URL(t.url),a=r.hostname.split(".").reverse().join("."),n={$schema:"https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",name:`${a}/mcp`,version:SERVER_INFO.version,description:TEMPLATE_CONFIG.description,title:TEMPLATE_CONFIG.name,remotes:[{type:"streamable-http",url:`${r.origin}${HTTP_CONFIG.endpoint}`}]};return TEMPLATE_CONFIG.icons?.length&&(n.icons=TEMPLATE_CONFIG.icons),Response.json(n,{headers:{"Content-Type":"application/mcp-server-card+json","Cache-Control":"public, max-age=3600, must-revalidate","Access-Control-Allow-Origin":"*"}})}})(),n})());
|