mboaai-sdk 1.0.15 → 1.0.17

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.
@@ -1 +1,2 @@
1
- import{MCPClient as e}from"mcp-client";import t from"pkce-challenge";var s,a;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(s||(s={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(a||(a={}));const n=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),r=e=>{switch(typeof e){case"undefined":return n.undefined;case"string":return n.string;case"number":return Number.isNaN(e)?n.nan:n.number;case"boolean":return n.boolean;case"function":return n.function;case"bigint":return n.bigint;case"symbol":return n.symbol;case"object":return Array.isArray(e)?n.array:null===e?n.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?n.promise:"undefined"!=typeof Map&&e instanceof Map?n.map:"undefined"!=typeof Set&&e instanceof Set?n.set:"undefined"!=typeof Date&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=s.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 o 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},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof o))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,s.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}o.create=e=>new o(e);const d=(e,t)=>{let a;switch(e.code){case i.invalid_type:a=e.received===n.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case i.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,s.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:a=`Unrecognized key(s) in object: ${s.joinValues(e.keys,", ")}`;break;case i.invalid_union:a="Invalid input";break;case i.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${s.joinValues(e.options)}`;break;case i.invalid_enum_value:a=`Invalid enum value. Expected ${s.joinValues(e.options)}, received '${e.received}'`;break;case i.invalid_arguments:a="Invalid function arguments";break;case i.invalid_return_type:a="Invalid function return type";break;case i.invalid_date:a="Invalid date";break;case i.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:s.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case i.too_small:a="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?`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 i.too_big:a="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 i.custom:a="Invalid input";break;case i.invalid_intersection_types:a="Intersection results could not be merged";break;case i.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case i.not_finite:a="Number must be finite";break;default:a=t.defaultError,s.assertNever(e)}return{message:a}};let c=d;function u(e,t){const s=c,a=(e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===d?void 0:d].filter((e=>!!e))});e.common.issues.push(a)}class l{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return h;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return l.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return h;if("aborted"===n.status)return h;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const h=Object.freeze({status:"aborted"}),p=e=>({status:"dirty",value:e}),m=e=>({status:"valid",value:e}),f=e=>"aborted"===e.status,_=e=>"dirty"===e.status,g=e=>"valid"===e.status,y=e=>"undefined"!=typeof Promise&&e instanceof Promise;var v;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(v||(v={}));class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const k=(e,t)=>{if(g(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 o(e.common.issues);return this._error=t,this._error}}};function w(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))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:r}=e;return"invalid_enum_value"===t.code?{message:r??n.defaultError}:void 0===n.data?{message:r??a??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:r??s??n.defaultError}},description:n}}class b{get description(){return this._def.description}_getType(e){return r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l,ctx:{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(y(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},a=this._parseSync({data:e,path:s.path,parent:s});return k(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return g(s)?{value:s.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>g(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(y(a)?a:Promise.resolve(a));return k(s,n)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),r=()=>a.addIssue({code:i.custom,...s(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(r(),!1))):!!n||(r(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new we({schema:this,typeName:Ee.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 be.create(this,this._def)}nullable(){return Te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ne.create(this)}promise(){return ke.create(this,this._def)}or(e){return oe.create([this,e],this._def)}and(e){return le.create(this,e,this._def)}transform(e){return new we({...w(this._def),schema:this,typeName:Ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Oe({...w(this._def),innerType:this,defaultValue:t,typeName:Ee.ZodDefault})}brand(){return new Ae({typeName:Ee.ZodBranded,type:this,...w(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ce({...w(this._def),innerType:this,catchValue:t,typeName:Ee.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ze.create(this,e)}readonly(){return Ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const T=/^c[^\s-]{8,}$/i,O=/^[0-9a-z]+$/,C=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S=/^[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,A=/^[a-z0-9_-]{21}$/i,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I=/^[-+]?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)?)??$/,E=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let j;const R=/^(?:(?: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])$/,P=/^(?:(?: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])$/,N=/^(([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]))$/,$=/^(([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])$/,M=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,U=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,z="((\\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])))",L=new RegExp(`^${z}$`);function F(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 D(e){let t=`${z}T${F(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function V(e,t){if(!Z.test(e))return!1;try{const[s]=e.split("."),a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function K(e,t){return!("v4"!==t&&t||!P.test(e))||!("v6"!==t&&t||!$.test(e))}class q extends b{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==n.string){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.string,received:t.parsedType}),h}const t=new l;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:i.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:i.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,r=e.data.length<n.value;(s||r)&&(a=this._getOrReturnCtx(e,a),s?u(a,{code:i.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&u(a,{code:i.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)E.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"email",code:i.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"emoji",code:i.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)S.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"uuid",code:i.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)A.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"nanoid",code:i.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)T.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid",code:i.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)O.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid2",code:i.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)C.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ulid",code:i.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),u(a,{validation:"url",code:i.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"regex",code:i.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){D(n).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){L.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){new RegExp(`^${F(n)}$`).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:i.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?I.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:i.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?(r=e.data,("v4"!==(o=n.version)&&o||!R.test(r))&&("v6"!==o&&o||!N.test(r))&&(a=this._getOrReturnCtx(e,a),u(a,{validation:"ip",code:i.invalid_string,message:n.message}),t.dirty())):"jwt"===n.kind?V(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"jwt",code:i.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?K(e.data,n.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cidr",code:i.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?M.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:i.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?U.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:i.invalid_string,message:n.message}),t.dirty()):s.assertNever(n);var r,o;return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:i.invalid_string,...v.errToObj(s)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.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,...v.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,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...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 W(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}q.create=e=>new q({checks:[],typeName:Ee.ZodString,coerce:e?.coerce??!1,...w(e)});class H extends b{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)!==n.number){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.number,received:t.parsedType}),h}let t;const a=new l;for(const n of this._def.checks)if("int"===n.kind)s.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),u(t,{code:i.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==W(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),u(t,{code:i.not_finite,message:n.message}),a.dirty()):s.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,a){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(a)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.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&&s.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}H.create=e=>new H({checks:[],typeName:Ee.ZodNumber,coerce:e?.coerce||!1,...w(e)});class B extends b{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)!==n.bigint)return this._getInvalidInput(e);let t;const a=new l;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),u(t,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):s.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,a){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(a)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}}B.create=e=>new B({checks:[],typeName:Ee.ZodBigInt,coerce:e?.coerce??!1,...w(e)});class J extends b{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==n.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),h}return m(e.data)}}J.create=e=>new J({typeName:Ee.ZodBoolean,coerce:e?.coerce||!1,...w(e)});class G extends b{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==n.date){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.date,received:t.parsedType}),h}if(Number.isNaN(e.data.getTime())){return u(this._getOrReturnCtx(e),{code:i.invalid_date}),h}const t=new l;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:i.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:i.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):s.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}}G.create=e=>new G({checks:[],coerce:e?.coerce||!1,typeName:Ee.ZodDate,...w(e)});class Y extends b{_parse(e){if(this._getType(e)!==n.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),h}return m(e.data)}}Y.create=e=>new Y({typeName:Ee.ZodSymbol,...w(e)});class X extends b{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),h}return m(e.data)}}X.create=e=>new X({typeName:Ee.ZodUndefined,...w(e)});class Q extends b{_parse(e){if(this._getType(e)!==n.null){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),h}return m(e.data)}}Q.create=e=>new Q({typeName:Ee.ZodNull,...w(e)});class ee extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return m(e.data)}}ee.create=e=>new ee({typeName:Ee.ZodAny,...w(e)});class te extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return m(e.data)}}te.create=e=>new te({typeName:Ee.ZodUnknown,...w(e)});class se extends b{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),h}}se.create=e=>new se({typeName:Ee.ZodNever,...w(e)});class ae extends b{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),h}return m(e.data)}}ae.create=e=>new ae({typeName:Ee.ZodVoid,...w(e)});class ne extends b{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==n.array)return u(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),h;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(u(t,{code:e?i.too_big:i.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(u(t,{code:i.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(u(t,{code:i.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>a.type._parseAsync(new x(t,e,t.path,s))))).then((e=>l.mergeArray(s,e)));const r=[...t.data].map(((e,s)=>a.type._parseSync(new x(t,e,t.path,s))));return l.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new ne({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new ne({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new ne({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}function re(e){if(e instanceof ie){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=be.create(re(a))}return new ie({...e._def,shape:()=>t})}return e instanceof ne?new ne({...e._def,type:re(e.element)}):e instanceof be?be.create(re(e.unwrap())):e instanceof Te?Te.create(re(e.unwrap())):e instanceof he?he.create(e.items.map((e=>re(e)))):e}ne.create=(e,t)=>new ne({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ee.ZodArray,...w(t)});class ie extends b{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=s.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==n.object){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),h}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),o=[];if(!(this._def.catchall instanceof se&&"strip"===this._def.unknownKeys))for(const e in s.data)r.includes(e)||o.push(e);const d=[];for(const e of r){const t=a[e],n=s.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new x(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof se){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)o.length>0&&(u(s,{code:i.unrecognized_keys,keys:o}),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 o){const a=s.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new x(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>l.mergeObjectSync(t,e))):l.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new ie({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return"unrecognized_keys"===t.code?{message:v.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ee.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ie({...this._def,catchall:e})}pick(e){const t={};for(const a of s.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new ie({...this._def,shape:()=>t})}omit(e){const t={};for(const a of s.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new ie({...this._def,shape:()=>t})}deepPartial(){return re(this)}partial(e){const t={};for(const a of s.objectKeys(this.shape)){const s=this.shape[a];e&&!e[a]?t[a]=s:t[a]=s.optional()}return new ie({...this._def,shape:()=>t})}required(e){const t={};for(const a of s.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof be;)e=e._def.innerType;t[a]=e}return new ie({...this._def,shape:()=>t})}keyof(){return ye(s.objectKeys(this.shape))}}ie.create=(e,t)=>new ie({shape:()=>e,unknownKeys:"strip",catchall:se.create(),typeName:Ee.ZodObject,...w(t)}),ie.strictCreate=(e,t)=>new ie({shape:()=>e,unknownKeys:"strict",catchall:se.create(),typeName:Ee.ZodObject,...w(t)}),ie.lazycreate=(e,t)=>new ie({shape:e,unknownKeys:"strip",catchall:se.create(),typeName:Ee.ZodObject,...w(t)});class oe extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).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 s=e.map((e=>new o(e.ctx.common.issues)));return u(t,{code:i.invalid_union,unionErrors:s}),h}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new o(e)));return u(t,{code:i.invalid_union,unionErrors:n}),h}}get options(){return this._def.options}}oe.create=(e,t)=>new oe({options:e,typeName:Ee.ZodUnion,...w(t)});const de=e=>e instanceof _e?de(e.schema):e instanceof we?de(e.innerType()):e instanceof ge?[e.value]:e instanceof ve?e.options:e instanceof xe?s.objectValues(e.enum):e instanceof Oe?de(e._def.innerType):e instanceof X?[void 0]:e instanceof Q?[null]:e instanceof be?[void 0,...de(e.unwrap())]:e instanceof Te?[null,...de(e.unwrap())]:e instanceof Ae||e instanceof Ie?de(e.unwrap()):e instanceof Ce?de(e._def.innerType):[];class ce extends b{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return u(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),h;const s=this.discriminator,a=t.data[s],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=de(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new ce({typeName:Ee.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...w(s)})}}function ue(e,t){const a=r(e),i=r(t);if(e===t)return{valid:!0,data:e};if(a===n.object&&i===n.object){const a=s.objectKeys(t),n=s.objectKeys(e).filter((e=>-1!==a.indexOf(e))),r={...e,...t};for(const s of n){const a=ue(e[s],t[s]);if(!a.valid)return{valid:!1};r[s]=a.data}return{valid:!0,data:r}}if(a===n.array&&i===n.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const n=ue(e[a],t[a]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return a===n.date&&i===n.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class le extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(f(e)||f(a))return h;const n=ue(e.value,a.value);return n.valid?((_(e)||_(a))&&t.dirty(),{status:t.value,value:n.data}):(u(s,{code:i.invalid_intersection_types}),h)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}le.create=(e,t,s)=>new le({left:e,right:t,typeName:Ee.ZodIntersection,...w(s)});class he extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==n.array)return u(s,{code:i.invalid_type,expected:n.array,received:s.parsedType}),h;if(s.data.length<this._def.items.length)return u(s,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new x(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(a).then((e=>l.mergeArray(t,e))):l.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new he({...this._def,rest:e})}}he.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:e,typeName:Ee.ZodTuple,rest:null,...w(t)})};class pe extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==n.object)return u(s,{code:i.invalid_type,expected:n.object,received:s.parsedType}),h;const a=[],r=this._def.keyType,o=this._def.valueType;for(const e in s.data)a.push({key:r._parse(new x(s,e,s.path,e)),value:o._parse(new x(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?l.mergeObjectAsync(t,a):l.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return new pe(t instanceof b?{keyType:e,valueType:t,typeName:Ee.ZodRecord,...w(s)}:{keyType:q.create(),valueType:e,typeName:Ee.ZodRecord,...w(t)})}}class me extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==n.map)return u(s,{code:i.invalid_type,expected:n.map,received:s.parsedType}),h;const a=this._def.keyType,r=this._def.valueType,o=[...s.data.entries()].map((([e,t],n)=>({key:a._parse(new x(s,e,s.path,[n,"key"])),value:r._parse(new x(s,t,s.path,[n,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of o){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return h;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of o){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return h;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}me.create=(e,t,s)=>new me({valueType:t,keyType:e,typeName:Ee.ZodMap,...w(s)});class fe extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==n.set)return u(s,{code:i.invalid_type,expected:n.set,received:s.parsedType}),h;const a=this._def;null!==a.minSize&&s.data.size<a.minSize.value&&(u(s,{code:i.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&s.data.size>a.maxSize.value&&(u(s,{code:i.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function o(e){const s=new Set;for(const a of e){if("aborted"===a.status)return h;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const d=[...s.data.values()].map(((e,t)=>r._parse(new x(s,e,s.path,t))));return s.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new fe({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new fe({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fe.create=(e,t)=>new fe({valueType:e,minSize:null,maxSize:null,typeName:Ee.ZodSet,...w(t)});class _e extends b{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})}}_e.create=(e,t)=>new _e({getter:e,typeName:Ee.ZodLazy,...w(t)});class ge extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ye(e,t){return new ve({values:e,typeName:Ee.ZodEnum,...w(t)})}ge.create=(e,t)=>new ge({value:e,typeName:Ee.ZodLiteral,...w(t)});class ve extends b{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return u(t,{expected:s.joinValues(a),received:t.parsedType,code:i.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{received:t.data,code:i.invalid_enum_value,options:s}),h}return m(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 ve.create(e,{...this._def,...t})}exclude(e,t=this._def){return ve.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ve.create=ye;class xe extends b{_parse(e){const t=s.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==n.string&&a.parsedType!==n.number){const e=s.objectValues(t);return u(a,{expected:s.joinValues(e),received:a.parsedType,code:i.invalid_type}),h}if(this._cache||(this._cache=new Set(s.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=s.objectValues(t);return u(a,{received:a.data,code:i.invalid_enum_value,options:e}),h}return m(e.data)}get enum(){return this._def.values}}xe.create=(e,t)=>new xe({values:e,typeName:Ee.ZodNativeEnum,...w(t)});class ke extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.promise&&!1===t.common.async)return u(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),h;const s=t.parsedType===n.promise?t.data:Promise.resolve(t.data);return m(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ke.create=(e,t)=>new ke({type:e,typeName:Ee.ZodPromise,...w(t)});class we extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{u(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return h;const s=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===s.status?h:"dirty"===s.status||"dirty"===t.value?p(s.value):s}));{if("aborted"===t.value)return h;const s=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===s.status?h:"dirty"===s.status||"dirty"===t.value?p(s.value):s}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.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===a.common.async){const s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===s.status?h:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((s=>"aborted"===s.status?h:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!g(e))return h;const s=n.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>g(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:t.value,value:e}))):h))}s.assertNever(n)}}we.create=(e,t,s)=>new we({schema:e,typeName:Ee.ZodEffects,effect:t,...w(s)}),we.createWithPreprocess=(e,t,s)=>new we({schema:t,effect:{type:"preprocess",transform:e},typeName:Ee.ZodEffects,...w(s)});class be extends b{_parse(e){return this._getType(e)===n.undefined?m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}be.create=(e,t)=>new be({innerType:e,typeName:Ee.ZodOptional,...w(t)});class Te extends b{_parse(e){return this._getType(e)===n.null?m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(e,t)=>new Te({innerType:e,typeName:Ee.ZodNullable,...w(t)});class Oe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===n.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:Ee.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...w(t)});class Ce extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return y(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new o(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new o(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ce.create=(e,t)=>new Ce({innerType:e,typeName:Ee.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...w(t)});class Se extends b{_parse(e){if(this._getType(e)!==n.nan){const t=this._getOrReturnCtx(e);return u(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),h}return{status:"valid",value:e.data}}}Se.create=e=>new Se({typeName:Ee.ZodNaN,...w(e)});class Ae extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ze extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),p(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})()}{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new Ze({in:e,out:t,typeName:Ee.ZodPipeline})}}class Ie extends b{_parse(e){const t=this._def.innerType._parse(e),s=e=>(g(e)&&(e.value=Object.freeze(e.value)),e);return y(t)?t.then((e=>s(e))):s(t)}unwrap(){return this._def.innerType}}var Ee;Ie.create=(e,t)=>new Ie({innerType:e,typeName:Ee.ZodReadonly,...w(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ee||(Ee={}));const je=q.create,Re=H.create,Pe=J.create,Ne=ee.create,$e=te.create;se.create;const Me=ne.create,Ue=ie.create,ze=oe.create,Le=ce.create;le.create,he.create;const Fe=pe.create,De=ge.create,Ve=ve.create;ke.create;const Ke=be.create;Te.create;const qe="2025-03-26",We="2.0",He=ze([je(),Re().int()]),Be=je(),Je=Ue({progressToken:Ke(He)}).passthrough(),Ge=Ue({_meta:Ke(Je)}).passthrough(),Ye=Ue({method:je(),params:Ke(Ge)}),Xe=Ue({_meta:Ke(Ue({}).passthrough())}).passthrough(),Qe=Ue({method:je(),params:Ke(Xe)}),et=Ue({_meta:Ke(Ue({}).passthrough())}).passthrough(),tt=ze([je(),Re().int()]),st=Ue({jsonrpc:De(We),id:tt}).merge(Ye).strict(),at=Ue({jsonrpc:De(We)}).merge(Qe).strict(),nt=Ue({jsonrpc:De(We),id:tt,result:et}).strict();var rt;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(rt||(rt={}));const it=Ue({jsonrpc:De(We),id:tt,error:Ue({code:Re().int(),message:je(),data:Ke($e())})}).strict(),ot=ze([st,at,nt,it]),dt=et.strict(),ct=Qe.extend({method:De("notifications/cancelled"),params:Xe.extend({requestId:tt,reason:je().optional()})}),ut=Ue({name:je(),version:je()}).passthrough(),lt=Ue({experimental:Ke(Ue({}).passthrough()),sampling:Ke(Ue({}).passthrough()),roots:Ke(Ue({listChanged:Ke(Pe())}).passthrough())}).passthrough(),ht=Ye.extend({method:De("initialize"),params:Ge.extend({protocolVersion:je(),capabilities:lt,clientInfo:ut})}),pt=Ue({experimental:Ke(Ue({}).passthrough()),logging:Ke(Ue({}).passthrough()),completions:Ke(Ue({}).passthrough()),prompts:Ke(Ue({listChanged:Ke(Pe())}).passthrough()),resources:Ke(Ue({subscribe:Ke(Pe()),listChanged:Ke(Pe())}).passthrough()),tools:Ke(Ue({listChanged:Ke(Pe())}).passthrough())}).passthrough(),mt=et.extend({protocolVersion:je(),capabilities:pt,serverInfo:ut,instructions:Ke(je())}),ft=Qe.extend({method:De("notifications/initialized")}),_t=Ye.extend({method:De("ping")}),gt=Ue({progress:Re(),total:Ke(Re()),message:Ke(je())}).passthrough(),yt=Qe.extend({method:De("notifications/progress"),params:Xe.merge(gt).extend({progressToken:He})}),vt=Ye.extend({params:Ge.extend({cursor:Ke(Be)}).optional()}),xt=et.extend({nextCursor:Ke(Be)}),kt=Ue({uri:je(),mimeType:Ke(je())}).passthrough(),wt=kt.extend({text:je()}),bt=kt.extend({blob:je().base64()}),Tt=Ue({uri:je(),name:je(),description:Ke(je()),mimeType:Ke(je())}).passthrough(),Ot=Ue({uriTemplate:je(),name:je(),description:Ke(je()),mimeType:Ke(je())}).passthrough(),Ct=vt.extend({method:De("resources/list")}),St=xt.extend({resources:Me(Tt)}),At=vt.extend({method:De("resources/templates/list")}),Zt=xt.extend({resourceTemplates:Me(Ot)}),It=Ye.extend({method:De("resources/read"),params:Ge.extend({uri:je()})}),Et=et.extend({contents:Me(ze([wt,bt]))}),jt=Qe.extend({method:De("notifications/resources/list_changed")}),Rt=Ye.extend({method:De("resources/subscribe"),params:Ge.extend({uri:je()})}),Pt=Ye.extend({method:De("resources/unsubscribe"),params:Ge.extend({uri:je()})}),Nt=Qe.extend({method:De("notifications/resources/updated"),params:Xe.extend({uri:je()})}),$t=Ue({name:je(),description:Ke(je()),required:Ke(Pe())}).passthrough(),Mt=Ue({name:je(),description:Ke(je()),arguments:Ke(Me($t))}).passthrough(),Ut=vt.extend({method:De("prompts/list")}),zt=xt.extend({prompts:Me(Mt)}),Lt=Ye.extend({method:De("prompts/get"),params:Ge.extend({name:je(),arguments:Ke(Fe(je()))})}),Ft=Ue({type:De("text"),text:je()}).passthrough(),Dt=Ue({type:De("image"),data:je().base64(),mimeType:je()}).passthrough(),Vt=Ue({type:De("audio"),data:je().base64(),mimeType:je()}).passthrough(),Kt=Ue({type:De("resource"),resource:ze([wt,bt])}).passthrough(),qt=Ue({role:Ve(["user","assistant"]),content:ze([Ft,Dt,Vt,Kt])}).passthrough(),Wt=et.extend({description:Ke(je()),messages:Me(qt)}),Ht=Qe.extend({method:De("notifications/prompts/list_changed")}),Bt=Ue({title:Ke(je()),readOnlyHint:Ke(Pe()),destructiveHint:Ke(Pe()),idempotentHint:Ke(Pe()),openWorldHint:Ke(Pe())}).passthrough(),Jt=Ue({name:je(),description:Ke(je()),inputSchema:Ue({type:De("object"),properties:Ke(Ue({}).passthrough()),required:Ke(Me(je()))}).passthrough(),outputSchema:Ke(Ue({type:De("object"),properties:Ke(Ue({}).passthrough()),required:Ke(Me(je()))}).passthrough()),annotations:Ke(Bt)}).passthrough(),Gt=vt.extend({method:De("tools/list")}),Yt=xt.extend({tools:Me(Jt)}),Xt=et.extend({content:Me(ze([Ft,Dt,Vt,Kt])).default([]),structuredContent:Ue({}).passthrough().optional(),isError:Ke(Pe())});Xt.or(et.extend({toolResult:$e()}));const Qt=Ye.extend({method:De("tools/call"),params:Ge.extend({name:je(),arguments:Ke(Fe($e()))})}),es=Qe.extend({method:De("notifications/tools/list_changed")}),ts=Ve(["debug","info","notice","warning","error","critical","alert","emergency"]),ss=Ye.extend({method:De("logging/setLevel"),params:Ge.extend({level:ts})}),as=Qe.extend({method:De("notifications/message"),params:Xe.extend({level:ts,logger:Ke(je()),data:$e()})}),ns=Ue({name:je().optional()}).passthrough(),rs=Ue({hints:Ke(Me(ns)),costPriority:Ke(Re().min(0).max(1)),speedPriority:Ke(Re().min(0).max(1)),intelligencePriority:Ke(Re().min(0).max(1))}).passthrough(),is=Ue({role:Ve(["user","assistant"]),content:ze([Ft,Dt,Vt])}).passthrough(),os=Ye.extend({method:De("sampling/createMessage"),params:Ge.extend({messages:Me(is),systemPrompt:Ke(je()),includeContext:Ke(Ve(["none","thisServer","allServers"])),temperature:Ke(Re()),maxTokens:Re().int(),stopSequences:Ke(Me(je())),metadata:Ke(Ue({}).passthrough()),modelPreferences:Ke(rs)})}),ds=et.extend({model:je(),stopReason:Ke(Ve(["endTurn","stopSequence","maxTokens"]).or(je())),role:Ve(["user","assistant"]),content:Le("type",[Ft,Dt,Vt])}),cs=Ue({type:De("ref/resource"),uri:je()}).passthrough(),us=Ue({type:De("ref/prompt"),name:je()}).passthrough(),ls=Ye.extend({method:De("completion/complete"),params:Ge.extend({ref:ze([us,cs]),argument:Ue({name:je(),value:je()}).passthrough()})}),hs=et.extend({completion:Ue({values:Me(je()).max(100),total:Ke(Re().int()),hasMore:Ke(Pe())}).passthrough()}),ps=Ue({uri:je().startsWith("file://"),name:Ke(je())}).passthrough(),ms=Ye.extend({method:De("roots/list")}),fs=et.extend({roots:Me(ps)}),_s=Qe.extend({method:De("notifications/roots/list_changed")});ze([_t,ht,ls,ss,Lt,Ut,Ct,At,It,Rt,Pt,Qt,Gt]),ze([ct,yt,ft,_s]),ze([dt,ds,fs]),ze([_t,os,ms]),ze([ct,yt,as,Nt,jt,es,Ht]),ze([dt,mt,hs,Wt,zt,St,Zt,Et,Xt,Yt]);const gs=Ue({resource:je().url(),authorization_servers:Me(je().url()).optional(),jwks_uri:je().url().optional(),scopes_supported:Me(je()).optional(),bearer_methods_supported:Me(je()).optional(),resource_signing_alg_values_supported:Me(je()).optional(),resource_name:je().optional(),resource_documentation:je().optional(),resource_policy_uri:je().url().optional(),resource_tos_uri:je().url().optional(),tls_client_certificate_bound_access_tokens:Pe().optional(),authorization_details_types_supported:Me(je()).optional(),dpop_signing_alg_values_supported:Me(je()).optional(),dpop_bound_access_tokens_required:Pe().optional()}).passthrough(),ys=Ue({issuer:je(),authorization_endpoint:je(),token_endpoint:je(),registration_endpoint:je().optional(),scopes_supported:Me(je()).optional(),response_types_supported:Me(je()),response_modes_supported:Me(je()).optional(),grant_types_supported:Me(je()).optional(),token_endpoint_auth_methods_supported:Me(je()).optional(),token_endpoint_auth_signing_alg_values_supported:Me(je()).optional(),service_documentation:je().optional(),revocation_endpoint:je().optional(),revocation_endpoint_auth_methods_supported:Me(je()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Me(je()).optional(),introspection_endpoint:je().optional(),introspection_endpoint_auth_methods_supported:Me(je()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Me(je()).optional(),code_challenge_methods_supported:Me(je()).optional()}).passthrough(),vs=Ue({access_token:je(),token_type:je(),expires_in:Re().optional(),scope:je().optional(),refresh_token:je().optional()}).strip();Ue({error:je(),error_description:je().optional(),error_uri:je().optional()});const xs=Ue({redirect_uris:Me(je()).refine((e=>e.every((e=>URL.canParse(e)))),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:je().optional(),grant_types:Me(je()).optional(),response_types:Me(je()).optional(),client_name:je().optional(),client_uri:je().optional(),logo_uri:je().optional(),scope:je().optional(),contacts:Me(je()).optional(),tos_uri:je().optional(),policy_uri:je().optional(),jwks_uri:je().optional(),jwks:Ne().optional(),software_id:je().optional(),software_version:je().optional()}).strip(),ks=Ue({client_id:je(),client_secret:je().optional(),client_id_issued_at:Re().optional(),client_secret_expires_at:Re().optional()}).strip(),ws=xs.merge(ks);Ue({error:je(),error_description:je().optional()}).strip(),Ue({token:je(),token_type_hint:je().optional()}).strip();class bs extends Error{constructor(e){super(null!=e?e:"Unauthorized")}}async function Ts(e,{serverUrl:s,authorizationCode:a,scope:n,resourceMetadataUrl:r}){let i=s;try{const e=await async function(e,t){var s;let a,n;a=new URL("/.well-known/oauth-protected-resource",e);try{n=await fetch(a,{headers:{"MCP-Protocol-Version":null!==(s=null==t?void 0:t.protocolVersion)&&void 0!==s?s:qe}})}catch(e){if(!(e instanceof TypeError))throw e;n=await fetch(a)}if(404===n.status)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return gs.parse(await n.json())}(r||s);e.authorization_servers&&e.authorization_servers.length>0&&(i=e.authorization_servers[0])}catch(e){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",e)}const o=await async function(e,t){var s;const a=new URL("/.well-known/oauth-authorization-server",e);let n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":null!==(s=null==t?void 0:t.protocolVersion)&&void 0!==s?s:qe}})}catch(e){if(!(e instanceof TypeError))throw e;n=await fetch(a)}if(404===n.status)return;if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return ys.parse(await n.json())}(i);let d=await Promise.resolve(e.clientInformation());if(!d){if(void 0!==a)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const t=await async function(e,{metadata:t,clientMetadata:s}){let a;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(t.registration_endpoint)}else a=new URL("/register",e);const n=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return ws.parse(await n.json())}(i,{metadata:o,clientMetadata:e.clientMetadata});await e.saveClientInformation(t),d=t}if(void 0!==a){const t=await e.codeVerifier(),s=await async function(e,{metadata:t,clientInformation:s,authorizationCode:a,codeVerifier:n,redirectUri:r}){const i="authorization_code";let o;if(t){if(o=new URL(t.token_endpoint),t.grant_types_supported&&!t.grant_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support grant type ${i}`)}else o=new URL("/token",e);const d=new URLSearchParams({grant_type:i,client_id:s.client_id,code:a,code_verifier:n,redirect_uri:String(r)});s.client_secret&&d.set("client_secret",s.client_secret);const c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:d});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return vs.parse(await c.json())}(i,{metadata:o,clientInformation:d,authorizationCode:a,codeVerifier:t,redirectUri:e.redirectUrl});return await e.saveTokens(s),"AUTHORIZED"}const c=await e.tokens();if(null==c?void 0:c.refresh_token)try{const t=await async function(e,{metadata:t,clientInformation:s,refreshToken:a}){const n="refresh_token";let r;if(t){if(r=new URL(t.token_endpoint),t.grant_types_supported&&!t.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else r=new URL("/token",e);const i=new URLSearchParams({grant_type:n,client_id:s.client_id,refresh_token:a});s.client_secret&&i.set("client_secret",s.client_secret);const o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i});if(!o.ok)throw new Error(`Token refresh failed: HTTP ${o.status}`);return vs.parse({refresh_token:a,...await o.json()})}(i,{metadata:o,clientInformation:d,refreshToken:c.refresh_token});return await e.saveTokens(t),"AUTHORIZED"}catch(e){console.error("Could not refresh OAuth tokens:",e)}const u=e.state?await e.state():void 0,{authorizationUrl:l,codeVerifier:h}=await async function(e,{metadata:s,clientInformation:a,redirectUrl:n,scope:r,state:i}){const o="code",d="S256";let c;if(s){if(c=new URL(s.authorization_endpoint),!s.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!s.code_challenge_methods_supported||!s.code_challenge_methods_supported.includes(d))throw new Error(`Incompatible auth server: does not support code challenge method ${d}`)}else c=new URL("/authorize",e);const u=await t(),l=u.code_verifier,h=u.code_challenge;c.searchParams.set("response_type",o),c.searchParams.set("client_id",a.client_id),c.searchParams.set("code_challenge",h),c.searchParams.set("code_challenge_method",d),c.searchParams.set("redirect_uri",String(n)),i&&c.searchParams.set("state",i);r&&c.searchParams.set("scope",r);return{authorizationUrl:c,codeVerifier:l}}(i,{metadata:o,clientInformation:d,state:u,redirectUrl:e.redirectUrl,scope:n||e.clientMetadata.scope});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(l),"REDIRECT"}class Os extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function Cs(e){}function Ss(e){if("function"==typeof e)throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Cs,onError:s=Cs,onRetry:a=Cs,onComment:n}=e;let r,i="",o=!0,d="",c="";function u(e){if(""===e)return d.length>0&&t({id:r,event:c||void 0,data:d.endsWith("\n")?d.slice(0,-1):d}),r=void 0,d="",void(c="");if(e.startsWith(":"))return void(n&&n(e.slice(e.startsWith(": ")?2:1)));const s=e.indexOf(":");if(-1===s)l(e,"",e);else{const t=e.slice(0,s),a=" "===e[s+1]?2:1;l(t,e.slice(s+a),e)}}function l(e,t,n){switch(e){case"event":c=t;break;case"data":d=`${d}${t}\n`;break;case"id":r=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?a(parseInt(t,10)):s(new Os(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:n}));break;default:s(new Os(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:t,line:n}))}}return{feed:function(e){const t=o?e.replace(/^\xEF\xBB\xBF/,""):e,[s,a]=function(e){const t=[];let s="",a=0;for(;a<e.length;){const n=e.indexOf("\r",a),r=e.indexOf("\n",a);let i=-1;if(-1!==n&&-1!==r?i=Math.min(n,r):-1!==n?i=n:-1!==r&&(i=r),-1===i){s=e.slice(a);break}{const s=e.slice(a,i);t.push(s),a=i+1,"\r"===e[a-1]&&"\n"===e[a]&&a++}}return[t,s]}(`${i}${t}`);for(const e of s)u(e);i=a,o=!1},reset:function(e={}){i&&e.consume&&u(i),o=!0,r=void 0,d="",c="",i=""}}}class As extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let a;super({start(n){a=Ss({onEvent:e=>{n.enqueue(e)},onError(t){"terminate"===e?n.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:s})},transform(e){a.feed(e)}})}}const Zs={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Is extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class Es{constructor(e,t){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=null==t?void 0:t.requestInit,this._authProvider=null==t?void 0:t.authProvider,this._sessionId=null==t?void 0:t.sessionId,this._reconnectionOptions=null!==(s=null==t?void 0:t.reconnectionOptions)&&void 0!==s?s:Zs}async _authThenStart(){var e;if(!this._authProvider)throw new bs("No auth provider");let t;try{t=await Ts(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(t){throw null===(e=this.onerror)||void 0===e||e.call(this,t),t}if("AUTHORIZED"!==t)throw new bs;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const t={};if(this._authProvider){const e=await this._authProvider.tokens();e&&(t.Authorization=`Bearer ${e.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...null===(e=this._requestInit)||void 0===e?void 0:e.headers})}async _startOrAuthSse(e){var t,s;const{resumptionToken:a}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),a&&s.set("last-event-id",a);const n=await fetch(this._url,{method:"GET",headers:s,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal});if(!n.ok){if(401===n.status&&this._authProvider)return await this._authThenStart();if(405===n.status)return;throw new Is(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,e)}catch(e){throw null===(s=this.onerror)||void 0===s||s.call(this,e),e}}_getNextReconnectionDelay(e){const t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),a)}_scheduleReconnection(e,t=0){var s;const a=this._reconnectionOptions.maxRetries;if(a>0&&t>=a)return void(null===(s=this.onerror)||void 0===s||s.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`)));const n=this._getNextReconnectionDelay(t);setTimeout((()=>{this._startOrAuthSse(e).catch((s=>{var a;null===(a=this.onerror)||void 0===a||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,t+1)}))}),n)}_handleSseStream(e,t){if(!e)return;const{onresumptiontoken:s,replayMessageId:a}=t;let n;(async()=>{var t,r,i,o,d;try{const i=e.pipeThrough(new TextDecoderStream).pipeThrough(new As).getReader();for(;;){const{value:e,done:o}=await i.read();if(o)break;if(e.id&&(n=e.id,null==s||s(e.id)),!e.event||"message"===e.event)try{const s=ot.parse(JSON.parse(e.data));void 0!==a&&(d=s,nt.safeParse(d).success)&&(s.id=a),null===(t=this.onmessage)||void 0===t||t.call(this,s)}catch(e){null===(r=this.onerror)||void 0===r||r.call(this,e)}}}catch(e){if(null===(i=this.onerror)||void 0===i||i.call(this,new Error(`SSE stream disconnected: ${e}`)),this._abortController&&!this._abortController.signal.aborted&&void 0!==n)try{this._scheduleReconnection({resumptionToken:n,onresumptiontoken:s,replayMessageId:a},0)}catch(e){null===(o=this.onerror)||void 0===o||o.call(this,new Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new bs("No auth provider");if("AUTHORIZED"!==await Ts(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl}))throw new bs("Failed to authorize")}async close(){var e,t;null===(e=this._abortController)||void 0===e||e.abort(),null===(t=this.onclose)||void 0===t||t.call(this)}async send(e,t){var s,a,n,r;try{const{resumptionToken:n,onresumptiontoken:i}=t||{};if(n)return void this._startOrAuthSse({resumptionToken:n,replayMessageId:(r=e,st.safeParse(r).success?e.id:void 0)}).catch((e=>{var t;return null===(t=this.onerror)||void 0===t?void 0:t.call(this,e)}));const o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");const d={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:null===(s=this._abortController)||void 0===s?void 0:s.signal},c=await fetch(this._url,d),u=c.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!c.ok){if(401===c.status&&this._authProvider){this._resourceMetadataUrl=function(e){const t=e.headers.get("WWW-Authenticate");if(!t)return;const[s,a]=t.split(" ");if("bearer"!==s.toLowerCase()||!a)return void console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");const n=/resource_metadata="([^"]*)"/.exec(t);if(n)try{return new URL(n[1])}catch(e){return void console.log("Invalid resource metadata url: ",n[1])}}(c);if("AUTHORIZED"!==await Ts(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl}))throw new bs;return this.send(e)}const t=await c.text().catch((()=>null));throw new Error(`Error POSTing to endpoint (HTTP ${c.status}): ${t}`)}if(202===c.status)return void((e=>ft.safeParse(e).success)(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch((e=>{var t;return null===(t=this.onerror)||void 0===t?void 0:t.call(this,e)})));const l=(Array.isArray(e)?e:[e]).filter((e=>"method"in e&&"id"in e&&void 0!==e.id)).length>0,h=c.headers.get("content-type");if(l)if(null==h?void 0:h.includes("text/event-stream"))this._handleSseStream(c.body,{onresumptiontoken:i});else{if(!(null==h?void 0:h.includes("application/json")))throw new Is(-1,`Unexpected content type: ${h}`);{const e=await c.json(),t=Array.isArray(e)?e.map((e=>ot.parse(e))):[ot.parse(e)];for(const e of t)null===(a=this.onmessage)||void 0===a||a.call(this,e)}}}catch(e){throw null===(n=this.onerror)||void 0===n||n.call(this,e),e}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{const t=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:t,signal:null===(e=this._abortController)||void 0===e?void 0:e.signal},a=await fetch(this._url,s);if(!a.ok&&405!==a.status)throw new Is(a.status,`Failed to terminate session: ${a.statusText}`);this._sessionId=void 0}catch(e){throw null===(t=this.onerror)||void 0===t||t.call(this,e),e}}}class js{static async init(t){if(!(null==t?void 0:t.apiKey))throw new Error("MboaAI-SDK: apiKey is required");if(js.ready)return;const{apiKey:s,mcpUrl:a="https://api.filparty.com:8001/mcp",name:n="MboaAI-SDK",version:r="1.0.0",defaultType:i="standard"}=t;js.client=new e({name:n,version:r}),await js.client.connect(new Es(new URL(a),{requestInit:{headers:{"x-api-key":s}}})),js.apiKey=s,js.defaultType=i,js.ready=!0}static async translate(e,t,s){var a,n,r;if(!js.ready)throw new Error("MboaAI-SDK: call init() first");const i=`Translate "${e}" into ${t} for ${null!=s?s:js.defaultType}`;try{const t=await js.client.callTool({name:"run_translate",arguments:{message:i,api_key:js.apiKey}}),s=String(null!==(r=null===(n=null===(a=null==t?void 0:t.content)||void 0===a?void 0:a[0])||void 0===n?void 0:n.text)&&void 0!==r?r:"");if((e=>{const t=e.trim().charAt(0);return"{"===t||"["===t})(s))try{const t=JSON.parse(s);return t.reply||t.text||e}catch(e){}return s||e}catch(t){return console.error("[MboaAI-SDK] translate error → returning source",t),e}}}js.ready=!1,js.defaultType="standard",js.apiKey="","undefined"!=typeof window&&(window.MboaAI=window.MboaAI||{},window.MboaAI.T=js);export{js as T,js as default};
1
+ var e,t;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.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},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const r=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return r.undefined;case"string":return r.string;case"number":return Number.isNaN(e)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":return Array.isArray(e)?r.array:null===e?r.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?r.promise:"undefined"!=typeof Map&&e instanceof Map?r.map:"undefined"!=typeof Set&&e instanceof Set?r.set:"undefined"!=typeof Date&&e instanceof Date?r.date:r.object;default:return r.unknown}},s=e.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 i 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:[]},a=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){const r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}i.create=e=>new i(e);const o=(t,a)=>{let i;switch(t.code){case s.invalid_type:i=t.received===r.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case s.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:i=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case s.invalid_union:i="Invalid input";break;case s.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case s.invalid_enum_value:i=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case s.invalid_arguments:i="Invalid function arguments";break;case s.invalid_return_type:i="Invalid function return type";break;case s.invalid_date:i="Invalid date";break;case s.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(i=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(i=`${i} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?i=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?i=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):i="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case s.too_small:i="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case s.too_big:i="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case s.custom:i="Invalid input";break;case s.invalid_intersection_types:i="Intersection results could not be merged";break;case s.not_multiple_of:i=`Number must be a multiple of ${t.multipleOf}`;break;case s.not_finite:i="Number must be finite";break;default:i=a.defaultError,e.assertNever(t)}return{message:i}};let n=o;function l(e,t){const r=n,a=(e=>{const{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],o={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let n="";const l=a.filter((e=>!!e)).slice().reverse();for(const e of l)n=e(o,{data:t,defaultError:n}).message;return{...s,path:i,message:n}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===o?void 0:o].filter((e=>!!e))});e.common.issues.push(a)}class d{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 a of t){if("aborted"===a.status)return u;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return d.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:s}=a;if("aborted"===t.status)return u;if("aborted"===s.status)return u;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!a.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const u=Object.freeze({status:"aborted"}),c=e=>({status:"dirty",value:e}),h=e=>({status:"valid",value:e}),p=e=>"aborted"===e.status,m=e=>"dirty"===e.status,f=e=>"valid"===e.status,v=e=>"undefined"!=typeof Promise&&e instanceof Promise;var g;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(g||(g={}));class y{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const _=(e,t)=>{if(f(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 i(e.common.issues);return this._error=t,this._error}}};function b(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class P{get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(v(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:a(e)},s=this._parseSync({data:e,path:r.path,parent:r});return _(r,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return f(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>f(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:a(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(v(s)?s:Promise.resolve(s));return _(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),o=()=>a.addIssue({code:s.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(o(),!1))):!!i||(o(),!1)}))}refinement(e,t){return this._refinement(((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1)))}_refinement(e){return new be({schema:this,typeName:Re.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 Pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return _e.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new be({...b(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ee({...b(this._def),innerType:this,defaultValue:t,typeName:Re.ZodDefault})}brand(){return new ke({typeName:Re.ZodBranded,type:this,...b(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new xe({...b(this._def),innerType:this,catchValue:t,typeName:Re.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Oe.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const w=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,x=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S=/^[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,k=/^[a-z0-9_-]{21}$/i,O=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$=/^[-+]?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)?)??$/,R=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let j;const C=/^(?:(?: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])$/,T=/^(?:(?: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])$/,F=/^(([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]))$/,I=/^(([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])$/,A=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,N="((\\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])))",q=new RegExp(`^${N}$`);function L(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 Z(e){let t=`${N}T${L(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 z(e,t){if(!O.test(e))return!1;try{const[r]=e.split("."),a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===s?.typ)&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function V(e,t){return!("v4"!==t&&t||!T.test(e))||!("v6"!==t&&t||!I.test(e))}class M extends P{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==r.string){const e=this._getOrReturnCtx(t);return l(e,{code:s.invalid_type,expected:r.string,received:e.parsedType}),u}const a=new d;let i;for(const r of this._def.checks)if("min"===r.kind)t.data.length<r.value&&(i=this._getOrReturnCtx(t,i),l(i,{code:s.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("max"===r.kind)t.data.length>r.value&&(i=this._getOrReturnCtx(t,i),l(i,{code:s.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("length"===r.kind){const e=t.data.length>r.value,o=t.data.length<r.value;(e||o)&&(i=this._getOrReturnCtx(t,i),e?l(i,{code:s.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&l(i,{code:s.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),a.dirty())}else if("email"===r.kind)R.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"email",code:s.invalid_string,message:r.message}),a.dirty());else if("emoji"===r.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"emoji",code:s.invalid_string,message:r.message}),a.dirty());else if("uuid"===r.kind)S.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"uuid",code:s.invalid_string,message:r.message}),a.dirty());else if("nanoid"===r.kind)k.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"nanoid",code:s.invalid_string,message:r.message}),a.dirty());else if("cuid"===r.kind)w.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"cuid",code:s.invalid_string,message:r.message}),a.dirty());else if("cuid2"===r.kind)E.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"cuid2",code:s.invalid_string,message:r.message}),a.dirty());else if("ulid"===r.kind)x.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"ulid",code:s.invalid_string,message:r.message}),a.dirty());else if("url"===r.kind)try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),l(i,{validation:"url",code:s.invalid_string,message:r.message}),a.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"regex",code:s.invalid_string,message:r.message}),a.dirty())}else if("trim"===r.kind)t.data=t.data.trim();else if("includes"===r.kind)t.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),a.dirty());else if("toLowerCase"===r.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===r.kind)t.data=t.data.toUpperCase();else if("startsWith"===r.kind)t.data.startsWith(r.value)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:{startsWith:r.value},message:r.message}),a.dirty());else if("endsWith"===r.kind)t.data.endsWith(r.value)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:{endsWith:r.value},message:r.message}),a.dirty());else if("datetime"===r.kind){Z(r).test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:"datetime",message:r.message}),a.dirty())}else if("date"===r.kind){q.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:"date",message:r.message}),a.dirty())}else if("time"===r.kind){new RegExp(`^${L(r)}$`).test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{code:s.invalid_string,validation:"time",message:r.message}),a.dirty())}else"duration"===r.kind?$.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"duration",code:s.invalid_string,message:r.message}),a.dirty()):"ip"===r.kind?(o=t.data,("v4"!==(n=r.version)&&n||!C.test(o))&&("v6"!==n&&n||!F.test(o))&&(i=this._getOrReturnCtx(t,i),l(i,{validation:"ip",code:s.invalid_string,message:r.message}),a.dirty())):"jwt"===r.kind?z(t.data,r.alg)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"jwt",code:s.invalid_string,message:r.message}),a.dirty()):"cidr"===r.kind?V(t.data,r.version)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"cidr",code:s.invalid_string,message:r.message}),a.dirty()):"base64"===r.kind?A.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"base64",code:s.invalid_string,message:r.message}),a.dirty()):"base64url"===r.kind?D.test(t.data)||(i=this._getOrReturnCtx(t,i),l(i,{validation:"base64url",code:s.invalid_string,message:r.message}),a.dirty()):e.assertNever(r);var o,n;return{status:a.value,value:t.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:s.invalid_string,...g.errToObj(r)})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new M({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new M({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new M({...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 H(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}M.create=e=>new M({checks:[],typeName:Re.ZodString,coerce:e?.coerce??!1,...b(e)});class U extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==r.number){const e=this._getOrReturnCtx(t);return l(e,{code:s.invalid_type,expected:r.number,received:e.parsedType}),u}let a;const i=new d;for(const r of this._def.checks)if("int"===r.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:s.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty());else if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty())}else"multipleOf"===r.kind?0!==H(t.data,r.value)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:s.not_finite,message:r.message}),i.dirty()):e.assertNever(r);return{status:i.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,a){return new U({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.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)}}U.create=e=>new U({checks:[],typeName:Re.ZodNumber,coerce:e?.coerce||!1,...b(e)});class Q extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==r.bigint)return this._getInvalidInput(t);let a;const i=new d;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty())}else"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),l(a,{code:s.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):e.assertNever(r);return{status:i.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.bigint,received:t.parsedType}),u}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,r,a){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:g.toString(a)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}Q.create=e=>new Q({checks:[],typeName:Re.ZodBigInt,coerce:e?.coerce??!1,...b(e)});class K extends P{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==r.boolean){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.boolean,received:t.parsedType}),u}return h(e.data)}}K.create=e=>new K({typeName:Re.ZodBoolean,coerce:e?.coerce||!1,...b(e)});class B extends P{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==r.date){const e=this._getOrReturnCtx(t);return l(e,{code:s.invalid_type,expected:r.date,received:e.parsedType}),u}if(Number.isNaN(t.data.getTime())){return l(this._getOrReturnCtx(t),{code:s.invalid_date}),u}const a=new d;let i;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()<r.value&&(i=this._getOrReturnCtx(t,i),l(i,{code:s.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),a.dirty()):"max"===r.kind?t.data.getTime()>r.value&&(i=this._getOrReturnCtx(t,i),l(i,{code:s.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),a.dirty()):e.assertNever(r);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}B.create=e=>new B({checks:[],coerce:e?.coerce||!1,typeName:Re.ZodDate,...b(e)});class J extends P{_parse(e){if(this._getType(e)!==r.symbol){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.symbol,received:t.parsedType}),u}return h(e.data)}}J.create=e=>new J({typeName:Re.ZodSymbol,...b(e)});class W extends P{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.undefined,received:t.parsedType}),u}return h(e.data)}}W.create=e=>new W({typeName:Re.ZodUndefined,...b(e)});class G extends P{_parse(e){if(this._getType(e)!==r.null){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.null,received:t.parsedType}),u}return h(e.data)}}G.create=e=>new G({typeName:Re.ZodNull,...b(e)});class Y extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return h(e.data)}}Y.create=e=>new Y({typeName:Re.ZodAny,...b(e)});class X extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return h(e.data)}}X.create=e=>new X({typeName:Re.ZodUnknown,...b(e)});class ee extends P{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.never,received:t.parsedType}),u}}ee.create=e=>new ee({typeName:Re.ZodNever,...b(e)});class te extends P{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.void,received:t.parsedType}),u}return h(e.data)}}te.create=e=>new te({typeName:Re.ZodVoid,...b(e)});class re extends P{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),i=this._def;if(t.parsedType!==r.array)return l(t,{code:s.invalid_type,expected:r.array,received:t.parsedType}),u;if(null!==i.exactLength){const e=t.data.length>i.exactLength.value,r=t.data.length<i.exactLength.value;(e||r)&&(l(t,{code:e?s.too_big:s.too_small,minimum:r?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(null!==i.minLength&&t.data.length<i.minLength.value&&(l(t,{code:s.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),null!==i.maxLength&&t.data.length>i.maxLength.value&&(l(t,{code:s.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>i.type._parseAsync(new y(t,e,t.path,r))))).then((e=>d.mergeArray(a,e)));const o=[...t.data].map(((e,r)=>i.type._parseSync(new y(t,e,t.path,r))));return d.mergeArray(a,o)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}function ae(e){if(e instanceof se){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=Pe.create(ae(a))}return new se({...e._def,shape:()=>t})}return e instanceof re?new re({...e._def,type:ae(e.element)}):e instanceof Pe?Pe.create(ae(e.unwrap())):e instanceof we?we.create(ae(e.unwrap())):e instanceof ue?ue.create(e.items.map((e=>ae(e)))):e}re.create=(e,t)=>new re({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...b(t)});class se extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),r=e.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(e){if(this._getType(e)!==r.object){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.object,received:t.parsedType}),u}const{status:t,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),n=[];if(!(this._def.catchall instanceof ee&&"strip"===this._def.unknownKeys))for(const e in a.data)o.includes(e)||n.push(e);const c=[];for(const e of o){const t=i[e],r=a.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new y(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ee){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of n)c.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)n.length>0&&(l(a,{code:s.unrecognized_keys,keys:n}),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 n){const r=a.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new y(a,r,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of c){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>d.mergeObjectSync(t,e))):d.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new se({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:g.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new se({...this._def,unknownKeys:"strip"})}passthrough(){return new se({...this._def,unknownKeys:"passthrough"})}extend(e){return new se({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new se({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new se({...this._def,catchall:e})}pick(t){const r={};for(const a of e.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new se({...this._def,shape:()=>r})}omit(t){const r={};for(const a of e.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new se({...this._def,shape:()=>r})}deepPartial(){return ae(this)}partial(t){const r={};for(const a of e.objectKeys(this.shape)){const e=this.shape[a];t&&!t[a]?r[a]=e:r[a]=e.optional()}return new se({...this._def,shape:()=>r})}required(t){const r={};for(const a of e.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Pe;)e=e._def.innerType;r[a]=e}return new se({...this._def,shape:()=>r})}keyof(){return ve(e.objectKeys(this.shape))}}se.create=(e,t)=>new se({shape:()=>e,unknownKeys:"strip",catchall:ee.create(),typeName:Re.ZodObject,...b(t)}),se.strictCreate=(e,t)=>new se({shape:()=>e,unknownKeys:"strict",catchall:ee.create(),typeName:Re.ZodObject,...b(t)}),se.lazycreate=(e,t)=>new se({shape:e,unknownKeys:"strip",catchall:ee.create(),typeName:Re.ZodObject,...b(t)});class ie extends P{_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 r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new i(e.ctx.common.issues)));return l(t,{code:s.invalid_union,unionErrors:r}),u}));{let e;const a=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=a.map((e=>new i(e)));return l(t,{code:s.invalid_union,unionErrors:o}),u}}get options(){return this._def.options}}ie.create=(e,t)=>new ie({options:e,typeName:Re.ZodUnion,...b(t)});const oe=t=>t instanceof me?oe(t.schema):t instanceof be?oe(t.innerType()):t instanceof fe?[t.value]:t instanceof ge?t.options:t instanceof ye?e.objectValues(t.enum):t instanceof Ee?oe(t._def.innerType):t instanceof W?[void 0]:t instanceof G?[null]:t instanceof Pe?[void 0,...oe(t.unwrap())]:t instanceof we?[null,...oe(t.unwrap())]:t instanceof ke||t instanceof $e?oe(t.unwrap()):t instanceof xe?oe(t._def.innerType):[];class ne extends P{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.object)return l(t,{code:s.invalid_type,expected:r.object,received:t.parsedType}),u;const a=this.discriminator,i=t.data[a],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),u)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const r of t){const t=oe(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new ne({typeName:Re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...b(r)})}}function le(t,s){const i=a(t),o=a(s);if(t===s)return{valid:!0,data:t};if(i===r.object&&o===r.object){const r=e.objectKeys(s),a=e.objectKeys(t).filter((e=>-1!==r.indexOf(e))),i={...t,...s};for(const e of a){const r=le(t[e],s[e]);if(!r.valid)return{valid:!1};i[e]=r.data}return{valid:!0,data:i}}if(i===r.array&&o===r.array){if(t.length!==s.length)return{valid:!1};const e=[];for(let r=0;r<t.length;r++){const a=le(t[r],s[r]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return i===r.date&&o===r.date&&+t===+s?{valid:!0,data:t}:{valid:!1}}class de extends P{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(p(e)||p(a))return u;const i=le(e.value,a.value);return i.valid?((m(e)||m(a))&&t.dirty(),{status:t.value,value:i.data}):(l(r,{code:s.invalid_intersection_types}),u)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}de.create=(e,t,r)=>new de({left:e,right:t,typeName:Re.ZodIntersection,...b(r)});class ue extends P{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.array)return l(a,{code:s.invalid_type,expected:r.array,received:a.parsedType}),u;if(a.data.length<this._def.items.length)return l(a,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u;!this._def.rest&&a.data.length>this._def.items.length&&(l(a,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...a.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new y(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(i).then((e=>d.mergeArray(t,e))):d.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ue({...this._def,rest:e})}}ue.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ue({items:e,typeName:Re.ZodTuple,rest:null,...b(t)})};class ce extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.object)return l(a,{code:s.invalid_type,expected:r.object,received:a.parsedType}),u;const i=[],o=this._def.keyType,n=this._def.valueType;for(const e in a.data)i.push({key:o._parse(new y(a,e,a.path,e)),value:n._parse(new y(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?d.mergeObjectAsync(t,i):d.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return new ce(t instanceof P?{keyType:e,valueType:t,typeName:Re.ZodRecord,...b(r)}:{keyType:M.create(),valueType:e,typeName:Re.ZodRecord,...b(t)})}}class he extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.map)return l(a,{code:s.invalid_type,expected:r.map,received:a.parsedType}),u;const i=this._def.keyType,o=this._def.valueType,n=[...a.data.entries()].map((([e,t],r)=>({key:i._parse(new y(a,e,a.path,[r,"key"])),value:o._parse(new y(a,t,a.path,[r,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of n){const a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return u;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of n){const a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return u;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}he.create=(e,t,r)=>new he({valueType:t,keyType:e,typeName:Re.ZodMap,...b(r)});class pe extends P{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.set)return l(a,{code:s.invalid_type,expected:r.set,received:a.parsedType}),u;const i=this._def;null!==i.minSize&&a.data.size<i.minSize.value&&(l(a,{code:s.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),null!==i.maxSize&&a.data.size>i.maxSize.value&&(l(a,{code:s.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const o=this._def.valueType;function n(e){const r=new Set;for(const a of e){if("aborted"===a.status)return u;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const d=[...a.data.values()].map(((e,t)=>o._parse(new y(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>n(e))):n(d)}min(e,t){return new pe({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new pe({...this._def,maxSize:{value:e,message:g.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:Re.ZodSet,...b(t)});class me extends P{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})}}me.create=(e,t)=>new me({getter:e,typeName:Re.ZodLazy,...b(t)});class fe extends P{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),u}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ve(e,t){return new ge({values:e,typeName:Re.ZodEnum,...b(t)})}fe.create=(e,t)=>new fe({value:e,typeName:Re.ZodLiteral,...b(t)});class ge extends P{_parse(t){if("string"!=typeof t.data){const r=this._getOrReturnCtx(t),a=this._def.values;return l(r,{expected:e.joinValues(a),received:r.parsedType,code:s.invalid_type}),u}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),r=this._def.values;return l(e,{received:e.data,code:s.invalid_enum_value,options:r}),u}return h(t.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 ge.create(e,{...this._def,...t})}exclude(e,t=this._def){return ge.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ge.create=ve;class ye extends P{_parse(t){const a=e.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==r.string&&i.parsedType!==r.number){const t=e.objectValues(a);return l(i,{expected:e.joinValues(t),received:i.parsedType,code:s.invalid_type}),u}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(a);return l(i,{received:i.data,code:s.invalid_enum_value,options:t}),u}return h(t.data)}get enum(){return this._def.values}}ye.create=(e,t)=>new ye({values:e,typeName:Re.ZodNativeEnum,...b(t)});class _e extends P{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.promise&&!1===t.common.async)return l(t,{code:s.invalid_type,expected:r.promise,received:t.parsedType}),u;const a=t.parsedType===r.promise?t.data:Promise.resolve(t.data);return h(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}_e.create=(e,t)=>new _e({type:e,typeName:Re.ZodPromise,...b(t)});class be extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:a}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:e=>{l(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){const e=s.transform(a.data,i);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===r.value)return u;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?u:"dirty"===t.status||"dirty"===r.value?c(t.value):t}));{if("aborted"===r.value)return u;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?u:"dirty"===t.status||"dirty"===r.value?c(t.value):t}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,i);if(a.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===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?u:("dirty"===t.status&&r.dirty(),e(t.value),{status:r.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((t=>"aborted"===t.status?u:("dirty"===t.status&&r.dirty(),e(t.value).then((()=>({status:r.value,value:t.value}))))))}if("transform"===s.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!f(e))return u;const t=s.transform(e.value,i);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>f(e)?Promise.resolve(s.transform(e.value,i)).then((e=>({status:r.value,value:e}))):u))}e.assertNever(s)}}be.create=(e,t,r)=>new be({schema:e,typeName:Re.ZodEffects,effect:t,...b(r)}),be.createWithPreprocess=(e,t,r)=>new be({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...b(r)});class Pe extends P{_parse(e){return this._getType(e)===r.undefined?h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:Re.ZodOptional,...b(t)});class we extends P{_parse(e){return this._getType(e)===r.null?h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}we.create=(e,t)=>new we({innerType:e,typeName:Re.ZodNullable,...b(t)});class Ee extends P{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===r.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ee.create=(e,t)=>new Ee({innerType:e,typeName:Re.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...b(t)});class xe extends P{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return v(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new i(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new i(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xe.create=(e,t)=>new xe({innerType:e,typeName:Re.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...b(t)});class Se extends P{_parse(e){if(this._getType(e)!==r.nan){const t=this._getOrReturnCtx(e);return l(t,{code:s.invalid_type,expected:r.nan,received:t.parsedType}),u}return{status:"valid",value:e.data}}}Se.create=e=>new Se({typeName:Re.ZodNaN,...b(e)});class ke extends P{_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 Oe extends P{_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?u:"dirty"===e.status?(t.dirty(),c(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?u:"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 Oe({in:e,out:t,typeName:Re.ZodPipeline})}}class $e extends P{_parse(e){const t=this._def.innerType._parse(e),r=e=>(f(e)&&(e.value=Object.freeze(e.value)),e);return v(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}var Re;$e.create=(e,t)=>new $e({innerType:e,typeName:Re.ZodReadonly,...b(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Re||(Re={}));const je=M.create,Ce=U.create,Te=K.create,Fe=X.create;ee.create;const Ie=re.create,Ae=se.create,De=ie.create,Ne=ne.create;de.create,ue.create;const qe=ce.create,Le=fe.create,Ze=ge.create;_e.create;const ze=Pe.create;we.create;const Ve="2025-03-26",Me=[Ve,"2024-11-05","2024-10-07"],He="2.0",Ue=De([je(),Ce().int()]),Qe=je(),Ke=Ae({progressToken:ze(Ue)}).passthrough(),Be=Ae({_meta:ze(Ke)}).passthrough(),Je=Ae({method:je(),params:ze(Be)}),We=Ae({_meta:ze(Ae({}).passthrough())}).passthrough(),Ge=Ae({method:je(),params:ze(We)}),Ye=Ae({_meta:ze(Ae({}).passthrough())}).passthrough(),Xe=De([je(),Ce().int()]),et=Ae({jsonrpc:Le(He),id:Xe}).merge(Je).strict(),tt=Ae({jsonrpc:Le(He)}).merge(Ge).strict(),rt=Ae({jsonrpc:Le(He),id:Xe,result:Ye}).strict(),at=e=>rt.safeParse(e).success;var st;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(st||(st={}));const it=Ae({jsonrpc:Le(He),id:Xe,error:Ae({code:Ce().int(),message:je(),data:ze(Fe())})}).strict();De([et,tt,rt,it]);const ot=Ye.strict(),nt=Ge.extend({method:Le("notifications/cancelled"),params:We.extend({requestId:Xe,reason:je().optional()})}),lt=Ae({name:je(),version:je()}).passthrough(),dt=Ae({experimental:ze(Ae({}).passthrough()),sampling:ze(Ae({}).passthrough()),roots:ze(Ae({listChanged:ze(Te())}).passthrough())}).passthrough(),ut=Je.extend({method:Le("initialize"),params:Be.extend({protocolVersion:je(),capabilities:dt,clientInfo:lt})}),ct=Ae({experimental:ze(Ae({}).passthrough()),logging:ze(Ae({}).passthrough()),completions:ze(Ae({}).passthrough()),prompts:ze(Ae({listChanged:ze(Te())}).passthrough()),resources:ze(Ae({subscribe:ze(Te()),listChanged:ze(Te())}).passthrough()),tools:ze(Ae({listChanged:ze(Te())}).passthrough())}).passthrough(),ht=Ye.extend({protocolVersion:je(),capabilities:ct,serverInfo:lt,instructions:ze(je())}),pt=Ge.extend({method:Le("notifications/initialized")}),mt=Je.extend({method:Le("ping")}),ft=Ae({progress:Ce(),total:ze(Ce()),message:ze(je())}).passthrough(),vt=Ge.extend({method:Le("notifications/progress"),params:We.merge(ft).extend({progressToken:Ue})}),gt=Je.extend({params:Be.extend({cursor:ze(Qe)}).optional()}),yt=Ye.extend({nextCursor:ze(Qe)}),_t=Ae({uri:je(),mimeType:ze(je())}).passthrough(),bt=_t.extend({text:je()}),Pt=_t.extend({blob:je().base64()}),wt=Ae({uri:je(),name:je(),description:ze(je()),mimeType:ze(je())}).passthrough(),Et=Ae({uriTemplate:je(),name:je(),description:ze(je()),mimeType:ze(je())}).passthrough(),xt=gt.extend({method:Le("resources/list")}),St=yt.extend({resources:Ie(wt)}),kt=gt.extend({method:Le("resources/templates/list")}),Ot=yt.extend({resourceTemplates:Ie(Et)}),$t=Je.extend({method:Le("resources/read"),params:Be.extend({uri:je()})}),Rt=Ye.extend({contents:Ie(De([bt,Pt]))}),jt=Ge.extend({method:Le("notifications/resources/list_changed")}),Ct=Je.extend({method:Le("resources/subscribe"),params:Be.extend({uri:je()})}),Tt=Je.extend({method:Le("resources/unsubscribe"),params:Be.extend({uri:je()})}),Ft=Ge.extend({method:Le("notifications/resources/updated"),params:We.extend({uri:je()})}),It=Ae({name:je(),description:ze(je()),required:ze(Te())}).passthrough(),At=Ae({name:je(),description:ze(je()),arguments:ze(Ie(It))}).passthrough(),Dt=gt.extend({method:Le("prompts/list")}),Nt=yt.extend({prompts:Ie(At)}),qt=Je.extend({method:Le("prompts/get"),params:Be.extend({name:je(),arguments:ze(qe(je()))})}),Lt=Ae({type:Le("text"),text:je()}).passthrough(),Zt=Ae({type:Le("image"),data:je().base64(),mimeType:je()}).passthrough(),zt=Ae({type:Le("audio"),data:je().base64(),mimeType:je()}).passthrough(),Vt=Ae({type:Le("resource"),resource:De([bt,Pt])}).passthrough(),Mt=Ae({role:Ze(["user","assistant"]),content:De([Lt,Zt,zt,Vt])}).passthrough(),Ht=Ye.extend({description:ze(je()),messages:Ie(Mt)}),Ut=Ge.extend({method:Le("notifications/prompts/list_changed")}),Qt=Ae({title:ze(je()),readOnlyHint:ze(Te()),destructiveHint:ze(Te()),idempotentHint:ze(Te()),openWorldHint:ze(Te())}).passthrough(),Kt=Ae({name:je(),description:ze(je()),inputSchema:Ae({type:Le("object"),properties:ze(Ae({}).passthrough()),required:ze(Ie(je()))}).passthrough(),outputSchema:ze(Ae({type:Le("object"),properties:ze(Ae({}).passthrough()),required:ze(Ie(je()))}).passthrough()),annotations:ze(Qt)}).passthrough(),Bt=gt.extend({method:Le("tools/list")}),Jt=yt.extend({tools:Ie(Kt)}),Wt=Ye.extend({content:Ie(De([Lt,Zt,zt,Vt])).default([]),structuredContent:Ae({}).passthrough().optional(),isError:ze(Te())});Wt.or(Ye.extend({toolResult:Fe()}));const Gt=Je.extend({method:Le("tools/call"),params:Be.extend({name:je(),arguments:ze(qe(Fe()))})}),Yt=Ge.extend({method:Le("notifications/tools/list_changed")}),Xt=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),er=Je.extend({method:Le("logging/setLevel"),params:Be.extend({level:Xt})}),tr=Ge.extend({method:Le("notifications/message"),params:We.extend({level:Xt,logger:ze(je()),data:Fe()})}),rr=Ae({name:je().optional()}).passthrough(),ar=Ae({hints:ze(Ie(rr)),costPriority:ze(Ce().min(0).max(1)),speedPriority:ze(Ce().min(0).max(1)),intelligencePriority:ze(Ce().min(0).max(1))}).passthrough(),sr=Ae({role:Ze(["user","assistant"]),content:De([Lt,Zt,zt])}).passthrough(),ir=Je.extend({method:Le("sampling/createMessage"),params:Be.extend({messages:Ie(sr),systemPrompt:ze(je()),includeContext:ze(Ze(["none","thisServer","allServers"])),temperature:ze(Ce()),maxTokens:Ce().int(),stopSequences:ze(Ie(je())),metadata:ze(Ae({}).passthrough()),modelPreferences:ze(ar)})}),or=Ye.extend({model:je(),stopReason:ze(Ze(["endTurn","stopSequence","maxTokens"]).or(je())),role:Ze(["user","assistant"]),content:Ne("type",[Lt,Zt,zt])}),nr=Ae({type:Le("ref/resource"),uri:je()}).passthrough(),lr=Ae({type:Le("ref/prompt"),name:je()}).passthrough(),dr=Je.extend({method:Le("completion/complete"),params:Be.extend({ref:De([lr,nr]),argument:Ae({name:je(),value:je()}).passthrough()})}),ur=Ye.extend({completion:Ae({values:Ie(je()).max(100),total:ze(Ce().int()),hasMore:ze(Te())}).passthrough()}),cr=Ae({uri:je().startsWith("file://"),name:ze(je())}).passthrough(),hr=Je.extend({method:Le("roots/list")}),pr=Ye.extend({roots:Ie(cr)}),mr=Ge.extend({method:Le("notifications/roots/list_changed")});De([mt,ut,dr,er,qt,Dt,xt,kt,$t,Ct,Tt,Gt,Bt]),De([nt,vt,pt,mr]),De([ot,or,pr]),De([mt,ir,hr]),De([nt,vt,tr,Ft,jt,Yt,Ut]),De([ot,ht,ur,Ht,Nt,St,Ot,Rt,Wt,Jt]);class fr extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}}class vr{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(nt,(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(mt,(e=>({})))}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_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 fr(st.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){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=e=>{this._onerror(e)},this._transport.onmessage=(e,t)=>{var r;at(e)||(r=e,it.safeParse(r).success)?this._onresponse(e):(e=>et.safeParse(e).success)(e)?this._onrequest(e,t):(e=>tt.safeParse(e).success)(e)?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=new Map,this._progressHandlers.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const r=new fr(st.ConnectionClosed,"Connection closed");for(const e of t.values())e(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,a,s,i;const o=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler;if(void 0===o)return void(null===(a=this._transport)||void 0===a||a.send({jsonrpc:"2.0",id:e.id,error:{code:st.MethodNotFound,message:"Method not found"}}).catch((e=>this._onerror(new Error(`Failed to send an error response: ${e}`)))));const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const l={signal:n.signal,sessionId:null===(s=this._transport)||void 0===s?void 0:s.sessionId,_meta:null===(i=e.params)||void 0===i?void 0:i._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,r,a)=>this.request(t,r,{...a,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id};Promise.resolve().then((()=>o(e,l))).then((t=>{var r;if(!n.signal.aborted)return null===(r=this._transport)||void 0===r?void 0:r.send({result:t,jsonrpc:"2.0",id:e.id})}),(t=>{var r,a;if(!n.signal.aborted)return null===(r=this._transport)||void 0===r?void 0:r.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:st.InternalError,message:null!==(a=t.message)&&void 0!==a?a:"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,a=Number(t),s=this._progressHandlers.get(a);if(!s)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){return void i(e)}s(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),at(e))r(e);else{r(new fr(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:a,resumptionToken:s,onresumptiontoken:i}=null!=r?r:{};return new Promise(((o,n)=>{var l,d,u,c,h,p;if(!this._transport)return void n(new Error("Not connected"));!0===(null===(l=this._options)||void 0===l?void 0:l.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(d=null==r?void 0:r.signal)||void 0===d||d.throwIfAborted();const m=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:m};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(m,r.onprogress),f.params={...e.params,_meta:{...(null===(u=e.params)||void 0===u?void 0:u._meta)||{},progressToken:m}});const v=e=>{var t;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch((e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)))),n(e)};this._responseHandlers.set(m,(e=>{var a;if(!(null===(a=null==r?void 0:r.signal)||void 0===a?void 0:a.aborted)){if(e instanceof Error)return n(e);try{const r=t.parse(e.result);o(r)}catch(e){n(e)}}})),null===(c=null==r?void 0:r.signal)||void 0===c||c.addEventListener("abort",(()=>{var e;v(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(m,g,null==r?void 0:r.maxTotalTimeout,(()=>v(new fr(st.RequestTimeout,"Request timed out",{timeout:g}))),null!==(p=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==p&&p),this._transport.send(f,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch((e=>{this._cleanupTimeout(m),n(e)}))}))}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r={...e,jsonrpc:"2.0"};await this._transport.send(r,t)}setRequestHandler(e,t){const r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,((r,a)=>Promise.resolve(t(e.parse(r),a))))}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)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yr={exports:{}};
2
+ /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */!function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var a=t.length-1,s=1;s<a;++s)t[s]=t[s].slice(1,-1);return t[a]=t[a].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function a(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function s(e){return e.toUpperCase()}function i(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function o(e,t){var r=e;if(t)for(var a in t)r[a]=t[a];return r}function n(e){var a="[A-Za-z]",s="[0-9]",i=t(s,"[A-Fa-f]"),o=r(r("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+r("%[89A-Fa-f]"+i+"%"+i+i)+"|"+r("%"+i+i)),n="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",l=t("[\\:\\/\\?\\#\\[\\]\\@]",n),d=e?"[\\uE000-\\uF8FF]":"[]",u=t(a,s,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");r(a+t(a,s,"[\\+\\-\\.]")+"*"),r(r(o+"|"+t(u,n,"[\\:]"))+"*");var c=r(r("25[0-5]")+"|"+r("2[0-4]"+s)+"|"+r("1"+s+s)+"|"+r("0?[1-9]"+s)+"|0?0?"+s),h=r(c+"\\."+c+"\\."+c+"\\."+c),p=r(i+"{1,4}"),m=r(r(p+"\\:"+p)+"|"+h),f=r(r(p+"\\:")+"{6}"+m),v=r("\\:\\:"+r(p+"\\:")+"{5}"+m),g=r(r(p)+"?\\:\\:"+r(p+"\\:")+"{4}"+m),y=r(r(r(p+"\\:")+"{0,1}"+p)+"?\\:\\:"+r(p+"\\:")+"{3}"+m),_=r(r(r(p+"\\:")+"{0,2}"+p)+"?\\:\\:"+r(p+"\\:")+"{2}"+m),b=r(r(r(p+"\\:")+"{0,3}"+p)+"?\\:\\:"+p+"\\:"+m),P=r(r(r(p+"\\:")+"{0,4}"+p)+"?\\:\\:"+m),w=r(r(r(p+"\\:")+"{0,5}"+p)+"?\\:\\:"+p),E=r(r(r(p+"\\:")+"{0,6}"+p)+"?\\:\\:"),x=r([f,v,g,y,_,b,P,w,E].join("|")),S=r(r(u+"|"+o)+"+");r("[vV]"+i+"+\\."+t(u,n,"[\\:]")+"+"),r(r(o+"|"+t(u,n))+"*");var k=r(o+"|"+t(u,n,"[\\:\\@]"));return r(r(o+"|"+t(u,n,"[\\@]"))+"+"),r(r(k+"|"+t("[\\/\\?]",d))+"*"),{NOT_SCHEME:new RegExp(t("[^]",a,s,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,n),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,n),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,n),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,n),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,n,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,n,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,n),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,l),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+h+")$"),IPV6ADDRESS:new RegExp("^\\[?("+x+")"+r(r("\\%25|\\%(?!"+i+"{2})")+"("+S+")")+"?\\]?$")}}var l=n(!1),d=n(!0),u=function(){function e(e,t){var r=[],a=!0,s=!1,i=void 0;try{for(var o,n=e[Symbol.iterator]();!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{!a&&n.return&&n.return()}finally{if(s)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},h=2147483647,p=36,m=1,f=26,v=38,g=700,y=72,_=128,b="-",P=/^xn--/,w=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=p-m,k=Math.floor,O=String.fromCharCode;function $(e){throw new RangeError(x[e])}function R(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}function j(e,t){var r=e.split("@"),a="";return r.length>1&&(a=r[0]+"@",e=r[1]),a+R((e=e.replace(E,".")).split("."),t).join(".")}function C(e){for(var t=[],r=0,a=e.length;r<a;){var s=e.charCodeAt(r++);if(s>=55296&&s<=56319&&r<a){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&s)<<10)+(1023&i)+65536):(t.push(s),r--)}else t.push(s)}return t}var T=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:p},F=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},I=function(e,t,r){var a=0;for(e=r?k(e/g):e>>1,e+=k(e/t);e>S*f>>1;a+=p)e=k(e/S);return k(a+(S+1)*e/(e+v))},A=function(e){var t=[],r=e.length,a=0,s=_,i=y,o=e.lastIndexOf(b);o<0&&(o=0);for(var n=0;n<o;++n)e.charCodeAt(n)>=128&&$("not-basic"),t.push(e.charCodeAt(n));for(var l=o>0?o+1:0;l<r;){for(var d=a,u=1,c=p;;c+=p){l>=r&&$("invalid-input");var v=T(e.charCodeAt(l++));(v>=p||v>k((h-a)/u))&&$("overflow"),a+=v*u;var g=c<=i?m:c>=i+f?f:c-i;if(v<g)break;var P=p-g;u>k(h/P)&&$("overflow"),u*=P}var w=t.length+1;i=I(a-d,w,0==d),k(a/w)>h-s&&$("overflow"),s+=k(a/w),a%=w,t.splice(a++,0,s)}return String.fromCodePoint.apply(String,t)},D=function(e){var t=[],r=(e=C(e)).length,a=_,s=0,i=y,o=!0,n=!1,l=void 0;try{for(var d,u=e[Symbol.iterator]();!(o=(d=u.next()).done);o=!0){var c=d.value;c<128&&t.push(O(c))}}catch(e){n=!0,l=e}finally{try{!o&&u.return&&u.return()}finally{if(n)throw l}}var v=t.length,g=v;for(v&&t.push(b);g<r;){var P=h,w=!0,E=!1,x=void 0;try{for(var S,R=e[Symbol.iterator]();!(w=(S=R.next()).done);w=!0){var j=S.value;j>=a&&j<P&&(P=j)}}catch(e){E=!0,x=e}finally{try{!w&&R.return&&R.return()}finally{if(E)throw x}}var T=g+1;P-a>k((h-s)/T)&&$("overflow"),s+=(P-a)*T,a=P;var A=!0,D=!1,N=void 0;try{for(var q,L=e[Symbol.iterator]();!(A=(q=L.next()).done);A=!0){var Z=q.value;if(Z<a&&++s>h&&$("overflow"),Z==a){for(var z=s,V=p;;V+=p){var M=V<=i?m:V>=i+f?f:V-i;if(z<M)break;var H=z-M,U=p-M;t.push(O(F(M+H%U,0))),z=k(H/U)}t.push(O(F(z,0))),i=I(s,T,g==v),s=0,++g}}}catch(e){D=!0,N=e}finally{try{!A&&L.return&&L.return()}finally{if(D)throw N}}++s,++a}return t.join("")},N=function(e){return j(e,(function(e){return P.test(e)?A(e.slice(4).toLowerCase()):e}))},q=function(e){return j(e,(function(e){return w.test(e)?"xn--"+D(e):e}))},L={version:"2.1.0",ucs2:{decode:C,encode:function(e){return String.fromCodePoint.apply(String,c(e))}},decode:A,encode:D,toASCII:q,toUnicode:N},Z={};function z(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function V(e){for(var t="",r=0,a=e.length;r<a;){var s=parseInt(e.substr(r+1,2),16);if(s<128)t+=String.fromCharCode(s),r+=3;else if(s>=194&&s<224){if(a-r>=6){var i=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&s)<<6|63&i)}else t+=e.substr(r,6);r+=6}else if(s>=224){if(a-r>=9){var o=parseInt(e.substr(r+4,2),16),n=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&o)<<6|63&n)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function M(e,t){function r(e){var r=V(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,z).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,z).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,z).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,z).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,z).replace(t.PCT_ENCODED,s)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function U(e,t){var r=e.match(t.IPV4ADDRESS)||[],a=u(r,2)[1];return a?a.split(".").map(H).join("."):e}function Q(e,t){var r=e.match(t.IPV6ADDRESS)||[],a=u(r,3),s=a[1],i=a[2];if(s){for(var o=s.toLowerCase().split("::").reverse(),n=u(o,2),l=n[0],d=n[1],c=d?d.split(":").map(H):[],h=l.split(":").map(H),p=t.IPV4ADDRESS.test(h[h.length-1]),m=p?7:8,f=h.length-m,v=Array(m),g=0;g<m;++g)v[g]=c[g]||h[f+g]||"";p&&(v[m-1]=U(v[m-1],t));var y=v.reduce((function(e,t,r){if(!t||"0"===t){var a=e[e.length-1];a&&a.index+a.length===r?a.length++:e.push({index:r,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],_=void 0;if(y&&y.length>1){var b=v.slice(0,y.index),P=v.slice(y.index+y.length);_=b.join(":")+"::"+P.join(":")}else _=v.join(":");return i&&(_+="%"+i),_}return e}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},a=!1!==t.iri?d:l;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(K);if(s){B?(r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5])):(r.scheme=s[1]||void 0,r.userinfo=-1!==e.indexOf("@")?s[3]:void 0,r.host=-1!==e.indexOf("//")?s[4]:void 0,r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=-1!==e.indexOf("?")?s[7]:void 0,r.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),r.host&&(r.host=Q(U(r.host,a),a)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var i=Z[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)M(r,a);else{if(r.host&&(t.domainHost||i&&i.domainHost))try{r.host=L.toASCII(r.host.replace(a.PCT_ENCODED,V).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}M(r,l)}i&&i.parse&&i.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function W(e,t){var r=!1!==t.iri?d:l,a=[];return void 0!==e.userinfo&&(a.push(e.userinfo),a.push("@")),void 0!==e.host&&a.push(Q(U(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(a.push(":"),a.push(String(e.port))),a.length?a.join(""):void 0}var G=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(G))e=e.replace(G,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var a=r[0];e=e.slice(a.length),t.push(a)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?d:l,a=[],s=Z[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?L.toUnicode(e.host):L.toASCII(e.host.replace(r.PCT_ENCODED,V).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}M(e,r),"suffix"!==t.reference&&e.scheme&&(a.push(e.scheme),a.push(":"));var i=W(e,t);if(void 0!==i&&("suffix"!==t.reference&&a.push("//"),a.push(i),e.path&&"/"!==e.path.charAt(0)&&a.push("/")),void 0!==e.path){var o=e.path;t.absolutePath||s&&s.absolutePath||(o=te(o)),void 0===i&&(o=o.replace(/^\/\//,"/%2F")),a.push(o)}return void 0!==e.query&&(a.push("?"),a.push(e.query)),void 0!==e.fragment&&(a.push("#"),a.push(e.fragment)),a.join("")}function ae(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={};return arguments[3]||(e=J(re(e,r),r),t=J(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=te(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=te(t.path||""),a.query=t.query):(t.path?("/"===t.path.charAt(0)?a.path=te(t.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)+t.path:a.path=t.path:a.path="/"+t.path,a.path=te(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function se(e,t,r){var a=o({scheme:"null"},r);return re(ae(J(e,a),J(t,a),a,!0),a)}function ie(e,t){return"string"==typeof e?e=re(J(e,t),t):"object"===a(e)&&(e=J(re(e,t),t)),e}function oe(e,t,r){return"string"==typeof e?e=re(J(e,r),r):"object"===a(e)&&(e=re(e,r)),"string"==typeof t?t=re(J(t,r),r):"object"===a(t)&&(t=re(t,r)),e===t}function ne(e,t){return e&&e.toString().replace(t&&t.iri?d.ESCAPE:l.ESCAPE,z)}function le(e,t){return e&&e.toString().replace(t&&t.iri?d.PCT_ENCODED:l.PCT_ENCODED,V)}var de={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},ue={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function ce(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var he={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=ce(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(ce(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){var r=e.resourceName.split("?"),a=u(r,2),s=a[0],i=a[1];e.path=s&&"/"!==s?s:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},pe={scheme:"wss",domainHost:he.domainHost,parse:he.parse,serialize:he.serialize},me={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ve="[0-9A-Fa-f]",ge=r(r("%[EFef]"+ve+"%"+ve+ve+"%"+ve+ve)+"|"+r("%[89A-Fa-f]"+ve+"%"+ve+ve)+"|"+r("%"+ve+ve)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_e=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),be="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Pe=new RegExp(fe,"g"),we=new RegExp(ge,"g"),Ee=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',_e),"g"),xe=new RegExp(t("[^]",fe,be),"g"),Se=xe;function ke(e){var t=V(e);return t.match(Pe)?t:e}var Oe={scheme:"mailto",parse:function(e,t){var r=e,a=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var s=!1,i={},o=r.query.split("&"),n=0,l=o.length;n<l;++n){var d=o[n].split("=");switch(d[0]){case"to":for(var u=d[1].split(","),c=0,h=u.length;c<h;++c)a.push(u[c]);break;case"subject":r.subject=le(d[1],t);break;case"body":r.body=le(d[1],t);break;default:s=!0,i[le(d[0],t)]=le(d[1],t)}}s&&(r.headers=i)}r.query=void 0;for(var p=0,m=a.length;p<m;++p){var f=a[p].split("@");if(f[0]=le(f[0]),t.unicodeSupport)f[1]=le(f[1],t).toLowerCase();else try{f[1]=L.toASCII(le(f[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}a[p]=f.join("@")}return r},serialize:function(e,t){var r=e,a=i(e.to);if(a){for(var o=0,n=a.length;o<n;++o){var l=String(a[o]),d=l.lastIndexOf("@"),u=l.slice(0,d).replace(we,ke).replace(we,s).replace(Ee,z),c=l.slice(d+1);try{c=t.iri?L.toUnicode(c):L.toASCII(le(c,t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}a[o]=u+"@"+c}r.path=a.join(",")}var h=e.headers=e.headers||{};e.subject&&(h.subject=e.subject),e.body&&(h.body=e.body);var p=[];for(var m in h)h[m]!==me[m]&&p.push(m.replace(we,ke).replace(we,s).replace(xe,z)+"="+h[m].replace(we,ke).replace(we,s).replace(Se,z));return p.length&&(r.query=p.join("&")),r}},$e=/^([^\:]+)\:(.*)/,Re={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match($e),a=e;if(r){var s=t.scheme||a.scheme||"urn",i=r[1].toLowerCase(),o=r[2],n=s+":"+(t.nid||i),l=Z[n];a.nid=i,a.nss=o,a.path=void 0,l&&(a=l.parse(a,t))}else a.error=a.error||"URN can not be parsed.";return a},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",a=e.nid,s=r+":"+(t.nid||a),i=Z[s];i&&(e=i.serialize(e,t));var o=e,n=e.nss;return o.path=(a||t.nid)+":"+n,o}},je=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ce={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(je)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};Z[de.scheme]=de,Z[ue.scheme]=ue,Z[he.scheme]=he,Z[pe.scheme]=pe,Z[Oe.scheme]=Oe,Z[Re.scheme]=Re,Z[Ce.scheme]=Ce,e.SCHEMES=Z,e.pctEncChar=z,e.pctDecChars=V,e.parse=J,e.removeDotSegments=te,e.serialize=re,e.resolveComponents=ae,e.resolve=se,e.normalize=ie,e.equal=oe,e.escapeComponent=ne,e.unescapeComponent=le,Object.defineProperty(e,"__esModule",{value:!0})}(yr.exports);var _r=yr.exports,br=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 a,s,i;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(s=a;0!==s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=a;0!==s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=a;0!==s--;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r},Pr={copy:function(e,t){for(var r in t=t||{},e)t[r]=e[r];return t},checkDataType:wr,checkDataTypes:function(e,t,r){if(1===e.length)return wr(e[0],t,r,!0);var a="",s=xr(e);for(var i in s.array&&s.object&&(a=s.null?"(":"(!"+t+" || ",a+="typeof "+t+' !== "object")',delete s.null,delete s.array,delete s.object),s.number&&delete s.integer,s)a+=(a?" && ":"")+wr(i,t,r,!0);return a},coerceToTypes:function(e,t){if(Array.isArray(t)){for(var r=[],a=0;a<t.length;a++){var s=t[a];(Er[s]||"array"===e&&"array"===s)&&(r[r.length]=s)}if(r.length)return r}else{if(Er[t])return[t];if("array"===e&&"array"===t)return["array"]}},toHash:xr,getProperty:Or,escapeQuotes:$r,equal:br,ucs2length:function(e){for(var t,r=0,a=e.length,s=0;s<a;)r++,(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<a&&56320==(64512&(t=e.charCodeAt(s)))&&s++;return r},varOccurences:function(e,t){t+="[^0-9]";var r=e.match(new RegExp(t,"g"));return r?r.length:0},varReplace:function(e,t,r){return t+="([^0-9])",r=r.replace(/\$/g,"$$$$"),e.replace(new RegExp(t,"g"),r+"$1")},schemaHasRules:function(e,t){if("boolean"==typeof e)return!e;for(var r in e)if(t[r])return!0},schemaHasRulesExcept:function(e,t,r){if("boolean"==typeof e)return!e&&"not"!=r;for(var a in e)if(a!=r&&t[a])return!0},schemaUnknownRules:function(e,t){if("boolean"==typeof e)return;for(var r in e)if(!t[r])return r},toQuotedString:Rr,getPathExpr:function(e,t,r,a){return Tr(e,r?"'/' + "+t+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+t+" + ']'":"'[\\'' + "+t+" + '\\']'")},getPath:function(e,t,r){var a=Rr(r?"/"+Fr(t):Or(t));return Tr(e,a)},getData:function(e,t,r){var a,s,i,o;if(""===e)return"rootData";if("/"==e[0]){if(!jr.test(e))throw new Error("Invalid JSON-pointer: "+e);s=e,i="rootData"}else{if(!(o=e.match(Cr)))throw new Error("Invalid JSON-pointer: "+e);if(a=+o[1],"#"==(s=o[2])){if(a>=t)throw new Error("Cannot access property/index "+a+" levels up, current level is "+t);return r[t-a]}if(a>t)throw new Error("Cannot access data "+a+" levels up, current level is "+t);if(i="data"+(t-a||""),!s)return i}for(var n=i,l=s.split("/"),d=0;d<l.length;d++){var u=l[d];u&&(n+=" && "+(i+=Or(Ir(u))))}return n},unescapeFragment:function(e){return Ir(decodeURIComponent(e))},unescapeJsonPointer:Ir,escapeFragment:function(e){return encodeURIComponent(Fr(e))},escapeJsonPointer:Fr};function wr(e,t,r,a){var s=a?" !== ":" === ",i=a?" || ":" && ",o=a?"!":"",n=a?"":"!";switch(e){case"null":return t+s+"null";case"array":return o+"Array.isArray("+t+")";case"object":return"("+o+t+i+"typeof "+t+s+'"object"'+i+n+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+s+'"number"'+i+n+"("+t+" % 1)"+i+t+s+t+(r?i+o+"isFinite("+t+")":"")+")";case"number":return"(typeof "+t+s+'"'+e+'"'+(r?i+o+"isFinite("+t+")":"")+")";default:return"typeof "+t+s+'"'+e+'"'}}var Er=xr(["string","number","integer","boolean","null"]);function xr(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return t}var Sr=/^[a-z$_][a-z$_0-9]*$/i,kr=/'|\\/g;function Or(e){return"number"==typeof e?"["+e+"]":Sr.test(e)?"."+e:"['"+$r(e)+"']"}function $r(e){return e.replace(kr,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Rr(e){return"'"+$r(e)+"'"}var jr=/^\/(?:[^~]|~0|~1)*$/,Cr=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Tr(e,t){return'""'==e?t:(e+" + "+t).replace(/([^\\])' \+ '/g,"$1")}function Fr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ir(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var Ar=Pr,Dr=function(e){Ar.copy(e,this)};var Nr={exports:{}},qr=Nr.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),Lr(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function Lr(e,t,r,a,s,i,o,n,l,d){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var u in t(a,s,i,o,n,l,d),a){var c=a[u];if(Array.isArray(c)){if(u in qr.arrayKeywords)for(var h=0;h<c.length;h++)Lr(e,t,r,c[h],s+"/"+u+"/"+h,i,s,u,a,h)}else if(u in qr.propsKeywords){if(c&&"object"==typeof c)for(var p in c)Lr(e,t,r,c[p],s+"/"+u+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1"),i,s,u,a,p)}else(u in qr.keywords||e.allKeys&&!(u in qr.skipKeywords))&&Lr(e,t,r,c,s+"/"+u,i,s,u,a)}r(a,s,i,o,n,l,d)}}qr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},qr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},qr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},qr.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};var Zr=Nr.exports,zr=_r,Vr=br,Mr=Pr,Hr=Dr,Ur=Zr,Qr=Kr;function Kr(e,t,r){var a=this._refs[r];if("string"==typeof a){if(!this._refs[a])return Kr.call(this,e,t,a);a=this._refs[a]}if((a=a||this._schemas[r])instanceof Hr)return Xr(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var s,i,o,n=Br.call(this,t,r);return n&&(s=n.schema,t=n.root,o=n.baseId),s instanceof Hr?i=s.validate||e.call(this,s.schema,t,void 0,o):void 0!==s&&(i=Xr(s,this._opts.inlineRefs)?s:e.call(this,s,t,void 0,o)),i}function Br(e,t){var r=zr.parse(t),a=aa(r),s=ra(this._getId(e.schema));if(0===Object.keys(e.schema).length||a!==s){var i=ia(a),o=this._refs[i];if("string"==typeof o)return Jr.call(this,e,o,r);if(o instanceof Hr)o.validate||this._compile(o),e=o;else{if(!((o=this._schemas[i])instanceof Hr))return;if(o.validate||this._compile(o),i==ia(t))return{schema:o,root:e,baseId:s};e=o}if(!e.schema)return;s=ra(this._getId(e.schema))}return Gr.call(this,r,s,e.schema,e)}function Jr(e,t,r){var a=Br.call(this,e,t);if(a){var s=a.schema,i=a.baseId;e=a.root;var o=this._getId(s);return o&&(i=oa(i,o)),Gr.call(this,r,i,s,e)}}Kr.normalizeId=ia,Kr.fullPath=ra,Kr.url=oa,Kr.ids=function(e){var t=ia(this._getId(e)),r={"":t},a={"":ra(t,!1)},s={},i=this;return Ur(e,{allKeys:!0},(function(e,t,o,n,l,d,u){if(""!==t){var c=i._getId(e),h=r[n],p=a[n]+"/"+l;if(void 0!==u&&(p+="/"+("number"==typeof u?u:Mr.escapeFragment(u))),"string"==typeof c){c=h=ia(h?zr.resolve(h,c):c);var m=i._refs[c];if("string"==typeof m&&(m=i._refs[m]),m&&m.schema){if(!Vr(e,m.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=ia(p))if("#"==c[0]){if(s[c]&&!Vr(e,s[c]))throw new Error('id "'+c+'" resolves to more than one schema');s[c]=e}else i._refs[c]=p}r[t]=h,a[t]=p}})),s},Kr.inlineRef=Xr,Kr.schema=Br;var Wr=Mr.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Gr(e,t,r,a){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var s=e.fragment.split("/"),i=1;i<s.length;i++){var o=s[i];if(o){if(void 0===(r=r[o=Mr.unescapeFragment(o)]))break;var n;if(!Wr[o]&&((n=this._getId(r))&&(t=oa(t,n)),r.$ref)){var l=oa(t,r.$ref),d=Br.call(this,a,l);d&&(r=d.schema,a=d.root,t=d.baseId)}}}return void 0!==r&&r!==a.schema?{schema:r,root:a,baseId:t}:void 0}}var Yr=Mr.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Xr(e,t){return!1!==t&&(void 0===t||!0===t?ea(e):t?ta(e)<=t:void 0)}function ea(e){var t;if(Array.isArray(e)){for(var r=0;r<e.length;r++)if("object"==typeof(t=e[r])&&!ea(t))return!1}else for(var a in e){if("$ref"==a)return!1;if("object"==typeof(t=e[a])&&!ea(t))return!1}return!0}function ta(e){var t,r=0;if(Array.isArray(e)){for(var a=0;a<e.length;a++)if("object"==typeof(t=e[a])&&(r+=ta(t)),r==1/0)return 1/0}else for(var s in e){if("$ref"==s)return 1/0;if(Yr[s])r++;else if("object"==typeof(t=e[s])&&(r+=ta(t)+1),r==1/0)return 1/0}return r}function ra(e,t){return!1!==t&&(e=ia(e)),aa(zr.parse(e))}function aa(e){return zr.serialize(e).split("#")[0]+"#"}var sa=/#\/?$/;function ia(e){return e?e.replace(sa,""):""}function oa(e,t){return t=ia(t),zr.resolve(e,t)}var na=Qr,la={Validation:ua((function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0})),MissingRef:ua(da)};function da(e,t,r){this.message=r||da.message(e,t),this.missingRef=na.url(e,t),this.missingSchema=na.normalizeId(na.fullPath(this.missingRef))}function ua(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}da.message=function(e,t){return"can't resolve reference "+t+" from id "+e};var ca=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r,a="boolean"==typeof t.cycles&&t.cycles,s=t.cmp&&(r=t.cmp,function(e){return function(t,a){var s={key:t,value:e[t]},i={key:a,value:e[a]};return r(s,i)}}),i=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var r,o;if(Array.isArray(t)){for(o="[",r=0;r<t.length;r++)r&&(o+=","),o+=e(t[r])||"null";return o+"]"}if(null===t)return"null";if(-1!==i.indexOf(t)){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var n=i.push(t)-1,l=Object.keys(t).sort(s&&s(t));for(o="",r=0;r<l.length;r++){var d=l[r],u=e(t[d]);u&&(o&&(o+=","),o+=JSON.stringify(d)+":"+u)}return i.splice(n,1),"{"+o+"}"}}(e)},ha=function(e,t,r){var a="",s=!0===e.schema.$async,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var n=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(n){var l="unknown keyword: "+n;if("log"!==e.opts.strictKeywords)throw new Error(l);e.logger.warn(l)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof e.schema||!i&&!e.schema.$ref){t="false schema";var d=e.level,u=e.dataLevel,c=e.schema[t],h=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,m=!e.opts.allErrors,f="data"+(u||""),v="valid"+d;if(!1===e.schema){e.isTop?m=!0:a+=" var "+v+" = false; ",(W=W||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";var g=a;a=W.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a+=s?" return data; ":" validate.errors = null; return true; ":a+=" var "+v+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var y=e.isTop;d=e.level=0,u=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var _="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{d=e.level,f="data"+((u=e.dataLevel)||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+d+" = errors;"}v="valid"+d,m=!e.opts.allErrors;var b="",P="",w=e.schema.type,E=Array.isArray(w);if(w&&e.opts.nullable&&!0===e.schema.nullable&&(E?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],E=!0)),E&&1==w.length&&(w=w[0],E=!1),e.schema.$ref&&i){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),w){if(e.opts.coerceTypes)var x=e.util.coerceToTypes(e.opts.coerceTypes,w);var S=e.RULES.types[w];if(x||E||!0===S||S&&!G(S)){h=e.schemaPath+".type",p=e.errSchemaPath+"/type",h=e.schemaPath+".type",p=e.errSchemaPath+"/type";var k=E?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[k](w,f,e.opts.strictNumbers,!0)+") { ",x){var O="dataType"+d,$="coerced"+d;a+=" var "+O+" = typeof "+f+"; var "+$+" = undefined; ","array"==e.opts.coerceTypes&&(a+=" if ("+O+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+O+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+$+" = "+f+"; } "),a+=" if ("+$+" !== undefined) ; ";var R=x;if(R)for(var j,C=-1,T=R.length-1;C<T;)"string"==(j=R[C+=1])?a+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+$+" = '' + "+f+"; else if ("+f+" === null) "+$+" = ''; ":"number"==j||"integer"==j?(a+=" else if ("+O+" == 'boolean' || "+f+" === null || ("+O+" == 'string' && "+f+" && "+f+" == +"+f+" ","integer"==j&&(a+=" && !("+f+" % 1)"),a+=")) "+$+" = +"+f+"; "):"boolean"==j?a+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+$+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+$+" = true; ":"null"==j?a+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+$+" = null; ":"array"==e.opts.coerceTypes&&"array"==j&&(a+=" else if ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+f+" == null) "+$+" = ["+f+"]; ");a+=" else { ",(W=W||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=E?""+w.join(","):""+w,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=E?""+w.join(","):""+w,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=W.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+$+" !== undefined) { ";var F=u?"data"+(u-1||""):"parentData";a+=" "+f+" = "+$+"; ",u||(a+="if ("+F+" !== undefined)"),a+=" "+F+"["+(u?e.dataPathArr[u]:"parentDataProperty")+"] = "+$+"; } "}else{(W=W||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=E?""+w.join(","):""+w,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=E?""+w.join(","):""+w,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=W.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!i)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",m&&(a+=" } if (errors === ",a+=y?"0":"errs_"+d,a+=") { ",P+="}");else{var I=e.RULES;if(I)for(var A=-1,D=I.length-1;A<D;)if(G(S=I[A+=1])){if(S.type&&(a+=" if ("+e.util.checkDataType(S.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults)if("object"==S.type&&e.schema.properties){c=e.schema.properties;var N=Object.keys(c);if(N)for(var q,L=-1,Z=N.length-1;L<Z;){if(void 0!==(M=c[q=N[L+=1]]).default){var z=f+e.util.getProperty(q);if(e.compositeRule){if(e.opts.strictDefaults){_="default is ignored for: "+z;if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+z+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+z+" === null || "+z+" === '' "),a+=" ) "+z+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(M.default)+" ":a+=" "+JSON.stringify(M.default)+" ",a+="; "}}}else if("array"==S.type&&Array.isArray(e.schema.items)){var V=e.schema.items;if(V){C=-1;for(var M,H=V.length-1;C<H;)if(void 0!==(M=V[C+=1]).default){z=f+"["+C+"]";if(e.compositeRule){if(e.opts.strictDefaults){_="default is ignored for: "+z;if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+z+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+z+" === null || "+z+" === '' "),a+=" ) "+z+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(M.default)+" ":a+=" "+JSON.stringify(M.default)+" ",a+="; "}}}var U=S.rules;if(U)for(var Q,K=-1,B=U.length-1;K<B;)if(Y(Q=U[K+=1])){var J=Q.code(e,Q.keyword,S.type);J&&(a+=" "+J+" ",m&&(b+="}"))}if(m&&(a+=" "+b+" ",b=""),S.type&&(a+=" } ",w&&w===S.type&&!x)){a+=" else { ";var W;h=e.schemaPath+".type",p=e.errSchemaPath+"/type";(W=W||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=E?""+w.join(","):""+w,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=E?""+w.join(","):""+w,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=W.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}m&&(a+=" if (errors === ",a+=y?"0":"errs_"+d,a+=") { ",P+="}")}}function G(e){for(var t=e.rules,r=0;r<t.length;r++)if(Y(t[r]))return!0}function Y(t){return void 0!==e.schema[t.keyword]||t.implements&&function(t){for(var r=t.implements,a=0;a<r.length;a++)if(void 0!==e.schema[r[a]])return!0}(t)}return m&&(a+=" "+P+" "),y?(s?(a+=" if (errors === 0) return data; ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0; "),a+=" }; return validate;"):a+=" var "+v+" = errors === errs_"+d+";",a},pa=Qr,ma=Pr,fa=la,va=ca,ga=ha,ya=ma.ucs2length,_a=br,ba=fa.Validation,Pa=function e(t,r,a,s){var i=this,o=this._opts,n=[void 0],l={},d=[],u={},c=[],h={},p=[];r=r||{schema:t,refVal:n,refs:l};var m=wa.call(this,t,r,s),f=this._compilations[m.index];if(m.compiling)return f.callValidate=function e(){var t=f.validate,r=t.apply(this,arguments);return e.errors=t.errors,r};var v=this._formats,g=this.RULES;try{var y=b(t,r,a,s);f.validate=y;var _=f.callValidate;return _&&(_.schema=y.schema,_.errors=null,_.refs=y.refs,_.refVal=y.refVal,_.root=y.root,_.$async=y.$async,o.sourceCode&&(_.source=y.source)),y}finally{Ea.call(this,t,r,s)}function b(t,a,s,u){var h=!a||a&&a.schema==t;if(a.schema!=r.schema)return e.call(i,t,a,s,u);var m,f=!0===t.$async,y=ga({isTop:!0,schema:t,isRoot:h,baseId:u,root:a,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:fa.MissingRef,RULES:g,validate:ga,util:ma,resolve:pa,resolveRef:P,usePattern:x,useDefault:S,useCustomRule:k,opts:o,formats:v,logger:i.logger,self:i});y=Ra(n,Oa)+Ra(d,Sa)+Ra(c,ka)+Ra(p,$a)+y,o.processCode&&(y=o.processCode(y,t));try{m=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",y)(i,g,v,r,n,c,p,_a,ya,ba),n[0]=m}catch(e){throw i.logger.error("Error compiling schema, function code:",y),e}return m.schema=t,m.errors=null,m.refs=l,m.refVal=n,m.root=h?m:a,f&&(m.$async=!0),!0===o.sourceCode&&(m.source={code:y,patterns:d,defaults:c}),m}function P(t,s,d){s=pa.url(t,s);var u,c,h=l[s];if(void 0!==h)return E(u=n[h],c="refVal["+h+"]");if(!d&&r.refs){var p=r.refs[s];if(void 0!==p)return E(u=r.refVal[p],c=w(s,u))}c=w(s);var m=pa.call(i,b,r,s);if(void 0===m){var f=a&&a[s];f&&(m=pa.inlineRef(f,o.inlineRefs)?f:e.call(i,f,r,a,t))}if(void 0!==m)return function(e,t){var r=l[e];n[r]=t}(s,m),E(m,c);!function(e){delete l[e]}(s)}function w(e,t){var r=n.length;return n[r]=t,l[e]=r,"refVal"+r}function E(e,t){return"object"==typeof e||"boolean"==typeof e?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function x(e){var t=u[e];return void 0===t&&(t=u[e]=d.length,d[t]=e),"pattern"+t}function S(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return ma.toQuotedString(e);case"object":if(null===e)return"null";var t=va(e),r=h[t];return void 0===r&&(r=h[t]=c.length,c[r]=e),"default"+r}}function k(e,t,r,a){if(!1!==i._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every((function(e){return Object.prototype.hasOwnProperty.call(r,e)})))throw new Error("parent schema must have all required keywords: "+s.join(","));var n=e.definition.validateSchema;if(n)if(!n(t)){var l="keyword schema is invalid: "+i.errorsText(n.errors);if("log"!=i._opts.validateSchema)throw new Error(l);i.logger.error(l)}}var d,u=e.definition.compile,c=e.definition.inline,h=e.definition.macro;if(u)d=u.call(i,t,r,a);else if(h)d=h.call(i,t,r,a),!1!==o.validateSchema&&i.validateSchema(d,!0);else if(c)d=c.call(i,a,e.keyword,t,r);else if(!(d=e.definition.validate))return;if(void 0===d)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var m=p.length;return p[m]=d,{code:"customRule"+m,validate:d}}};function wa(e,t,r){var a=xa.call(this,e,t,r);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:t,baseId:r},{index:a,compiling:!1})}function Ea(e,t,r){var a=xa.call(this,e,t,r);a>=0&&this._compilations.splice(a,1)}function xa(e,t,r){for(var a=0;a<this._compilations.length;a++){var s=this._compilations[a];if(s.schema==e&&s.root==t&&s.baseId==r)return a}return-1}function Sa(e,t){return"var pattern"+e+" = new RegExp("+ma.toQuotedString(t[e])+");"}function ka(e){return"var default"+e+" = defaults["+e+"];"}function Oa(e,t){return void 0===t[e]?"":"var refVal"+e+" = refVal["+e+"];"}function $a(e){return"var customRule"+e+" = customRules["+e+"];"}function Ra(e,t){if(!e.length)return"";for(var r="",a=0;a<e.length;a++)r+=t(a,e);return r}var ja={exports:{}},Ca=ja.exports=function(){this._cache={}};Ca.prototype.put=function(e,t){this._cache[e]=t},Ca.prototype.get=function(e){return this._cache[e]},Ca.prototype.del=function(e){delete this._cache[e]},Ca.prototype.clear=function(){this._cache={}};var Ta=ja.exports,Fa=Pr,Ia=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Aa=[0,31,28,31,30,31,30,31,31,30,31,30,31],Da=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Na=/^(?=.{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,qa=/^(?:[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,La=/^(?:(?:[^\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,Za=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,za=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Va=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ma=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Ha=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ua=Qa;function Qa(e){return e="full"==e?"full":"fast",Fa.copy(Qa[e])}function Ka(e){var t=e.match(Ia);if(!t)return!1;var r=+t[1],a=+t[2],s=+t[3];return a>=1&&a<=12&&s>=1&&s<=(2==a&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:Aa[a])}function Ba(e,t){var r=e.match(Da);if(!r)return!1;var a=r[1],s=r[2],i=r[3],o=r[5];return(a<=23&&s<=59&&i<=59||23==a&&59==s&&60==i)&&(!t||o)}Qa.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":La,url:Za,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,hostname:Na,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Ya,uuid:za,"json-pointer":Va,"json-pointer-uri-fragment":Ma,"relative-json-pointer":Ha},Qa.full={date:Ka,time:Ba,"date-time":function(e){var t=e.split(Ja);return 2==t.length&&Ka(t[0])&&Ba(t[1],!0)},uri:function(e){return Wa.test(e)&&qa.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":La,url:Za,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:Na,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Ya,uuid:za,"json-pointer":Va,"json-pointer-uri-fragment":Ma,"relative-json-pointer":Ha};var Ja=/t|\s/i;var Wa=/\/|:/;var Ga=/[^\\]\\Z/;function Ya(e){if(Ga.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var Xa=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n;var p="maximum"==t,m=p?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[m],v=e.opts.$data&&f&&f.$data,g=p?"<":">",y=p?">":"<",_=void 0;if(!h&&"number"!=typeof n&&void 0!==n)throw new Error(t+" must be number");if(!v&&void 0!==f&&"number"!=typeof f&&"boolean"!=typeof f)throw new Error(m+" must be number or boolean");if(v){var b=e.util.getData(f.$data,o,e.dataPathArr),P="exclusive"+i,w="exclType"+i,E="exclIsNumber"+i,x="' + "+(O="op"+i)+" + '";s+=" var schemaExcl"+i+" = "+b+"; ",s+=" var "+P+"; var "+w+" = typeof "+(b="schemaExcl"+i)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";var S;_=m;(S=S||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var k=s;s=S.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+k+"]); ":s+=" validate.errors = ["+k+"]; return false; ":s+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+w+" == 'number' ? ( ("+P+" = "+a+" === undefined || "+b+" "+g+"= "+a+") ? "+c+" "+y+"= "+b+" : "+c+" "+y+" "+a+" ) : ( ("+P+" = "+b+" === true) ? "+c+" "+y+"= "+a+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { var op"+i+" = "+P+" ? '"+g+"' : '"+g+"='; ",void 0===n&&(_=m,d=e.errSchemaPath+"/"+m,a=b,h=v)}else{x=g;if((E="number"==typeof f)&&h){var O="'"+x+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+f+" "+g+"= "+a+" ? "+c+" "+y+"= "+f+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { "}else{E&&void 0===n?(P=!0,_=m,d=e.errSchemaPath+"/"+m,a=f,y+="="):(E&&(a=Math[p?"min":"max"](f,n)),f===(!E||a)?(P=!0,_=m,d=e.errSchemaPath+"/"+m,y+="="):(P=!1,x+="="));O="'"+x+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+" "+y+" "+a+" || "+c+" !== "+c+") { "}}_=_||t,(S=S||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { comparison: "+O+", limit: "+a+", exclusive: "+P+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+x+" ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";k=s;return s=S.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+k+"]); ":s+=" validate.errors = ["+k+"]; return false; ":s+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s},es=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+".length "+("maxItems"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s},ts=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");var p="maxLength"==t?">":"<";s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),!1===e.opts.unicode?s+=" "+c+".length ":s+=" ucs2length("+c+") ",s+=" "+p+" "+a+") { ";var m=t,f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==t?"longer":"shorter",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var v=s;return s=f.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+v+"]); ":s+=" validate.errors = ["+v+"]; return false; ":s+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s},rs=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+c+").length "+("maxProperties"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s},as={$ref:function(e,t,r){var a,s,i=" ",o=e.level,n=e.dataLevel,l=e.schema[t],d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(n||""),h="valid"+o;if("#"==l||"#/"==l)e.isRoot?(a=e.async,s="validate"):(a=!0===e.root.schema.$async,s="root.refVal[0]");else{var p=e.resolveRef(e.baseId,l,e.isRoot);if(void 0===p){var m=e.MissingRefError.message(e.baseId,l);if("fail"==e.opts.missingRefs){e.logger.error(m),(y=y||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",!1!==e.opts.messages&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var f=i;i=y.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,l,m);e.logger.warn(m),u&&(i+=" if (true) { ")}}else if(p.inline){var v=e.util.copy(e);v.level++;var g="valid"+v.level;v.schema=p.schema,v.schemaPath="",v.errSchemaPath=l,i+=" "+e.validate(v).replace(/validate\.schema/g,p.code)+" ",u&&(i+=" if ("+g+") { ")}else a=!0===p.$async||e.async&&!1!==p.$async,s=p.code}if(s){var y;(y=y||[]).push(i),i="",e.opts.passContext?i+=" "+s+".call(this, ":i+=" "+s+"( ",i+=" "+c+", (dataPath || '')",'""'!=e.errorPath&&(i+=" + "+e.errorPath);var _=i+=" , "+(n?"data"+(n-1||""):"parentData")+" , "+(n?e.dataPathArr[n]:"parentDataProperty")+", rootData) ";if(i=y.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+h+"; "),i+=" try { await "+_+"; ",u&&(i+=" "+h+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+h+" = false; "),i+=" } ",u&&(i+=" if ("+h+") { ")}else i+=" if (!"+_+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i},allOf:function(e,t,r){var a=" ",s=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,n=!e.opts.allErrors,l=e.util.copy(e),d="";l.level++;var u="valid"+l.level,c=l.baseId,h=!0,p=s;if(p)for(var m,f=-1,v=p.length-1;f<v;)m=p[f+=1],(e.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0||!1===m:e.util.schemaHasRules(m,e.RULES.all))&&(h=!1,l.schema=m,l.schemaPath=i+"["+f+"]",l.errSchemaPath=o+"/"+f,a+=" "+e.validate(l)+" ",l.baseId=c,n&&(a+=" if ("+u+") { ",d+="}"));return n&&(a+=h?" if (true) { ":" "+d.slice(0,-1)+" "),a},anyOf:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v=o.every((function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0||!1===t:e.util.schemaHasRules(t,e.RULES.all)}));if(v){var g=p.baseId;a+=" var "+h+" = errors; var "+c+" = false; ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0;var _=o;if(_)for(var b,P=-1,w=_.length-1;P<w;)b=_[P+=1],p.schema=b,p.schemaPath=n+"["+P+"]",p.errSchemaPath=l+"/"+P,a+=" "+e.validate(p)+" ",p.baseId=g,a+=" "+c+" = "+c+" || "+f+"; if (!"+c+") { ",m+="}";e.compositeRule=p.compositeRule=y,a+=" "+m+" if (!"+c+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else d&&(a+=" if (true) { ");return a},$comment:function(e,t,r){var a=" ",s=e.schema[t],i=e.errSchemaPath+"/"+t;e.opts.allErrors;var o=e.util.toQuotedString(s);return!0===e.opts.$comment?a+=" console.log("+o+");":"function"==typeof e.opts.$comment&&(a+=" self._opts.$comment("+o+", "+e.util.toQuotedString(i)+", validate.root.schema);"),a},const:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h=e.opts.$data&&o&&o.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; "),h||(a+=" var schema"+s+" = validate.schema"+n+";"),a+="var "+c+" = equal("+u+", schema"+s+"); if (!"+c+") { ";var p=p||[];p.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValue: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var m=a;return a=p.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+m+"]); ":a+=" validate.errors = ["+m+"]; return false; ":a+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",d&&(a+=" else { "),a},contains:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f="i"+s,v=p.dataLevel=e.dataLevel+1,g="data"+v,y=e.baseId,_=e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:e.util.schemaHasRules(o,e.RULES.all);if(a+="var "+h+" = errors;var "+c+";",_){var b=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" var "+m+" = false; for (var "+f+" = 0; "+f+" < "+u+".length; "+f+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);var P=u+"["+f+"]";p.dataPathArr[v]=f;var w=e.validate(p);p.baseId=y,e.util.varOccurences(w,g)<2?a+=" "+e.util.varReplace(w,g,P)+" ":a+=" var "+g+" = "+P+"; "+w+" ",a+=" if ("+m+") break; } ",e.compositeRule=p.compositeRule=b,a+=" if (!"+m+") {"}else a+=" if ("+u+".length == 0) {";var E=E||[];E.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var x=a;return a=E.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",_&&(a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a},dependencies:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f={},v={},g=e.opts.ownProperties;for(P in o)if("__proto__"!=P){var y=o[P],_=Array.isArray(y)?v:f;_[P]=y}a+="var "+c+" = errors;";var b=e.errorPath;for(var P in a+="var missing"+s+";",v)if((_=v[P]).length){if(a+=" if ( "+u+e.util.getProperty(P)+" !== undefined ",g&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(P)+"') "),d){a+=" && ( ";var w=_;if(w)for(var E=-1,x=w.length-1;E<x;){j=w[E+=1],E&&(a+=" || "),a+=" ( ( "+(I=u+(F=e.util.getProperty(j)))+" === undefined ",g&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(j)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?j:F)+") ) "}a+=")) { ";var S="missing"+s,k="' + "+S+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,S,!0):b+" + "+S);var O=O||[];O.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(P)+"', missingProperty: '"+k+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var $=a;a=O.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+$+"]); ":a+=" validate.errors = ["+$+"]; return false; ":a+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var R=_;if(R)for(var j,C=-1,T=R.length-1;C<T;){j=R[C+=1];var F=e.util.getProperty(j),I=(k=e.util.escapeQuotes(j),u+F);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,j,e.opts.jsonPointers)),a+=" if ( "+I+" === undefined ",g&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(j)+"') "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(P)+"', missingProperty: '"+k+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",d&&(p+="}",a+=" else { ")}e.errorPath=b;var A=h.baseId;for(var P in f){y=f[P];(e.opts.strictKeywords?"object"==typeof y&&Object.keys(y).length>0||!1===y:e.util.schemaHasRules(y,e.RULES.all))&&(a+=" "+m+" = true; if ( "+u+e.util.getProperty(P)+" !== undefined ",g&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(P)+"') "),a+=") { ",h.schema=y,h.schemaPath=n+e.util.getProperty(P),h.errSchemaPath=l+"/"+e.util.escapeFragment(P),a+=" "+e.validate(h)+" ",h.baseId=A,a+=" } ",d&&(a+=" if ("+m+") { ",p+="}"))}return d&&(a+=" "+p+" if ("+c+" == errors) {"),a},enum:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h=e.opts.$data&&o&&o.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var p="i"+s,m="schema"+s;h||(a+=" var "+m+" = validate.schema"+n+";"),a+="var "+c+";",h&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=c+" = false;for (var "+p+"=0; "+p+"<"+m+".length; "+p+"++) if (equal("+u+", "+m+"["+p+"])) { "+c+" = true; break; }",h&&(a+=" } "),a+=" if (!"+c+") { ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;return a=f.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",d&&(a+=" else { "),a},format:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||"");if(!1===e.opts.format)return d&&(a+=" if (true) { "),a;var c,h=e.opts.$data&&o&&o.$data;h?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",c="schema"+s):c=o;var p=e.opts.unknownFormats,m=Array.isArray(p);if(h){a+=" var "+(f="format"+s)+" = formats["+c+"]; var "+(v="isObject"+s)+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+(g="formatType"+s)+" = "+v+" && "+f+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if ( ",h&&(a+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),a+=" (","ignore"!=p&&(a+=" ("+c+" && !"+f+" ",m&&(a+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),a+=") || "),a+=" ("+f+" && "+g+" == '"+r+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+u+") : "+f+"("+u+")) ":a+=" "+f+"("+u+") ",a+=" : "+f+".test("+u+"))))) {"}else{var f;if(!(f=e.formats[o])){if("ignore"==p)return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(a+=" if (true) { "),a;if(m&&p.indexOf(o)>=0)return d&&(a+=" if (true) { "),a;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var v,g=(v="object"==typeof f&&!(f instanceof RegExp)&&f.validate)&&f.type||"string";if(v){var y=!0===f.async;f=f.validate}if(g!=r)return d&&(a+=" if (true) { "),a;if(y){if(!e.async)throw new Error("async format in sync schema");a+=" if (!(await "+(_="formats"+e.util.getProperty(o)+".validate")+"("+u+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(o);v&&(_+=".validate"),a+="function"==typeof f?" "+_+"("+u+") ":" "+_+".test("+u+") ",a+=") { "}}var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=h?""+c:""+e.util.toQuotedString(o),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=h?"' + "+c+" + '":""+e.util.escapeQuotes(o),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var P=a;return a=b.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+P+"]); ":a+=" validate.errors = ["+P+"]; return false; ":a+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d&&(a+=" else { "),a},if:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f=e.schema.then,v=e.schema.else,g=void 0!==f&&(e.opts.strictKeywords?"object"==typeof f&&Object.keys(f).length>0||!1===f:e.util.schemaHasRules(f,e.RULES.all)),y=void 0!==v&&(e.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0||!1===v:e.util.schemaHasRules(v,e.RULES.all)),_=p.baseId;if(g||y){var b;p.createErrors=!1,p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" var "+h+" = errors; var "+c+" = true; ";var P=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+=" "+e.validate(p)+" ",p.baseId=_,p.createErrors=!0,a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=p.compositeRule=P,g?(a+=" if ("+m+") { ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(p)+" ",p.baseId=_,a+=" "+c+" = "+m+"; ",g&&y?a+=" var "+(b="ifClause"+s)+" = 'then'; ":b="'then'",a+=" } ",y&&(a+=" else { ")):a+=" if (!"+m+") { ",y&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(p)+" ",p.baseId=_,a+=" "+c+" = "+m+"; ",g&&y?a+=" var "+(b="ifClause"+s)+" = 'else'; ":b="'else'",a+=" } "),a+=" if (!"+c+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+b+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match \"' + "+b+" + '\" schema' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",d&&(a+=" else { ")}else d&&(a+=" if (true) { ");return a},items:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v="i"+s,g=p.dataLevel=e.dataLevel+1,y="data"+g,_=e.baseId;if(a+="var "+h+" = errors;var "+c+";",Array.isArray(o)){var b=e.schema.additionalItems;if(!1===b){a+=" "+c+" = "+u+".length <= "+o.length+"; ";var P=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+c+") { ";var w=w||[];w.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+o.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var E=a;a=w.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=P,d&&(m+="}",a+=" else { ")}var x=o;if(x)for(var S,k=-1,O=x.length-1;k<O;)if(S=x[k+=1],e.opts.strictKeywords?"object"==typeof S&&Object.keys(S).length>0||!1===S:e.util.schemaHasRules(S,e.RULES.all)){a+=" "+f+" = true; if ("+u+".length > "+k+") { ";var $=u+"["+k+"]";p.schema=S,p.schemaPath=n+"["+k+"]",p.errSchemaPath=l+"/"+k,p.errorPath=e.util.getPathExpr(e.errorPath,k,e.opts.jsonPointers,!0),p.dataPathArr[g]=k;var R=e.validate(p);p.baseId=_,e.util.varOccurences(R,y)<2?a+=" "+e.util.varReplace(R,y,$)+" ":a+=" var "+y+" = "+$+"; "+R+" ",a+=" } ",d&&(a+=" if ("+f+") { ",m+="}")}if("object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&Object.keys(b).length>0||!1===b:e.util.schemaHasRules(b,e.RULES.all))){p.schema=b,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+u+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";p.dataPathArr[g]=v;R=e.validate(p);p.baseId=_,e.util.varOccurences(R,y)<2?a+=" "+e.util.varReplace(R,y,$)+" ":a+=" var "+y+" = "+$+"; "+R+" ",d&&(a+=" if (!"+f+") break; "),a+=" } } ",d&&(a+=" if ("+f+") { ",m+="}")}}else if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";p.dataPathArr[g]=v;R=e.validate(p);p.baseId=_,e.util.varOccurences(R,y)<2?a+=" "+e.util.varReplace(R,y,$)+" ":a+=" var "+y+" = "+$+"; "+R+" ",d&&(a+=" if (!"+f+") break; "),a+=" }"}return d&&(a+=" "+m+" if ("+h+" == errors) {"),a},maximum:Xa,minimum:Xa,maxItems:es,minItems:es,maxLength:ts,minLength:ts,maxProperties:rs,minProperties:rs,multipleOf:function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="var division"+i+";if (",h&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+i+" = "+c+" / "+a+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",h&&(s+=" ) "),s+=" ) { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s},not:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=n,h.errSchemaPath=l,a+=" var "+c+" = errors; ";var m,f=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1,h.opts.allErrors&&(m=h.opts.allErrors,h.opts.allErrors=!1),a+=" "+e.validate(h)+" ",h.createErrors=!0,m&&(h.opts.allErrors=m),e.compositeRule=h.compositeRule=f,a+=" if ("+p+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var g=a;a=v.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(a+=" if (false) { ");return a},oneOf:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v=p.baseId,g="prevValid"+s,y="passingSchemas"+s;a+="var "+h+" = errors , "+g+" = false , "+c+" = false , "+y+" = null; ";var _=e.compositeRule;e.compositeRule=p.compositeRule=!0;var b=o;if(b)for(var P,w=-1,E=b.length-1;w<E;)P=b[w+=1],(e.opts.strictKeywords?"object"==typeof P&&Object.keys(P).length>0||!1===P:e.util.schemaHasRules(P,e.RULES.all))?(p.schema=P,p.schemaPath=n+"["+w+"]",p.errSchemaPath=l+"/"+w,a+=" "+e.validate(p)+" ",p.baseId=v):a+=" var "+f+" = true; ",w&&(a+=" if ("+f+" && "+g+") { "+c+" = false; "+y+" = ["+y+", "+w+"]; } else { ",m+="}"),a+=" if ("+f+") { "+c+" = "+g+" = true; "+y+" = "+w+"; }";return e.compositeRule=p.compositeRule=_,a+=m+"if (!"+c+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+y+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a},pattern:function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h=e.opts.$data&&n&&n.$data;h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),s+=" !"+(h?"(new RegExp("+a+"))":e.usePattern(n))+".test("+c+") ) { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { pattern: ",s+=h?""+a:""+e.util.toQuotedString(n),s+=" } ",!1!==e.opts.messages&&(s+=" , message: 'should match pattern \"",s+=h?"' + "+a+" + '":""+e.util.escapeQuotes(n),s+="\"' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+e.util.toQuotedString(n),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s},properties:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f="key"+s,v="idx"+s,g=h.dataLevel=e.dataLevel+1,y="data"+g,_="dataProperties"+s,b=Object.keys(o||{}).filter(F),P=e.schema.patternProperties||{},w=Object.keys(P).filter(F),E=e.schema.additionalProperties,x=b.length||w.length,S=!1===E,k="object"==typeof E&&Object.keys(E).length,O=e.opts.removeAdditional,$=S||k||O,R=e.opts.ownProperties,j=e.baseId,C=e.schema.required;if(C&&(!e.opts.$data||!C.$data)&&C.length<e.opts.loopRequired)var T=e.util.toHash(C);function F(e){return"__proto__"!==e}if(a+="var "+c+" = errors;var "+m+" = true;",R&&(a+=" var "+_+" = undefined;"),$){if(a+=R?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+v+"=0; "+v+"<"+_+".length; "+v+"++) { var "+f+" = "+_+"["+v+"]; ":" for (var "+f+" in "+u+") { ",x){if(a+=" var isAdditional"+s+" = !(false ",b.length)if(b.length>8)a+=" || validate.schema"+n+".hasOwnProperty("+f+") ";else{var I=b;if(I)for(var A=-1,D=I.length-1;A<D;)J=I[A+=1],a+=" || "+f+" == "+e.util.toQuotedString(J)+" "}if(w.length){var N=w;if(N)for(var q=-1,L=N.length-1;q<L;)ie=N[q+=1],a+=" || "+e.usePattern(ie)+".test("+f+") "}a+=" ); if (isAdditional"+s+") { "}if("all"==O)a+=" delete "+u+"["+f+"]; ";else{var Z=e.errorPath,z="' + "+f+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers)),S)if(O)a+=" delete "+u+"["+f+"]; ";else{a+=" "+m+" = false; ";var V=l;l=e.errSchemaPath+"/additionalProperties",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+z+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var M=a;a=re.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=V,d&&(a+=" break; ")}else if(k)if("failing"==O){a+=" var "+c+" = errors; ";var H=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=E,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);var U=u+"["+f+"]";h.dataPathArr[g]=f;var Q=e.validate(h);h.baseId=j,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",a+=" if (!"+m+") { errors = "+c+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+u+"["+f+"]; } ",e.compositeRule=h.compositeRule=H}else{h.schema=E,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);U=u+"["+f+"]";h.dataPathArr[g]=f;Q=e.validate(h);h.baseId=j,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",d&&(a+=" if (!"+m+") break; ")}e.errorPath=Z}x&&(a+=" } "),a+=" } ",d&&(a+=" if ("+m+") { ",p+="}")}var K=e.opts.useDefaults&&!e.compositeRule;if(b.length){var B=b;if(B)for(var J,W=-1,G=B.length-1;W<G;){var Y=o[J=B[W+=1]];if(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all)){var X=e.util.getProperty(J),ee=(U=u+X,K&&void 0!==Y.default);h.schema=Y,h.schemaPath=n+X,h.errSchemaPath=l+"/"+e.util.escapeFragment(J),h.errorPath=e.util.getPath(e.errorPath,J,e.opts.jsonPointers),h.dataPathArr[g]=e.util.toQuotedString(J);Q=e.validate(h);if(h.baseId=j,e.util.varOccurences(Q,y)<2){Q=e.util.varReplace(Q,y,U);var te=U}else{te=y;a+=" var "+y+" = "+U+"; "}if(ee)a+=" "+Q+" ";else{if(T&&T[J]){a+=" if ( "+te+" === undefined ",R&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+m+" = false; ";Z=e.errorPath,V=l;var re,ae=e.util.escapeQuotes(J);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Z,J,e.opts.jsonPointers)),l=e.errSchemaPath+"/required",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+ae+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ae+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";M=a;a=re.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=V,e.errorPath=Z,a+=" } else { "}else d?(a+=" if ( "+te+" === undefined ",R&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+m+" = true; } else { "):(a+=" if ("+te+" !== undefined ",R&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=" ) { ");a+=" "+Q+" } "}}d&&(a+=" if ("+m+") { ",p+="}")}}if(w.length){var se=w;if(se)for(var ie,oe=-1,ne=se.length-1;oe<ne;){Y=P[ie=se[oe+=1]];if(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all)){h.schema=Y,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ie),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ie),a+=R?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+v+"=0; "+v+"<"+_+".length; "+v+"++) { var "+f+" = "+_+"["+v+"]; ":" for (var "+f+" in "+u+") { ",a+=" if ("+e.usePattern(ie)+".test("+f+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);U=u+"["+f+"]";h.dataPathArr[g]=f;Q=e.validate(h);h.baseId=j,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",d&&(a+=" if (!"+m+") break; "),a+=" } ",d&&(a+=" else "+m+" = true; "),a+=" } ",d&&(a+=" if ("+m+") { ",p+="}")}}}return d&&(a+=" "+p+" if ("+c+" == errors) {"),a},propertyNames:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(a+="var "+c+" = errors;",e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0||!1===o:e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=n,h.errSchemaPath=l;var m="key"+s,f="idx"+s,v="i"+s,g="' + "+m+" + '",y="data"+(h.dataLevel=e.dataLevel+1),_="dataProperties"+s,b=e.opts.ownProperties,P=e.baseId;b&&(a+=" var "+_+" = undefined; "),a+=b?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+f+"=0; "+f+"<"+_+".length; "+f+"++) { var "+m+" = "+_+"["+f+"]; ":" for (var "+m+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var w=m,E=e.compositeRule;e.compositeRule=h.compositeRule=!0;var x=e.validate(h);h.baseId=P,e.util.varOccurences(x,y)<2?a+=" "+e.util.varReplace(x,y,w)+" ":a+=" var "+y+" = "+w+"; "+x+" ",e.compositeRule=h.compositeRule=E,a+=" if (!"+p+") { for (var "+v+"=startErrs"+s+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+m+"; } var err = ",!1!==e.createErrors?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { propertyName: '"+g+"' } ",!1!==e.opts.messages&&(a+=" , message: 'property name \\'"+g+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),d&&(a+=" break; "),a+=" } }"}return d&&(a+=" if ("+c+" == errors) {"),a},required:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(i||""),c="valid"+s,h=e.opts.$data&&o&&o.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var p="schema"+s;if(!h)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var m=[],f=o;if(f)for(var v,g=-1,y=f.length-1;g<y;){v=f[g+=1];var _=e.schema.properties[v];_&&(e.opts.strictKeywords?"object"==typeof _&&Object.keys(_).length>0||!1===_:e.util.schemaHasRules(_,e.RULES.all))||(m[m.length]=v)}}else m=o;if(h||m.length){var b=e.errorPath,P=h||m.length>=e.opts.loopRequired,w=e.opts.ownProperties;if(d)if(a+=" var missing"+s+"; ",P){h||(a+=" var "+p+" = validate.schema"+n+"; ");var E="' + "+(R="schema"+s+"["+(k="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,R,e.opts.jsonPointers)),a+=" var "+c+" = true; ",h&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=" for (var "+k+" = 0; "+k+" < "+p+".length; "+k+"++) { "+c+" = "+u+"["+p+"["+k+"]] !== undefined ",w&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", "+p+"["+k+"]) "),a+="; if (!"+c+") break; } ",h&&(a+=" } "),a+=" if (!"+c+") { ",($=$||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var x=a;a=$.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var S=m;if(S)for(var k=-1,O=S.length-1;k<O;){C=S[k+=1],k&&(a+=" || "),a+=" ( ( "+(A=u+(I=e.util.getProperty(C)))+" === undefined ",w&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(C)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?C:I)+") ) "}a+=") { ";var $;E="' + "+(R="missing"+s)+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,R,!0):b+" + "+R),($=$||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";x=a;a=$.pop(),!e.compositeRule&&d?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(P){h||(a+=" var "+p+" = validate.schema"+n+"; ");var R;E="' + "+(R="schema"+s+"["+(k="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,R,e.opts.jsonPointers)),h&&(a+=" if ("+p+" && !Array.isArray("+p+")) { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+p+" !== undefined) { "),a+=" for (var "+k+" = 0; "+k+" < "+p+".length; "+k+"++) { if ("+u+"["+p+"["+k+"]] === undefined ",w&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+p+"["+k+"]) "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(a+=" } ")}else{var j=m;if(j)for(var C,T=-1,F=j.length-1;T<F;){C=j[T+=1];var I=e.util.getProperty(C),A=(E=e.util.escapeQuotes(C),u+I);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,C,e.opts.jsonPointers)),a+=" if ( "+A+" === undefined ",w&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(C)+"') "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=b}else d&&(a+=" if (true) {");return a},uniqueItems:function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c="data"+(o||""),h="valid"+i,p=e.opts.$data&&n&&n.$data;if(p?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,(n||p)&&!1!==e.opts.uniqueItems){p&&(s+=" var "+h+"; if ("+a+" === false || "+a+" === undefined) "+h+" = true; else if (typeof "+a+" != 'boolean') "+h+" = false; else { "),s+=" var i = "+c+".length , "+h+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,f=Array.isArray(m);if(!m||"object"==m||"array"==m||f&&(m.indexOf("object")>=0||m.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+h+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+c+"[i]; ";var v="checkDataType"+(f?"s":"");s+=" if ("+e.util[v](m,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(s+=" if (typeof item == 'string') item = '\"' + item; "),s+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",p&&(s+=" } "),s+=" if (!"+h+") { ";var g=g||[];g.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=p?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var y=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s},validate:ha},ss=as,is=Pr.toHash,os=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],ns=la.MissingRef,ls=function e(t,r,a){var s=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof r&&(a=r,r=void 0);var i=o(t).then((function(){var e=s._addSchema(t,void 0,r);return e.validate||n(e)}));a&&i.then((function(e){a(null,e)}),a);return i;function o(t){var r=t.$schema;return r&&!s.getSchema(r)?e.call(s,{$ref:r},!0):Promise.resolve()}function n(e){try{return s._compile(e)}catch(t){if(t instanceof ns)return function(t){var a=t.missingSchema;if(d(a))throw new Error("Schema "+a+" is loaded but "+t.missingRef+" cannot be resolved");var i=s._loadingSchemas[a];i||(i=s._loadingSchemas[a]=s._opts.loadSchema(a)).then(l,l);return i.then((function(e){if(!d(a))return o(e).then((function(){d(a)||s.addSchema(e,a,void 0,r)}))})).then((function(){return n(e)}));function l(){delete s._loadingSchemas[a]}function d(e){return s._refs[e]||s._schemas[e]}}(t);throw t}}};var ds={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},us=ds,cs={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:us.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:us.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},hs=/^[a-z_$][a-z0-9_$-]*$/i,ps=function(e,t,r){var a,s,i=" ",o=e.level,n=e.dataLevel,l=e.schema[t],d=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(n||""),p="valid"+o,m="errs__"+o,f=e.opts.$data&&l&&l.$data;f?(i+=" var schema"+o+" = "+e.util.getData(l.$data,n,e.dataPathArr)+"; ",s="schema"+o):s=l;var v,g,y,_,b,P=this,w="definition"+o,E=P.definition,x="";if(f&&E.$data){b="keywordValidate"+o;var S=E.validateSchema;i+=" var "+w+" = RULES.custom['"+t+"'].definition; var "+b+" = "+w+".validate;"}else{if(!(_=e.useCustomRule(P,l,e.schema,e)))return;s="validate.schema"+d,b=_.code,v=E.compile,g=E.inline,y=E.macro}var k=b+".errors",O="i"+o,$="ruleErr"+o,R=E.async;if(R&&!e.async)throw new Error("async keyword in sync schema");if(g||y||(i+=k+" = null;"),i+="var "+m+" = errors;var "+p+";",f&&E.$data&&(x+="}",i+=" if ("+s+" === undefined) { "+p+" = true; } else { ",S&&(x+="}",i+=" "+p+" = "+w+".validateSchema("+s+"); if ("+p+") { ")),g)E.statements?i+=" "+_.validate+" ":i+=" "+p+" = "+_.validate+"; ";else if(y){var j=e.util.copy(e);x="";j.level++;var C="valid"+j.level;j.schema=_.validate,j.schemaPath="";var T=e.compositeRule;e.compositeRule=j.compositeRule=!0;var F=e.validate(j).replace(/validate\.schema/g,b);e.compositeRule=j.compositeRule=T,i+=" "+F}else{(N=N||[]).push(i),i="",i+=" "+b+".call( ",e.opts.passContext?i+="this":i+="self",v||!1===E.schema?i+=" , "+h+" ":i+=" , "+s+" , "+h+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",'""'!=e.errorPath&&(i+=" + "+e.errorPath);var I=n?"data"+(n-1||""):"parentData",A=n?e.dataPathArr[n]:"parentDataProperty",D=i+=" , "+I+" , "+A+" , rootData ) ";i=N.pop(),!1===E.errors?(i+=" "+p+" = ",R&&(i+="await "),i+=D+"; "):i+=R?" var "+(k="customErrors"+o)+" = null; try { "+p+" = await "+D+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+k+" = e.errors; else throw e; } ":" "+k+" = null; "+p+" = "+D+"; "}if(E.modifying&&(i+=" if ("+I+") "+h+" = "+I+"["+A+"];"),i+=""+x,E.valid)c&&(i+=" if (true) { ");else{var N;i+=" if ( ",void 0===E.valid?(i+=" !",i+=y?""+C:""+p):i+=" "+!E.valid+" ",i+=") { ",a=P.keyword,(N=N||[]).push(i),i="",(N=N||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+P.keyword+"' } ",!1!==e.opts.messages&&(i+=" , message: 'should pass \""+P.keyword+"\" keyword validation' "),e.opts.verbose&&(i+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var q=i;i=N.pop(),!e.compositeRule&&c?e.async?i+=" throw new ValidationError(["+q+"]); ":i+=" validate.errors = ["+q+"]; return false; ":i+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var L=i;i=N.pop(),g?E.errors?"full"!=E.errors&&(i+=" for (var "+O+"="+m+"; "+O+"<errors; "+O+"++) { var "+$+" = vErrors["+O+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+$+".schema = "+s+"; "+$+".data = "+h+"; "),i+=" } "):!1===E.errors?i+=" "+L+" ":(i+=" if ("+m+" == errors) { "+L+" } else { for (var "+O+"="+m+"; "+O+"<errors; "+O+"++) { var "+$+" = vErrors["+O+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+$+".schema = "+s+"; "+$+".data = "+h+"; "),i+=" } } "):y?(i+=" var err = ",!1!==e.createErrors?(i+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+P.keyword+"' } ",!1!==e.opts.messages&&(i+=" , message: 'should pass \""+P.keyword+"\" keyword validation' "),e.opts.verbose&&(i+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):!1===E.errors?i+=" "+L+" ":(i+=" if (Array.isArray("+k+")) { if (vErrors === null) vErrors = "+k+"; else vErrors = vErrors.concat("+k+"); errors = vErrors.length; for (var "+O+"="+m+"; "+O+"<errors; "+O+"++) { var "+$+" = vErrors["+O+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; "+$+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+$+".schema = "+s+"; "+$+".data = "+h+"; "),i+=" } } else { "+L+" } "),i+=" } ",c&&(i+=" else { ")}return i},ms=cs,fs={add:function(e,t){var r=this.RULES;if(r.keywords[e])throw new Error("Keyword "+e+" is already defined");if(!hs.test(e))throw new Error("Keyword "+e+" is not a valid identifier");if(t){this.validateKeyword(t,!0);var a=t.type;if(Array.isArray(a))for(var s=0;s<a.length;s++)o(e,a[s],t);else o(e,a,t);var i=t.metaSchema;i&&(t.$data&&this._opts.$data&&(i={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),t.validateSchema=this.compile(i,!0))}function o(e,t,a){for(var s,i=0;i<r.length;i++){var o=r[i];if(o.type==t){s=o;break}}s||(s={type:t,rules:[]},r.push(s));var n={keyword:e,definition:a,custom:!0,code:ps,implements:a.implements};s.rules.push(n),r.custom[e]=n}return r.keywords[e]=r.all[e]=!0,this},get:function(e){var t=this.RULES.custom[e];return t?t.definition:this.RULES.keywords[e]||!1},remove:function(e){var t=this.RULES;delete t.keywords[e],delete t.all[e],delete t.custom[e];for(var r=0;r<t.length;r++)for(var a=t[r].rules,s=0;s<a.length;s++)if(a[s].keyword==e){a.splice(s,1);break}return this},validate:function e(t,r){e.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(ms,!0);if(a(t))return!0;if(e.errors=a.errors,r)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}};var vs={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},gs=Pa,ys=Qr,_s=Ta,bs=Dr,Ps=ca,ws=Ua,Es=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"];return e.all=is(t),e.types=is(["number","integer","string","array","object","boolean","null"]),e.forEach((function(r){r.rules=r.rules.map((function(r){var a;if("object"==typeof r){var s=Object.keys(r)[0];a=r[s],r=s,a.forEach((function(r){t.push(r),e.all[r]=!0}))}return t.push(r),e.all[r]={keyword:r,code:ss[r],implements:a}})),e.all.$comment={keyword:"$comment",code:ss.$comment},r.type&&(e.types[r.type]=r)})),e.keywords=is(t.concat(["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"])),e.custom={},e},xs=function(e,t){for(var r=0;r<t.length;r++){e=JSON.parse(JSON.stringify(e));var a,s=t[r].split("/"),i=e;for(a=1;a<s.length;a++)i=i[s[a]];for(a=0;a<os.length;a++){var o=os[a],n=i[o];n&&(i[o]={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e},Ss=Pr,ks=Ts;Ts.prototype.validate=function(e,t){var r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=this._addSchema(e);r=a.validate||this._compile(a)}var s=r(t);!0!==r.$async&&(this.errors=r.errors);return s},Ts.prototype.compile=function(e,t){var r=this._addSchema(e,void 0,t);return r.validate||this._compile(r)},Ts.prototype.addSchema=function(e,t,r,a){if(Array.isArray(e)){for(var s=0;s<e.length;s++)this.addSchema(e[s],void 0,r,a);return this}var i=this._getId(e);if(void 0!==i&&"string"!=typeof i)throw new Error("schema id must be string");return qs(this,t=ys.normalizeId(t||i)),this._schemas[t]=this._addSchema(e,r,a,!0),this},Ts.prototype.addMetaSchema=function(e,t,r){return this.addSchema(e,t,r,!0),this},Ts.prototype.validateSchema=function(e,t){var r=e.$schema;if(void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||function(e){var t=e._opts.meta;return e._opts.defaultMeta="object"==typeof t?e._getId(t)||t:e.getSchema(Rs)?Rs:void 0,e._opts.defaultMeta}(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(r,e);if(!a&&t){var s="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(s);this.logger.error(s)}return a},Ts.prototype.getSchema=function(e){var t=Fs(this,e);switch(typeof t){case"object":return t.validate||this._compile(t);case"string":return this.getSchema(t);case"undefined":return function(e,t){var r=ys.schema.call(e,{schema:{}},t);if(r){var a=r.schema,s=r.root,i=r.baseId,o=gs.call(e,a,s,void 0,i);return e._fragments[t]=new bs({ref:t,fragment:!0,schema:a,root:s,baseId:i,validate:o}),o}}(this,e)}},Ts.prototype.removeSchema=function(e){if(e instanceof RegExp)return Is(this,this._schemas,e),Is(this,this._refs,e),this;switch(typeof e){case"undefined":return Is(this,this._schemas),Is(this,this._refs),this._cache.clear(),this;case"string":var t=Fs(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var r=this._opts.serialize,a=r?r(e):e;this._cache.del(a);var s=this._getId(e);s&&(s=ys.normalizeId(s),delete this._schemas[s],delete this._refs[s])}return this},Ts.prototype.addFormat=function(e,t){"string"==typeof t&&(t=new RegExp(t));return this._formats[e]=t,this},Ts.prototype.errorsText=function(e,t){if(!(e=e||this.errors))return"No errors";for(var r=void 0===(t=t||{}).separator?", ":t.separator,a=void 0===t.dataVar?"data":t.dataVar,s="",i=0;i<e.length;i++){var o=e[i];o&&(s+=a+o.dataPath+" "+o.message+r)}return s.slice(0,-r.length)},Ts.prototype._addSchema=function(e,t,r,a){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var s=this._opts.serialize,i=s?s(e):e,o=this._cache.get(i);if(o)return o;a=a||!1!==this._opts.addUsedSchema;var n=ys.normalizeId(this._getId(e));n&&a&&qs(this,n);var l,d=!1!==this._opts.validateSchema&&!t;d&&!(l=n&&n==ys.normalizeId(e.$schema))&&this.validateSchema(e,!0);var u=ys.ids.call(this,e),c=new bs({id:n,schema:e,localRefs:u,cacheKey:i,meta:r});"#"!=n[0]&&a&&(this._refs[n]=c);this._cache.put(i,c),d&&l&&this.validateSchema(e,!0);return c},Ts.prototype._compile=function(e,t){if(e.compiling)return e.validate=s,s.schema=e.schema,s.errors=null,s.root=t||s,!0===e.schema.$async&&(s.$async=!0),s;var r,a;e.compiling=!0,e.meta&&(r=this._opts,this._opts=this._metaOpts);try{a=gs.call(this,e.schema,t,e.localRefs)}catch(t){throw delete e.validate,t}finally{e.compiling=!1,e.meta&&(this._opts=r)}return e.validate=a,e.refs=a.refs,e.refVal=a.refVal,e.root=a.root,a;function s(){var t=e.validate,r=t.apply(this,arguments);return s.errors=t.errors,r}},Ts.prototype.compileAsync=ls;var Os=fs;Ts.prototype.addKeyword=Os.add,Ts.prototype.getKeyword=Os.get,Ts.prototype.removeKeyword=Os.remove,Ts.prototype.validateKeyword=Os.validate;var $s=la;Ts.ValidationError=$s.Validation,Ts.MissingRefError=$s.MissingRef,Ts.$dataMetaSchema=xs;var Rs="http://json-schema.org/draft-07/schema",js=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Cs=["/properties"];function Ts(e){if(!(this instanceof Ts))return new Ts(e);e=this._opts=Ss.copy(e)||{},function(e){var t=e._opts.logger;if(!1===t)e.logger={log:Ls,warn:Ls,error:Ls};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=ws(e.format),this._cache=e.cache||new _s,this._loadingSchemas={},this._compilations=[],this.RULES=Es(),this._getId=function(e){switch(e.schemaId){case"auto":return Ns;case"id":return As;default:return Ds}}(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=Ps),this._metaOpts=function(e){for(var t=Ss.copy(e._opts),r=0;r<js.length;r++)delete t[js[r]];return t}(this),e.formats&&function(e){for(var t in e._opts.formats){var r=e._opts.formats[t];e.addFormat(t,r)}}(this),e.keywords&&function(e){for(var t in e._opts.keywords){var r=e._opts.keywords[t];e.addKeyword(t,r)}}(this),function(e){var t;e._opts.$data&&(t=vs,e.addMetaSchema(t,t.$id,!0));if(!1===e._opts.meta)return;var r=ds;e._opts.$data&&(r=xs(r,Cs));e.addMetaSchema(r,Rs,!0),e._refs["http://json-schema.org/schema"]=Rs}(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),function(e){var t=e._opts.schemas;if(!t)return;if(Array.isArray(t))e.addSchema(t);else for(var r in t)e.addSchema(t[r],r)}(this)}function Fs(e,t){return t=ys.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function Is(e,t,r){for(var a in t){var s=t[a];s.meta||r&&!r.test(a)||(e._cache.del(s.cacheKey),delete t[a])}}function As(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function Ds(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function Ns(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function qs(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function Ls(){}var Zs=gr(ks);class zs extends vr{constructor(e,t){var r;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._ajv=new Zs}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}))}assertCapability(e,t){var r;if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{const e=await this.request({method:"initialize",params:{protocolVersion:Ve,capabilities:this._capabilities,clientInfo:this._clientInfo}},ht,t);if(void 0===e)throw new Error(`Server sent invalid initialize result: ${e}`);if(!Me.includes(e.protocolVersion))throw new Error(`Server's protocol version is not supported: ${e.protocolVersion}`);this._serverCapabilities=e.capabilities,this._serverVersion=e.serverInfo,this._instructions=e.instructions,await this.notification({method:"notifications/initialized"})}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,r,a,s,i;switch(e){case"logging/setLevel":if(!(null===(t=this._serverCapabilities)||void 0===t?void 0:t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(null===(a=this._serverCapabilities)||void 0===a?void 0:a.resources))throw new Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(null===(s=this._serverCapabilities)||void 0===s?void 0:s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(null===(i=this._serverCapabilities)||void 0===i?void 0:i.completions))throw new Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){var t;if("notifications/roots/list_changed"===e)if(!(null===(t=this._capabilities.roots)||void 0===t?void 0:t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},ot,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},ur,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},ot,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ht,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Nt,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},St,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ot,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Rt,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},ot,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},ot,t)}async callTool(e,t=Wt,r){const a=await this.request({method:"tools/call",params:e},t,r),s=this.getToolOutputValidator(e.name);if(s){if(!a.structuredContent&&!a.isError)throw new fr(st.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!s(a.structuredContent))throw new fr(st.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(s.errors)}`)}catch(e){if(e instanceof fr)throw e;throw new fr(st.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const t of e)if(t.outputSchema)try{const e=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}catch(e){console.warn(`Failed to compile output schema for tool ${t.name}: ${e}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},Jt,t);return this.cacheToolOutputSchemas(r.tools),r}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}class Vs{static async init(e){if(!(null==e?void 0:e.apiKey))throw new Error("MboaAI-SDK: apiKey is required");if(Vs.ready)return;const{apiKey:t,mcpUrl:r="https://api.filparty.com:8001/mcp",name:a="MboaAI-SDK",version:s="1.0.0",defaultType:i="standard"}=e,o=new Ms(new URL(r),t),n=new zs({name:a,version:s});await n.connect(o),Vs.client=n,Vs.apiKey=t,Vs.defaultType=i,Vs.ready=!0}static async translate(e,t,r){var a,s;if(!Vs.ready)throw new Error("MboaAI-SDK: call init() first");const i=`Translate "${e}" into ${t} for ${null!=r?r:Vs.defaultType}`;try{const t=await Vs.client.callTool({name:"run_translate",arguments:{message:i,api_key:Vs.apiKey}}),r=null==t?void 0:t.content,o=String(null!==(s=null===(a=null==r?void 0:r[0])||void 0===a?void 0:a.text)&&void 0!==s?s:"");if((e=>{const t=e.trim().charAt(0);return"{"===t||"["===t})(o))try{const t=JSON.parse(o);return t.reply||t.text||e}catch(e){}return o||e}catch(t){return console.error("[MboaAI-SDK] translate error → returning source",t),e}}}Vs.ready=!1,Vs.defaultType="standard",Vs.apiKey="","undefined"!=typeof window&&(window.MboaAI=window.MboaAI||{},window.MboaAI.T=Vs);class Ms{constructor(e,t){this.url=e,this.headers={accept:"application/json","x-api-key":t}}async send(e){const t=new URLSearchParams({json:JSON.stringify(e)}).toString(),r=`${this.url.toString()}?${t}`,a=await fetch(r,{method:"GET",headers:this.headers});if(!a.ok){const e=await a.text();throw new Error(`GETJsonTransport failed: ${a.status} ${e}`)}return await a.json()}async start(){}async close(){}get sessionId(){}async terminateSession(){}}export{Vs as T,Vs as default};