@aiquants/html-to-markdown 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-ChRwTJHy.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -18
- package/dist/main.js +1 -105
- package/dist/mcp-server-CvLGX0Fe.js +1 -0
- package/dist/{mcp-server-Dn3EHzcf.cjs → mcp-server-eznfa4gh.cjs} +1 -1
- package/dist/mcp-server-streamable-CjY9xfH0.js +1 -0
- package/dist/mcp-server-streamable-DJ-R_Z_E.cjs +1 -0
- package/dist/mcp-streamable.cjs +1 -1
- package/dist/mcp-streamable.js +1 -5
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -12
- package/dist/src/mcp-server.d.ts +18 -0
- package/dist/version-D8gIcbbb.cjs +7 -0
- package/dist/version-DEqf1gI6.js +7 -0
- package/package.json +17 -13
- package/dist/core-DhxxOcPm.js +0 -21155
- package/dist/mcp-server-DOe8W9IZ.js +0 -267
- package/dist/mcp-server-streamable-DUB_ixZe.cjs +0 -1
- package/dist/mcp-server-streamable-pcpU_lDl.js +0 -7714
- package/dist/version-BNwQMbri.js +0 -11539
- package/dist/version-BsWiDlbg.cjs +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{Window as e}from"happy-dom";const t=new e;Object.assign(global,{document:t.document,window:t,self:t});import{b as r}from"./core-ChRwTJHy.js";import{promises as s}from"fs";import{resolve as n,dirname as a}from"path";import{readFileSync as i}from"node:fs";import{dirname as o,resolve as c}from"node:path";import{fileURLToPath as d}from"node:url";var u,l,h;(l=u||(u={})).assertEqual=e=>{},l.assertIs=function(e){},l.assertNever=function(e){throw new Error},l.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},l.getValidEnumValues=e=>{const t=l.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(const s of t)r[s]=e[s];return l.objectValues(r)},l.objectValues=e=>l.objectKeys(e).map(function(t){return e[t]}),l.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},l.find=(e,t)=>{for(const r of e)if(t(r))return r},l.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,l.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},l.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(h||(h={})).mergeShapes=(e,t)=>({...e,...t});const f=u.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(e)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(e)?f.array:null===e?f.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?f.promise:"undefined"!=typeof Map&&e instanceof Map?f.map:"undefined"!=typeof Set&&e instanceof Set?f.set:"undefined"!=typeof Date&&e instanceof Date?f.date:f.object;default:return f.unknown}},m=u.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 y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},s=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(s);else if("invalid_return_type"===n.code)s(n.returnTypeError);else if("invalid_arguments"===n.code)s(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,s=0;for(;s<n.path.length;){const r=n.path[s];s===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,u.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const s of this.issues)if(s.path.length>0){const r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const g=(e,t)=>{let r;switch(e.code){case m.invalid_type:r=e.received===f.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,u.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:r=`Unrecognized key(s) in object: ${u.joinValues(e.keys,", ")}`;break;case m.invalid_union:r="Invalid input";break;case m.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${u.joinValues(e.options)}`;break;case m.invalid_enum_value:r=`Invalid enum value. Expected ${u.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:r="Invalid function arguments";break;case m.invalid_return_type:r="Invalid function return type";break;case m.invalid_date:r="Invalid date";break;case m.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:u.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case m.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case m.custom:r="Invalid input";break;case m.invalid_intersection_types:r="Intersection results could not be merged";break;case m.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:r="Number must be finite";break;default:r=t.defaultError,u.assertNever(e)}return{message:r}};let v=g;function _(e,t){const r=v,s=(e=>{const{data:t,path:r,errorMaps:s,issueData:n}=e,a=[...r,...n.path||[]],i={...n,path:a};if(void 0!==n.message)return{...n,path:a,message:n.message};let o="";const c=s.filter(e=>!!e).slice().reverse();for(const d of c)o=d(i,{data:t,defaultError:o}).message;return{...n,path:a,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===g?void 0:g].filter(e=>!!e)});e.common.issues.push(s)}class ${constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if("aborted"===s.status)return w;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const e=await s.key,t=await s.value;r.push({key:e,value:t})}return $.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:t,value:n}=s;if("aborted"===t.status)return w;if("aborted"===n.status)return w;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!s.alwaysSet||(r[t.value]=n.value)}return{status:e.value,value:r}}}const w=Object.freeze({status:"aborted"}),b=e=>({status:"dirty",value:e}),k=e=>({status:"valid",value:e}),x=e=>"aborted"===e.status,E=e=>"dirty"===e.status,S=e=>"valid"===e.status,P=e=>"undefined"!=typeof Promise&&e instanceof Promise;var j,N;(N=j||(j={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},N.toString=e=>"string"==typeof e?e:e?.message;class T{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const C=(e,t)=>{if(S(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function O(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:s,description:n}=e;if(t&&(r||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??n.defaultError}:void 0===n.data?{message:a??s??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:a??r??n.defaultError}},description:n}}class I{get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(P(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},s=this._parseSync({data:e,path:r.path,parent:r});return C(r,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return S(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>S(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},s=this._parse({data:e,path:r.path,parent:r}),n=await(P(s)?s:Promise.resolve(s));return C(r,n)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,s)=>{const n=e(t),a=()=>s.addIssue({code:m.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(a(),!1)):!!n||(a(),!1)})}refinement(e,t){return this._refinement((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1))}_refinement(e){return new Re({schema:this,typeName:Fe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ae.create(this,this._def)}nullable(){return Me.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ye.create(this)}promise(){return Ie.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return ke.create(this,e,this._def)}transform(e){return new Re({...O(this._def),schema:this,typeName:Fe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ze({...O(this._def),innerType:this,defaultValue:t,typeName:Fe.ZodDefault})}brand(){return new Ve({typeName:Fe.ZodBranded,type:this,...O(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new De({...O(this._def),innerType:this,catchValue:t,typeName:Fe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ze.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const R=/^c[^\s-]{8,}$/i,A=/^[0-9a-z]+$/,M=/^[0-9A-HJKMNP-TV-Z]{26}$/i,z=/^[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,D=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,V=/^[-+]?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)?)??$/,Z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let L;const F=/^(?:(?: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])$/,U=/^(?:(?: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])$/,K=/^(([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]))$/,H=/^(([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])$/,G=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,J=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,B="((\\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])))",W=new RegExp(`^${B}$`);function Y(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Q(e){return new RegExp(`^${Y(e)}$`)}function X(e){let t=`${B}T${Y(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ee(e,t){return!("v4"!==t&&t||!F.test(e))||!("v6"!==t&&t||!K.test(e))}function te(e,t){if(!q.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function re(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!H.test(e))}class se extends I{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==f.string){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.string,received:t.parsedType}),w}const t=new $;let r;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),_(r,{code:m.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),_(r,{code:m.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const n=e.data.length>s.value,a=e.data.length<s.value;(n||a)&&(r=this._getOrReturnCtx(e,r),n?_(r,{code:m.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&_(r,{code:m.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)Z.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"email",code:m.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)L||(L=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),L.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"emoji",code:m.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"uuid",code:m.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)D.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"nanoid",code:m.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)R.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"cuid",code:m.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)A.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"cuid2",code:m.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)M.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"ulid",code:m.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),_(r,{validation:"url",code:m.invalid_string,message:s.message}),t.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"regex",code:m.invalid_string,message:s.message}),t.dirty())}else if("trim"===s.kind)e.data=e.data.trim();else if("includes"===s.kind)e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty());else if("toLowerCase"===s.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===s.kind)e.data=e.data.toUpperCase();else if("startsWith"===s.kind)e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty());else if("endsWith"===s.kind)e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty());else if("datetime"===s.kind){X(s).test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:"datetime",message:s.message}),t.dirty())}else if("date"===s.kind){W.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:"date",message:s.message}),t.dirty())}else if("time"===s.kind){Q(s).test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:m.invalid_string,validation:"time",message:s.message}),t.dirty())}else"duration"===s.kind?V.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"duration",code:m.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?ee(e.data,s.version)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"ip",code:m.invalid_string,message:s.message}),t.dirty()):"jwt"===s.kind?te(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"jwt",code:m.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?re(e.data,s.version)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"cidr",code:m.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?G.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"base64",code:m.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?J.test(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{validation:"base64url",code:m.invalid_string,message:s.message}),t.dirty()):u.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:m.invalid_string,...j.errToObj(r)})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...j.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...j.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...j.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...j.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...j.errToObj(t)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new se({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ne(e,t){const r=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,n=r>s?r:s;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}se.create=e=>new se({checks:[],typeName:Fe.ZodString,coerce:e?.coerce??!1,...O(e)});class ae extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==f.number){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.number,received:t.parsedType}),w}let t;const r=new $;for(const s of this._def.checks)if("int"===s.kind)u.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),_(t,{code:m.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty());else if("min"===s.kind){(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else"multipleOf"===s.kind?0!==ne(e.data,s.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),_(t,{code:m.not_finite,message:s.message}),r.dirty()):u.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,r,s){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:j.toString(s)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&u.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ae.create=e=>new ae({checks:[],typeName:Fe.ZodNumber,coerce:e?.coerce||!1,...O(e)});class ie extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let t;const r=new $;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),_(t,{code:m.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):u.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,r,s){return new ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:j.toString(s)}]})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ie.create=e=>new ie({checks:[],typeName:Fe.ZodBigInt,coerce:e?.coerce??!1,...O(e)});class oe extends I{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==f.boolean){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.boolean,received:t.parsedType}),w}return k(e.data)}}oe.create=e=>new oe({typeName:Fe.ZodBoolean,coerce:e?.coerce||!1,...O(e)});class ce extends I{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==f.date){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.date,received:t.parsedType}),w}if(Number.isNaN(e.data.getTime())){return _(this._getOrReturnCtx(e),{code:m.invalid_date}),w}const t=new $;let r;for(const s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),_(r,{code:m.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),_(r,{code:m.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):u.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ce.create=e=>new ce({checks:[],coerce:e?.coerce||!1,typeName:Fe.ZodDate,...O(e)});class de extends I{_parse(e){if(this._getType(e)!==f.symbol){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.symbol,received:t.parsedType}),w}return k(e.data)}}de.create=e=>new de({typeName:Fe.ZodSymbol,...O(e)});class ue extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.undefined,received:t.parsedType}),w}return k(e.data)}}ue.create=e=>new ue({typeName:Fe.ZodUndefined,...O(e)});class le extends I{_parse(e){if(this._getType(e)!==f.null){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.null,received:t.parsedType}),w}return k(e.data)}}le.create=e=>new le({typeName:Fe.ZodNull,...O(e)});class he extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}}he.create=e=>new he({typeName:Fe.ZodAny,...O(e)});class fe extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}}fe.create=e=>new fe({typeName:Fe.ZodUnknown,...O(e)});class pe extends I{_parse(e){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.never,received:t.parsedType}),w}}pe.create=e=>new pe({typeName:Fe.ZodNever,...O(e)});class me extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.void,received:t.parsedType}),w}return k(e.data)}}me.create=e=>new me({typeName:Fe.ZodVoid,...O(e)});class ye extends I{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return _(t,{code:m.invalid_type,expected:f.array,received:t.parsedType}),w;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,n=t.data.length<s.exactLength.value;(e||n)&&(_(t,{code:e?m.too_big:m.too_small,minimum:n?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(_(t,{code:m.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(_(t,{code:m.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>s.type._parseAsync(new T(t,e,t.path,r)))).then(e=>$.mergeArray(r,e));const n=[...t.data].map((e,r)=>s.type._parseSync(new T(t,e,t.path,r)));return $.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ye({...this._def,minLength:{value:e,message:j.toString(t)}})}max(e,t){return new ye({...this._def,maxLength:{value:e,message:j.toString(t)}})}length(e,t){return new ye({...this._def,exactLength:{value:e,message:j.toString(t)}})}nonempty(e){return this.min(1,e)}}function ge(e){if(e instanceof ve){const t={};for(const r in e.shape){const s=e.shape[r];t[r]=Ae.create(ge(s))}return new ve({...e._def,shape:()=>t})}return e instanceof ye?new ye({...e._def,type:ge(e.element)}):e instanceof Ae?Ae.create(ge(e.unwrap())):e instanceof Me?Me.create(ge(e.unwrap())):e instanceof xe?xe.create(e.items.map(e=>ge(e))):e}ye.create=(e,t)=>new ye({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Fe.ZodArray,...O(t)});class ve extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=u.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),w}const{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),a=[];if(!(this._def.catchall instanceof pe&&"strip"===this._def.unknownKeys))for(const o in r.data)n.includes(o)||a.push(o);const i=[];for(const o of n){const e=s[o],t=r.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new T(r,t,r.path,o)),alwaysSet:o in r.data})}if(this._def.catchall instanceof pe){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)i.push({key:{status:"valid",value:t},value:{status:"valid",value:r.data[t]}});else if("strict"===e)a.length>0&&(_(r,{code:m.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const s=r.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new T(r,s,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const r=await t.key,s=await t.value;e.push({key:r,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>$.mergeObjectSync(t,e)):$.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new ve({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const s=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:j.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ve({...this._def,unknownKeys:"strip"})}passthrough(){return new ve({...this._def,unknownKeys:"passthrough"})}extend(e){return new ve({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ve({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Fe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ve({...this._def,catchall:e})}pick(e){const t={};for(const r of u.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ve({...this._def,shape:()=>t})}omit(e){const t={};for(const r of u.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ve({...this._def,shape:()=>t})}deepPartial(){return ge(this)}partial(e){const t={};for(const r of u.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new ve({...this._def,shape:()=>t})}required(e){const t={};for(const r of u.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Ae;)e=e._def.innerType;t[r]=e}return new ve({...this._def,shape:()=>t})}keyof(){return Te(u.objectKeys(this.shape))}}ve.create=(e,t)=>new ve({shape:()=>e,unknownKeys:"strip",catchall:pe.create(),typeName:Fe.ZodObject,...O(t)}),ve.strictCreate=(e,t)=>new ve({shape:()=>e,unknownKeys:"strict",catchall:pe.create(),typeName:Fe.ZodObject,...O(t)}),ve.lazycreate=(e,t)=>new ve({shape:e,unknownKeys:"strip",catchall:pe.create(),typeName:Fe.ZodObject,...O(t)});class _e extends I{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const r=e.map(e=>new y(e.ctx.common.issues));return _(t,{code:m.invalid_union,unionErrors:r}),w});{let e;const s=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},n=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=s.map(e=>new y(e));return _(t,{code:m.invalid_union,unionErrors:n}),w}}get options(){return this._def.options}}_e.create=(e,t)=>new _e({options:e,typeName:Fe.ZodUnion,...O(t)});const $e=e=>e instanceof je?$e(e.schema):e instanceof Re?$e(e.innerType()):e instanceof Ne?[e.value]:e instanceof Ce?e.options:e instanceof Oe?u.objectValues(e.enum):e instanceof ze?$e(e._def.innerType):e instanceof ue?[void 0]:e instanceof le?[null]:e instanceof Ae?[void 0,...$e(e.unwrap())]:e instanceof Me?[null,...$e(e.unwrap())]:e instanceof Ve||e instanceof Le?$e(e.unwrap()):e instanceof De?$e(e._def.innerType):[];class we extends I{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return _(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),w;const r=this.discriminator,s=t.data[r],n=this.optionsMap.get(s);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(_(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=/* @__PURE__ */new Map;for(const n of t){const t=$e(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(s.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);s.set(r,n)}}return new we({typeName:Fe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...O(r)})}}function be(e,t){const r=p(e),s=p(t);if(e===t)return{valid:!0,data:e};if(r===f.object&&s===f.object){const r=u.objectKeys(t),s=u.objectKeys(e).filter(e=>-1!==r.indexOf(e)),n={...e,...t};for(const a of s){const r=be(e[a],t[a]);if(!r.valid)return{valid:!1};n[a]=r.data}return{valid:!0,data:n}}if(r===f.array&&s===f.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let s=0;s<e.length;s++){const n=be(e[s],t[s]);if(!n.valid)return{valid:!1};r.push(n.data)}return{valid:!0,data:r}}return r===f.date&&s===f.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class ke extends I{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if(x(e)||x(s))return w;const n=be(e.value,s.value);return n.valid?((E(e)||E(s))&&t.dirty(),{status:t.value,value:n.data}):(_(r,{code:m.invalid_intersection_types}),w)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>s(e,t)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ke.create=(e,t,r)=>new ke({left:e,right:t,typeName:Fe.ZodIntersection,...O(r)});class xe extends I{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return _(r,{code:m.invalid_type,expected:f.array,received:r.parsedType}),w;if(r.data.length<this._def.items.length)return _(r,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...r.data].map((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new T(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>$.mergeArray(t,e)):$.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new xe({...this._def,rest:e})}}xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:Fe.ZodTuple,rest:null,...O(t)})};class Ee extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return _(r,{code:m.invalid_type,expected:f.object,received:r.parsedType}),w;const s=[],n=this._def.keyType,a=this._def.valueType;for(const i in r.data)s.push({key:n._parse(new T(r,i,r.path,i)),value:a._parse(new T(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?$.mergeObjectAsync(t,s):$.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new Ee(t instanceof I?{keyType:e,valueType:t,typeName:Fe.ZodRecord,...O(r)}:{keyType:se.create(),valueType:e,typeName:Fe.ZodRecord,...O(t)})}}class Se extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.map)return _(r,{code:m.invalid_type,expected:f.map,received:r.parsedType}),w;const s=this._def.keyType,n=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:s._parse(new T(r,e,r.path,[a,"key"])),value:n._parse(new T(r,t,r.path,[a,"value"]))}));if(r.common.async){const e=/* @__PURE__ */new Map;return Promise.resolve().then(async()=>{for(const r of a){const s=await r.key,n=await r.value;if("aborted"===s.status||"aborted"===n.status)return w;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}})}{const e=/* @__PURE__ */new Map;for(const r of a){const s=r.key,n=r.value;if("aborted"===s.status||"aborted"===n.status)return w;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}}}Se.create=(e,t,r)=>new Se({valueType:t,keyType:e,typeName:Fe.ZodMap,...O(r)});class Pe extends I{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return _(r,{code:m.invalid_type,expected:f.set,received:r.parsedType}),w;const s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(_(r,{code:m.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(_(r,{code:m.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const n=this._def.valueType;function a(e){const r=/* @__PURE__ */new Set;for(const s of e){if("aborted"===s.status)return w;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}const i=[...r.data.values()].map((e,t)=>n._parse(new T(r,e,r.path,t)));return r.common.async?Promise.all(i).then(e=>a(e)):a(i)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:j.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:j.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pe.create=(e,t)=>new Pe({valueType:e,minSize:null,maxSize:null,typeName:Fe.ZodSet,...O(t)});class je extends I{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}je.create=(e,t)=>new je({getter:e,typeName:Fe.ZodLazy,...O(t)});class Ne extends I{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Te(e,t){return new Ce({values:e,typeName:Fe.ZodEnum,...O(t)})}Ne.create=(e,t)=>new Ne({value:e,typeName:Fe.ZodLiteral,...O(t)});class Ce extends I{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{expected:u.joinValues(r),received:t.parsedType,code:m.invalid_type}),w}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{received:t.data,code:m.invalid_enum_value,options:r}),w}return k(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ce.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ce.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ce.create=Te;class Oe extends I{_parse(e){const t=u.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){const e=u.objectValues(t);return _(r,{expected:u.joinValues(e),received:r.parsedType,code:m.invalid_type}),w}if(this._cache||(this._cache=new Set(u.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=u.objectValues(t);return _(r,{received:r.data,code:m.invalid_enum_value,options:e}),w}return k(e.data)}get enum(){return this._def.values}}Oe.create=(e,t)=>new Oe({values:e,typeName:Fe.ZodNativeEnum,...O(t)});class Ie extends I{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&!1===t.common.async)return _(t,{code:m.invalid_type,expected:f.promise,received:t.parsedType}),w;const r=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return k(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ie.create=(e,t)=>new Ie({type:e,typeName:Fe.ZodPromise,...O(t)});class Re extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,n={addIssue:e=>{_(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===s.type){const e=s.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return w;const s=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===s.status?w:"dirty"===s.status||"dirty"===t.value?b(s.value):s});{if("aborted"===t.value)return w;const s=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===s.status?w:"dirty"===s.status||"dirty"===t.value?b(s.value):s}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===s.status?w:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?w:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===s.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!S(e))return w;const a=s.transform(e.value,n);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>S(e)?Promise.resolve(s.transform(e.value,n)).then(e=>({status:t.value,value:e})):w)}u.assertNever(s)}}Re.create=(e,t,r)=>new Re({schema:e,typeName:Fe.ZodEffects,effect:t,...O(r)}),Re.createWithPreprocess=(e,t,r)=>new Re({schema:t,effect:{type:"preprocess",transform:e},typeName:Fe.ZodEffects,...O(r)});class Ae extends I{_parse(e){return this._getType(e)===f.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Fe.ZodOptional,...O(t)});class Me extends I{_parse(e){return this._getType(e)===f.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Me.create=(e,t)=>new Me({innerType:e,typeName:Fe.ZodNullable,...O(t)});class ze extends I{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Fe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...O(t)});class De extends I{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return P(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}De.create=(e,t)=>new De({innerType:e,typeName:Fe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...O(t)});class qe extends I{_parse(e){if(this._getType(e)!==f.nan){const t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.nan,received:t.parsedType}),w}return{status:"valid",value:e.data}}}qe.create=e=>new qe({typeName:Fe.ZodNaN,...O(e)});class Ve extends I{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ze extends I{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?w:"dirty"===e.status?(t.dirty(),b(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?w:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Ze({in:e,out:t,typeName:Fe.ZodPipeline})}}class Le extends I{_parse(e){const t=this._def.innerType._parse(e),r=e=>(S(e)&&(e.value=Object.freeze(e.value)),e);return P(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var Fe,Ue;Le.create=(e,t)=>new Le({innerType:e,typeName:Fe.ZodReadonly,...O(t)}),(Ue=Fe||(Fe={})).ZodString="ZodString",Ue.ZodNumber="ZodNumber",Ue.ZodNaN="ZodNaN",Ue.ZodBigInt="ZodBigInt",Ue.ZodBoolean="ZodBoolean",Ue.ZodDate="ZodDate",Ue.ZodSymbol="ZodSymbol",Ue.ZodUndefined="ZodUndefined",Ue.ZodNull="ZodNull",Ue.ZodAny="ZodAny",Ue.ZodUnknown="ZodUnknown",Ue.ZodNever="ZodNever",Ue.ZodVoid="ZodVoid",Ue.ZodArray="ZodArray",Ue.ZodObject="ZodObject",Ue.ZodUnion="ZodUnion",Ue.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ue.ZodIntersection="ZodIntersection",Ue.ZodTuple="ZodTuple",Ue.ZodRecord="ZodRecord",Ue.ZodMap="ZodMap",Ue.ZodSet="ZodSet",Ue.ZodFunction="ZodFunction",Ue.ZodLazy="ZodLazy",Ue.ZodLiteral="ZodLiteral",Ue.ZodEnum="ZodEnum",Ue.ZodEffects="ZodEffects",Ue.ZodNativeEnum="ZodNativeEnum",Ue.ZodOptional="ZodOptional",Ue.ZodNullable="ZodNullable",Ue.ZodDefault="ZodDefault",Ue.ZodCatch="ZodCatch",Ue.ZodPromise="ZodPromise",Ue.ZodBranded="ZodBranded",Ue.ZodPipeline="ZodPipeline",Ue.ZodReadonly="ZodReadonly";const Ke=se.create,He=ae.create,Ge=oe.create,Je=fe.create;pe.create;const Be=ye.create,We=ve.create,Ye=_e.create,Qe=we.create;ke.create,xe.create;const Xe=Ee.create,et=Ne.create,tt=Ce.create;Ie.create;const rt=Ae.create;Me.create;const st="2025-06-18",nt="2025-03-26",at=[st,"2025-03-26","2024-11-05","2024-10-07"],it="2.0",ot=Ye([Ke(),He().int()]),ct=Ke(),dt=We({progressToken:rt(ot)}).passthrough(),ut=We({_meta:rt(dt)}).passthrough(),lt=We({method:Ke(),params:rt(ut)}),ht=We({_meta:rt(We({}).passthrough())}).passthrough(),ft=We({method:Ke(),params:rt(ht)}),pt=We({_meta:rt(We({}).passthrough())}).passthrough(),mt=Ye([Ke(),He().int()]),yt=We({jsonrpc:et(it),id:mt}).merge(lt).strict(),gt=e=>yt.safeParse(e).success,vt=We({jsonrpc:et(it)}).merge(ft).strict(),_t=We({jsonrpc:et(it),id:mt,result:pt}).strict(),$t=e=>_t.safeParse(e).success;var wt,bt;(bt=wt||(wt={}))[bt.ConnectionClosed=-32e3]="ConnectionClosed",bt[bt.RequestTimeout=-32001]="RequestTimeout",bt[bt.ParseError=-32700]="ParseError",bt[bt.InvalidRequest=-32600]="InvalidRequest",bt[bt.MethodNotFound=-32601]="MethodNotFound",bt[bt.InvalidParams=-32602]="InvalidParams",bt[bt.InternalError=-32603]="InternalError";const kt=We({jsonrpc:et(it),id:mt,error:We({code:He().int(),message:Ke(),data:rt(Je())})}).strict(),xt=e=>kt.safeParse(e).success,Et=Ye([yt,vt,_t,kt]),St=pt.strict(),Pt=ft.extend({method:et("notifications/cancelled"),params:ht.extend({requestId:mt,reason:Ke().optional()})}),jt=We({src:Ke(),mimeType:rt(Ke()),sizes:rt(Be(Ke()))}).passthrough(),Nt=We({icons:Be(jt).optional()}).passthrough(),Tt=We({name:Ke(),title:rt(Ke())}).passthrough(),Ct=Tt.extend({version:Ke(),websiteUrl:rt(Ke())}).merge(Nt),Ot=We({experimental:rt(We({}).passthrough()),sampling:rt(We({}).passthrough()),elicitation:rt(We({}).passthrough()),roots:rt(We({listChanged:rt(Ge())}).passthrough())}).passthrough(),It=lt.extend({method:et("initialize"),params:ut.extend({protocolVersion:Ke(),capabilities:Ot,clientInfo:Ct})}),Rt=e=>It.safeParse(e).success,At=We({experimental:rt(We({}).passthrough()),logging:rt(We({}).passthrough()),completions:rt(We({}).passthrough()),prompts:rt(We({listChanged:rt(Ge())}).passthrough()),resources:rt(We({subscribe:rt(Ge()),listChanged:rt(Ge())}).passthrough()),tools:rt(We({listChanged:rt(Ge())}).passthrough())}).passthrough(),Mt=pt.extend({protocolVersion:Ke(),capabilities:At,serverInfo:Ct,instructions:rt(Ke())}),zt=ft.extend({method:et("notifications/initialized")}),Dt=lt.extend({method:et("ping")}),qt=We({progress:He(),total:rt(He()),message:rt(Ke())}).passthrough(),Vt=ft.extend({method:et("notifications/progress"),params:ht.merge(qt).extend({progressToken:ot})}),Zt=lt.extend({params:ut.extend({cursor:rt(ct)}).optional()}),Lt=pt.extend({nextCursor:rt(ct)}),Ft=We({uri:Ke(),mimeType:rt(Ke()),_meta:rt(We({}).passthrough())}).passthrough(),Ut=Ft.extend({text:Ke()}),Kt=Ke().refine(e=>{try{return atob(e),!0}catch(t){return!1}},{message:"Invalid Base64 string"}),Ht=Ft.extend({blob:Kt}),Gt=Tt.extend({uri:Ke(),description:rt(Ke()),mimeType:rt(Ke()),_meta:rt(We({}).passthrough())}).merge(Nt),Jt=Tt.extend({uriTemplate:Ke(),description:rt(Ke()),mimeType:rt(Ke()),_meta:rt(We({}).passthrough())}).merge(Nt),Bt=Zt.extend({method:et("resources/list")}),Wt=Lt.extend({resources:Be(Gt)}),Yt=Zt.extend({method:et("resources/templates/list")}),Qt=Lt.extend({resourceTemplates:Be(Jt)}),Xt=lt.extend({method:et("resources/read"),params:ut.extend({uri:Ke()})}),er=pt.extend({contents:Be(Ye([Ut,Ht]))}),tr=ft.extend({method:et("notifications/resources/list_changed")}),rr=lt.extend({method:et("resources/subscribe"),params:ut.extend({uri:Ke()})}),sr=lt.extend({method:et("resources/unsubscribe"),params:ut.extend({uri:Ke()})}),nr=ft.extend({method:et("notifications/resources/updated"),params:ht.extend({uri:Ke()})}),ar=We({name:Ke(),description:rt(Ke()),required:rt(Ge())}).passthrough(),ir=Tt.extend({description:rt(Ke()),arguments:rt(Be(ar)),_meta:rt(We({}).passthrough())}).merge(Nt),or=Zt.extend({method:et("prompts/list")}),cr=Lt.extend({prompts:Be(ir)}),dr=lt.extend({method:et("prompts/get"),params:ut.extend({name:Ke(),arguments:rt(Xe(Ke()))})}),ur=We({type:et("text"),text:Ke(),_meta:rt(We({}).passthrough())}).passthrough(),lr=We({type:et("image"),data:Kt,mimeType:Ke(),_meta:rt(We({}).passthrough())}).passthrough(),hr=We({type:et("audio"),data:Kt,mimeType:Ke(),_meta:rt(We({}).passthrough())}).passthrough(),fr=We({type:et("resource"),resource:Ye([Ut,Ht]),_meta:rt(We({}).passthrough())}).passthrough(),pr=Ye([ur,lr,hr,Gt.extend({type:et("resource_link")}),fr]),mr=We({role:tt(["user","assistant"]),content:pr}).passthrough(),yr=pt.extend({description:rt(Ke()),messages:Be(mr)}),gr=ft.extend({method:et("notifications/prompts/list_changed")}),vr=We({title:rt(Ke()),readOnlyHint:rt(Ge()),destructiveHint:rt(Ge()),idempotentHint:rt(Ge()),openWorldHint:rt(Ge())}).passthrough(),_r=Tt.extend({description:rt(Ke()),inputSchema:We({type:et("object"),properties:rt(We({}).passthrough()),required:rt(Be(Ke()))}).passthrough(),outputSchema:rt(We({type:et("object"),properties:rt(We({}).passthrough()),required:rt(Be(Ke()))}).passthrough()),annotations:rt(vr),_meta:rt(We({}).passthrough())}).merge(Nt),$r=Zt.extend({method:et("tools/list")}),wr=Lt.extend({tools:Be(_r)}),br=pt.extend({content:Be(pr).default([]),structuredContent:We({}).passthrough().optional(),isError:rt(Ge())});br.or(pt.extend({toolResult:Je()}));const kr=lt.extend({method:et("tools/call"),params:ut.extend({name:Ke(),arguments:rt(Xe(Je()))})}),xr=ft.extend({method:et("notifications/tools/list_changed")}),Er=tt(["debug","info","notice","warning","error","critical","alert","emergency"]),Sr=lt.extend({method:et("logging/setLevel"),params:ut.extend({level:Er})}),Pr=ft.extend({method:et("notifications/message"),params:ht.extend({level:Er,logger:rt(Ke()),data:Je()})}),jr=We({name:Ke().optional()}).passthrough(),Nr=We({hints:rt(Be(jr)),costPriority:rt(He().min(0).max(1)),speedPriority:rt(He().min(0).max(1)),intelligencePriority:rt(He().min(0).max(1))}).passthrough(),Tr=We({role:tt(["user","assistant"]),content:Ye([ur,lr,hr])}).passthrough(),Cr=lt.extend({method:et("sampling/createMessage"),params:ut.extend({messages:Be(Tr),systemPrompt:rt(Ke()),includeContext:rt(tt(["none","thisServer","allServers"])),temperature:rt(He()),maxTokens:He().int(),stopSequences:rt(Be(Ke())),metadata:rt(We({}).passthrough()),modelPreferences:rt(Nr)})}),Or=pt.extend({model:Ke(),stopReason:rt(tt(["endTurn","stopSequence","maxTokens"]).or(Ke())),role:tt(["user","assistant"]),content:Qe("type",[ur,lr,hr])}),Ir=Ye([We({type:et("boolean"),title:rt(Ke()),description:rt(Ke()),default:rt(Ge())}).passthrough(),We({type:et("string"),title:rt(Ke()),description:rt(Ke()),minLength:rt(He()),maxLength:rt(He()),format:rt(tt(["email","uri","date","date-time"]))}).passthrough(),We({type:tt(["number","integer"]),title:rt(Ke()),description:rt(Ke()),minimum:rt(He()),maximum:rt(He())}).passthrough(),We({type:et("string"),title:rt(Ke()),description:rt(Ke()),enum:Be(Ke()),enumNames:rt(Be(Ke()))}).passthrough()]),Rr=lt.extend({method:et("elicitation/create"),params:ut.extend({message:Ke(),requestedSchema:We({type:et("object"),properties:Xe(Ke(),Ir),required:rt(Be(Ke()))}).passthrough()})}),Ar=pt.extend({action:tt(["accept","decline","cancel"]),content:rt(Xe(Ke(),Je()))}),Mr=We({type:et("ref/resource"),uri:Ke()}).passthrough(),zr=We({type:et("ref/prompt"),name:Ke()}).passthrough(),Dr=lt.extend({method:et("completion/complete"),params:ut.extend({ref:Ye([zr,Mr]),argument:We({name:Ke(),value:Ke()}).passthrough(),context:rt(We({arguments:rt(Xe(Ke(),Ke()))}))})}),qr=pt.extend({completion:We({values:Be(Ke()).max(100),total:rt(He().int()),hasMore:rt(Ge())}).passthrough()}),Vr=We({uri:Ke().startsWith("file://"),name:rt(Ke()),_meta:rt(We({}).passthrough())}).passthrough(),Zr=lt.extend({method:et("roots/list")}),Lr=pt.extend({roots:Be(Vr)}),Fr=ft.extend({method:et("notifications/roots/list_changed")});Ye([Dt,It,Dr,Sr,dr,or,Bt,Yt,Xt,rr,sr,kr,$r]),Ye([Pt,Vt,zt,Fr]),Ye([St,Or,Ar,Lr]),Ye([Dt,Cr,Rr,Zr]),Ye([Pt,Vt,Pr,nr,tr,xr,gr]),Ye([St,Mt,qr,yr,cr,Wt,Qt,er,br,wr]);class Ur extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}}class Kr{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=/* @__PURE__ */new Map,this._requestHandlerAbortControllers=/* @__PURE__ */new Map,this._notificationHandlers=/* @__PURE__ */new Map,this._responseHandlers=/* @__PURE__ */new Map,this._progressHandlers=/* @__PURE__ */new Map,this._timeoutInfo=/* @__PURE__ */new Map,this._pendingDebouncedNotifications=/* @__PURE__ */new Set,this.setNotificationHandler(Pt,e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}),this.setNotificationHandler(Vt,e=>{this._onprogress(e)}),this.setRequestHandler(Dt,e=>({}))}_setupTimeout(e,t,r,s,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:s})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ur(wt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,r,s;this._transport=e;const n=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==n||n(),this._onclose()};const a=null===(r=this.transport)||void 0===r?void 0:r.onerror;this._transport.onerror=e=>{null==a||a(e),this._onerror(e)};const i=null===(s=this._transport)||void 0===s?void 0:s.onmessage;this._transport.onmessage=(e,t)=>{var r;null==i||i(e,t),$t(e)||xt(e)?this._onresponse(e):gt(e)?this._onrequest(e,t):(r=e,vt.safeParse(r).success?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`)))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=/* @__PURE__ */new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const r=new Ur(wt.ConnectionClosed,"Connection closed");for(const s of t.values())s(r)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const r=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,s;const n=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler,a=this._transport;if(void 0===n)return void(null==a||a.send({jsonrpc:"2.0",id:e.id,error:{code:wt.MethodNotFound,message:"Method not found"}}).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))));const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const o={signal:i.signal,sessionId:null==a?void 0:a.sessionId,_meta:null===(s=e.params)||void 0===s?void 0:s._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,r,s)=>this.request(t,r,{...s,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,o)).then(t=>{if(!i.signal.aborted)return null==a?void 0:a.send({result:t,jsonrpc:"2.0",id:e.id})},t=>{var r;if(!i.signal.aborted)return null==a?void 0:a.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:wt.InternalError,message:null!==(r=t.message)&&void 0!==r?r:"Internal error"}})}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,s=Number(t),n=this._progressHandlers.get(s);if(!n)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const a=this._responseHandlers.get(s),i=this._timeoutInfo.get(s);if(i&&a&&i.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(o){return void a(o)}n(r)}_onresponse(e){const t=Number(e.id),r=this._responseHandlers.get(t);if(void 0!==r)if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),$t(e))r(e);else{r(new Ur(e.error.code,e.error.message,e.error.data))}else this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,r){const{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a}=null!=r?r:{};return new Promise((i,o)=>{var c,d,u,l,h,f;if(!this._transport)return void o(new Error("Not connected"));!0===(null===(c=this._options)||void 0===c?void 0:c.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(d=null==r?void 0:r.signal)||void 0===d||d.throwIfAborted();const p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(p,r.onprogress),m.params={...e.params,_meta:{...(null===(u=e.params)||void 0===u?void 0:u._meta)||{},progressToken:p}});const y=e=>{var t;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(e)}},{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`))),o(e)};this._responseHandlers.set(p,e=>{var s;if(!(null===(s=null==r?void 0:r.signal)||void 0===s?void 0:s.aborted)){if(e instanceof Error)return o(e);try{const r=t.parse(e.result);i(r)}catch(n){o(n)}}}),null===(l=null==r?void 0:r.signal)||void 0===l||l.addEventListener("abort",()=>{var e;y(null===(e=null==r?void 0:r.signal)||void 0===e?void 0:e.reason)});const g=null!==(h=null==r?void 0:r.timeout)&&void 0!==h?h:6e4;this._setupTimeout(p,g,null==r?void 0:r.maxTotalTimeout,()=>y(new Ur(wt.RequestTimeout,"Request timed out",{timeout:g})),null!==(f=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==f&&f),this._transport.send(m,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(p),o(e)})})}async notification(e,t){var r,s;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);if((null!==(s=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==s?s:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var r;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const s={...e,jsonrpc:"2.0"};null===(r=this._transport)||void 0===r||r.send(s,t).catch(e=>this._onerror(e))})}const n={...e,jsonrpc:"2.0"};await this._transport.send(n,t)}setRequestHandler(e,t){const r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,s)=>Promise.resolve(t(e.parse(r),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,r=>Promise.resolve(t(e.parse(r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}var Hr,Gr={exports:{}},Jr={},Br={},Wr={},Yr={},Qr={},Xr={};function es(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class s extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function n(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)o(r,t[n]),r.push(e[++n]);return new s(r)}e._Code=s,e.nil=new s(""),e._=n;const a=new s("+");function i(e,...t){const r=[d(e[0])];let n=0;for(;n<t.length;)r.push(a),o(r,t[n]),r.push(a,d(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new s(r)}function o(e,t){var n;t instanceof s?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:d(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=i,e.addCodeArg=o,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:i`${e}${t}`},e.stringify=function(e){return new s(d(e))},e.safeStringify=d,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new s(`.${t}`):n`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new s(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new s(e.toString())}}(Xr)),Xr}var ts,rs,ss={};function ns(){return ts||(ts=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=es();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var s,n;(n=s||(e.UsedValueState=s={}))[n.Started=0]="Started",n[n.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class a{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=a;class i extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:s}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${s}]`}}e.ValueScopeName=i;const o=t._`\n`;e.ValueScope=class extends a{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new i(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:n}=s,a=null!==(r=t.key)&&void 0!==r?r:t.ref;let i=this._values[n];if(i){const e=i.get(a);if(e)return e}else i=this._values[n]=/* @__PURE__ */new Map;i.set(a,s);const o=this._scope[n]||(this._scope[n]=[]),c=o.length;return o[c]=t.ref,s.setValue(t,{property:n,itemIndex:c}),s}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(n,a,i={},o){let c=t.nil;for(const d in n){const u=n[d];if(!u)continue;const l=i[d]=i[d]||/* @__PURE__ */new Map;u.forEach(n=>{if(l.has(n))return;l.set(n,s.Started);let i=a(n);if(i){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${n} = ${i};${this.opts._n}`}else{if(!(i=null==o?void 0:o(n)))throw new r(n);c=t._`${c}${i}${this.opts._n}`}l.set(n,s.Completed)})}return c}}}(ss)),ss}function as(){return rs||(rs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=es(),r=ns();var s=es();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return s.Name}});var n=ns();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class i extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const s=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${s} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class o extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,r),this}get names(){return j(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends o{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class l extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=N(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;for(;s--;){const n=r[s];n.optimizeNames(e,t)||(T(e,n.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>P(e,t.names),{})}}class p extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends f{}class y extends p{}y.kind="else";class g extends p{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof g?t:t.nodes:this.nodes.length?this:new g(C(e),t instanceof g?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=N(this.condition,e,t),this}get names(){const e=super.names;return j(e,this.condition),this.else&&P(e,this.else.names),e}}g.kind="if";class v extends p{}v.kind="for";class _ extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=N(this.iteration,e,t),this}get names(){return P(super.names,this.iteration.names)}}class $ extends v{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:s,from:n,to:a}=this;return`for(${t} ${s}=${n}; ${s}<${a}; ${s}++)`+super.render(e)}get names(){const e=j(super.names,this.from);return j(e,this.to)}}class w extends v{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=N(this.iterable,e,t),this}get names(){return P(super.names,this.iterable.names)}}class b extends p{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class k extends f{render(e){return"return "+super.render(e)}}k.kind="return";class x extends p{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&P(e,this.catch.names),this.finally&&P(e,this.finally.names),e}}class E extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class S extends p{render(e){return"finally"+super.render(e)}}S.kind="finally";function P(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function j(e,r){return r instanceof t._CodeOrName?P(e,r.names):e}function N(e,r,s){return e instanceof t.Name?a(e):(n=e)instanceof t._Code&&n._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==s[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=a(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var n;function a(e){const t=s[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function T(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function C(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${A(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=/* @__PURE__ */new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const n=this._scope.toName(t);return void 0!==r&&s&&(this._constants[n.str]=r),this._leafNode(new i(e,n,r)),n}const(e,t,s){return this._def(r.varKinds.const,e,t,s)}let(e,t,s){return this._def(r.varKinds.let,e,t,s)}var(e,t,s){return this._def(r.varKinds.var,e,t,s)}assign(e,t,r){return this._leafNode(new o(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){const r=["{"];for(const[s,n]of e)r.length>1&&r.push(","),r.push(s),(s!==n||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,n));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new g(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new g(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(g,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,s,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const i=this._scope.toName(e);return this._for(new $(a,i,t,s),()=>n(i))}forOf(e,s,n,a=r.varKinds.const){const i=this._scope.toName(e);if(this.opts.es5){const e=s instanceof t.Name?s:this.var("_arr",s);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(i,t._`${e}[${r}]`),n(i)})}return this._for(new w("of",a,i,s),()=>n(i))}forIn(e,s,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${s})`,n);const i=this._scope.toName(e);return this._for(new w("in",a,i,s),()=>n(i))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new u(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new x;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new E(e),t(e)}return r&&(this._currNode=s.finally=new S,this.code(r)),this._endBlockNode(E,S)}throw(e){return this._leafNode(new l(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,s,n){return this._blockNode(new b(e,r,s)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=C;const O=R(e.operators.AND);e.and=function(...e){return e.reduce(O)};const I=R(e.operators.OR);function R(e){return(r,s)=>r===t.nil?s:s===t.nil?r:t._`${A(r)} ${e} ${A(s)}`}function A(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(I)}}(Qr)),Qr}var is,os={};function cs(){if(is)return os;is=1,Object.defineProperty(os,"__esModule",{value:!0}),os.checkStrictMode=os.getErrorPath=os.Type=os.useFunc=os.setEvaluated=os.evaluatedPropsToName=os.mergeEvaluated=os.eachItem=os.unescapeJsonPointer=os.escapeJsonPointer=os.escapeFragment=os.unescapeFragment=os.schemaRefOrVal=os.schemaHasRulesButRef=os.schemaHasRules=os.checkUnknownRules=os.alwaysValidSchema=os.toHash=void 0;const e=as(),t=es();function r(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=s.RULES.keywords;for(const a in t)n[a]||h(e,`unknown keyword: "${a}"`)}function s(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function i({mergeNames:t,mergeToName:r,mergeValues:s,resultToName:n}){return(a,i,o,c)=>{const d=void 0===o?i:o instanceof e.Name?(i instanceof e.Name?t(a,i,o):r(a,i,o),o):i instanceof e.Name?(r(a,o,i),i):s(i,o);return c!==e.Name||d instanceof e.Name?d:n(a,d)}}function o(t,r){if(!0===r)return t.var("props",!0);const s=t.var("props",e._`{}`);return void 0!==r&&c(t,s,r),s}function c(t,r,s){Object.keys(s).forEach(s=>t.assign(e._`${r}${(0,e.getProperty)(s)}`,!0))}os.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},os.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!s(t,e.self.RULES.all))},os.checkUnknownRules=r,os.schemaHasRules=s,os.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},os.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},s,n,a){if(!a){if("number"==typeof s||"boolean"==typeof s)return s;if("string"==typeof s)return e._`${s}`}return e._`${t}${r}${(0,e.getProperty)(n)}`},os.unescapeFragment=function(e){return a(decodeURIComponent(e))},os.escapeFragment=function(e){return encodeURIComponent(n(e))},os.escapeJsonPointer=n,os.unescapeJsonPointer=a,os.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},os.mergeEvaluated={props:i({mergeNames:(t,r,s)=>t.if(e._`${s} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(s,!0),()=>t.assign(s,e._`${s} || {}`).code(e._`Object.assign(${s}, ${r})`))}),mergeToName:(t,r,s)=>t.if(e._`${s} !== true`,()=>{!0===r?t.assign(s,!0):(t.assign(s,e._`${s} || {}`),c(t,s,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:o}),items:i({mergeNames:(t,r,s)=>t.if(e._`${s} !== true && ${r} !== undefined`,()=>t.assign(s,e._`${r} === true ? true : ${s} > ${r} ? ${s} : ${r}`)),mergeToName:(t,r,s)=>t.if(e._`${s} !== true`,()=>t.assign(s,!0===r||e._`${s} > ${r} ? ${s} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},os.evaluatedPropsToName=o,os.setEvaluated=c;const d={};var u,l;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return os.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:d[r.code]||(d[r.code]=new t._Code(r.code))})},(l=u||(os.Type=u={}))[l.Num=0]="Num",l[l.Str=1]="Str",os.getErrorPath=function(t,r,s){if(t instanceof e.Name){const n=r===u.Num;return s?n?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:n?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return s?(0,e.getProperty)(t).toString():"/"+n(t)},os.checkStrictMode=h,os}var ds,us,ls,hs={};function fs(){if(ds)return hs;ds=1,Object.defineProperty(hs,"__esModule",{value:!0});const e=as(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return hs.default=t,hs}function ps(){return us||(us=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=as(),r=cs(),s=fs();function n(e,r){const n=e.const("err",r);e.if(t._`${s.default.vErrors} === null`,()=>e.assign(s.default.vErrors,t._`[${n}]`),t._`${s.default.vErrors}.push(${n})`),e.code(t._`${s.default.errors}++`)}function a(e,r){const{gen:s,validateName:n,schemaEnv:a}=e;a.$async?s.throw(t._`new ${e.ValidationError}(${r})`):(s.assign(t._`${n}.errors`,r),s.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,s=e.keywordError,i,c){const{it:d}=r,{gen:u,compositeRule:l,allErrors:h}=d,f=o(r,s,i);(null!=c?c:l||h)?n(u,f):a(d,t._`[${f}]`)},e.reportExtraError=function(t,r=e.keywordError,i){const{it:c}=t,{gen:d,compositeRule:u,allErrors:l}=c;n(d,o(t,r,i)),u||l||a(c,s.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(s.default.errors,r),e.if(t._`${s.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${s.default.vErrors}.length`,r),()=>e.assign(s.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:n,data:a,errsCount:i,it:o}){if(void 0===i)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",i,s.default.errors,i=>{e.const(c,t._`${s.default.vErrors}[${i}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(s.default.instancePath,o.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${o.errSchemaPath}/${r}`),o.opts.verbose&&(e.assign(t._`${c}.schema`,n),e.assign(t._`${c}.data`,a))})};const i={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function o(e,r,n){const{createErrors:a}=e.it;return!1===a?t._`{}`:function(e,r,n={}){const{gen:a,it:o}=e,u=[c(o,n),d(e,n)];return function(e,{params:r,message:n},a){const{keyword:o,data:c,schemaValue:d,it:u}=e,{opts:l,propertyName:h,topSchemaRef:f,schemaPath:p}=u;a.push([i.keyword,o],[i.params,"function"==typeof r?r(e):r||t._`{}`]),l.messages&&a.push([i.message,"function"==typeof n?n(e):n]);l.verbose&&a.push([i.schema,d],[i.parentSchema,t._`${f}${p}`],[s.default.data,c]);h&&a.push([i.propertyName,h])}(e,r,u),a.object(...u)}(e,r,n)}function c({errorPath:e},{instancePath:n}){const a=n?t.str`${e}${(0,r.getErrorPath)(n,r.Type.Str)}`:e;return[s.default.instancePath,(0,t.strConcat)(s.default.instancePath,a)]}function d({keyword:e,it:{errSchemaPath:s}},{schemaPath:n,parentSchema:a}){let o=a?s:t.str`${s}/${e}`;return n&&(o=t.str`${o}${(0,r.getErrorPath)(n,r.Type.Str)}`),[i.schemaPath,o]}}(Yr)),Yr}var ms,ys={},gs={};function vs(){if(ms)return gs;ms=1,Object.defineProperty(gs,"__esModule",{value:!0}),gs.getRules=gs.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return gs.isJSONType=function(t){return"string"==typeof t&&e.has(t)},gs.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},gs}var _s,$s,ws={};function bs(){if(_s)return ws;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return _s=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.shouldUseRule=ws.shouldUseGroup=ws.schemaHasRulesForType=void 0,ws.schemaHasRulesForType=function({schema:t,self:r},s){const n=r.RULES.types[s];return n&&!0!==n&&e(t,n)},ws.shouldUseGroup=e,ws.shouldUseRule=t,ws}function ks(){if($s)return ys;$s=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.reportTypeError=ys.checkDataTypes=ys.checkDataType=ys.coerceAndCheckDataType=ys.getJSONTypes=ys.getSchemaTypes=ys.DataType=void 0;const e=vs(),t=bs(),r=ps(),s=as(),n=cs();var a,i;function o(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(i=a||(ys.DataType=a={}))[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong",ys.getSchemaTypes=function(e){const t=o(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},ys.getJSONTypes=o,ys.coerceAndCheckDataType=function(e,r){const{gen:n,data:i,opts:o}=e,d=function(e,t){return t?e.filter(e=>c.has(e)||"array"===t&&"array"===e):[]}(r,o.coerceTypes),l=r.length>0&&!(0===d.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(l){const t=u(r,i,o.strictNumbers,a.Wrong);n.if(t,()=>{d.length?function(e,t,r){const{gen:n,data:a,opts:i}=e,o=n.let("dataType",s._`typeof ${a}`),d=n.let("coerced",s._`undefined`);"array"===i.coerceTypes&&n.if(s._`${o} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>n.assign(a,s._`${a}[0]`).assign(o,s._`typeof ${a}`).if(u(t,a,i.strictNumbers),()=>n.assign(d,a)));n.if(s._`${d} !== undefined`);for(const s of r)(c.has(s)||"array"===s&&"array"===i.coerceTypes)&&l(s);function l(e){switch(e){case"string":return void n.elseIf(s._`${o} == "number" || ${o} == "boolean"`).assign(d,s._`"" + ${a}`).elseIf(s._`${a} === null`).assign(d,s._`""`);case"number":return void n.elseIf(s._`${o} == "boolean" || ${a} === null
|
|
2
|
+
|| (${o} == "string" && ${a} && ${a} == +${a})`).assign(d,s._`+${a}`);case"integer":return void n.elseIf(s._`${o} === "boolean" || ${a} === null
|
|
3
|
+
|| (${o} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(d,s._`+${a}`);case"boolean":return void n.elseIf(s._`${a} === "false" || ${a} === 0 || ${a} === null`).assign(d,!1).elseIf(s._`${a} === "true" || ${a} === 1`).assign(d,!0);case"null":return n.elseIf(s._`${a} === "" || ${a} === 0 || ${a} === false`),void n.assign(d,null);case"array":n.elseIf(s._`${o} === "string" || ${o} === "number"
|
|
4
|
+
|| ${o} === "boolean" || ${a} === null`).assign(d,s._`[${a}]`)}}n.else(),h(e),n.endIf(),n.if(s._`${d} !== undefined`,()=>{n.assign(a,d),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(s._`${t} !== undefined`,()=>e.assign(s._`${t}[${r}]`,n))}(e,d)})}(e,r,d):h(e)})}return l};const c=/* @__PURE__ */new Set(["string","number","integer","boolean","null"]);function d(e,t,r,n=a.Correct){const i=n===a.Correct?s.operators.EQ:s.operators.NEQ;let o;switch(e){case"null":return s._`${t} ${i} null`;case"array":o=s._`Array.isArray(${t})`;break;case"object":o=s._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=c(s._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=c();break;default:return s._`typeof ${t} ${i} ${e}`}return n===a.Correct?o:(0,s.not)(o);function c(e=s.nil){return(0,s.and)(s._`typeof ${t} == "number"`,e,r?s._`isFinite(${t})`:s.nil)}}function u(e,t,r,a){if(1===e.length)return d(e[0],t,r,a);let i;const o=(0,n.toHash)(e);if(o.array&&o.object){const e=s._`typeof ${t} != "object"`;i=o.null?e:s._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=s.nil;o.number&&delete o.integer;for(const n in o)i=(0,s.and)(i,d(n,t,r,a));return i}ys.checkDataType=d,ys.checkDataTypes=u;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:s}=e,a=(0,n.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:a,schemaValue:a,parentSchema:s,params:{},it:e}}(e);(0,r.reportError)(t,l)}return ys.reportTypeError=h,ys}var xs,Es={};var Ss,Ps,js={},Ns={};function Ts(){if(Ss)return Ns;Ss=1,Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.validateUnion=Ns.validateArray=Ns.usePattern=Ns.callValidateCode=Ns.schemaProperties=Ns.allSchemaProperties=Ns.noPropertyInData=Ns.propertyInData=Ns.isOwnProperty=Ns.hasPropFunc=Ns.reportMissingProp=Ns.checkMissingProp=Ns.checkReportMissingProp=void 0;const e=as(),t=cs(),r=fs(),s=cs();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function a(t,r,s){return e._`${n(t)}.call(${r}, ${s})`}function i(t,r,s,n){const i=e._`${r}${(0,e.getProperty)(s)} === undefined`;return n?(0,e.or)(i,(0,e.not)(a(t,r,s))):i}function o(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}Ns.checkReportMissingProp=function(t,r){const{gen:s,data:n,it:a}=t;s.if(i(s,n,r,a.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},Ns.checkMissingProp=function({gen:t,data:r,it:{opts:s}},n,a){return(0,e.or)(...n.map(n=>(0,e.and)(i(t,r,n,s.ownProperties),e._`${a} = ${n}`)))},Ns.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},Ns.hasPropFunc=n,Ns.isOwnProperty=a,Ns.propertyInData=function(t,r,s,n){const i=e._`${r}${(0,e.getProperty)(s)} !== undefined`;return n?e._`${i} && ${a(t,r,s)}`:i},Ns.noPropertyInData=i,Ns.allSchemaProperties=o,Ns.schemaProperties=function(e,r){return o(r).filter(s=>!(0,t.alwaysValidSchema)(e,r[s]))},Ns.callValidateCode=function({schemaCode:t,data:s,it:{gen:n,topSchemaRef:a,schemaPath:i,errorPath:o},it:c},d,u,l){const h=l?e._`${t}, ${s}, ${a}${i}`:s,f=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,o)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&f.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const p=e._`${h}, ${n.object(...f)}`;return u!==e.nil?e._`${d}.call(${u}, ${p})`:e._`${d}(${p})`};const c=e._`new RegExp`;return Ns.usePattern=function({gen:t,it:{opts:r}},n){const a=r.unicodeRegExp?"u":"",{regExp:i}=r.code,o=i(n,a);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:e._`${"new RegExp"===i.code?c:(0,s.useFunc)(t,i)}(${n}, ${a})`})},Ns.validateArray=function(r){const{gen:s,data:n,keyword:a,it:i}=r,o=s.name("valid");if(i.allErrors){const e=s.let("valid",!0);return c(()=>s.assign(e,!1)),e}return s.var(o,!0),c(()=>s.break()),o;function c(i){const c=s.const("len",e._`${n}.length`);s.forRange("i",0,c,n=>{r.subschema({keyword:a,dataProp:n,dataPropType:t.Type.Num},o),s.if((0,e.not)(o),i)})}},Ns.validateUnion=function(r){const{gen:s,schema:n,keyword:a,it:i}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(e=>(0,t.alwaysValidSchema)(i,e))&&!i.opts.unevaluated)return;const o=s.let("valid",!1),c=s.name("_valid");s.block(()=>n.forEach((t,n)=>{const i=r.subschema({keyword:a,schemaProp:n,compositeRule:!0},c);s.assign(o,e._`${o} || ${c}`);r.mergeValidEvaluated(i,c)||s.if((0,e.not)(o))})),r.result(o,()=>r.reset(),()=>r.error(!0))},Ns}function Cs(){if(Ps)return js;Ps=1,Object.defineProperty(js,"__esModule",{value:!0}),js.validateKeywordUsage=js.validSchemaType=js.funcKeywordCode=js.macroKeywordCode=void 0;const e=as(),t=fs(),r=Ts(),s=ps();function n(t){const{gen:r,data:s,it:n}=t;r.if(n.parentData,()=>r.assign(s,e._`${n.parentData}[${n.parentDataProperty}]`))}function a(t,r,s){if(void 0===s)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof s?{ref:s}:{ref:s,code:(0,e.stringify)(s)})}return js.macroKeywordCode=function(t,r){const{gen:s,keyword:n,schema:i,parentSchema:o,it:c}=t,d=r.macro.call(c.self,i,o,c),u=a(s,n,d);!1!==c.opts.validateSchema&&c.self.validateSchema(d,!0);const l=s.name("valid");t.subschema({schema:d,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,()=>t.error(!0))},js.funcKeywordCode=function(i,o){var c;const{gen:d,keyword:u,schema:l,parentSchema:h,$data:f,it:p}=i;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,o);const m=!f&&o.compile?o.compile.call(p.self,l,h,p):o.validate,y=a(d,u,m),g=d.let("valid");function v(s=(o.async?e._`await `:e.nil)){const n=p.opts.passContext?t.default.this:t.default.self,a=!("compile"in o&&!f||!1===o.schema);d.assign(g,e._`${s}${(0,r.callValidateCode)(i,y,n,a)}`,o.modifying)}function _(t){var r;d.if((0,e.not)(null!==(r=o.valid)&&void 0!==r?r:g),t)}i.block$data(g,function(){if(!1===o.errors)v(),o.modifying&&n(i),_(()=>i.error());else{const r=o.async?function(){const t=d.let("ruleErrs",null);return d.try(()=>v(e._`await `),r=>d.assign(g,!1).if(e._`${r} instanceof ${p.ValidationError}`,()=>d.assign(t,e._`${r}.errors`),()=>d.throw(r))),t}():function(){const t=e._`${y}.errors`;return d.assign(t,null),v(e.nil),t}();o.modifying&&n(i),_(()=>function(r,n){const{gen:a}=r;a.if(e._`Array.isArray(${n})`,()=>{a.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${n} : ${t.default.vErrors}.concat(${n})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,s.extendErrors)(r)},()=>r.error())}(i,r))}}),i.ok(null!==(c=o.valid)&&void 0!==c?c:g)},js.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},js.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},n,a){if(Array.isArray(n.keyword)?!n.keyword.includes(a):n.keyword!==a)throw new Error("ajv implementation error");const i=n.dependencies;if(null==i?void 0:i.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${a}: ${i.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[a])){const e=`keyword "${a}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},js}var Os,Is={};var Rs,As,Ms={};function zs(){return As?Rs:(As=1,Rs=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,a;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;for(n=s;0!==n--;){var i=a[n];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r})}var Ds,qs,Vs,Zs={exports:{}};function Ls(){if(Ds)return Zs.exports;Ds=1;var e=Zs.exports=function(e,r,s){"function"==typeof r&&(s=r,r={}),t(r,"function"==typeof(s=r.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function t(s,n,a,i,o,c,d,u,l,h){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var f in n(i,o,c,d,u,l,h),i){var p=i[f];if(Array.isArray(p)){if(f in e.arrayKeywords)for(var m=0;m<p.length;m++)t(s,n,a,p[m],o+"/"+f+"/"+m,c,o,f,i,m)}else if(f in e.propsKeywords){if(p&&"object"==typeof p)for(var y in p)t(s,n,a,p[y],o+"/"+f+"/"+r(y),c,o,f,i,y)}else(f in e.keywords||s.allKeys&&!(f in e.skipKeywords))&&t(s,n,a,p,o+"/"+f,c,o,f,i)}a(i,o,c,d,u,l,h)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.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},Zs.exports}function Fs(){if(qs)return Ms;qs=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.getSchemaRefs=Ms.resolveUrl=Ms.normalizeId=Ms._getFullPath=Ms.getFullPath=Ms.inlineRef=void 0;const e=cs(),t=zs(),r=Ls(),s=/* @__PURE__ */new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Ms.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!a(e):!!t&&i(e)<=t)};const n=/* @__PURE__ */new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(e){for(const t in e){if(n.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(a))return!0;if("object"==typeof r&&a(r))return!0}return!1}function i(t){let r=0;for(const n in t){if("$ref"===n)return 1/0;if(r++,!s.has(n)&&("object"==typeof t[n]&&(0,e.eachItem)(t[n],e=>r+=i(e)),r===1/0))return 1/0}return r}function o(e,t="",r){!1!==r&&(t=u(t));const s=e.parse(t);return c(e,s)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Ms.getFullPath=o,Ms._getFullPath=c;const d=/#\/?$/;function u(e){return e?e.replace(d,""):""}Ms.normalizeId=u,Ms.resolveUrl=function(e,t,r){return r=u(r),e.resolve(t,r)};const l=/^[a-z_][-a-z0-9._]*$/i;return Ms.getSchemaRefs=function(e,s){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:a}=this.opts,i=u(e[n]||s),c={"":i},d=o(a,i,!1),h={},f=/* @__PURE__ */new Set;return r(e,{allKeys:!0},(e,t,r,s)=>{if(void 0===s)return;const a=d+t;let i=c[s];function o(t){const r=this.opts.uriResolver.resolve;if(t=u(i?r(i,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?p(e,s.schema,t):t!==u(a)&&("#"===t[0]?(p(e,h[t],t),h[t]=e):this.refs[t]=a),t}function y(e){if("string"==typeof e){if(!l.test(e))throw new Error(`invalid anchor "${e}"`);o.call(this,`#${e}`)}}"string"==typeof e[n]&&(i=o.call(this,e[n])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),c[t]=i}),h;function p(e,r,s){if(void 0!==r&&!t(e,r))throw m(s)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Ms}function Us(){if(Vs)return Br;Vs=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.getData=Br.KeywordCxt=Br.validateFunctionCode=void 0;const e=function(){if(ls)return Wr;ls=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.boolOrEmptySchema=Wr.topBoolOrEmptySchema=void 0;const e=ps(),t=as(),r=fs(),s={message:"boolean schema is false"};function n(t,r){const{gen:n,data:a}=t,i={gen:n,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(i,s,void 0,r)}return Wr.topBoolOrEmptySchema=function(e){const{gen:s,schema:a,validateName:i}=e;!1===a?n(e,!1):"object"==typeof a&&!0===a.$async?s.return(r.default.data):(s.assign(t._`${i}.errors`,null),s.return(!0))},Wr.boolOrEmptySchema=function(e,t){const{gen:r,schema:s}=e;!1===s?(r.var(t,!1),n(e)):r.var(t,!0)},Wr}(),t=ks(),r=bs(),s=ks(),n=function(){if(xs)return Es;xs=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.assignDefaults=void 0;const e=as(),t=cs();function r(r,s,n){const{gen:a,compositeRule:i,data:o,opts:c}=r;if(void 0===n)return;const d=e._`${o}${(0,e.getProperty)(s)}`;if(i)return void(0,t.checkStrictMode)(r,`default is ignored for: ${d}`);let u=e._`${d} === undefined`;"empty"===c.useDefaults&&(u=e._`${u} || ${d} === null || ${d} === ""`),a.if(u,e._`${d} = ${(0,e.stringify)(n)}`)}return Es.assignDefaults=function(e,t){const{properties:s,items:n}=e.schema;if("object"===t&&s)for(const a in s)r(e,a,s[a].default);else"array"===t&&Array.isArray(n)&&n.forEach((t,s)=>r(e,s,t.default))},Es}(),a=Cs(),i=function(){if(Os)return Is;Os=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.extendSubschemaMode=Is.extendSubschemaData=Is.getSubschema=void 0;const e=as(),t=cs();return Is.getSubschema=function(r,{keyword:s,schemaProp:n,schema:a,schemaPath:i,errSchemaPath:o,topSchemaRef:c}){if(void 0!==s&&void 0!==a)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==s){const a=r.schema[s];return void 0===n?{schema:a,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${r.errSchemaPath}/${s}`}:{schema:a[n],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${s}/${(0,t.escapeFragment)(n)}`}}if(void 0!==a){if(void 0===i||void 0===o||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:i,topSchemaRef:c,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},Is.extendSubschemaData=function(r,s,{dataProp:n,dataPropType:a,data:i,dataTypes:o,propertyName:c}){if(void 0!==i&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:d}=s;if(void 0!==n){const{errorPath:i,dataPathArr:o,opts:c}=s;u(d.let("data",e._`${s.data}${(0,e.getProperty)(n)}`,!0)),r.errorPath=e.str`${i}${(0,t.getErrorPath)(n,a,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${n}`,r.dataPathArr=[...o,r.parentDataProperty]}function u(e){r.data=e,r.dataLevel=s.dataLevel+1,r.dataTypes=[],s.definedProperties=/* @__PURE__ */new Set,r.parentData=s.data,r.dataNames=[...s.dataNames,e]}void 0!==i&&(u(i instanceof e.Name?i:d.let("data",i,!0)),void 0!==c&&(r.propertyName=c)),o&&(r.dataTypes=o)},Is.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:a}){void 0!==s&&(e.compositeRule=s),void 0!==n&&(e.createErrors=n),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r},Is}(),o=as(),c=fs(),d=Fs(),u=cs(),l=ps();function h({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},a){n.code.es5?e.func(t,o._`${c.default.data}, ${c.default.valCxt}`,s.$async,()=>{e.code(o._`"use strict"; ${f(r,n)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,o._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,o._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,o._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,o._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,o._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,o._`""`),e.var(c.default.parentData,o._`undefined`),e.var(c.default.parentDataProperty,o._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,o._`{}`)})}(e,n),e.code(a)}):e.func(t,o._`${c.default.data}, ${function(e){return o._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?o._`, ${c.default.dynamicAnchors}={}`:o.nil}}={}`}(n)}`,s.$async,()=>e.code(f(r,n)).code(a))}function f(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?o._`/*# sourceURL=${r} */`:o.nil}function p(t,r){y(t)&&(g(t),m(t))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&_(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const a=s.const("_errs",c.default.errors);v(e,a),s.var(t,o._`${a} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function g(e){(0,u.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return $(e,[],!1,r);const s=(0,t.getSchemaTypes)(e.schema);$(e,s,!(0,t.coerceAndCheckDataType)(e,s),r)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const a=r.$comment;if(!0===n.$comment)e.code(o._`${c.default.self}.logger.log(${a})`);else if("function"==typeof n.$comment){const r=o.str`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(o._`${c.default.self}.opts.$comment(${a}, ${r}, ${n}.schema)`)}}function $(e,t,n,a){const{gen:i,schema:d,data:l,allErrors:h,opts:f,self:p}=e,{RULES:m}=p;function y(u){(0,r.shouldUseGroup)(d,u)&&(u.type?(i.if((0,s.checkDataType)(u.type,l,f.strictNumbers)),w(e,u),1===t.length&&t[0]===u.type&&n&&(i.else(),(0,s.reportTypeError)(e)),i.endIf()):w(e,u),h||i.if(o._`${c.default.errors} === ${a||0}`))}!d.$ref||!f.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(d,m)?(f.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||x(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const s of e.dataTypes)k(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&x(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const s=e.self.RULES.all;for(const n in s){const a=s[n];if("object"==typeof a&&(0,r.shouldUseRule)(e.schema,a)){const{type:r}=a.definition;r.length&&!r.some(e=>b(t,e))&&x(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes)}(e,t),i.block(()=>{for(const e of m.rules)y(e);y(m.post)})):i.block(()=>S(e,"$ref",m.all.$ref.definition))}function w(e,t){const{gen:s,schema:a,opts:{useDefaults:i}}=e;i&&(0,n.assignDefaults)(e,t.type),s.block(()=>{for(const s of t.rules)(0,r.shouldUseRule)(a,s)&&S(e,s.keyword,s.definition,t.type)})}function b(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function x(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,u.checkStrictMode)(e,t,e.opts.strictTypes)}Br.validateFunctionCode=function(t){y(t)&&(g(t),m(t))?function(e){const{schema:t,opts:r,gen:s}=e;h(e,()=>{r.$comment&&t.$comment&&_(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(c.default.vErrors,null),s.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",o._`${r}.evaluated`),t.if(o._`${e.evaluated}.dynamicProps`,()=>t.assign(o._`${e.evaluated}.props`,o._`undefined`)),t.if(o._`${e.evaluated}.dynamicItems`,()=>t.assign(o._`${e.evaluated}.items`,o._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:n,opts:a}=e;r.$async?t.if(o._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(o._`new ${n}(${c.default.vErrors})`)):(t.assign(o._`${s}.errors`,c.default.vErrors),a.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof o.Name&&e.assign(o._`${t}.props`,r);s instanceof o.Name&&e.assign(o._`${t}.items`,s)}(e),t.return(o._`${c.default.errors} === 0`))}(e)})}(t):h(t,()=>(0,e.topBoolOrEmptySchema)(t))};class E{constructor(e,t,r){if((0,a.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,o.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,o.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(o._`${t} !== undefined && (${(0,o.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?l.reportExtraError:l.reportError)(this,this.def.error,t)}$dataError(){(0,l.reportError)(this,this.def.$dataError||l.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,l.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=o.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=o.nil,t=o.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:a}=this;r.if((0,o.or)(o._`${s} === undefined`,t)),e!==o.nil&&r.assign(e,!0),(n.length||a.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==o.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:a}=this;return(0,o.or)(function(){if(r.length){if(!(t instanceof o.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return o._`${(0,s.checkDataTypes)(e,t,a.opts.strictNumbers,s.DataType.Wrong)}`}return o.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return o._`!${r}(${t})`}return o.nil}())}subschema(e,t){const r=(0,i.getSubschema)(this.it,e);(0,i.extendSubschemaData)(r,this.it,e),(0,i.extendSubschemaMode)(r,e);const s={...this.it,...r,items:void 0,props:void 0};return p(s,t),s}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=u.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=u.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,o.Name)),!0}}function S(e,t,r,s){const n=new E(e,r,t);"code"in r?r.code(n,s):n.$data&&r.validate?(0,a.funcKeywordCode)(n,r):"macro"in r?(0,a.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,a.funcKeywordCode)(n,r)}Br.KeywordCxt=E;const P=/^\/(?:[^~]|~0|~1)*$/,j=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let n,a;if(""===e)return c.default.rootData;if("/"===e[0]){if(!P.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,a=c.default.rootData}else{const i=j.exec(e);if(!i)throw new Error(`Invalid JSON-pointer: ${e}`);const o=+i[1];if(n=i[2],"#"===n){if(o>=t)throw new Error(l("property/index",o));return s[t-o]}if(o>t)throw new Error(l("data",o));if(a=r[t-o],!n)return a}let i=a;const d=n.split("/");for(const c of d)c&&(a=o._`${a}${(0,o.getProperty)((0,u.unescapeJsonPointer)(c))}`,i=o._`${i} && ${a}`);return i;function l(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Br.getData=N,Br}var Ks,Hs={};function Gs(){if(Ks)return Hs;Ks=1,Object.defineProperty(Hs,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Hs.default=e,Hs}var Js,Bs={};function Ws(){if(Js)return Bs;Js=1,Object.defineProperty(Bs,"__esModule",{value:!0});const e=Fs();class t extends Error{constructor(t,r,s,n){super(n||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,s),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Bs.default=t,Bs}var Ys,Qs={};function Xs(){if(Ys)return Qs;Ys=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.resolveSchema=Qs.getCompilingSchema=Qs.resolveRef=Qs.compileSchema=Qs.SchemaEnv=void 0;const e=as(),t=Gs(),r=fs(),s=Fs(),n=cs(),a=Us();class i{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,s.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function o(n){const i=d.call(this,n);if(i)return i;const o=(0,s.getFullPath)(this.opts.uriResolver,n.root.baseId),{es5:c,lines:u}=this.opts.code,{ownProperties:l}=this.opts,h=new e.CodeGen(this.scope,{es5:c,lines:u,ownProperties:l});let f;n.$async&&(f=h.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");n.validateName=p;const m={gen:h,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:/* @__PURE__ */new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:n.schema,code:(0,e.stringify)(n.schema)}:{ref:n.schema}),validateName:p,ValidationError:f,schema:n.schema,schemaEnv:n,rootId:o,baseId:n.baseId||o,schemaPath:e.nil,errSchemaPath:n.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(n),(0,a.validateFunctionCode)(m),h.optimize(this.opts.code.optimize);const t=h.toString();y=`${h.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,n));const s=new Function(`${r.default.self}`,`${r.default.scope}`,y)(this,this.scope.get());if(this.scope.value(p,{ref:s}),s.errors=null,s.schema=n.schema,s.schemaEnv=n,n.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:t,items:r}=m;s.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},s.source&&(s.source.evaluated=(0,e.stringify)(s.evaluated))}return n.validate=s,n}catch(g){throw delete n.validate,delete n.validateName,y&&this.logger.error("Error compiling schema, function code:",y),g}finally{this._compilations.delete(n)}}function c(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:o.call(this,e)}function d(e){for(const t of this._compilations)if(u(t,e))return t}function u(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function l(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){const r=this.opts.uriResolver.parse(t),n=(0,s._getFullPath)(this.opts.uriResolver,r);let a=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===a)return p.call(this,r,e);const c=(0,s.normalizeId)(n),d=this.refs[c]||this.schemas[c];if("string"==typeof d){const t=h.call(this,e,d);if("object"!=typeof(null==t?void 0:t.schema))return;return p.call(this,r,t)}if("object"==typeof(null==d?void 0:d.schema)){if(d.validate||o.call(this,d),c===(0,s.normalizeId)(t)){const{schema:t}=d,{schemaId:r}=this.opts,n=t[r];return n&&(a=(0,s.resolveUrl)(this.opts.uriResolver,a,n)),new i({schema:t,schemaId:r,root:e,baseId:a})}return p.call(this,r,d)}}Qs.SchemaEnv=i,Qs.compileSchema=o,Qs.resolveRef=function(e,t,r){var n;r=(0,s.resolveUrl)(this.opts.uriResolver,t,r);const a=e.refs[r];if(a)return a;let o=l.call(this,e,r);if(void 0===o){const s=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new i({schema:s,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=c.call(this,o):void 0},Qs.getCompilingSchema=d,Qs.resolveSchema=h;const f=/* @__PURE__ */new Set(["properties","patternProperties","enum","dependencies","definitions"]);function p(e,{baseId:t,schema:r,root:a}){var o;if("/"!==(null===(o=e.fragment)||void 0===o?void 0:o[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,n.unescapeFragment)(i)];if(void 0===e)return;const a="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(i)&&a&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,a))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){const e=(0,s.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=h.call(this,a,e)}const{schemaId:d}=this.opts;return c=c||new i({schema:r,schemaId:d,root:a,baseId:t}),c.schema!==c.root.schema?c:void 0}return Qs}const en={$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};var tn,rn,sn,nn,an,on,cn,dn={},un={exports:{}};function ln(){if(rn)return tn;rn=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=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 r(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(r=e[s].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(r=e[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function n(e){return e.length=0,!0}function a(e,t,s){if(e.length){const n=r(e);if(""===n)return s.error=!0,!1;t.push(n),e.length=0}return!0}function i(e){if(function(e,t){let r=0;for(let s=0;s<e.length;s++)e[s]===t&&r++;return r}(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const s={error:!1,address:"",zone:""},i=[],o=[];let c=!1,d=!1,u=a;for(let r=0;r<e.length;r++){const a=e[r];if("["!==a&&"]"!==a)if(":"!==a)if("%"===a){if(!u(o,i,s))break;u=n}else o.push(a);else{if(!0===c&&(d=!0),!u(o,i,s))break;if(++t>7){s.error=!0;break}r>0&&":"===e[r-1]&&(c=!0),i.push(":")}}return o.length&&(u===n?s.zone=o.join(""):d?i.push(o.join("")):i.push(r(o))),s.address=i.join(""),s}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}return tn={nonSimpleDomain:s,recomposeAuthority:function(e){const r=[];if(void 0!==e.userinfo&&(r.push(e.userinfo),r.push("@")),void 0!==e.host){let s=unescape(e.host);if(!t(s)){const t=i(s);s=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}r.push(s)}return"number"!=typeof e.port&&"string"!=typeof e.port||(r.push(":"),r.push(String(e.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e;const r=[];let s=-1,n=0;for(;n=t.length;){if(1===n){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===n){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===n&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:t,isUUID:e,normalizeIPv6:i,stringArrayToHexStripped:r}}function hn(){if(an)return un.exports;an=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizeComponentEncoding:s,isIPv4:n,nonSimpleDomain:a}=ln(),{SCHEMES:i,getSchemeHandler:o}=function(){if(nn)return sn;nn=1;const{isUUID:e}=ln(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function s(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function n(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function a(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const i={scheme:"http",domainHost:!0,parse:n,serialize:a},o={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=s(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(s(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:i,https:{scheme:"https",domainHost:i.domainHost,parse:n,serialize:a},ws:o,wss:{scheme:"wss",domainHost:o.domainHost,parse:o.parse,serialize:o.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const s=e.path.match(t);if(s){const t=r.scheme||e.scheme||"urn";e.nid=s[1].toLowerCase(),e.nss=s[2];const n=d(`${t}:${r.nid||e.nid}`);e.path=void 0,n&&(e=n.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),n=d(`${r}:${t.nid||s}`);n&&(e=n.serialize(e,t));const a=e,i=e.nss;return a.path=`${s||t.nid}:${i}`,t.skipEscape=!0,a},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const s=t;return s.uuid=s.nss,s.nss=void 0,r.tolerant||s.uuid&&e(s.uuid)||(s.error=s.error||"UUID is not valid."),s},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function d(e){return e&&(c[e]||c[e.toLowerCase()])||void 0}return Object.setPrototypeOf(c,null),sn={wsIsSecure:s,SCHEMES:c,isValidSchemeName:function(e){return-1!==r.indexOf(e)},getSchemeHandler:d}}();function c(e,r,s,n){const a={};return n||(e=l(d(e,s),s),r=l(d(r,s),s)),!(s=s||{}).tolerant&&r.scheme?(a.scheme=r.scheme,a.userinfo=r.userinfo,a.host=r.host,a.port=r.port,a.path=t(r.path||""),a.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(a.userinfo=r.userinfo,a.host=r.host,a.port=r.port,a.path=t(r.path||""),a.query=r.query):(r.path?("/"===r.path[0]?a.path=t(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:a.path=r.path:a.path="/"+r.path,a.path=t(a.path)),a.query=r.query):(a.path=e.path,void 0!==r.query?a.query=r.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=r.fragment,a}function d(e,s){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},a=Object.assign({},s),i=[],c=o(a.scheme||n.scheme);c&&c.serialize&&c.serialize(n,a),void 0!==n.path&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==a.reference&&n.scheme&&i.push(n.scheme,":");const d=r(n);if(void 0!==d&&("suffix"!==a.reference&&i.push("//"),i.push(d),n.path&&"/"!==n.path[0]&&i.push("/")),void 0!==n.path){let e=n.path;a.absolutePath||c&&c.absolutePath||(e=t(e)),void 0===d&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),i.push(e)}return void 0!==n.query&&i.push("?",n.query),void 0!==n.fragment&&i.push("#",n.fragment),i.join("")}const u=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(t,r){const s=Object.assign({},r),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let c=!1;"suffix"===s.reference&&(t=s.scheme?s.scheme+":"+t:"//"+t);const d=t.match(u);if(d){if(i.scheme=d[1],i.userinfo=d[3],i.host=d[4],i.port=parseInt(d[5],10),i.path=d[6]||"",i.query=d[7],i.fragment=d[8],isNaN(i.port)&&(i.port=d[5]),i.host){if(!1===n(i.host)){const t=e(i.host);i.host=t.host.toLowerCase(),c=t.isIPV6}else c=!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",s.reference&&"suffix"!==s.reference&&s.reference!==i.reference&&(i.error=i.error||"URI is not a "+s.reference+" reference.");const r=o(s.scheme||i.scheme);if(!(s.unicodeSupport||r&&r.unicodeSupport)&&i.host&&(s.domainHost||r&&r.domainHost)&&!1===c&&a(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(l){i.error=i.error||"Host's domain name can not be converted to ASCII: "+l}(!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,s)}else i.error=i.error||"URI can not be parsed.";return i}const h={SCHEMES:i,normalize:function(e,t){return"string"==typeof e?e=d(l(e,t),t):"object"==typeof e&&(e=l(d(e,t),t)),e},resolve:function(e,t,r){const s=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=c(l(e,s),l(t,s),s,!0);return s.skipEscape=!0,d(n,s)},resolveComponent:c,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=d(s(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=d(s(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=d(s(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=d(s(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:l};return un.exports=h,un.exports.default=h,un.exports.fastUri=h,un.exports}function fn(){return cn||(cn=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Us();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=as();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const s=Gs(),n=Ws(),a=vs(),i=Xs(),o=as(),c=Fs(),d=ks(),u=cs(),l=en,h=function(){if(on)return dn;on=1,Object.defineProperty(dn,"__esModule",{value:!0});const e=hn();return e.code='require("ajv/dist/runtime/uri").default',dn.default=e,dn}(),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],m=/* @__PURE__ */new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,s,n,a,i,o,c,d,u,l,p,m,y,g,v,_,$,w,b,k,x,E,S,P;const j=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,T=!0===N||void 0===N?1:N||0,C=null!==(s=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==s?s:f,O=null!==(n=e.uriResolver)&&void 0!==n?n:h.default;return{strictSchema:null===(i=null!==(a=e.strictSchema)&&void 0!==a?a:j)||void 0===i||i,strictNumbers:null===(c=null!==(o=e.strictNumbers)&&void 0!==o?o:j)||void 0===c||c,strictTypes:null!==(u=null!==(d=e.strictTypes)&&void 0!==d?d:j)&&void 0!==u?u:"log",strictTuples:null!==(p=null!==(l=e.strictTuples)&&void 0!==l?l:j)&&void 0!==p?p:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:j)&&void 0!==y&&y,code:e.code?{...e.code,optimize:T,regExp:C}:{optimize:T,regExp:C},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===($=e.messages)||void 0===$||$,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(x=e.validateSchema)||void 0===x||x,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(S=e.unicodeRegExp)||void 0===S||S,int32range:null===(P=e.int32range)||void 0===P||P,uriResolver:O}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=/* @__PURE__ */new Set,this._loading={},this._cache=/* @__PURE__ */new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return S;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),$.call(this,y,e,"NOT SUPPORTED"),$.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=l;"id"===r&&(s={...l},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await a.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function a(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return o.call(this,t),await c.call(this,t.missingSchema),i.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await d.call(this,e);this.refs[e]||await a.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function d(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,s);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,s=new i.SchemaEnv({schema:{},schemaId:r});if(t=i.resolveSchema.call(this,s,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(j.call(this,r,t),!t)return(0,u.eachItem)(r,e=>N.call(this,e)),this;C.call(this,t);const s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===s.type.length?e=>N.call(this,e,s):e=>s.type.forEach(t=>N.call(this,e,s,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,a=n[e];s&&a&&(n[e]=I(a))}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];t&&!t.test(r)||("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,n=this.opts.addUsedSchema){let a;const{schemaId:o}=this.opts;if("object"==typeof e)a=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let d=this._cache.get(e);if(void 0!==d)return d;r=(0,c.normalizeId)(a||r);const u=c.getSchemaRefs.call(this,e,r);return d=new i.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:u}),this._cache.set(d.schema,d),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=d),s&&this.validateSchema(e,!0),d}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}}function $(e,t,r,s="error"){for(const n in e){const a=n;a in t&&this.logger[s](`${r}: option ${n}. ${e[a]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function x(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function E(){const e={...this.opts};for(const t of p)delete e[t];return e}_.ValidationError=s.default,_.MissingRefError=n.default,e.default=_;const S={log(){},warn(){},error(){}};const P=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){const{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!P.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function N(e,t,r){var s;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:a}=this;let i=n?a.post:a.rules.find(({type:e})=>e===r);if(i||(i={type:r,rules:[]},a.rules.push(i)),a.keywords[e]=!0,!t)return;const o={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?T.call(this,i,o,t.before):i.rules.push(o),a.all[e]=o,null===(s=t.implements)||void 0===s||s.forEach(e=>this.addKeyword(e))}function T(e,t,r){const s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function C(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=I(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(e){return{anyOf:[e,O]}}}(Jr)),Jr}var pn,mn={},yn={},gn={};var vn,_n,$n={};function wn(){if(_n)return yn;_n=1,Object.defineProperty(yn,"__esModule",{value:!0});const e=function(){if(pn)return gn;pn=1,Object.defineProperty(gn,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return gn.default=e,gn}(),t=function(){if(vn)return $n;vn=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.callRef=$n.getValidate=void 0;const e=Ws(),t=Ts(),r=as(),s=fs(),n=Xs(),a=cs(),i={keyword:"$ref",schemaType:"string",code(t){const{gen:s,schema:a,it:i}=t,{baseId:d,schemaEnv:u,validateName:l,opts:h,self:f}=i,{root:p}=u;if(("#"===a||"#/"===a)&&d===p.baseId)return function(){if(u===p)return c(t,l,u,u.$async);const e=s.scopeValue("root",{ref:p});return c(t,r._`${e}.validate`,p,p.$async)}();const m=n.resolveRef.call(f,p,d,a);if(void 0===m)throw new e.default(i.opts.uriResolver,d,a);return m instanceof n.SchemaEnv?function(e){const r=o(t,e);c(t,r,e,e.$async)}(m):function(e){const n=s.scopeValue("schema",!0===h.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),i=s.name("valid"),o=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:n,errSchemaPath:a},i);t.mergeEvaluated(o),t.ok(i)}(m)}};function o(e,t){const{gen:s}=e;return t.validate?s.scopeValue("validate",{ref:t.validate}):r._`${s.scopeValue("wrapper",{ref:t})}.validate`}function c(e,n,i,o){const{gen:c,it:d}=e,{allErrors:u,schemaEnv:l,opts:h}=d,f=h.passContext?s.default.this:r.nil;function p(e){const t=r._`${e}.errors`;c.assign(s.default.vErrors,r._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`),c.assign(s.default.errors,r._`${s.default.vErrors}.length`)}function m(e){var t;if(!d.opts.unevaluated)return;const s=null===(t=null==i?void 0:i.validate)||void 0===t?void 0:t.evaluated;if(!0!==d.props)if(s&&!s.dynamicProps)void 0!==s.props&&(d.props=a.mergeEvaluated.props(c,s.props,d.props));else{const t=c.var("props",r._`${e}.evaluated.props`);d.props=a.mergeEvaluated.props(c,t,d.props,r.Name)}if(!0!==d.items)if(s&&!s.dynamicItems)void 0!==s.items&&(d.items=a.mergeEvaluated.items(c,s.items,d.items));else{const t=c.var("items",r._`${e}.evaluated.items`);d.items=a.mergeEvaluated.items(c,t,d.items,r.Name)}}o?function(){if(!l.$async)throw new Error("async schema referenced by sync schema");const s=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,n,f)}`),m(n),u||c.assign(s,!0)},e=>{c.if(r._`!(${e} instanceof ${d.ValidationError})`,()=>c.throw(e)),p(e),u||c.assign(s,!1)}),e.ok(s)}():e.result((0,t.callValidateCode)(e,n,f),()=>m(n),()=>p(n))}return $n.getValidate=o,$n.callRef=c,$n.default=i,$n}(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return yn.default=r,yn}var bn,kn={},xn={};var En,Sn={};var Pn,jn,Nn={},Tn={};function Cn(){if(jn)return Nn;jn=1,Object.defineProperty(Nn,"__esModule",{value:!0});const e=as(),t=cs(),r=function(){if(Pn)return Tn;function e(e){const t=e.length;let r,s=0,n=0;for(;n<t;)s++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return s}return Pn=1,Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Tn}(),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxLength"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(s){const{keyword:n,data:a,schemaCode:i,it:o}=s,c="maxLength"===n?e.operators.GT:e.operators.LT,d=!1===o.opts.unicode?e._`${a}.length`:e._`${(0,t.useFunc)(s.gen,r.default)}(${a})`;s.fail$data(e._`${d} ${c} ${i}`)}};return Nn.default=s,Nn}var On,In={};var Rn,An={};var Mn,zn={};function Dn(){if(Mn)return zn;Mn=1,Object.defineProperty(zn,"__esModule",{value:!0});const e=Ts(),t=as(),r=cs(),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(s){const{gen:n,schema:a,schemaCode:i,data:o,$data:c,it:d}=s,{opts:u}=d;if(!c&&0===a.length)return;const l=a.length>=u.loopRequired;if(d.allErrors?function(){if(l||c)s.block$data(t.nil,h);else for(const t of a)(0,e.checkReportMissingProp)(s,t)}():function(){const r=n.let("missing");if(l||c){const a=n.let("valid",!0);s.block$data(a,()=>function(r,a){s.setParams({missingProperty:r}),n.forOf(r,i,()=>{n.assign(a,(0,e.propertyInData)(n,o,r,u.ownProperties)),n.if((0,t.not)(a),()=>{s.error(),n.break()})},t.nil)}(r,a)),s.ok(a)}else n.if((0,e.checkMissingProp)(s,a,r)),(0,e.reportMissingProp)(s,r),n.else()}(),u.strictRequired){const e=s.parentSchema.properties,{definedProperties:t}=s.it;for(const s of a)if(void 0===(null==e?void 0:e[s])&&!t.has(s)){const e=`required property "${s}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(d,e,d.opts.strictRequired)}}function h(){n.forOf("prop",i,t=>{s.setParams({missingProperty:t}),n.if((0,e.noPropertyInData)(n,o,t,u.ownProperties),()=>s.error())})}}};return zn.default=s,zn}var qn,Vn={};var Zn,Ln,Fn={},Un={};function Kn(){if(Zn)return Un;Zn=1,Object.defineProperty(Un,"__esModule",{value:!0});const e=zs();return e.code='require("ajv/dist/runtime/equal").default',Un.default=e,Un}function Hn(){if(Ln)return Fn;Ln=1,Object.defineProperty(Fn,"__esModule",{value:!0});const e=ks(),t=as(),r=cs(),s=Kn(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(n){const{gen:a,data:i,$data:o,schema:c,parentSchema:d,schemaCode:u,it:l}=n;if(!o&&!c)return;const h=a.let("valid"),f=d.items?(0,e.getSchemaTypes)(d.items):[];function p(r,s){const o=a.name("item"),c=(0,e.checkDataTypes)(f,o,l.opts.strictNumbers,e.DataType.Wrong),d=a.const("indices",t._`{}`);a.for(t._`;${r}--;`,()=>{a.let(o,t._`${i}[${r}]`),a.if(c,t._`continue`),f.length>1&&a.if(t._`typeof ${o} == "string"`,t._`${o} += "_"`),a.if(t._`typeof ${d}[${o}] == "number"`,()=>{a.assign(s,t._`${d}[${o}]`),n.error(),a.assign(h,!1).break()}).code(t._`${d}[${o}] = ${r}`)})}function m(e,o){const c=(0,r.useFunc)(a,s.default),d=a.name("outer");a.label(d).for(t._`;${e}--;`,()=>a.for(t._`${o} = ${e}; ${o}--;`,()=>a.if(t._`${c}(${i}[${e}], ${i}[${o}])`,()=>{n.error(),a.assign(h,!1).break(d)})))}n.block$data(h,function(){const e=a.let("i",t._`${i}.length`),r=a.let("j");n.setParams({i:e,j:r}),a.assign(h,!0),a.if(t._`${e} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?p:m)(e,r))},t._`${u} === false`),n.ok(h)}};return Fn.default=n,Fn}var Gn,Jn={};var Bn,Wn,Yn={};function Qn(){if(Bn)return Yn;Bn=1,Object.defineProperty(Yn,"__esModule",{value:!0});const e=as(),t=cs(),r=Kn(),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(s){const{gen:n,data:a,$data:i,schema:o,schemaCode:c,it:d}=s;if(!i&&0===o.length)throw new Error("enum must have non-empty array");const u=o.length>=d.opts.loopEnum;let l;const h=()=>null!=l?l:l=(0,t.useFunc)(n,r.default);let f;if(u||i)f=n.let("valid"),s.block$data(f,function(){n.assign(f,!1),n.forOf("v",c,t=>n.if(e._`${h()}(${a}, ${t})`,()=>n.assign(f,!0).break()))});else{if(!Array.isArray(o))throw new Error("ajv implementation error");const t=n.const("vSchema",c);f=(0,e.or)(...o.map((r,s)=>function(t,r){const s=o[r];return"object"==typeof s&&null!==s?e._`${h()}(${a}, ${t}[${r}])`:e._`${a} === ${s}`}(t,s)))}s.pass(f)}};return Yn.default=s,Yn}function Xn(){if(Wn)return kn;Wn=1,Object.defineProperty(kn,"__esModule",{value:!0});const e=function(){if(bn)return xn;bn=1,Object.defineProperty(xn,"__esModule",{value:!0});const e=as(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},s={message:({keyword:t,schemaCode:s})=>e.str`must be ${r[t].okStr} ${s}`,params:({keyword:t,schemaCode:s})=>e._`{comparison: ${r[t].okStr}, limit: ${s}}`},n={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:s,code(t){const{keyword:s,data:n,schemaCode:a}=t;t.fail$data(e._`${n} ${r[s].fail} ${a} || isNaN(${n})`)}};return xn.default=n,xn}(),t=function(){if(En)return Sn;En=1,Object.defineProperty(Sn,"__esModule",{value:!0});const e=as(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:s,schemaCode:n,it:a}=t,i=a.opts.multipleOfPrecision,o=r.let("res"),c=i?e._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:e._`${o} !== parseInt(${o})`;t.fail$data(e._`(${n} === 0 || (${o} = ${s}/${n}, ${c}))`)}};return Sn.default=t,Sn}(),r=Cn(),s=function(){if(On)return In;On=1,Object.defineProperty(In,"__esModule",{value:!0});const e=Ts(),t=as(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:s,$data:n,schema:a,schemaCode:i,it:o}=r,c=o.opts.unicodeRegExp?"u":"",d=n?t._`(new RegExp(${i}, ${c}))`:(0,e.usePattern)(r,a);r.fail$data(t._`!${d}.test(${s})`)}};return In.default=r,In}(),n=function(){if(Rn)return An;Rn=1,Object.defineProperty(An,"__esModule",{value:!0});const e=as(),t={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:s,schemaCode:n}=t,a="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${s}).length ${a} ${n}`)}};return An.default=t,An}(),a=Dn(),i=function(){if(qn)return Vn;qn=1,Object.defineProperty(Vn,"__esModule",{value:!0});const e=as(),t={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxItems"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:s,schemaCode:n}=t,a="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${s}.length ${a} ${n}`)}};return Vn.default=t,Vn}(),o=Hn(),c=function(){if(Gn)return Jn;Gn=1,Object.defineProperty(Jn,"__esModule",{value:!0});const e=as(),t=cs(),r=Kn(),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(s){const{gen:n,data:a,$data:i,schemaCode:o,schema:c}=s;i||c&&"object"==typeof c?s.fail$data(e._`!${(0,t.useFunc)(n,r.default)}(${a}, ${o})`):s.fail(e._`${c} !== ${a}`)}};return Jn.default=s,Jn}(),d=Qn(),u=[e.default,t.default,r.default,s.default,n.default,a.default,i.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,d.default];return kn.default=u,kn}var ea,ta={},ra={};function sa(){if(ea)return ra;ea=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.validateAdditionalItems=void 0;const e=as(),t=cs(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:n}=e,{items:a}=r;Array.isArray(a)?s(e,a):(0,t.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(r,s){const{gen:n,schema:a,data:i,keyword:o,it:c}=r;c.items=!0;const d=n.const("len",e._`${i}.length`);if(!1===a)r.setParams({len:s.length}),r.pass(e._`${d} <= ${s.length}`);else if("object"==typeof a&&!(0,t.alwaysValidSchema)(c,a)){const a=n.var("valid",e._`${d} <= ${s.length}`);n.if((0,e.not)(a),()=>function(a){n.forRange("i",s.length,d,s=>{r.subschema({keyword:o,dataProp:s,dataPropType:t.Type.Num},a),c.allErrors||n.if((0,e.not)(a),()=>n.break())})}(a)),r.ok(a)}}return ra.validateAdditionalItems=s,ra.default=r,ra}var na,aa,ia={},oa={};function ca(){if(na)return oa;na=1,Object.defineProperty(oa,"__esModule",{value:!0}),oa.validateTuple=void 0;const e=as(),t=cs(),r=Ts(),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:s,it:a}=e;if(Array.isArray(s))return n(e,"additionalItems",s);a.items=!0,(0,t.alwaysValidSchema)(a,s)||e.ok((0,r.validateArray)(e))}};function n(r,s,n=r.schema){const{gen:a,parentSchema:i,data:o,keyword:c,it:d}=r;!function(e){const{opts:r,errSchemaPath:a}=d,i=n.length,o=i===e.minItems&&(i===e.maxItems||!1===e[s]);if(r.strictTuples&&!o){const e=`"${c}" is ${i}-tuple, but minItems or maxItems/${s} are not specified or different at path "${a}"`;(0,t.checkStrictMode)(d,e,r.strictTuples)}}(i),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=t.mergeEvaluated.items(a,n.length,d.items));const u=a.name("valid"),l=a.const("len",e._`${o}.length`);n.forEach((s,n)=>{(0,t.alwaysValidSchema)(d,s)||(a.if(e._`${l} > ${n}`,()=>r.subschema({keyword:c,schemaProp:n,dataProp:n},u)),r.ok(u))})}return oa.validateTuple=n,oa.default=s,oa}var da,ua={};var la,ha={};function fa(){if(la)return ha;la=1,Object.defineProperty(ha,"__esModule",{value:!0});const e=as(),t=cs(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:s,schema:n,parentSchema:a,data:i,it:o}=r;let c,d;const{minContains:u,maxContains:l}=a;o.opts.next?(c=void 0===u?1:u,d=l):c=1;const h=s.const("len",e._`${i}.length`);if(r.setParams({min:c,max:d}),void 0===d&&0===c)return void(0,t.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==d&&c>d)return(0,t.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(o,n)){let t=e._`${h} >= ${c}`;return void 0!==d&&(t=e._`${t} && ${h} <= ${d}`),void r.pass(t)}o.items=!0;const f=s.name("valid");function p(){const t=s.name("_valid"),r=s.let("count",0);m(t,()=>s.if(t,()=>function(t){s.code(e._`${t}++`),void 0===d?s.if(e._`${t} >= ${c}`,()=>s.assign(f,!0).break()):(s.if(e._`${t} > ${d}`,()=>s.assign(f,!1).break()),1===c?s.assign(f,!0):s.if(e._`${t} >= ${c}`,()=>s.assign(f,!0)))}(r)))}function m(e,n){s.forRange("i",0,h,s=>{r.subschema({keyword:"contains",dataProp:s,dataPropType:t.Type.Num,compositeRule:!0},e),n()})}void 0===d&&1===c?m(f,()=>s.if(f,()=>s.break())):0===c?(s.let(f,!0),void 0!==d&&s.if(e._`${i}.length > 0`,p)):(s.let(f,!1),p()),r.result(f,()=>r.reset())}};return ha.default=r,ha}var pa,ma={};function ya(){return pa||(pa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=as(),r=cs(),s=Ts();e.error={message:({params:{property:e,depsCount:r,deps:s}})=>{const n=1===r?"property":"properties";return t.str`must have ${n} ${s} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:s,missingProperty:n}})=>t._`{property: ${e},
|
|
5
|
+
missingProperty: ${n},
|
|
6
|
+
depsCount: ${r},
|
|
7
|
+
deps: ${s}}`};const n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const s in e){if("__proto__"===s)continue;(Array.isArray(e[s])?t:r)[s]=e[s]}return[t,r]}(e);a(e,t),i(e,r)}};function a(e,r=e.schema){const{gen:n,data:a,it:i}=e;if(0===Object.keys(r).length)return;const o=n.let("missing");for(const c in r){const d=r[c];if(0===d.length)continue;const u=(0,s.propertyInData)(n,a,c,i.opts.ownProperties);e.setParams({property:c,depsCount:d.length,deps:d.join(", ")}),i.allErrors?n.if(u,()=>{for(const t of d)(0,s.checkReportMissingProp)(e,t)}):(n.if(t._`${u} && (${(0,s.checkMissingProp)(e,d,o)})`),(0,s.reportMissingProp)(e,o),n.else())}}function i(e,t=e.schema){const{gen:n,data:a,keyword:i,it:o}=e,c=n.name("valid");for(const d in t)(0,r.alwaysValidSchema)(o,t[d])||(n.if((0,s.propertyInData)(n,a,d,o.opts.ownProperties),()=>{const t=e.subschema({keyword:i,schemaProp:d},c);e.mergeValidEvaluated(t,c)},()=>n.var(c,!0)),e.ok(c))}e.validatePropertyDeps=a,e.validateSchemaDeps=i,e.default=n}(ma)),ma}var ga,va={};var _a,$a={};function wa(){if(_a)return $a;_a=1,Object.defineProperty($a,"__esModule",{value:!0});const e=Ts(),t=as(),r=fs(),s=cs(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(n){const{gen:a,schema:i,parentSchema:o,data:c,errsCount:d,it:u}=n;if(!d)throw new Error("ajv implementation error");const{allErrors:l,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,s.alwaysValidSchema)(u,i))return;const f=(0,e.allSchemaProperties)(o.properties),p=(0,e.allSchemaProperties)(o.patternProperties);function m(e){a.code(t._`delete ${c}[${e}]`)}function y(e){if("all"===h.removeAdditional||h.removeAdditional&&!1===i)m(e);else{if(!1===i)return n.setParams({additionalProperty:e}),n.error(),void(l||a.break());if("object"==typeof i&&!(0,s.alwaysValidSchema)(u,i)){const r=a.name("valid");"failing"===h.removeAdditional?(g(e,r,!1),a.if((0,t.not)(r),()=>{n.reset(),m(e)})):(g(e,r),l||a.if((0,t.not)(r),()=>a.break()))}}}function g(e,t,r){const a={keyword:"additionalProperties",dataProp:e,dataPropType:s.Type.Str};!1===r&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),n.subschema(a,t)}a.forIn("key",c,r=>{f.length||p.length?a.if(function(r){let i;if(f.length>8){const t=(0,s.schemaRefOrVal)(u,o.properties,"properties");i=(0,e.isOwnProperty)(a,t,r)}else i=f.length?(0,t.or)(...f.map(e=>t._`${r} === ${e}`)):t.nil;return p.length&&(i=(0,t.or)(i,...p.map(s=>t._`${(0,e.usePattern)(n,s)}.test(${r})`))),(0,t.not)(i)}(r),()=>y(r)):y(r)}),n.ok(t._`${d} === ${r.default.errors}`)}};return $a.default=n,$a}var ba,ka={};var xa,Ea={};var Sa,Pa={};var ja,Na={};var Ta,Ca={};var Oa,Ia={};var Ra,Aa={};var Ma,za,Da={};function qa(){if(za)return ta;za=1,Object.defineProperty(ta,"__esModule",{value:!0});const e=sa(),t=function(){if(aa)return ia;aa=1,Object.defineProperty(ia,"__esModule",{value:!0});const e=ca(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return ia.default=t,ia}(),r=ca(),s=function(){if(da)return ua;da=1,Object.defineProperty(ua,"__esModule",{value:!0});const e=as(),t=cs(),r=Ts(),s=sa(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:n,parentSchema:a,it:i}=e,{prefixItems:o}=a;i.items=!0,(0,t.alwaysValidSchema)(i,n)||(o?(0,s.validateAdditionalItems)(e,o):e.ok((0,r.validateArray)(e)))}};return ua.default=n,ua}(),n=fa(),a=ya(),i=function(){if(ga)return va;ga=1,Object.defineProperty(va,"__esModule",{value:!0});const e=as(),t=cs(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:s,schema:n,data:a,it:i}=r;if((0,t.alwaysValidSchema)(i,n))return;const o=s.name("valid");s.forIn("key",a,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},o),s.if((0,e.not)(o),()=>{r.error(!0),i.allErrors||s.break()})}),r.ok(o)}};return va.default=r,va}(),o=wa(),c=function(){if(ba)return ka;ba=1,Object.defineProperty(ka,"__esModule",{value:!0});const e=Us(),t=Ts(),r=cs(),s=wa(),n={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:a,schema:i,parentSchema:o,data:c,it:d}=n;"all"===d.opts.removeAdditional&&void 0===o.additionalProperties&&s.default.code(new e.KeywordCxt(d,s.default,"additionalProperties"));const u=(0,t.allSchemaProperties)(i);for(const e of u)d.definedProperties.add(e);d.opts.unevaluated&&u.length&&!0!==d.props&&(d.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),d.props));const l=u.filter(e=>!(0,r.alwaysValidSchema)(d,i[e]));if(0===l.length)return;const h=a.name("valid");for(const e of l)f(e)?p(e):(a.if((0,t.propertyInData)(a,c,e,d.opts.ownProperties)),p(e),d.allErrors||a.else().var(h,!0),a.endIf()),n.it.definedProperties.add(e),n.ok(h);function f(e){return d.opts.useDefaults&&!d.compositeRule&&void 0!==i[e].default}function p(e){n.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}};return ka.default=n,ka}(),d=function(){if(xa)return Ea;xa=1,Object.defineProperty(Ea,"__esModule",{value:!0});const e=Ts(),t=as(),r=cs(),s=cs(),n={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:a,schema:i,data:o,parentSchema:c,it:d}=n,{opts:u}=d,l=(0,e.allSchemaProperties)(i),h=l.filter(e=>(0,r.alwaysValidSchema)(d,i[e]));if(0===l.length||h.length===l.length&&(!d.opts.unevaluated||!0===d.props))return;const f=u.strictSchema&&!u.allowMatchingProperties&&c.properties,p=a.name("valid");!0===d.props||d.props instanceof t.Name||(d.props=(0,s.evaluatedPropsToName)(a,d.props));const{props:m}=d;function y(e){for(const t in f)new RegExp(e).test(t)&&(0,r.checkStrictMode)(d,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function g(r){a.forIn("key",o,i=>{a.if(t._`${(0,e.usePattern)(n,r)}.test(${i})`,()=>{const e=h.includes(r);e||n.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:s.Type.Str},p),d.opts.unevaluated&&!0!==m?a.assign(t._`${m}[${i}]`,!0):e||d.allErrors||a.if((0,t.not)(p),()=>a.break())})})}!function(){for(const e of l)f&&y(e),d.allErrors?g(e):(a.var(p,!0),g(e),a.if(p))}()}};return Ea.default=n,Ea}(),u=function(){if(Sa)return Pa;Sa=1,Object.defineProperty(Pa,"__esModule",{value:!0});const e=cs(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:s,it:n}=t;if((0,e.alwaysValidSchema)(n,s))return void t.fail();const a=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),t.failResult(a,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return Pa.default=t,Pa}(),l=function(){if(ja)return Na;ja=1,Object.defineProperty(Na,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ts().validateUnion,error:{message:"must match a schema in anyOf"}};return Na.default=e,Na}(),h=function(){if(Ta)return Ca;Ta=1,Object.defineProperty(Ca,"__esModule",{value:!0});const e=as(),t=cs(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:s,schema:n,parentSchema:a,it:i}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(i.opts.discriminator&&a.discriminator)return;const o=n,c=s.let("valid",!1),d=s.let("passing",null),u=s.name("_valid");r.setParams({passing:d}),s.block(function(){o.forEach((n,a)=>{let o;(0,t.alwaysValidSchema)(i,n)?s.var(u,!0):o=r.subschema({keyword:"oneOf",schemaProp:a,compositeRule:!0},u),a>0&&s.if(e._`${u} && ${c}`).assign(c,!1).assign(d,e._`[${d}, ${a}]`).else(),s.if(u,()=>{s.assign(c,!0),s.assign(d,a),o&&r.mergeEvaluated(o,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return Ca.default=r,Ca}(),f=function(){if(Oa)return Ia;Oa=1,Object.defineProperty(Ia,"__esModule",{value:!0});const e=cs(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:s,it:n}=t;if(!Array.isArray(s))throw new Error("ajv implementation error");const a=r.name("valid");s.forEach((r,s)=>{if((0,e.alwaysValidSchema)(n,r))return;const i=t.subschema({keyword:"allOf",schemaProp:s},a);t.ok(a),t.mergeEvaluated(i)})}};return Ia.default=t,Ia}(),p=function(){if(Ra)return Aa;Ra=1,Object.defineProperty(Aa,"__esModule",{value:!0});const e=as(),t=cs(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:n,parentSchema:a,it:i}=r;void 0===a.then&&void 0===a.else&&(0,t.checkStrictMode)(i,'"if" without "then" and "else" is ignored');const o=s(i,"then"),c=s(i,"else");if(!o&&!c)return;const d=n.let("valid",!0),u=n.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);r.mergeEvaluated(e)}(),r.reset(),o&&c){const e=n.let("ifClause");r.setParams({ifClause:e}),n.if(u,l("then",e),l("else",e))}else o?n.if(u,l("then")):n.if((0,e.not)(u),l("else"));function l(t,s){return()=>{const a=r.subschema({keyword:t},u);n.assign(d,u),r.mergeValidEvaluated(a,d),s?n.assign(s,e._`${t}`):r.setParams({ifClause:t})}}r.pass(d,()=>r.error(!0))}};function s(e,r){const s=e.schema[r];return void 0!==s&&!(0,t.alwaysValidSchema)(e,s)}return Aa.default=r,Aa}(),m=function(){if(Ma)return Da;Ma=1,Object.defineProperty(Da,"__esModule",{value:!0});const e=cs(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:s}){void 0===r.if&&(0,e.checkStrictMode)(s,`"${t}" without "if" is ignored`)}};return Da.default=t,Da}();return ta.default=function(y=!1){const g=[u.default,l.default,h.default,f.default,p.default,m.default,i.default,o.default,a.default,c.default,d.default];return y?g.push(t.default,s.default):g.push(e.default,r.default),g.push(n.default),g},ta}var Va,Za,La={},Fa={};function Ua(){if(Za)return La;Za=1,Object.defineProperty(La,"__esModule",{value:!0});const e=function(){if(Va)return Fa;Va=1,Object.defineProperty(Fa,"__esModule",{value:!0});const e=as(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:s,data:n,$data:a,schema:i,schemaCode:o,it:c}=t,{opts:d,errSchemaPath:u,schemaEnv:l,self:h}=c;d.validateFormats&&(a?function(){const a=s.scopeValue("formats",{ref:h.formats,code:d.code.formats}),i=s.const("fDef",e._`${a}[${o}]`),c=s.let("fType"),u=s.let("format");s.if(e._`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>s.assign(c,e._`${i}.type || "string"`).assign(u,e._`${i}.validate`),()=>s.assign(c,e._`"string"`).assign(u,i)),t.fail$data((0,e.or)(!1===d.strictSchema?e.nil:e._`${o} && !${u}`,function(){const t=l.$async?e._`(${i}.async ? await ${u}(${n}) : ${u}(${n}))`:e._`${u}(${n})`,s=e._`(typeof ${u} == "function" ? ${t} : ${u}.test(${n}))`;return e._`${u} && ${u} !== true && ${c} === ${r} && !${s}`}()))}():function(){const a=h.formats[i];if(!a)return void function(){if(!1!==d.strictSchema)throw new Error(e());function e(){return`unknown format "${i}" ignored in schema at path "${u}"`}h.logger.warn(e())}();if(!0===a)return;const[o,c,f]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):d.code.formats?e._`${d.code.formats}${(0,e.getProperty)(i)}`:void 0,n=s.scopeValue("formats",{key:i,ref:t,code:r});return"object"!=typeof t||t instanceof RegExp?["string",t,n]:[t.type||"string",t.validate,e._`${n}.validate`]}(a);o===r&&t.pass(function(){if("object"==typeof a&&!(a instanceof RegExp)&&a.async){if(!l.$async)throw new Error("async format in sync schema");return e._`await ${f}(${n})`}return"function"==typeof c?e._`${f}(${n})`:e._`${f}.test(${n})`}())}())}};return Fa.default=t,Fa}(),t=[e.default];return La.default=t,La}var Ka,Ha,Ga={};function Ja(){if(Ha)return mn;Ha=1,Object.defineProperty(mn,"__esModule",{value:!0});const e=wn(),t=Xn(),r=qa(),s=Ua(),n=(Ka||(Ka=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.contentVocabulary=Ga.metadataVocabulary=void 0,Ga.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Ga.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Ga),a=[e.default,t.default,(0,r.default)(),s.default,n.metadataVocabulary,n.contentVocabulary];return mn.default=a,mn}var Ba,Wa,Ya={},Qa={};function Xa(){if(Wa)return Ya;Wa=1,Object.defineProperty(Ya,"__esModule",{value:!0});const e=as(),t=(Ba||(Ba=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.DiscrError=void 0,(s=r||(Qa.DiscrError=r={})).Tag="tag",s.Mapping="mapping"),Qa);var r,s;const n=Xs(),a=Ws(),i=cs(),o={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:s}})=>e._`{error: ${t}, tag: ${s}, tagValue: ${r}}`},code(r){const{gen:s,data:o,schema:c,parentSchema:d,it:u}=r,{oneOf:l}=d;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=s.let("valid",!1),p=s.const("tag",e._`${o}${(0,e.getProperty)(h)}`);function m(t){const n=s.name("valid"),a=r.subschema({keyword:"oneOf",schemaProp:t},n);return r.mergeEvaluated(a,e.Name),n}s.if(e._`typeof ${p} == "string"`,()=>function(){const o=function(){var e;const t={},r=o(d);let s=!0;for(let d=0;d<l.length;d++){let t=l[d];if((null==t?void 0:t.$ref)&&!(0,i.schemaHasRulesButRef)(t,u.self.RULES)){const e=t.$ref;if(t=n.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),t instanceof n.SchemaEnv&&(t=t.schema),void 0===t)throw new a.default(u.opts.uriResolver,u.baseId,e)}const f=null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e[h];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(r||o(t)),c(f,d)}if(!s)throw new Error(`discriminator: "${h}" must be required`);return t;function o({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();s.if(!1);for(const t in o)s.elseIf(e._`${p} === ${t}`),s.assign(f,m(o[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:p,tagName:h}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:p,tagName:h})),r.ok(f)}};return Ya.default=o,Ya}const ei={$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};var ti;function ri(){return ti||(ti=1,function(e,t){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;const r=fn(),s=Ja(),n=Xa(),a=ei,i=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(a,i):a;this.addMetaSchema(e,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var d=Us();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var u=as();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 l=Gs();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var h=Ws();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}(Gr,Gr.exports)),Gr.exports}var si,ni=ri(),ai={exports:{}},ii={};var oi,ci,di={};const ui=/* @__PURE__ */r((ci||(ci=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=(si||(si=1,function(e){function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(n,a),time:t(o(!0),c),"date-time":t(l(!0),h),"iso-time":t(o(),d),"iso-date-time":t(l(),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return p.test(e)&&m.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if($.test(e))return!1;try{return new RegExp(e),!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(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=g}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(e){const t=r.exec(e);if(!t)return!1;const n=+t[1],a=+t[2],i=+t[3];return a>=1&&a<=12&&i>=1&&i<=(2===a&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(n)?29:s[a])}function a(e,t){if(e&&t)return e>t?1:e<t?-1:0}const i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function o(e){return function(t){const r=i.exec(t);if(!r)return!1;const s=+r[1],n=+r[2],a=+r[3],o=r[4],c="-"===r[5]?-1:1,d=+(r[6]||0),u=+(r[7]||0);if(d>23||u>59||e&&!o)return!1;if(s<=23&&n<=59&&a<60)return!0;const l=n-u*c,h=s-d*c-(l<0?1:0);return(23===h||-1===h)&&(59===l||-1===l)&&a<61}}function c(e,t){if(!e||!t)return;const r=/* @__PURE__ */new Date("2020-01-01T"+e).valueOf(),s=/* @__PURE__ */new Date("2020-01-01T"+t).valueOf();return r&&s?r-s:void 0}function d(e,t){if(!e||!t)return;const r=i.exec(e),s=i.exec(t);return r&&s?(e=r[1]+r[2]+r[3])>(t=s[1]+s[2]+s[3])?1:e<t?-1:0:void 0}const u=/t|\s/i;function l(e){const t=o(e);return function(e){const r=e.split(u);return 2===r.length&&n(r[0])&&t(r[1])}}function h(e,t){if(!e||!t)return;const r=new Date(e).valueOf(),s=new Date(t).valueOf();return r&&s?r-s:void 0}function f(e,t){if(!e||!t)return;const[r,s]=e.split(u),[n,i]=t.split(u),o=a(r,n);return void 0!==o?o||c(s,i):void 0}const p=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,g=-2147483648,v=2**31-1;function _(){return!0}const $=/[^\\]\\Z/}(ii)),ii),s=(oi||(oi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=ri(),r=as(),s=r.operators,n={formatMaximum:{okStr:"<=",ok:s.LTE,fail:s.GT},formatMinimum:{okStr:">=",ok:s.GTE,fail:s.LT},formatExclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},formatExclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},a={message:({keyword:e,schemaCode:t})=>r.str`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${n[e].okStr}, limit: ${t}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:a,code(e){const{gen:s,data:a,schemaCode:i,keyword:o,it:c}=e,{opts:d,self:u}=c;if(!d.validateFormats)return;const l=new t.KeywordCxt(c,u.RULES.all.format.definition,"format");function h(e){return r._`${e}.compare(${a}, ${i}) ${n[o].fail} 0`}l.$data?function(){const t=s.scopeValue("formats",{ref:u.formats,code:d.code.formats}),n=s.const("fmt",r._`${t}[${l.schemaCode}]`);e.fail$data((0,r.or)(r._`typeof ${n} != "object"`,r._`${n} instanceof RegExp`,r._`typeof ${n}.compare != "function"`,h(n)))}():function(){const t=l.schema,n=u.formats[t];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw new Error(`"${o}": format "${t}" does not define "compare" function`);const a=s.scopeValue("formats",{key:t,ref:n,code:d.code.formats?r._`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(h(a))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}(di)),di),n=as(),a=new n.Name("fullFormats"),i=new n.Name("fastFormats"),o=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,r.fullFormats,a),e;const[n,o]="fast"===t.mode?[r.fastFormats,i]:[r.fullFormats,a];return c(e,t.formats||r.formatNames,n,o),t.keywords&&(0,s.default)(e),e};function c(e,t,r,s){var a,i;null!==(a=(i=e.opts.code).formats)&&void 0!==a||(i.formats=n._`require("ajv-formats/dist/formats").${s}`);for(const n of t)e.addFormat(n,r[n])}o.get=(e,t="full")=>{const s=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!s)throw new Error(`Unknown format "${e}"`);return s},e.exports=t=o,Object.defineProperty(t,"__esModule",{value:!0}),t.default=o}(ai,ai.exports)),ai.exports));class li{constructor(e){this._ajv=null!=e?e:function(){const e=new ni.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ui(e),e}()}getValidator(e){var t;const r="$id"in e&&"string"==typeof e.$id&&null!==(t=this._ajv.getSchema(e.$id))&&void 0!==t?t:this._ajv.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class hi extends Kr{constructor(e,t){var r,s;super(t),this._serverInfo=e,this._loggingLevels=/* @__PURE__ */new Map,this.LOG_LEVEL_SEVERITY=new Map(Er.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!==(s=null==t?void 0:t.jsonSchemaValidator)&&void 0!==s?s:new li,this.setRequestHandler(It,e=>this._oninitialize(e)),this.setNotificationHandler(zt,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(Sr,async(e,t)=>{var r;const s=t.sessionId||(null===(r=t.requestInfo)||void 0===r?void 0:r.headers["mcp-session-id"])||void 0,{level:n}=e.params,a=Er.safeParse(n);return a.success&&this._loggingLevels.set(s,a.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");var t,r;this._capabilities=(t=this._capabilities,r=e,Object.entries(r).reduce((e,[t,r])=>(e[t]=r&&"object"==typeof r&&e[t]?{...e[t],...r}:r,e),{...t}))}assertCapabilityForMethod(e){var t,r,s;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(r=this._clientCapabilities)||void 0===r?void 0:r.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(s=this._clientCapabilities)||void 0===s?void 0:s.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`)}}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:at.includes(t)?t:st,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},St)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Or,t)}async elicitInput(e,t){const r=await this.request({method:"elicitation/create",params:e},Ar,t);if("accept"===r.action&&r.content&&e.requestedSchema)try{const t=this._jsonSchemaValidator.getValidator(e.requestedSchema)(r.content);if(!t.valid)throw new Ur(wt.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorMessage}`)}catch(s){if(s instanceof Ur)throw s;throw new Ur(wt.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return r}async listRoots(e,t){return this.request({method:"roots/list",params:e},Lr,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}function fi(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:s="en-US"}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(s&&!["en-US","ja-JP"].includes(s))throw new Error("'locale' must be 'en-US' or 'ja-JP'");return{url:t,html_content:r,locale:s}}function pi(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{content:t,save_path:r,save_directory:s,filename:n}=e;if(!t||"string"!=typeof t)throw new Error("'content' is required and must be a string");if(!r&&!s)throw new Error("Either 'save_path' or 'save_directory' is required");if(r&&"string"!=typeof r)throw new Error("'save_path' must be a string");if(s&&"string"!=typeof s)throw new Error("'save_directory' must be a string");if(n&&"string"!=typeof n)throw new Error("'filename' must be a string");if(r&&s)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{content:t,save_path:r,save_directory:s,filename:n}}function mi(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:s="en-US",save_path:n,save_directory:a,filename:i}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(s&&!["en-US","ja-JP"].includes(s))throw new Error("'locale' must be 'en-US' or 'ja-JP'");if(!n&&!a)throw new Error("Either 'save_path' or 'save_directory' is required");if(n&&"string"!=typeof n)throw new Error("'save_path' must be a string");if(a&&"string"!=typeof a)throw new Error("'save_directory' must be a string");if(i&&"string"!=typeof i)throw new Error("'filename' must be a string");if(n&&a)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{url:t,html_content:r,locale:s,save_path:n,save_directory:a,filename:i}}async function yi(e,t,r,i){let o;if(t)o=n(t);else{if(!r)throw new Error("Either save_path or save_directory must be specified");o=n(r,`${i||"page"}${".md"}`)}return await s.mkdir(a(o),{recursive:!0}),await s.writeFile(o,e,"utf-8"),o}const gi={htmlToMarkdown:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"}},anyOf:[{required:["url"]},{required:["html_content"]}]},saveContentToFile:{type:"object",properties:{content:{type:"string",description:"Text content to save to file. Will be saved as Markdown format."},save_path:{type:"string",description:"Complete file path including filename to save content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},required:["content"],anyOf:[{required:["save_path"]},{required:["save_directory"]}]},urlToMarkdownFile:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert and save as Markdown file (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly and save as Markdown file. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"},save_path:{type:"string",description:"Complete file path including filename to save the converted Markdown content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save the converted Markdown content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},anyOf:[{required:["url","save_path"]},{required:["url","save_directory"]},{required:["html_content","save_path"]},{required:["html_content","save_directory"]}]}};function vi(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}function _i(e){return{content:[{type:"text",text:e}],isError:!1}}const $i=()=>{try{const e=d(import.meta.url),t=o(e),r=c(t,"../package.json");return JSON.parse(i(r,"utf-8")).version||"0.0.0"}catch(e){return"0.0.0"}};export{kr as C,nt as D,It as I,Et as J,$r as L,gi as M,hi as S,vi as a,pi as b,_i as c,mi as d,gt as e,at as f,$i as g,$t as h,Rt as i,xt as j,fi as p,yi as s};
|