@mcp-b/global 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.js +24 -3
- package/package.json +45 -53
- package/dist/.tsbuildinfo +0 -1
- package/dist/index.cjs +0 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -23
- package/dist/index.d.ts +0 -23
- package/dist/index.js.map +0 -1
- package/dist/index.umd.js +0 -11
- package/dist/index.umd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// ==UserScript==
|
|
2
|
+
// @name Gmail MCP-B Injector
|
|
3
|
+
// @namespace https://github.com/miguelspizza/mcp-b-user-scripts
|
|
4
|
+
// @version 1.0.0
|
|
5
|
+
// @author Alex Nahas
|
|
6
|
+
// @description Injects MCP-B server into Gmail for AI assistant integration
|
|
7
|
+
// @license MIT
|
|
8
|
+
// @homepage https://github.com/MiguelsPizza/WebMCP#readme
|
|
9
|
+
// @homepageURL https://github.com/miguelspizza/mcp-b-user-scripts
|
|
10
|
+
// @source https://github.com/MiguelsPizza/WebMCP.git
|
|
11
|
+
// @supportURL https://github.com/miguelspizza/mcp-b-user-scripts/issues
|
|
12
|
+
// @match https://mail.google.com/*
|
|
13
|
+
// ==/UserScript==
|
|
14
|
+
|
|
15
|
+
(function () {
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
(function(){var ue;(function(s){s.assertEqual=r=>r;function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{const i={};for(const l of r)i[l]=l;return i},s.getValidEnumValues=r=>{const i=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),l={};for(const o of i)l[o]=r[o];return s.objectValues(l)},s.objectValues=r=>s.objectKeys(r).map(function(i){return r[i]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const l in r)Object.prototype.hasOwnProperty.call(r,l)&&i.push(l);return i},s.find=(r,i)=>{for(const l of r)if(i(l))return l},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function a(r,i=" | "){return r.map(l=>typeof l=="string"?`'${l}'`:l).join(i)}s.joinValues=a,s.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i;})(ue||(ue={}));var Ot;(function(s){s.mergeShapes=(e,t)=>({...e,...t});})(Ot||(Ot={}));const H=ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=s=>{switch(typeof s){case "undefined":return H.undefined;case "string":return H.string;case "number":return isNaN(s)?H.nan:H.number;case "boolean":return H.boolean;case "function":return H.function;case "bigint":return H.bigint;case "symbol":return H.symbol;case "object":return Array.isArray(s)?H.array:s===null?H.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?H.promise:typeof Map<"u"&&s instanceof Map?H.map:typeof Set<"u"&&s instanceof Set?H.set:typeof Date<"u"&&s instanceof Date?H.date:H.object;default:return H.unknown}},q=ue.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"]),gi=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class Ue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a];},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a];};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(i){return i.message},a={_errors:[]},r=i=>{for(const l of i.issues)if(l.code==="invalid_union")l.unionErrors.map(r);else if(l.code==="invalid_return_type")r(l.returnTypeError);else if(l.code==="invalid_arguments")r(l.argumentsError);else if(l.path.length===0)a._errors.push(t(l));else {let o=a,c=0;for(;c<l.path.length;){const h=l.path[c];c===l.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(l))):o[h]=o[h]||{_errors:[]},o=o[h],c++;}}};return r(this),a}static assert(e){if(!(e instanceof Ue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ue.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},a=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):a.push(e(r));return {formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}Ue.create=s=>new Ue(s);const $r=(s,e)=>{let t;switch(s.code){case q.invalid_type:s.received===H.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case q.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,ue.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:t=`Unrecognized key(s) in object: ${ue.joinValues(s.keys,", ")}`;break;case q.invalid_union:t="Invalid input";break;case q.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ue.joinValues(s.options)}`;break;case q.invalid_enum_value:t=`Invalid enum value. Expected ${ue.joinValues(s.options)}, received '${s.received}'`;break;case q.invalid_arguments:t="Invalid function arguments";break;case q.invalid_return_type:t="Invalid function return type";break;case q.invalid_date:t="Invalid date";break;case q.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:ue.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case q.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case q.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case q.custom:t="Invalid input";break;case q.invalid_intersection_types:t="Intersection results could not be merged";break;case q.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case q.not_finite:t="Number must be finite";break;default:t=e.defaultError,ue.assertNever(s);}return {message:t}};let Xa=$r;function yi(s){Xa=s;}function ot(){return Xa}const lt=s=>{const{data:e,path:t,errorMaps:a,issueData:r}=s,i=[...t,...r.path||[]],l={...r,path:i};if(r.message!==void 0)return {...r,path:i,message:r.message};let o="";const c=a.filter(h=>!!h).slice().reverse();for(const h of c)o=h(l,{data:e,defaultError:o}).message;return {...r,path:i,message:o}},_i=[];function U(s,e){const t=ot(),a=lt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===$r?void 0:$r].filter(r=>!!r)});s.common.issues.push(a);}class Ae{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){const a=[];for(const r of t){if(r.status==="aborted")return G;r.status==="dirty"&&e.dirty(),a.push(r.value);}return {status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const r of t){const i=await r.key,l=await r.value;a.push({key:i,value:l});}return Ae.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const r of t){const{key:i,value:l}=r;if(i.status==="aborted"||l.status==="aborted")return G;i.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof l.value<"u"||r.alwaysSet)&&(a[i.value]=l.value);}return {status:e.value,value:a}}}const G=Object.freeze({status:"aborted"}),Tr=s=>({status:"dirty",value:s}),De=s=>({status:"valid",value:s}),It=s=>s.status==="aborted",Ct=s=>s.status==="dirty",Pr=s=>s.status==="valid",Nr=s=>typeof Promise<"u"&&s instanceof Promise;function ct(s,e,t,a){if(typeof e=="function"?s!==e||true:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(s)}function es(s,e,t,a,r){if(typeof e=="function"?s!==e||true:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(s,t),t}typeof SuppressedError=="function"&&SuppressedError;var B;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message;})(B||(B={}));var Fr,qr;class tr{constructor(e,t,a,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=r;}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const rs=(s,e)=>{if(Pr(e))return {success:true,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:false,get error(){if(this._error)return this._error;const t=new Ue(s.common.issues);return this._error=t,this._error}}};function te(s){if(!s)return {};const{errorMap:e,invalid_type_error:t,required_error:a,description:r}=s;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(l,o)=>{var c,h;const{message:f}=s;return l.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(c=f??a)!==null&&c!==void 0?c:o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:(h=f??t)!==null&&h!==void 0?h:o.defaultError}},description:r}}class se{get description(){return this._def.description}_getType(e){return dr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new Ae,ctx:{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Nr(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 a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const r={common:{issues:[],async:(a=t?.async)!==null&&a!==void 0?a:false,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},i=this._parseSync({data:e,path:r.path,parent:r});return rs(r,i)}"~validate"(e){var t,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return Pr(i)?{value:i.value}:{issues:r.common.issues}}catch(i){!((a=(t=i?.message)===null||t===void 0?void 0:t.toLowerCase())===null||a===void 0)&&a.includes("encountered")&&(this["~standard"].async=true),r.common={issues:[],async:true};}return this._parseAsync({data:e,path:[],parent:r}).then(i=>Pr(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:true},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},r=this._parse({data:e,path:a.path,parent:a}),i=await(Nr(r)?r:Promise.resolve(r));return rs(a,i)}refine(e,t){const a=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const l=e(r),o=()=>i.addIssue({code:q.custom,...a(r)});return typeof Promise<"u"&&l instanceof Promise?l.then(c=>c?true:(o(),false)):l?true:(o(),false)})}refinement(e,t){return this._refinement((a,r)=>e(a)?true:(r.addIssue(typeof t=="function"?t(a,r):t),false))}_refinement(e){return new Ye({schema:this,typeName:Z.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:t=>this["~validate"](t)};}optional(){return sr.create(this,this._def)}nullable(){return _r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ge.create(this)}promise(){return kr.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Ur.create(this,e,this._def)}transform(e){return new Ye({...te(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Jr({...te(this._def),innerType:this,defaultValue:t,typeName:Z.ZodDefault})}brand(){return new At({typeName:Z.ZodBranded,type:this,...te(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Kr({...te(this._def),innerType:this,catchValue:t,typeName:Z.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wr.create(this,e)}readonly(){return Gr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const bi=/^c[^\s-]{8,}$/i,Pi=/^[0-9a-z]+$/,Si=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ei=/^[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,wi=/^[a-z0-9_-]{21}$/i,Ri=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xi=/^[-+]?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)?)??$/,$i=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ti="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kt;const Oi=/^(?:(?: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])$/,Ii=/^(?:(?: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])$/,Ci=/^(([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]))$/,ki=/^(([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])$/,ji=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ai=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ts="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Di=new RegExp(`^${ts}$`);function as(s){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ni(s){return new RegExp(`^${as(s)}$`)}function ss(s){let e=`${ts}T${as(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Fi(s,e){return !!((e==="v4"||!e)&&Oi.test(s)||(e==="v6"||!e)&&Ci.test(s))}function qi(s,e){if(!Ri.test(s))return false;try{const[t]=s.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(a));return !(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch{return false}}function Li(s,e){return !!((e==="v4"||!e)&&Ii.test(s)||(e==="v6"||!e)&&ki.test(s))}class We extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){const i=this._getOrReturnCtx(e);return U(i,{code:q.invalid_type,expected:H.string,received:i.parsedType}),G}const a=new Ae;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:q.too_small,minimum:i.value,type:"string",inclusive:true,exact:false,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:q.too_big,maximum:i.value,type:"string",inclusive:true,exact:false,message:i.message}),a.dirty());else if(i.kind==="length"){const l=e.data.length>i.value,o=e.data.length<i.value;(l||o)&&(r=this._getOrReturnCtx(e,r),l?U(r,{code:q.too_big,maximum:i.value,type:"string",inclusive:true,exact:true,message:i.message}):o&&U(r,{code:q.too_small,minimum:i.value,type:"string",inclusive:true,exact:true,message:i.message}),a.dirty());}else if(i.kind==="email")$i.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"email",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")kt||(kt=new RegExp(Ti,"u")),kt.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"emoji",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")Ei.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"uuid",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")wi.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"nanoid",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")bi.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cuid",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")Pi.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cuid2",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")Si.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"ulid",code:q.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data);}catch{r=this._getOrReturnCtx(e,r),U(r,{validation:"url",code:q.invalid_string,message:i.message}),a.dirty();}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"regex",code:q.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?ss(i).test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?Di.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Ni(i).test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:q.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?xi.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"duration",code:q.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Fi(e.data,i.version)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"ip",code:q.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?qi(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"jwt",code:q.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?Li(e.data,i.version)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cidr",code:q.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?ji.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"base64",code:q.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"base64url",code:q.invalid_string,message:i.message}),a.dirty()):ue.assertNever(i);return {status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(r=>e.test(r),{validation:t,code:q.invalid_string,...B.errToObj(a)})}_addCheck(e){return new We({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...B.errToObj(e)})}url(e){return this._addCheck({kind:"url",...B.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...B.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...B.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...B.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...B.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...B.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...B.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...B.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...B.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...B.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...B.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...B.errToObj(e)})}datetime(e){var t,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:false,local:false,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:false,local:(a=e?.local)!==null&&a!==void 0?a:false,...B.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...B.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...B.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...B.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...B.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...B.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...B.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...B.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...B.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...B.errToObj(t)})}nonempty(e){return this.min(1,B.errToObj(e))}trim(){return new We({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new We({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new We({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return !!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return !!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}We.create=s=>{var e;return new We({checks:[],typeName:Z.ZodString,coerce:(e=s?.coerce)!==null&&e!==void 0?e:false,...te(s)})};function Mi(s,e){const t=(s.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,r=t>a?t:a,i=parseInt(s.toFixed(r).replace(".","")),l=parseInt(e.toFixed(r).replace(".",""));return i%l/Math.pow(10,r)}class vr extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){const i=this._getOrReturnCtx(e);return U(i,{code:q.invalid_type,expected:H.number,received:i.parsedType}),G}let a;const r=new Ae;for(const i of this._def.checks)i.kind==="int"?ue.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),U(a,{code:q.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:false,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:false,message:i.message}),r.dirty()):i.kind==="multipleOf"?Mi(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),U(a,{code:q.not_finite,message:i.message}),r.dirty()):ue.assertNever(i);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,true,B.toString(t))}gt(e,t){return this.setLimit("min",e,false,B.toString(t))}lte(e,t){return this.setLimit("max",e,true,B.toString(t))}lt(e,t){return this.setLimit("max",e,false,B.toString(t))}setLimit(e,t,a,r){return new vr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:B.toString(r)}]})}_addCheck(e){return new vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:B.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:B.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:B.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:B.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:B.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ue.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return true;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);}return Number.isFinite(t)&&Number.isFinite(e)}}vr.create=s=>new vr({checks:[],typeName:Z.ZodNumber,coerce:s?.coerce||false,...te(s)});class gr extends se{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)!==H.bigint)return this._getInvalidInput(e);let a;const r=new Ae;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),U(a,{code:q.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):ue.assertNever(i);return {status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return U(t,{code:q.invalid_type,expected:H.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit("min",e,true,B.toString(t))}gt(e,t){return this.setLimit("min",e,false,B.toString(t))}lte(e,t){return this.setLimit("max",e,true,B.toString(t))}lt(e,t){return this.setLimit("max",e,false,B.toString(t))}setLimit(e,t,a,r){return new gr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:B.toString(r)}]})}_addCheck(e){return new gr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:B.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}gr.create=s=>{var e;return new gr({checks:[],typeName:Z.ZodBigInt,coerce:(e=s?.coerce)!==null&&e!==void 0?e:false,...te(s)})};class Lr extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.boolean,received:a.parsedType}),G}return De(e.data)}}Lr.create=s=>new Lr({typeName:Z.ZodBoolean,coerce:s?.coerce||false,...te(s)});class Sr extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){const i=this._getOrReturnCtx(e);return U(i,{code:q.invalid_type,expected:H.date,received:i.parsedType}),G}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return U(i,{code:q.invalid_date}),G}const a=new Ae;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:q.too_small,message:i.message,inclusive:true,exact:false,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:q.too_big,message:i.message,inclusive:true,exact:false,maximum:i.value,type:"date"}),a.dirty()):ue.assertNever(i);return {status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Sr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:B.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:B.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Sr.create=s=>new Sr({checks:[],coerce:s?.coerce||false,typeName:Z.ZodDate,...te(s)});class ut extends se{_parse(e){if(this._getType(e)!==H.symbol){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.symbol,received:a.parsedType}),G}return De(e.data)}}ut.create=s=>new ut({typeName:Z.ZodSymbol,...te(s)});class Mr extends se{_parse(e){if(this._getType(e)!==H.undefined){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.undefined,received:a.parsedType}),G}return De(e.data)}}Mr.create=s=>new Mr({typeName:Z.ZodUndefined,...te(s)});class Zr extends se{_parse(e){if(this._getType(e)!==H.null){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.null,received:a.parsedType}),G}return De(e.data)}}Zr.create=s=>new Zr({typeName:Z.ZodNull,...te(s)});class Or extends se{constructor(){super(...arguments),this._any=true;}_parse(e){return De(e.data)}}Or.create=s=>new Or({typeName:Z.ZodAny,...te(s)});class Er extends se{constructor(){super(...arguments),this._unknown=true;}_parse(e){return De(e.data)}}Er.create=s=>new Er({typeName:Z.ZodUnknown,...te(s)});class hr extends se{_parse(e){const t=this._getOrReturnCtx(e);return U(t,{code:q.invalid_type,expected:H.never,received:t.parsedType}),G}}hr.create=s=>new hr({typeName:Z.ZodNever,...te(s)});class dt extends se{_parse(e){if(this._getType(e)!==H.undefined){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.void,received:a.parsedType}),G}return De(e.data)}}dt.create=s=>new dt({typeName:Z.ZodVoid,...te(s)});class Ge extends se{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==H.array)return U(t,{code:q.invalid_type,expected:H.array,received:t.parsedType}),G;if(r.exactLength!==null){const l=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(l||o)&&(U(t,{code:l?q.too_big:q.too_small,minimum:o?r.exactLength.value:void 0,maximum:l?r.exactLength.value:void 0,type:"array",inclusive:true,exact:true,message:r.exactLength.message}),a.dirty());}if(r.minLength!==null&&t.data.length<r.minLength.value&&(U(t,{code:q.too_small,minimum:r.minLength.value,type:"array",inclusive:true,exact:false,message:r.minLength.message}),a.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(U(t,{code:q.too_big,maximum:r.maxLength.value,type:"array",inclusive:true,exact:false,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((l,o)=>r.type._parseAsync(new tr(t,l,t.path,o)))).then(l=>Ae.mergeArray(a,l));const i=[...t.data].map((l,o)=>r.type._parseSync(new tr(t,l,t.path,o)));return Ae.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new Ge({...this._def,minLength:{value:e,message:B.toString(t)}})}max(e,t){return new Ge({...this._def,maxLength:{value:e,message:B.toString(t)}})}length(e,t){return new Ge({...this._def,exactLength:{value:e,message:B.toString(t)}})}nonempty(e){return this.min(1,e)}}Ge.create=(s,e)=>new Ge({type:s,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...te(e)});function Ir(s){if(s instanceof Pe){const e={};for(const t in s.shape){const a=s.shape[t];e[t]=sr.create(Ir(a));}return new Pe({...s._def,shape:()=>e})}else return s instanceof Ge?new Ge({...s._def,type:Ir(s.element)}):s instanceof sr?sr.create(Ir(s.unwrap())):s instanceof _r?_r.create(Ir(s.unwrap())):s instanceof ar?ar.create(s.items.map(e=>Ir(e))):s}class Pe extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=ue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==H.object){const h=this._getOrReturnCtx(e);return U(h,{code:q.invalid_type,expected:H.object,received:h.parsedType}),G}const{status:a,ctx:r}=this._processInputParams(e),{shape:i,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof hr&&this._def.unknownKeys==="strip"))for(const h in r.data)l.includes(h)||o.push(h);const c=[];for(const h of l){const f=i[h],m=r.data[h];c.push({key:{status:"valid",value:h},value:f._parse(new tr(r,m,r.path,h)),alwaysSet:h in r.data});}if(this._def.catchall instanceof hr){const h=this._def.unknownKeys;if(h==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(h==="strict")o.length>0&&(U(r,{code:q.unrecognized_keys,keys:o}),a.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {const h=this._def.catchall;for(const f of o){const m=r.data[f];c.push({key:{status:"valid",value:f},value:h._parse(new tr(r,m,r.path,f)),alwaysSet:f in r.data});}}return r.common.async?Promise.resolve().then(async()=>{const h=[];for(const f of c){const m=await f.key,b=await f.value;h.push({key:m,value:b,alwaysSet:f.alwaysSet});}return h}).then(h=>Ae.mergeObjectSync(a,h)):Ae.mergeObjectSync(a,c)}get shape(){return this._def.shape()}strict(e){return B.errToObj,new Pe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{var r,i,l,o;const c=(l=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,t,a).message)!==null&&l!==void 0?l:a.defaultError;return t.code==="unrecognized_keys"?{message:(o=B.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Pe({...this._def,unknownKeys:"strip"})}passthrough(){return new Pe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Pe({...this._def,catchall:e})}pick(e){const t={};return ue.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a]);}),new Pe({...this._def,shape:()=>t})}omit(e){const t={};return ue.objectKeys(this.shape).forEach(a=>{e[a]||(t[a]=this.shape[a]);}),new Pe({...this._def,shape:()=>t})}deepPartial(){return Ir(this)}partial(e){const t={};return ue.objectKeys(this.shape).forEach(a=>{const r=this.shape[a];e&&!e[a]?t[a]=r:t[a]=r.optional();}),new Pe({...this._def,shape:()=>t})}required(e){const t={};return ue.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])t[a]=this.shape[a];else {let i=this.shape[a];for(;i instanceof sr;)i=i._def.innerType;t[a]=i;}}),new Pe({...this._def,shape:()=>t})}keyof(){return ns(ue.objectKeys(this.shape))}}Pe.create=(s,e)=>new Pe({shape:()=>s,unknownKeys:"strip",catchall:hr.create(),typeName:Z.ZodObject,...te(e)}),Pe.strictCreate=(s,e)=>new Pe({shape:()=>s,unknownKeys:"strict",catchall:hr.create(),typeName:Z.ZodObject,...te(e)}),Pe.lazycreate=(s,e)=>new Pe({shape:s,unknownKeys:"strip",catchall:hr.create(),typeName:Z.ZodObject,...te(e)});class zr extends se{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const l=i.map(o=>new Ue(o.ctx.common.issues));return U(t,{code:q.invalid_union,unionErrors:l}),G}if(t.common.async)return Promise.all(a.map(async i=>{const l={...t,common:{...t.common,issues:[]},parent:null};return {result:await i._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let i;const l=[];for(const c of a){const h={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:h});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:h}),h.common.issues.length&&l.push(h.common.issues);}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=l.map(c=>new Ue(c));return U(t,{code:q.invalid_union,unionErrors:o}),G}}get options(){return this._def.options}}zr.create=(s,e)=>new zr({options:s,typeName:Z.ZodUnion,...te(e)});const fr=s=>s instanceof Hr?fr(s.schema):s instanceof Ye?fr(s.innerType()):s instanceof Br?[s.value]:s instanceof yr?s.options:s instanceof Qr?ue.objectValues(s.enum):s instanceof Jr?fr(s._def.innerType):s instanceof Mr?[void 0]:s instanceof Zr?[null]:s instanceof sr?[void 0,...fr(s.unwrap())]:s instanceof _r?[null,...fr(s.unwrap())]:s instanceof At||s instanceof Gr?fr(s.unwrap()):s instanceof Kr?fr(s._def.innerType):[];class ht extends se{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.object)return U(t,{code:q.invalid_type,expected:H.object,received:t.parsedType}),G;const a=this.discriminator,r=t.data[a],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(U(t,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const r=new Map;for(const i of t){const l=fr(i.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of l){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i);}}return new ht({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...te(a)})}}function jt(s,e){const t=dr(s),a=dr(e);if(s===e)return {valid:true,data:s};if(t===H.object&&a===H.object){const r=ue.objectKeys(e),i=ue.objectKeys(s).filter(o=>r.indexOf(o)!==-1),l={...s,...e};for(const o of i){const c=jt(s[o],e[o]);if(!c.valid)return {valid:false};l[o]=c.data;}return {valid:true,data:l}}else if(t===H.array&&a===H.array){if(s.length!==e.length)return {valid:false};const r=[];for(let i=0;i<s.length;i++){const l=s[i],o=e[i],c=jt(l,o);if(!c.valid)return {valid:false};r.push(c.data);}return {valid:true,data:r}}else return t===H.date&&a===H.date&&+s==+e?{valid:true,data:s}:{valid:false}}class Ur extends se{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=(i,l)=>{if(It(i)||It(l))return G;const o=jt(i.value,l.value);return o.valid?((Ct(i)||Ct(l))&&t.dirty(),{status:t.value,value:o.data}):(U(a,{code:q.invalid_intersection_types}),G)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,l])=>r(i,l)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}Ur.create=(s,e,t)=>new Ur({left:s,right:e,typeName:Z.ZodIntersection,...te(t)});class ar extends se{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==H.array)return U(a,{code:q.invalid_type,expected:H.array,received:a.parsedType}),G;if(a.data.length<this._def.items.length)return U(a,{code:q.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"}),G;!this._def.rest&&a.data.length>this._def.items.length&&(U(a,{code:q.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"}),t.dirty());const i=[...a.data].map((l,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new tr(a,l,a.path,o)):null}).filter(l=>!!l);return a.common.async?Promise.all(i).then(l=>Ae.mergeArray(t,l)):Ae.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ar({...this._def,rest:e})}}ar.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ar({items:s,typeName:Z.ZodTuple,rest:null,...te(e)})};class Vr extends se{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!==H.object)return U(a,{code:q.invalid_type,expected:H.object,received:a.parsedType}),G;const r=[],i=this._def.keyType,l=this._def.valueType;for(const o in a.data)r.push({key:i._parse(new tr(a,o,a.path,o)),value:l._parse(new tr(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Ae.mergeObjectAsync(t,r):Ae.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof se?new Vr({keyType:e,valueType:t,typeName:Z.ZodRecord,...te(a)}):new Vr({keyType:We.create(),valueType:e,typeName:Z.ZodRecord,...te(t)})}}class ft extends se{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!==H.map)return U(a,{code:q.invalid_type,expected:H.map,received:a.parsedType}),G;const r=this._def.keyType,i=this._def.valueType,l=[...a.data.entries()].map(([o,c],h)=>({key:r._parse(new tr(a,o,a.path,[h,"key"])),value:i._parse(new tr(a,c,a.path,[h,"value"]))}));if(a.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of l){const h=await c.key,f=await c.value;if(h.status==="aborted"||f.status==="aborted")return G;(h.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(h.value,f.value);}return {status:t.value,value:o}})}else {const o=new Map;for(const c of l){const h=c.key,f=c.value;if(h.status==="aborted"||f.status==="aborted")return G;(h.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(h.value,f.value);}return {status:t.value,value:o}}}}ft.create=(s,e,t)=>new ft({valueType:e,keyType:s,typeName:Z.ZodMap,...te(t)});class wr extends se{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==H.set)return U(a,{code:q.invalid_type,expected:H.set,received:a.parsedType}),G;const r=this._def;r.minSize!==null&&a.data.size<r.minSize.value&&(U(a,{code:q.too_small,minimum:r.minSize.value,type:"set",inclusive:true,exact:false,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&a.data.size>r.maxSize.value&&(U(a,{code:q.too_big,maximum:r.maxSize.value,type:"set",inclusive:true,exact:false,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function l(c){const h=new Set;for(const f of c){if(f.status==="aborted")return G;f.status==="dirty"&&t.dirty(),h.add(f.value);}return {status:t.value,value:h}}const o=[...a.data.values()].map((c,h)=>i._parse(new tr(a,c,a.path,h)));return a.common.async?Promise.all(o).then(c=>l(c)):l(o)}min(e,t){return new wr({...this._def,minSize:{value:e,message:B.toString(t)}})}max(e,t){return new wr({...this._def,maxSize:{value:e,message:B.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wr.create=(s,e)=>new wr({valueType:s,minSize:null,maxSize:null,typeName:Z.ZodSet,...te(e)});class Cr extends se{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.function)return U(t,{code:q.invalid_type,expected:H.function,received:t.parsedType}),G;function a(o,c){return lt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),$r].filter(h=>!!h),issueData:{code:q.invalid_arguments,argumentsError:c}})}function r(o,c){return lt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),$r].filter(h=>!!h),issueData:{code:q.invalid_return_type,returnTypeError:c}})}const i={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof kr){const o=this;return De(async function(...c){const h=new Ue([]),f=await o._def.args.parseAsync(c,i).catch(u=>{throw h.addIssue(a(c,u)),h}),m=await Reflect.apply(l,this,f);return await o._def.returns._def.type.parseAsync(m,i).catch(u=>{throw h.addIssue(r(m,u)),h})})}else {const o=this;return De(function(...c){const h=o._def.args.safeParse(c,i);if(!h.success)throw new Ue([a(c,h.error)]);const f=Reflect.apply(l,this,h.data),m=o._def.returns.safeParse(f,i);if(!m.success)throw new Ue([r(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Cr({...this._def,args:ar.create(e).rest(Er.create())})}returns(e){return new Cr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new Cr({args:e||ar.create([]).rest(Er.create()),returns:t||Er.create(),typeName:Z.ZodFunction,...te(a)})}}class Hr extends se{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})}}Hr.create=(s,e)=>new Hr({getter:s,typeName:Z.ZodLazy,...te(e)});class Br extends se{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return U(t,{received:t.data,code:q.invalid_literal,expected:this._def.value}),G}return {status:"valid",value:e.data}}get value(){return this._def.value}}Br.create=(s,e)=>new Br({value:s,typeName:Z.ZodLiteral,...te(e)});function ns(s,e){return new yr({values:s,typeName:Z.ZodEnum,...te(e)})}class yr extends se{constructor(){super(...arguments),Fr.set(this,void 0);}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),a=this._def.values;return U(t,{expected:ue.joinValues(a),received:t.parsedType,code:q.invalid_type}),G}if(ct(this,Fr)||es(this,Fr,new Set(this._def.values)),!ct(this,Fr).has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return U(t,{received:t.data,code:q.invalid_enum_value,options:a}),G}return De(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 yr.create(e,{...this._def,...t})}exclude(e,t=this._def){return yr.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}}Fr=new WeakMap,yr.create=ns;class Qr extends se{constructor(){super(...arguments),qr.set(this,void 0);}_parse(e){const t=ue.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==H.string&&a.parsedType!==H.number){const r=ue.objectValues(t);return U(a,{expected:ue.joinValues(r),received:a.parsedType,code:q.invalid_type}),G}if(ct(this,qr)||es(this,qr,new Set(ue.getValidEnumValues(this._def.values))),!ct(this,qr).has(e.data)){const r=ue.objectValues(t);return U(a,{received:a.data,code:q.invalid_enum_value,options:r}),G}return De(e.data)}get enum(){return this._def.values}}qr=new WeakMap,Qr.create=(s,e)=>new Qr({values:s,typeName:Z.ZodNativeEnum,...te(e)});class kr extends se{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.promise&&t.common.async===false)return U(t,{code:q.invalid_type,expected:H.promise,received:t.parsedType}),G;const a=t.parsedType===H.promise?t.data:Promise.resolve(t.data);return De(a.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}kr.create=(s,e)=>new kr({type:s,typeName:Z.ZodPromise,...te(e)});class Ye extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:l=>{U(a,l),l.fatal?t.abort():t.dirty();},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const l=r.transform(a.data,i);if(a.common.async)return Promise.resolve(l).then(async o=>{if(t.value==="aborted")return G;const c=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return c.status==="aborted"?G:c.status==="dirty"||t.value==="dirty"?Tr(c.value):c});{if(t.value==="aborted")return G;const o=this._def.schema._parseSync({data:l,path:a.path,parent:a});return o.status==="aborted"?G:o.status==="dirty"||t.value==="dirty"?Tr(o.value):o}}if(r.type==="refinement"){const l=o=>{const c=r.refinement(o,i);if(a.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===false){const o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?G:(o.status==="dirty"&&t.dirty(),l(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?G:(o.status==="dirty"&&t.dirty(),l(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(a.common.async===false){const l=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Pr(l))return l;const o=r.transform(l.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(l=>Pr(l)?Promise.resolve(r.transform(l.value,i)).then(o=>({status:t.value,value:o})):l);ue.assertNever(r);}}Ye.create=(s,e,t)=>new Ye({schema:s,typeName:Z.ZodEffects,effect:e,...te(t)}),Ye.createWithPreprocess=(s,e,t)=>new Ye({schema:e,effect:{type:"preprocess",transform:s},typeName:Z.ZodEffects,...te(t)});class sr extends se{_parse(e){return this._getType(e)===H.undefined?De(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}sr.create=(s,e)=>new sr({innerType:s,typeName:Z.ZodOptional,...te(e)});class _r extends se{_parse(e){return this._getType(e)===H.null?De(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_r.create=(s,e)=>new _r({innerType:s,typeName:Z.ZodNullable,...te(e)});class Jr extends se{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===H.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Jr.create=(s,e)=>new Jr({innerType:s,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...te(e)});class Kr extends se{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Nr(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ue(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ue(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Kr.create=(s,e)=>new Kr({innerType:s,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...te(e)});class pt extends se{_parse(e){if(this._getType(e)!==H.nan){const a=this._getOrReturnCtx(e);return U(a,{code:q.invalid_type,expected:H.nan,received:a.parsedType}),G}return {status:"valid",value:e.data}}}pt.create=s=>new pt({typeName:Z.ZodNaN,...te(s)});const Zi=Symbol("zod_brand");class At extends se{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class Wr extends se{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return (async()=>{const i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?G:i.status==="dirty"?(t.dirty(),Tr(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{const r=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return r.status==="aborted"?G:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:a.path,parent:a})}}static create(e,t){return new Wr({in:e,out:t,typeName:Z.ZodPipeline})}}class Gr extends se{_parse(e){const t=this._def.innerType._parse(e),a=r=>(Pr(r)&&(r.value=Object.freeze(r.value)),r);return Nr(t)?t.then(r=>a(r)):a(t)}unwrap(){return this._def.innerType}}Gr.create=(s,e)=>new Gr({innerType:s,typeName:Z.ZodReadonly,...te(e)});function is(s,e={},t){return s?Or.create().superRefine((a,r)=>{var i,l;if(!s(a)){const o=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,c=(l=(i=o.fatal)!==null&&i!==void 0?i:t)!==null&&l!==void 0?l:true,h=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...h,fatal:c});}}):Or.create()}const zi={object:Pe.lazycreate};var Z;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly";})(Z||(Z={}));const Ui=(s,e={message:`Input not instance of ${s.name}`})=>is(t=>t instanceof s,e),os=We.create,ls=vr.create,Vi=pt.create,Hi=gr.create,cs=Lr.create,Bi=Sr.create,Qi=ut.create,Ji=Mr.create,Ki=Zr.create,Wi=Or.create,Gi=Er.create,Yi=hr.create,Xi=dt.create,eo=Ge.create,ro=Pe.create,to=Pe.strictCreate,ao=zr.create,so=ht.create,no=Ur.create,io=ar.create,oo=Vr.create,lo=ft.create,co=wr.create,uo=Cr.create,ho=Hr.create,fo=Br.create,po=yr.create,mo=Qr.create,vo=kr.create,us=Ye.create,go=sr.create,yo=_r.create,_o=Ye.createWithPreprocess,bo=Wr.create;var n=Object.freeze({__proto__:null,defaultErrorMap:$r,setErrorMap:yi,getErrorMap:ot,makeIssue:lt,EMPTY_PATH:_i,addIssueToContext:U,ParseStatus:Ae,INVALID:G,DIRTY:Tr,OK:De,isAborted:It,isDirty:Ct,isValid:Pr,isAsync:Nr,get util(){return ue},get objectUtil(){return Ot},ZodParsedType:H,getParsedType:dr,ZodType:se,datetimeRegex:ss,ZodString:We,ZodNumber:vr,ZodBigInt:gr,ZodBoolean:Lr,ZodDate:Sr,ZodSymbol:ut,ZodUndefined:Mr,ZodNull:Zr,ZodAny:Or,ZodUnknown:Er,ZodNever:hr,ZodVoid:dt,ZodArray:Ge,ZodObject:Pe,ZodUnion:zr,ZodDiscriminatedUnion:ht,ZodIntersection:Ur,ZodTuple:ar,ZodRecord:Vr,ZodMap:ft,ZodSet:wr,ZodFunction:Cr,ZodLazy:Hr,ZodLiteral:Br,ZodEnum:yr,ZodNativeEnum:Qr,ZodPromise:kr,ZodEffects:Ye,ZodTransformer:Ye,ZodOptional:sr,ZodNullable:_r,ZodDefault:Jr,ZodCatch:Kr,ZodNaN:pt,BRAND:Zi,ZodBranded:At,ZodPipeline:Wr,ZodReadonly:Gr,custom:is,Schema:se,ZodSchema:se,late:zi,get ZodFirstPartyTypeKind(){return Z},coerce:{string:(s=>We.create({...s,coerce:true})),number:(s=>vr.create({...s,coerce:true})),boolean:(s=>Lr.create({...s,coerce:true})),bigint:(s=>gr.create({...s,coerce:true})),date:(s=>Sr.create({...s,coerce:true}))},any:Wi,array:eo,bigint:Hi,boolean:cs,date:Bi,discriminatedUnion:so,effect:us,enum:po,function:uo,instanceof:Ui,intersection:no,lazy:ho,literal:fo,map:lo,nan:Vi,nativeEnum:mo,never:Yi,null:Ki,nullable:yo,number:ls,object:ro,oboolean:()=>cs().optional(),onumber:()=>ls().optional(),optional:go,ostring:()=>os().optional(),pipeline:bo,preprocess:_o,promise:vo,record:oo,set:co,strictObject:to,string:os,symbol:Qi,transformer:us,tuple:io,undefined:Ji,union:ao,unknown:Gi,void:Xi,NEVER:G,ZodIssueCode:q,quotelessJson:gi,ZodError:Ue});const mt="2.0",ds=n.union([n.string(),n.number().int()]),hs=n.string(),Po=n.object({progressToken:n.optional(ds)}).passthrough(),Ve=n.object({_meta:n.optional(Po)}).passthrough(),Le=n.object({method:n.string(),params:n.optional(Ve)}),Yr=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),nr=n.object({method:n.string(),params:n.optional(Yr)}),He=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),vt=n.union([n.string(),n.number().int()]),So=n.object({jsonrpc:n.literal(mt),id:vt}).merge(Le).strict(),Eo=n.object({jsonrpc:n.literal(mt)}).merge(nr).strict(),wo=n.object({jsonrpc:n.literal(mt),id:vt,result:He}).strict();var fs;(function(s){s[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError";})(fs||(fs={}));const Ro=n.object({jsonrpc:n.literal(mt),id:vt,error:n.object({code:n.number().int(),message:n.string(),data:n.optional(n.unknown())})}).strict(),xo=n.union([So,Eo,wo,Ro]),ps=He.strict(),ms=nr.extend({method:n.literal("notifications/cancelled"),params:Yr.extend({requestId:vt,reason:n.string().optional()})}),Xr=n.object({name:n.string(),title:n.optional(n.string())}).passthrough(),vs=Xr.extend({version:n.string()}),$o=n.object({experimental:n.optional(n.object({}).passthrough()),sampling:n.optional(n.object({}).passthrough()),elicitation:n.optional(n.object({}).passthrough()),roots:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),To=Le.extend({method:n.literal("initialize"),params:Ve.extend({protocolVersion:n.string(),capabilities:$o,clientInfo:vs})}),Oo=n.object({experimental:n.optional(n.object({}).passthrough()),logging:n.optional(n.object({}).passthrough()),completions:n.optional(n.object({}).passthrough()),prompts:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough()),resources:n.optional(n.object({subscribe:n.optional(n.boolean()),listChanged:n.optional(n.boolean())}).passthrough()),tools:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),Io=He.extend({protocolVersion:n.string(),capabilities:Oo,serverInfo:vs,instructions:n.optional(n.string())}),Co=nr.extend({method:n.literal("notifications/initialized")}),gs=Le.extend({method:n.literal("ping")}),ko=n.object({progress:n.number(),total:n.optional(n.number()),message:n.optional(n.string())}).passthrough(),ys=nr.extend({method:n.literal("notifications/progress"),params:Yr.merge(ko).extend({progressToken:ds})}),gt=Le.extend({params:Ve.extend({cursor:n.optional(hs)}).optional()}),yt=He.extend({nextCursor:n.optional(hs)}),_s=n.object({uri:n.string(),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}).passthrough(),bs=_s.extend({text:n.string()}),Dt=n.string().refine(s=>{try{return atob(s),!0}catch{return false}},{message:"Invalid Base64 string"}),Ps=_s.extend({blob:Dt}),Ss=Xr.extend({uri:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}),jo=Xr.extend({uriTemplate:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}),Ao=gt.extend({method:n.literal("resources/list")}),Do=yt.extend({resources:n.array(Ss)}),No=gt.extend({method:n.literal("resources/templates/list")}),Fo=yt.extend({resourceTemplates:n.array(jo)}),qo=Le.extend({method:n.literal("resources/read"),params:Ve.extend({uri:n.string()})}),Lo=He.extend({contents:n.array(n.union([bs,Ps]))}),Mo=nr.extend({method:n.literal("notifications/resources/list_changed")}),Zo=Le.extend({method:n.literal("resources/subscribe"),params:Ve.extend({uri:n.string()})}),zo=Le.extend({method:n.literal("resources/unsubscribe"),params:Ve.extend({uri:n.string()})}),Uo=nr.extend({method:n.literal("notifications/resources/updated"),params:Yr.extend({uri:n.string()})}),Vo=n.object({name:n.string(),description:n.optional(n.string()),required:n.optional(n.boolean())}).passthrough(),Ho=Xr.extend({description:n.optional(n.string()),arguments:n.optional(n.array(Vo)),_meta:n.optional(n.object({}).passthrough())}),Bo=gt.extend({method:n.literal("prompts/list")}),Qo=yt.extend({prompts:n.array(Ho)}),Jo=Le.extend({method:n.literal("prompts/get"),params:Ve.extend({name:n.string(),arguments:n.optional(n.record(n.string()))})}),Nt=n.object({type:n.literal("text"),text:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Ft=n.object({type:n.literal("image"),data:Dt,mimeType:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),qt=n.object({type:n.literal("audio"),data:Dt,mimeType:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Ko=n.object({type:n.literal("resource"),resource:n.union([bs,Ps]),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Wo=Ss.extend({type:n.literal("resource_link")}),Es=n.union([Nt,Ft,qt,Wo,Ko]),Go=n.object({role:n.enum(["user","assistant"]),content:Es}).passthrough(),Yo=He.extend({description:n.optional(n.string()),messages:n.array(Go)}),Xo=nr.extend({method:n.literal("notifications/prompts/list_changed")}),el=n.object({title:n.optional(n.string()),readOnlyHint:n.optional(n.boolean()),destructiveHint:n.optional(n.boolean()),idempotentHint:n.optional(n.boolean()),openWorldHint:n.optional(n.boolean())}).passthrough(),rl=Xr.extend({description:n.optional(n.string()),inputSchema:n.object({type:n.literal("object"),properties:n.optional(n.object({}).passthrough()),required:n.optional(n.array(n.string()))}).passthrough(),outputSchema:n.optional(n.object({type:n.literal("object"),properties:n.optional(n.object({}).passthrough()),required:n.optional(n.array(n.string()))}).passthrough()),annotations:n.optional(el),_meta:n.optional(n.object({}).passthrough())}),tl=gt.extend({method:n.literal("tools/list")}),al=yt.extend({tools:n.array(rl)}),ws=He.extend({content:n.array(Es).default([]),structuredContent:n.object({}).passthrough().optional(),isError:n.optional(n.boolean())});ws.or(He.extend({toolResult:n.unknown()}));const sl=Le.extend({method:n.literal("tools/call"),params:Ve.extend({name:n.string(),arguments:n.optional(n.record(n.unknown()))})}),nl=nr.extend({method:n.literal("notifications/tools/list_changed")}),Rs=n.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),il=Le.extend({method:n.literal("logging/setLevel"),params:Ve.extend({level:Rs})}),ol=nr.extend({method:n.literal("notifications/message"),params:Yr.extend({level:Rs,logger:n.optional(n.string()),data:n.unknown()})}),ll=n.object({name:n.string().optional()}).passthrough(),cl=n.object({hints:n.optional(n.array(ll)),costPriority:n.optional(n.number().min(0).max(1)),speedPriority:n.optional(n.number().min(0).max(1)),intelligencePriority:n.optional(n.number().min(0).max(1))}).passthrough(),ul=n.object({role:n.enum(["user","assistant"]),content:n.union([Nt,Ft,qt])}).passthrough(),dl=Le.extend({method:n.literal("sampling/createMessage"),params:Ve.extend({messages:n.array(ul),systemPrompt:n.optional(n.string()),includeContext:n.optional(n.enum(["none","thisServer","allServers"])),temperature:n.optional(n.number()),maxTokens:n.number().int(),stopSequences:n.optional(n.array(n.string())),metadata:n.optional(n.object({}).passthrough()),modelPreferences:n.optional(cl)})}),hl=He.extend({model:n.string(),stopReason:n.optional(n.enum(["endTurn","stopSequence","maxTokens"]).or(n.string())),role:n.enum(["user","assistant"]),content:n.discriminatedUnion("type",[Nt,Ft,qt])}),fl=n.object({type:n.literal("boolean"),title:n.optional(n.string()),description:n.optional(n.string()),default:n.optional(n.boolean())}).passthrough(),pl=n.object({type:n.literal("string"),title:n.optional(n.string()),description:n.optional(n.string()),minLength:n.optional(n.number()),maxLength:n.optional(n.number()),format:n.optional(n.enum(["email","uri","date","date-time"]))}).passthrough(),ml=n.object({type:n.enum(["number","integer"]),title:n.optional(n.string()),description:n.optional(n.string()),minimum:n.optional(n.number()),maximum:n.optional(n.number())}).passthrough(),vl=n.object({type:n.literal("string"),title:n.optional(n.string()),description:n.optional(n.string()),enum:n.array(n.string()),enumNames:n.optional(n.array(n.string()))}).passthrough(),gl=n.union([fl,pl,ml,vl]),yl=Le.extend({method:n.literal("elicitation/create"),params:Ve.extend({message:n.string(),requestedSchema:n.object({type:n.literal("object"),properties:n.record(n.string(),gl),required:n.optional(n.array(n.string()))}).passthrough()})}),_l=He.extend({action:n.enum(["accept","decline","cancel"]),content:n.optional(n.record(n.string(),n.unknown()))}),bl=n.object({type:n.literal("ref/resource"),uri:n.string()}).passthrough(),Pl=n.object({type:n.literal("ref/prompt"),name:n.string()}).passthrough(),Sl=Le.extend({method:n.literal("completion/complete"),params:Ve.extend({ref:n.union([Pl,bl]),argument:n.object({name:n.string(),value:n.string()}).passthrough(),context:n.optional(n.object({arguments:n.optional(n.record(n.string(),n.string()))}))})}),El=He.extend({completion:n.object({values:n.array(n.string()).max(100),total:n.optional(n.number().int()),hasMore:n.optional(n.boolean())}).passthrough()}),wl=n.object({uri:n.string().startsWith("file://"),name:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Rl=Le.extend({method:n.literal("roots/list")}),xl=He.extend({roots:n.array(wl)}),$l=nr.extend({method:n.literal("notifications/roots/list_changed")});n.union([gs,To,Sl,il,Jo,Bo,Ao,No,qo,Zo,zo,sl,tl]),n.union([ms,ys,Co,$l]),n.union([ps,hl,_l,xl]),n.union([gs,dl,yl,Rl]),n.union([ms,ys,ol,Uo,Mo,nl,Xo]),n.union([ps,Io,El,Yo,Qo,Do,Fo,Lo,ws,al]);var Tl=(s=>(s.START="start",s.STARTED="started",s.STOP="stop",s.STOPPED="stopped",s.PING="ping",s.PONG="pong",s.ERROR="error",s.LIST_TOOLS="list_tools",s.CALL_TOOL="call_tool",s.TOOL_LIST_UPDATED="tool_list_updated",s.TOOL_LIST_UPDATED_ACK="tool_list_updated_ack",s.PROCESS_DATA="process_data",s.SERVER_STARTED="server_started",s.SERVER_STOPPED="server_stopped",s.ERROR_FROM_NATIVE_HOST="error_from_native_host",s.CONNECT_NATIVE="connectNative",s.PING_NATIVE="ping_native",s.DISCONNECT_NATIVE="disconnect_native",s))(Tl||{}),Ol=class{_started=false;_allowedOrigins;_channelId;_messageHandler;_clientOrigin;onclose;onerror;onmessage;constructor(s){if(!s.allowedOrigins||s.allowedOrigins.length===0)throw new Error("At least one allowed origin must be specified");this._allowedOrigins=s.allowedOrigins,this._channelId=s.channelId||"mcp-default";}async start(){if(this._started)throw new Error("Transport already started");this._messageHandler=s=>{if(!this._allowedOrigins.includes(s.origin)&&!this._allowedOrigins.includes("*")||s.data?.channel!==this._channelId||s.data?.type!=="mcp"||s.data?.direction!=="client-to-server")return;this._clientOrigin=s.origin;let e=s.data.payload;if(typeof e=="string"&&e==="mcp-check-ready"){window.postMessage({channel:this._channelId,type:"mcp",direction:"server-to-client",payload:"mcp-server-ready"},this._clientOrigin);return}try{let t=xo.parse(e);this.onmessage?.(t);}catch(t){this.onerror?.(new Error(`Invalid message: ${t instanceof Error?t.message:String(t)}`));}},window.addEventListener("message",this._messageHandler),this._started=true,window.postMessage({channel:this._channelId,type:"mcp",direction:"server-to-client",payload:"mcp-server-ready"},"*");}async send(s){if(!this._started)throw new Error("Transport not started");if(!this._clientOrigin)throw new Error("No client connected");window.postMessage({channel:this._channelId,type:"mcp",direction:"server-to-client",payload:s},this._clientOrigin);}async close(){this._messageHandler&&window.removeEventListener("message",this._messageHandler),this._started=false,window.postMessage({channel:this._channelId,type:"mcp",direction:"server-to-client",payload:"mcp-server-stopped"},"*"),this.onclose?.();}};const xs="2025-06-18",Il=[xs,"2025-03-26","2024-11-05","2024-10-07"],_t="2.0",$s=n.union([n.string(),n.number().int()]),Ts=n.string(),Cl=n.object({progressToken:n.optional($s)}).passthrough(),Be=n.object({_meta:n.optional(Cl)}).passthrough(),Me=n.object({method:n.string(),params:n.optional(Be)}),et=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),ir=n.object({method:n.string(),params:n.optional(et)}),Qe=n.object({_meta:n.optional(n.object({}).passthrough())}).passthrough(),bt=n.union([n.string(),n.number().int()]),Os=n.object({jsonrpc:n.literal(_t),id:bt}).merge(Me).strict(),kl=s=>Os.safeParse(s).success,Is=n.object({jsonrpc:n.literal(_t)}).merge(ir).strict(),jl=s=>Is.safeParse(s).success,Cs=n.object({jsonrpc:n.literal(_t),id:bt,result:Qe}).strict(),ks=s=>Cs.safeParse(s).success;var Se;(function(s){s[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError";})(Se||(Se={}));const js=n.object({jsonrpc:n.literal(_t),id:bt,error:n.object({code:n.number().int(),message:n.string(),data:n.optional(n.unknown())})}).strict(),Al=s=>js.safeParse(s).success;n.union([Os,Is,Cs,js]);const Lt=Qe.strict(),Mt=ir.extend({method:n.literal("notifications/cancelled"),params:et.extend({requestId:bt,reason:n.string().optional()})}),rt=n.object({name:n.string(),title:n.optional(n.string())}).passthrough(),As=rt.extend({version:n.string()}),Dl=n.object({experimental:n.optional(n.object({}).passthrough()),sampling:n.optional(n.object({}).passthrough()),elicitation:n.optional(n.object({}).passthrough()),roots:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),Ds=Me.extend({method:n.literal("initialize"),params:Be.extend({protocolVersion:n.string(),capabilities:Dl,clientInfo:As})}),Nl=n.object({experimental:n.optional(n.object({}).passthrough()),logging:n.optional(n.object({}).passthrough()),completions:n.optional(n.object({}).passthrough()),prompts:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough()),resources:n.optional(n.object({subscribe:n.optional(n.boolean()),listChanged:n.optional(n.boolean())}).passthrough()),tools:n.optional(n.object({listChanged:n.optional(n.boolean())}).passthrough())}).passthrough(),Fl=Qe.extend({protocolVersion:n.string(),capabilities:Nl,serverInfo:As,instructions:n.optional(n.string())}),Ns=ir.extend({method:n.literal("notifications/initialized")}),Zt=Me.extend({method:n.literal("ping")}),ql=n.object({progress:n.number(),total:n.optional(n.number()),message:n.optional(n.string())}).passthrough(),zt=ir.extend({method:n.literal("notifications/progress"),params:et.merge(ql).extend({progressToken:$s})}),Pt=Me.extend({params:Be.extend({cursor:n.optional(Ts)}).optional()}),St=Qe.extend({nextCursor:n.optional(Ts)}),Fs=n.object({uri:n.string(),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}).passthrough(),qs=Fs.extend({text:n.string()}),Ls=Fs.extend({blob:n.string().base64()}),Ms=rt.extend({uri:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}),Ll=rt.extend({uriTemplate:n.string(),description:n.optional(n.string()),mimeType:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}),Ut=Pt.extend({method:n.literal("resources/list")}),Ml=St.extend({resources:n.array(Ms)}),Vt=Pt.extend({method:n.literal("resources/templates/list")}),Zl=St.extend({resourceTemplates:n.array(Ll)}),Ht=Me.extend({method:n.literal("resources/read"),params:Be.extend({uri:n.string()})}),zl=Qe.extend({contents:n.array(n.union([qs,Ls]))}),Ul=ir.extend({method:n.literal("notifications/resources/list_changed")}),Vl=Me.extend({method:n.literal("resources/subscribe"),params:Be.extend({uri:n.string()})}),Hl=Me.extend({method:n.literal("resources/unsubscribe"),params:Be.extend({uri:n.string()})}),Bl=ir.extend({method:n.literal("notifications/resources/updated"),params:et.extend({uri:n.string()})}),Ql=n.object({name:n.string(),description:n.optional(n.string()),required:n.optional(n.boolean())}).passthrough(),Jl=rt.extend({description:n.optional(n.string()),arguments:n.optional(n.array(Ql)),_meta:n.optional(n.object({}).passthrough())}),Bt=Pt.extend({method:n.literal("prompts/list")}),Kl=St.extend({prompts:n.array(Jl)}),Qt=Me.extend({method:n.literal("prompts/get"),params:Be.extend({name:n.string(),arguments:n.optional(n.record(n.string()))})}),Jt=n.object({type:n.literal("text"),text:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Kt=n.object({type:n.literal("image"),data:n.string().base64(),mimeType:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Wt=n.object({type:n.literal("audio"),data:n.string().base64(),mimeType:n.string(),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Wl=n.object({type:n.literal("resource"),resource:n.union([qs,Ls]),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Gl=Ms.extend({type:n.literal("resource_link")}),Zs=n.union([Jt,Kt,Wt,Gl,Wl]),Yl=n.object({role:n.enum(["user","assistant"]),content:Zs}).passthrough(),Xl=Qe.extend({description:n.optional(n.string()),messages:n.array(Yl)}),ec=ir.extend({method:n.literal("notifications/prompts/list_changed")}),rc=n.object({title:n.optional(n.string()),readOnlyHint:n.optional(n.boolean()),destructiveHint:n.optional(n.boolean()),idempotentHint:n.optional(n.boolean()),openWorldHint:n.optional(n.boolean())}).passthrough(),tc=rt.extend({description:n.optional(n.string()),inputSchema:n.object({type:n.literal("object"),properties:n.optional(n.object({}).passthrough()),required:n.optional(n.array(n.string()))}).passthrough(),outputSchema:n.optional(n.object({type:n.literal("object"),properties:n.optional(n.object({}).passthrough()),required:n.optional(n.array(n.string()))}).passthrough()),annotations:n.optional(rc),_meta:n.optional(n.object({}).passthrough())}),Gt=Pt.extend({method:n.literal("tools/list")}),ac=St.extend({tools:n.array(tc)}),zs=Qe.extend({content:n.array(Zs).default([]),structuredContent:n.object({}).passthrough().optional(),isError:n.optional(n.boolean())});zs.or(Qe.extend({toolResult:n.unknown()}));const Yt=Me.extend({method:n.literal("tools/call"),params:Be.extend({name:n.string(),arguments:n.optional(n.record(n.unknown()))})}),sc=ir.extend({method:n.literal("notifications/tools/list_changed")}),Us=n.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),nc=Me.extend({method:n.literal("logging/setLevel"),params:Be.extend({level:Us})}),ic=ir.extend({method:n.literal("notifications/message"),params:et.extend({level:Us,logger:n.optional(n.string()),data:n.unknown()})}),oc=n.object({name:n.string().optional()}).passthrough(),lc=n.object({hints:n.optional(n.array(oc)),costPriority:n.optional(n.number().min(0).max(1)),speedPriority:n.optional(n.number().min(0).max(1)),intelligencePriority:n.optional(n.number().min(0).max(1))}).passthrough(),cc=n.object({role:n.enum(["user","assistant"]),content:n.union([Jt,Kt,Wt])}).passthrough(),uc=Me.extend({method:n.literal("sampling/createMessage"),params:Be.extend({messages:n.array(cc),systemPrompt:n.optional(n.string()),includeContext:n.optional(n.enum(["none","thisServer","allServers"])),temperature:n.optional(n.number()),maxTokens:n.number().int(),stopSequences:n.optional(n.array(n.string())),metadata:n.optional(n.object({}).passthrough()),modelPreferences:n.optional(lc)})}),Vs=Qe.extend({model:n.string(),stopReason:n.optional(n.enum(["endTurn","stopSequence","maxTokens"]).or(n.string())),role:n.enum(["user","assistant"]),content:n.discriminatedUnion("type",[Jt,Kt,Wt])}),dc=n.object({type:n.literal("boolean"),title:n.optional(n.string()),description:n.optional(n.string()),default:n.optional(n.boolean())}).passthrough(),hc=n.object({type:n.literal("string"),title:n.optional(n.string()),description:n.optional(n.string()),minLength:n.optional(n.number()),maxLength:n.optional(n.number()),format:n.optional(n.enum(["email","uri","date","date-time"]))}).passthrough(),fc=n.object({type:n.enum(["number","integer"]),title:n.optional(n.string()),description:n.optional(n.string()),minimum:n.optional(n.number()),maximum:n.optional(n.number())}).passthrough(),pc=n.object({type:n.literal("string"),title:n.optional(n.string()),description:n.optional(n.string()),enum:n.array(n.string()),enumNames:n.optional(n.array(n.string()))}).passthrough(),mc=n.union([dc,hc,fc,pc]),vc=Me.extend({method:n.literal("elicitation/create"),params:Be.extend({message:n.string(),requestedSchema:n.object({type:n.literal("object"),properties:n.record(n.string(),mc),required:n.optional(n.array(n.string()))}).passthrough()})}),Hs=Qe.extend({action:n.enum(["accept","decline","cancel"]),content:n.optional(n.record(n.string(),n.unknown()))}),gc=n.object({type:n.literal("ref/resource"),uri:n.string()}).passthrough(),yc=n.object({type:n.literal("ref/prompt"),name:n.string()}).passthrough(),Xt=Me.extend({method:n.literal("completion/complete"),params:Be.extend({ref:n.union([yc,gc]),argument:n.object({name:n.string(),value:n.string()}).passthrough(),context:n.optional(n.object({arguments:n.optional(n.record(n.string(),n.string()))}))})}),_c=Qe.extend({completion:n.object({values:n.array(n.string()).max(100),total:n.optional(n.number().int()),hasMore:n.optional(n.boolean())}).passthrough()}),bc=n.object({uri:n.string().startsWith("file://"),name:n.optional(n.string()),_meta:n.optional(n.object({}).passthrough())}).passthrough(),Pc=Me.extend({method:n.literal("roots/list")}),Bs=Qe.extend({roots:n.array(bc)}),Sc=ir.extend({method:n.literal("notifications/roots/list_changed")});n.union([Zt,Ds,Xt,nc,Qt,Bt,Ut,Vt,Ht,Vl,Hl,Yt,Gt]),n.union([Mt,zt,Ns,Sc]),n.union([Lt,Vs,Hs,Bs]),n.union([Zt,uc,vc,Pc]),n.union([Mt,zt,ic,Bl,Ul,sc,ec]),n.union([Lt,Fl,_c,Xl,Kl,Ml,Zl,zl,zs,ac]);class Re extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError";}}const Ec=6e4;class wc{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(Mt,t=>{const a=this._requestHandlerAbortControllers.get(t.params.requestId);a?.abort(t.params.reason);}),this.setNotificationHandler(zt,t=>{this._onprogress(t);}),this.setRequestHandler(Zt,t=>({}));}_setupTimeout(e,t,a,r,i=false){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:r});}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return false;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Re(Se.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),true}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e));}async connect(e){var t,a,r;this._transport=e;const i=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{i?.(),this._onclose();};const l=(a=this.transport)===null||a===void 0?void 0:a.onerror;this._transport.onerror=c=>{l?.(c),this._onerror(c);};const o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,h)=>{o?.(c,h),ks(c)||Al(c)?this._onresponse(c):kl(c)?this._onrequest(c,h):jl(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`));},await this._transport.start();}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const a=new Re(Se.ConnectionClosed,"Connection closed");for(const r of t.values())r(a);}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e);}_onnotification(e){var t;const a=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)));}_onrequest(e,t){var a,r,i,l;const o=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler;if(o===void 0){(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",id:e.id,error:{code:Se.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}const c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);const h={signal:c.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(l=e.params)===null||l===void 0?void 0:l._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,m,b)=>this.request(f,m,{...b,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>o(e,h)).then(f=>{var m;if(!c.signal.aborted)return (m=this._transport)===null||m===void 0?void 0:m.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var m,b;if(!c.signal.aborted)return (m=this._transport)===null||m===void 0?void 0:m.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Se.InternalError,message:(b=f.message)!==null&&b!==void 0?b:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id);});}_onprogress(e){const{progressToken:t,...a}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const l=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&l&&o.resetTimeoutOnProgress)try{this._resetTimeout(r);}catch(c){l(c);return}i(a);}_onresponse(e){const t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),ks(e))a(e);else {const r=new Re(e.error.code,e.error.message,e.error.data);a(r);}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close());}request(e,t,a){const{relatedRequestId:r,resumptionToken:i,onresumptiontoken:l}=a??{};return new Promise((o,c)=>{var h,f,m,b,u,p;if(!this._transport){c(new Error("Not connected"));return}((h=this._options)===null||h===void 0?void 0:h.enforceStrictCapabilities)===true&&this.assertCapabilityForMethod(e.method),(f=a?.signal)===null||f===void 0||f.throwIfAborted();const _=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:_};a?.onprogress&&(this._progressHandlers.set(_,a.onprogress),g.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});const S=P=>{var R;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(P)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:l}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`))),c(P);};this._responseHandlers.set(_,P=>{var R;if(!(!((R=a?.signal)===null||R===void 0)&&R.aborted)){if(P instanceof Error)return c(P);try{const O=t.parse(P.result);o(O);}catch(O){c(O);}}}),(b=a?.signal)===null||b===void 0||b.addEventListener("abort",()=>{var P;S((P=a?.signal)===null||P===void 0?void 0:P.reason);});const A=(u=a?.timeout)!==null&&u!==void 0?u:Ec,I=()=>S(new Re(Se.RequestTimeout,"Request timed out",{timeout:A}));this._setupTimeout(_,A,a?.maxTotalTimeout,I,(p=a?.resetTimeoutOnProgress)!==null&&p!==void 0?p:false),this._transport.send(g,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:l}).catch(P=>{this._cleanupTimeout(_),c(P);});})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const a={...e,jsonrpc:"2.0"};await this._transport.send(a,t);}setRequestHandler(e,t){const a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(r,i)=>Promise.resolve(t(e.parse(r),i)));}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,a=>Promise.resolve(t(e.parse(a))));}removeNotificationHandler(e){this._notificationHandlers.delete(e);}}function Rc(s,e){return Object.entries(e).reduce((t,[a,r])=>(r&&typeof r=="object"?t[a]=t[a]?{...t[a],...r}:r:t[a]=r,t),{...s})}function xc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var tt={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */var $c=tt.exports,Qs;function Tc(){return Qs||(Qs=1,(function(s,e){(function(t,a){a(e);})($c,(function(t){function a(){for(var v=arguments.length,d=Array(v),y=0;y<v;y++)d[y]=arguments[y];if(d.length>1){d[0]=d[0].slice(0,-1);for(var T=d.length-1,$=1;$<T;++$)d[$]=d[$].slice(1,-1);return d[T]=d[T].slice(1),d.join("")}else return d[0]}function r(v){return "(?:"+v+")"}function i(v){return v===void 0?"undefined":v===null?"null":Object.prototype.toString.call(v).split(" ").pop().split("]").shift().toLowerCase()}function l(v){return v.toUpperCase()}function o(v){return v!=null?v instanceof Array?v:typeof v.length!="number"||v.split||v.setInterval||v.call?[v]:Array.prototype.slice.call(v):[]}function c(v,d){var y=v;if(d)for(var T in d)y[T]=d[T];return y}function h(v){var d="[A-Za-z]",y="[0-9]",T=a(y,"[A-Fa-f]"),$=r(r("%[EFef]"+T+"%"+T+T+"%"+T+T)+"|"+r("%[89A-Fa-f]"+T+"%"+T+T)+"|"+r("%"+T+T)),J="[\\:\\/\\?\\#\\[\\]\\@]",K="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",de=a(J,K),ge=v?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Te=v?"[\\uE000-\\uF8FF]":"[]",ce=a(d,y,"[\\-\\.\\_\\~]",ge);r(d+a(d,y,"[\\+\\-\\.]")+"*"),r(r($+"|"+a(ce,K,"[\\:]"))+"*");var ve=r(r("25[0-5]")+"|"+r("2[0-4]"+y)+"|"+r("1"+y+y)+"|"+r("0?[1-9]"+y)+"|0?0?"+y),Oe=r(ve+"\\."+ve+"\\."+ve+"\\."+ve),re=r(T+"{1,4}"),_e=r(r(re+"\\:"+re)+"|"+Oe),Ie=r(r(re+"\\:")+"{6}"+_e),be=r("\\:\\:"+r(re+"\\:")+"{5}"+_e),br=r(r(re)+"?\\:\\:"+r(re+"\\:")+"{4}"+_e),lr=r(r(r(re+"\\:")+"{0,1}"+re)+"?\\:\\:"+r(re+"\\:")+"{3}"+_e),cr=r(r(r(re+"\\:")+"{0,2}"+re)+"?\\:\\:"+r(re+"\\:")+"{2}"+_e),Dr=r(r(r(re+"\\:")+"{0,3}"+re)+"?\\:\\:"+re+"\\:"+_e),Rr=r(r(r(re+"\\:")+"{0,4}"+re)+"?\\:\\:"+_e),Ke=r(r(r(re+"\\:")+"{0,5}"+re)+"?\\:\\:"+re),ur=r(r(r(re+"\\:")+"{0,6}"+re)+"?\\:\\:"),xr=r([Ie,be,br,lr,cr,Dr,Rr,Ke,ur].join("|")),mr=r(r(ce+"|"+$)+"+");r("[vV]"+T+"+\\."+a(ce,K,"[\\:]")+"+"),r(r($+"|"+a(ce,K))+"*");var nt=r($+"|"+a(ce,K,"[\\:\\@]"));return r(r($+"|"+a(ce,K,"[\\@]"))+"+"),r(r(nt+"|"+a("[\\/\\?]",Te))+"*"),{NOT_SCHEME:new RegExp(a("[^]",d,y,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(a("[^\\%\\:]",ce,K),"g"),NOT_HOST:new RegExp(a("[^\\%\\[\\]\\:]",ce,K),"g"),NOT_PATH:new RegExp(a("[^\\%\\/\\:\\@]",ce,K),"g"),NOT_PATH_NOSCHEME:new RegExp(a("[^\\%\\/\\@]",ce,K),"g"),NOT_QUERY:new RegExp(a("[^\\%]",ce,K,"[\\:\\@\\/\\?]",Te),"g"),NOT_FRAGMENT:new RegExp(a("[^\\%]",ce,K,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(a("[^]",ce,K),"g"),UNRESERVED:new RegExp(ce,"g"),OTHER_CHARS:new RegExp(a("[^\\%]",ce,de),"g"),PCT_ENCODED:new RegExp($,"g"),IPV4ADDRESS:new RegExp("^("+Oe+")$"),IPV6ADDRESS:new RegExp("^\\[?("+xr+")"+r(r("\\%25|\\%(?!"+T+"{2})")+"("+mr+")")+"?\\]?$")}}var f=h(false),m=h(true),b=(function(){function v(d,y){var T=[],$=true,J=false,K=void 0;try{for(var de=d[Symbol.iterator](),ge;!($=(ge=de.next()).done)&&(T.push(ge.value),!(y&&T.length===y));$=!0);}catch(Te){J=true,K=Te;}finally{try{!$&&de.return&&de.return();}finally{if(J)throw K}}return T}return function(d,y){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return v(d,y);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),u=function(v){if(Array.isArray(v)){for(var d=0,y=Array(v.length);d<v.length;d++)y[d]=v[d];return y}else return Array.from(v)},p=2147483647,_=36,g=1,S=26,A=38,I=700,P=72,R=128,O="-",C=/^xn--/,k=/[^\0-\x7E]/,j=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=_-g,D=Math.floor,L=String.fromCharCode;function M(v){throw new RangeError(E[v])}function Q(v,d){for(var y=[],T=v.length;T--;)y[T]=d(v[T]);return y}function ae(v,d){var y=v.split("@"),T="";y.length>1&&(T=y[0]+"@",v=y[1]),v=v.replace(j,".");var $=v.split("."),J=Q($,d).join(".");return T+J}function W(v){for(var d=[],y=0,T=v.length;y<T;){var $=v.charCodeAt(y++);if($>=55296&&$<=56319&&y<T){var J=v.charCodeAt(y++);(J&64512)==56320?d.push((($&1023)<<10)+(J&1023)+65536):(d.push($),y--);}else d.push($);}return d}var ie=function(d){return String.fromCodePoint.apply(String,u(d))},X=function(d){return d-48<10?d-22:d-65<26?d-65:d-97<26?d-97:_},ee=function(d,y){return d+22+75*(d<26)-((y!=0)<<5)},Fe=function(d,y,T){var $=0;for(d=T?D(d/I):d>>1,d+=D(d/y);d>x*S>>1;$+=_)d=D(d/x);return D($+(x+1)*d/(d+A))},ke=function(d){var y=[],T=d.length,$=0,J=R,K=P,de=d.lastIndexOf(O);de<0&&(de=0);for(var ge=0;ge<de;++ge)d.charCodeAt(ge)>=128&&M("not-basic"),y.push(d.charCodeAt(ge));for(var Te=de>0?de+1:0;Te<T;){for(var ce=$,ve=1,Oe=_;;Oe+=_){Te>=T&&M("invalid-input");var re=X(d.charCodeAt(Te++));(re>=_||re>D((p-$)/ve))&&M("overflow"),$+=re*ve;var _e=Oe<=K?g:Oe>=K+S?S:Oe-K;if(re<_e)break;var Ie=_-_e;ve>D(p/Ie)&&M("overflow"),ve*=Ie;}var be=y.length+1;K=Fe($-ce,be,ce==0),D($/be)>p-J&&M("overflow"),J+=D($/be),$%=be,y.splice($++,0,J);}return String.fromCodePoint.apply(String,y)},Ce=function(d){var y=[];d=W(d);var T=d.length,$=R,J=0,K=P,de=true,ge=false,Te=void 0;try{for(var ce=d[Symbol.iterator](),ve;!(de=(ve=ce.next()).done);de=!0){var Oe=ve.value;Oe<128&&y.push(L(Oe));}}catch(it){ge=true,Te=it;}finally{try{!de&&ce.return&&ce.return();}finally{if(ge)throw Te}}var re=y.length,_e=re;for(re&&y.push(O);_e<T;){var Ie=p,be=true,br=false,lr=void 0;try{for(var cr=d[Symbol.iterator](),Dr;!(be=(Dr=cr.next()).done);be=!0){var Rr=Dr.value;Rr>=$&&Rr<Ie&&(Ie=Rr);}}catch(it){br=true,lr=it;}finally{try{!be&&cr.return&&cr.return();}finally{if(br)throw lr}}var Ke=_e+1;Ie-$>D((p-J)/Ke)&&M("overflow"),J+=(Ie-$)*Ke,$=Ie;var ur=true,xr=false,mr=void 0;try{for(var nt=d[Symbol.iterator](),fi;!(ur=(fi=nt.next()).done);ur=!0){var pi=fi.value;if(pi<$&&++J>p&&M("overflow"),pi==$){for(var xt=J,$t=_;;$t+=_){var Tt=$t<=K?g:$t>=K+S?S:$t-K;if(xt<Tt)break;var mi=xt-Tt,vi=_-Tt;y.push(L(ee(Tt+mi%vi,0))),xt=D(mi/vi);}y.push(L(ee(xt,0))),K=Fe(J,Ke,_e==re),J=0,++_e;}}}catch(it){xr=true,mr=it;}finally{try{!ur&&nt.return&&nt.return();}finally{if(xr)throw mr}}++J,++$;}return y.join("")},xe=function(d){return ae(d,function(y){return C.test(y)?ke(y.slice(4).toLowerCase()):y})},Je=function(d){return ae(d,function(y){return k.test(y)?"xn--"+Ce(y):y})},w={version:"2.1.0",ucs2:{decode:W,encode:ie},decode:ke,encode:Ce,toASCII:Je,toUnicode:xe},N={};function V(v){var d=v.charCodeAt(0),y=void 0;return d<16?y="%0"+d.toString(16).toUpperCase():d<128?y="%"+d.toString(16).toUpperCase():d<2048?y="%"+(d>>6|192).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase():y="%"+(d>>12|224).toString(16).toUpperCase()+"%"+(d>>6&63|128).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase(),y}function Y(v){for(var d="",y=0,T=v.length;y<T;){var $=parseInt(v.substr(y+1,2),16);if($<128)d+=String.fromCharCode($),y+=3;else if($>=194&&$<224){if(T-y>=6){var J=parseInt(v.substr(y+4,2),16);d+=String.fromCharCode(($&31)<<6|J&63);}else d+=v.substr(y,6);y+=6;}else if($>=224){if(T-y>=9){var K=parseInt(v.substr(y+4,2),16),de=parseInt(v.substr(y+7,2),16);d+=String.fromCharCode(($&15)<<12|(K&63)<<6|de&63);}else d+=v.substr(y,9);y+=9;}else d+=v.substr(y,3),y+=3;}return d}function F(v,d){function y(T){var $=Y(T);return $.match(d.UNRESERVED)?$:T}return v.scheme&&(v.scheme=String(v.scheme).replace(d.PCT_ENCODED,y).toLowerCase().replace(d.NOT_SCHEME,"")),v.userinfo!==void 0&&(v.userinfo=String(v.userinfo).replace(d.PCT_ENCODED,y).replace(d.NOT_USERINFO,V).replace(d.PCT_ENCODED,l)),v.host!==void 0&&(v.host=String(v.host).replace(d.PCT_ENCODED,y).toLowerCase().replace(d.NOT_HOST,V).replace(d.PCT_ENCODED,l)),v.path!==void 0&&(v.path=String(v.path).replace(d.PCT_ENCODED,y).replace(v.scheme?d.NOT_PATH:d.NOT_PATH_NOSCHEME,V).replace(d.PCT_ENCODED,l)),v.query!==void 0&&(v.query=String(v.query).replace(d.PCT_ENCODED,y).replace(d.NOT_QUERY,V).replace(d.PCT_ENCODED,l)),v.fragment!==void 0&&(v.fragment=String(v.fragment).replace(d.PCT_ENCODED,y).replace(d.NOT_FRAGMENT,V).replace(d.PCT_ENCODED,l)),v}function z(v){return v.replace(/^0*(.*)/,"$1")||"0"}function ne(v,d){var y=v.match(d.IPV4ADDRESS)||[],T=b(y,2),$=T[1];return $?$.split(".").map(z).join("."):v}function le(v,d){var y=v.match(d.IPV6ADDRESS)||[],T=b(y,3),$=T[1],J=T[2];if($){for(var K=$.toLowerCase().split("::").reverse(),de=b(K,2),ge=de[0],Te=de[1],ce=Te?Te.split(":").map(z):[],ve=ge.split(":").map(z),Oe=d.IPV4ADDRESS.test(ve[ve.length-1]),re=Oe?7:8,_e=ve.length-re,Ie=Array(re),be=0;be<re;++be)Ie[be]=ce[be]||ve[_e+be]||"";Oe&&(Ie[re-1]=ne(Ie[re-1],d));var br=Ie.reduce(function(Ke,ur,xr){if(!ur||ur==="0"){var mr=Ke[Ke.length-1];mr&&mr.index+mr.length===xr?mr.length++:Ke.push({index:xr,length:1});}return Ke},[]),lr=br.sort(function(Ke,ur){return ur.length-Ke.length})[0],cr=void 0;if(lr&&lr.length>1){var Dr=Ie.slice(0,lr.index),Rr=Ie.slice(lr.index+lr.length);cr=Dr.join(":")+"::"+Rr.join(":");}else cr=Ie.join(":");return J&&(cr+="%"+J),cr}else return v}var oe=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ye="".match(/(){0}/)[1]===void 0;function fe(v){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},T=d.iri!==false?m:f;d.reference==="suffix"&&(v=(d.scheme?d.scheme+":":"")+"//"+v);var $=v.match(oe);if($){ye?(y.scheme=$[1],y.userinfo=$[3],y.host=$[4],y.port=parseInt($[5],10),y.path=$[6]||"",y.query=$[7],y.fragment=$[8],isNaN(y.port)&&(y.port=$[5])):(y.scheme=$[1]||void 0,y.userinfo=v.indexOf("@")!==-1?$[3]:void 0,y.host=v.indexOf("//")!==-1?$[4]:void 0,y.port=parseInt($[5],10),y.path=$[6]||"",y.query=v.indexOf("?")!==-1?$[7]:void 0,y.fragment=v.indexOf("#")!==-1?$[8]:void 0,isNaN(y.port)&&(y.port=v.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?$[4]:void 0)),y.host&&(y.host=le(ne(y.host,T),T)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==y.reference&&(y.error=y.error||"URI is not a "+d.reference+" reference.");var J=N[(d.scheme||y.scheme||"").toLowerCase()];if(!d.unicodeSupport&&(!J||!J.unicodeSupport)){if(y.host&&(d.domainHost||J&&J.domainHost))try{y.host=w.toASCII(y.host.replace(T.PCT_ENCODED,Y).toLowerCase());}catch(K){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+K;}F(y,f);}else F(y,T);J&&J.parse&&J.parse(y,d);}else y.error=y.error||"URI can not be parsed.";return y}function pe(v,d){var y=d.iri!==false?m:f,T=[];return v.userinfo!==void 0&&(T.push(v.userinfo),T.push("@")),v.host!==void 0&&T.push(le(ne(String(v.host),y),y).replace(y.IPV6ADDRESS,function($,J,K){return "["+J+(K?"%25"+K:"")+"]"})),(typeof v.port=="number"||typeof v.port=="string")&&(T.push(":"),T.push(String(v.port))),T.length?T.join(""):void 0}var je=/^\.\.?\//,Ee=/^\/\.(\/|$)/,rr=/^\/\.\.(\/|$)/,qe=/^\/?(?:.|\n)*?(?=\/|$)/;function we(v){for(var d=[];v.length;)if(v.match(je))v=v.replace(je,"");else if(v.match(Ee))v=v.replace(Ee,"/");else if(v.match(rr))v=v.replace(rr,"/"),d.pop();else if(v==="."||v==="..")v="";else {var y=v.match(qe);if(y){var T=y[0];v=v.slice(T.length),d.push(T);}else throw new Error("Unexpected dot segment condition")}return d.join("")}function $e(v){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=d.iri?m:f,T=[],$=N[(d.scheme||v.scheme||"").toLowerCase()];if($&&$.serialize&&$.serialize(v,d),v.host&&!y.IPV6ADDRESS.test(v.host)){if(d.domainHost||$&&$.domainHost)try{v.host=d.iri?w.toUnicode(v.host):w.toASCII(v.host.replace(y.PCT_ENCODED,Y).toLowerCase());}catch(de){v.error=v.error||"Host's domain name can not be converted to "+(d.iri?"Unicode":"ASCII")+" via punycode: "+de;}}F(v,y),d.reference!=="suffix"&&v.scheme&&(T.push(v.scheme),T.push(":"));var J=pe(v,d);if(J!==void 0&&(d.reference!=="suffix"&&T.push("//"),T.push(J),v.path&&v.path.charAt(0)!=="/"&&T.push("/")),v.path!==void 0){var K=v.path;!d.absolutePath&&(!$||!$.absolutePath)&&(K=we(K)),J===void 0&&(K=K.replace(/^\/\//,"/%2F")),T.push(K);}return v.query!==void 0&&(T.push("?"),T.push(v.query)),v.fragment!==void 0&&(T.push("#"),T.push(v.fragment)),T.join("")}function ze(v,d){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},T=arguments[3],$={};return T||(v=fe($e(v,y),y),d=fe($e(d,y),y)),y=y||{},!y.tolerant&&d.scheme?($.scheme=d.scheme,$.userinfo=d.userinfo,$.host=d.host,$.port=d.port,$.path=we(d.path||""),$.query=d.query):(d.userinfo!==void 0||d.host!==void 0||d.port!==void 0?($.userinfo=d.userinfo,$.host=d.host,$.port=d.port,$.path=we(d.path||""),$.query=d.query):(d.path?(d.path.charAt(0)==="/"?$.path=we(d.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?$.path="/"+d.path:v.path?$.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+d.path:$.path=d.path,$.path=we($.path)),$.query=d.query):($.path=v.path,d.query!==void 0?$.query=d.query:$.query=v.query),$.userinfo=v.userinfo,$.host=v.host,$.port=v.port),$.scheme=v.scheme),$.fragment=d.fragment,$}function Rt(v,d,y){var T=c({scheme:"null"},y);return $e(ze(fe(v,T),fe(d,T),T,true),T)}function Wa(v,d){return typeof v=="string"?v=$e(fe(v,d),d):i(v)==="object"&&(v=fe($e(v,d),d)),v}function Ga(v,d,y){return typeof v=="string"?v=$e(fe(v,y),y):i(v)==="object"&&(v=$e(v,y)),typeof d=="string"?d=$e(fe(d,y),y):i(d)==="object"&&(d=$e(d,y)),v===d}function rd(v,d){return v&&v.toString().replace(!d||!d.iri?f.ESCAPE:m.ESCAPE,V)}function pr(v,d){return v&&v.toString().replace(!d||!d.iri?f.PCT_ENCODED:m.PCT_ENCODED,Y)}var at={scheme:"http",domainHost:true,parse:function(d,y){return d.host||(d.error=d.error||"HTTP URIs must have a host."),d},serialize:function(d,y){var T=String(d.scheme).toLowerCase()==="https";return (d.port===(T?443:80)||d.port==="")&&(d.port=void 0),d.path||(d.path="/"),d}},ni={scheme:"https",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize};function ii(v){return typeof v.secure=="boolean"?v.secure:String(v.scheme).toLowerCase()==="wss"}var st={scheme:"ws",domainHost:true,parse:function(d,y){var T=d;return T.secure=ii(T),T.resourceName=(T.path||"/")+(T.query?"?"+T.query:""),T.path=void 0,T.query=void 0,T},serialize:function(d,y){if((d.port===(ii(d)?443:80)||d.port==="")&&(d.port=void 0),typeof d.secure=="boolean"&&(d.scheme=d.secure?"wss":"ws",d.secure=void 0),d.resourceName){var T=d.resourceName.split("?"),$=b(T,2),J=$[0],K=$[1];d.path=J&&J!=="/"?J:void 0,d.query=K,d.resourceName=void 0;}return d.fragment=void 0,d}},oi={scheme:"wss",domainHost:st.domainHost,parse:st.parse,serialize:st.serialize},td={},li="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",or="[0-9A-Fa-f]",ad=r(r("%[EFef]"+or+"%"+or+or+"%"+or+or)+"|"+r("%[89A-Fa-f]"+or+"%"+or+or)+"|"+r("%"+or+or)),sd="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",nd="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",id=a(nd,'[\\"\\\\]'),od="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ld=new RegExp(li,"g"),Ar=new RegExp(ad,"g"),cd=new RegExp(a("[^]",sd,"[\\.]",'[\\"]',id),"g"),ci=new RegExp(a("[^]",li,od),"g"),ud=ci;function Ya(v){var d=Y(v);return d.match(ld)?d:v}var ui={scheme:"mailto",parse:function(d,y){var T=d,$=T.to=T.path?T.path.split(","):[];if(T.path=void 0,T.query){for(var J=false,K={},de=T.query.split("&"),ge=0,Te=de.length;ge<Te;++ge){var ce=de[ge].split("=");switch(ce[0]){case "to":for(var ve=ce[1].split(","),Oe=0,re=ve.length;Oe<re;++Oe)$.push(ve[Oe]);break;case "subject":T.subject=pr(ce[1],y);break;case "body":T.body=pr(ce[1],y);break;default:J=true,K[pr(ce[0],y)]=pr(ce[1],y);break}}J&&(T.headers=K);}T.query=void 0;for(var _e=0,Ie=$.length;_e<Ie;++_e){var be=$[_e].split("@");if(be[0]=pr(be[0]),y.unicodeSupport)be[1]=pr(be[1],y).toLowerCase();else try{be[1]=w.toASCII(pr(be[1],y).toLowerCase());}catch(br){T.error=T.error||"Email address's domain name can not be converted to ASCII via punycode: "+br;}$[_e]=be.join("@");}return T},serialize:function(d,y){var T=d,$=o(d.to);if($){for(var J=0,K=$.length;J<K;++J){var de=String($[J]),ge=de.lastIndexOf("@"),Te=de.slice(0,ge).replace(Ar,Ya).replace(Ar,l).replace(cd,V),ce=de.slice(ge+1);try{ce=y.iri?w.toUnicode(ce):w.toASCII(pr(ce,y).toLowerCase());}catch(_e){T.error=T.error||"Email address's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+_e;}$[J]=Te+"@"+ce;}T.path=$.join(",");}var ve=d.headers=d.headers||{};d.subject&&(ve.subject=d.subject),d.body&&(ve.body=d.body);var Oe=[];for(var re in ve)ve[re]!==td[re]&&Oe.push(re.replace(Ar,Ya).replace(Ar,l).replace(ci,V)+"="+ve[re].replace(Ar,Ya).replace(Ar,l).replace(ud,V));return Oe.length&&(T.query=Oe.join("&")),T}},dd=/^([^\:]+)\:(.*)/,di={scheme:"urn",parse:function(d,y){var T=d.path&&d.path.match(dd),$=d;if(T){var J=y.scheme||$.scheme||"urn",K=T[1].toLowerCase(),de=T[2],ge=J+":"+(y.nid||K),Te=N[ge];$.nid=K,$.nss=de,$.path=void 0,Te&&($=Te.parse($,y));}else $.error=$.error||"URN can not be parsed.";return $},serialize:function(d,y){var T=y.scheme||d.scheme||"urn",$=d.nid,J=T+":"+(y.nid||$),K=N[J];K&&(d=K.serialize(d,y));var de=d,ge=d.nss;return de.path=($||y.nid)+":"+ge,de}},hd=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,hi={scheme:"urn:uuid",parse:function(d,y){var T=d;return T.uuid=T.nss,T.nss=void 0,!y.tolerant&&(!T.uuid||!T.uuid.match(hd))&&(T.error=T.error||"UUID is not valid."),T},serialize:function(d,y){var T=d;return T.nss=(d.uuid||"").toLowerCase(),T}};N[at.scheme]=at,N[ni.scheme]=ni,N[st.scheme]=st,N[oi.scheme]=oi,N[ui.scheme]=ui,N[di.scheme]=di,N[hi.scheme]=hi,t.SCHEMES=N,t.pctEncChar=V,t.pctDecChars=Y,t.parse=fe,t.removeDotSegments=we,t.serialize=$e,t.resolveComponents=ze,t.resolve=Rt,t.normalize=Wa,t.equal=Ga,t.escapeComponent=rd,t.unescapeComponent=pr,Object.defineProperty(t,"__esModule",{value:true});}));})(tt,tt.exports)),tt.exports}var ea,Js;function ra(){return Js||(Js=1,ea=function s(e,t){if(e===t)return true;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return false;var a,r,i;if(Array.isArray(e)){if(a=e.length,a!=t.length)return false;for(r=a;r--!==0;)if(!s(e[r],t[r]))return false;return true}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return false;for(r=a;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return false;for(r=a;r--!==0;){var l=i[r];if(!s(e[l],t[l]))return false}return true}return e!==e&&t!==t}),ea}var ta,Ks;function Oc(){return Ks||(Ks=1,ta=function(e){for(var t=0,a=e.length,r=0,i;r<a;)t++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<a&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return t}),ta}var aa,Ws;function jr(){if(Ws)return aa;Ws=1,aa={copy:s,checkDataType:e,checkDataTypes:t,coerceToTypes:r,toHash:i,getProperty:c,escapeQuotes:h,equal:ra(),ucs2length:Oc(),varOccurences:f,varReplace:m,schemaHasRules:b,schemaHasRulesExcept:u,schemaUnknownRules:p,toQuotedString:_,getPathExpr:g,getPath:S,getData:P,unescapeFragment:O,unescapeJsonPointer:j,escapeFragment:C,escapeJsonPointer:k};function s(E,x){x=x||{};for(var D in E)x[D]=E[D];return x}function e(E,x,D,L){var M=L?" !== ":" === ",Q=L?" || ":" && ",ae=L?"!":"",W=L?"":"!";switch(E){case "null":return x+M+"null";case "array":return ae+"Array.isArray("+x+")";case "object":return "("+ae+x+Q+"typeof "+x+M+'"object"'+Q+W+"Array.isArray("+x+"))";case "integer":return "(typeof "+x+M+'"number"'+Q+W+"("+x+" % 1)"+Q+x+M+x+(D?Q+ae+"isFinite("+x+")":"")+")";case "number":return "(typeof "+x+M+'"'+E+'"'+(D?Q+ae+"isFinite("+x+")":"")+")";default:return "typeof "+x+M+'"'+E+'"'}}function t(E,x,D){switch(E.length){case 1:return e(E[0],x,D,true);default:var L="",M=i(E);M.array&&M.object&&(L=M.null?"(":"(!"+x+" || ",L+="typeof "+x+' !== "object")',delete M.null,delete M.array,delete M.object),M.number&&delete M.integer;for(var Q in M)L+=(L?" && ":"")+e(Q,x,D,true);return L}}var a=i(["string","number","integer","boolean","null"]);function r(E,x){if(Array.isArray(x)){for(var D=[],L=0;L<x.length;L++){var M=x[L];(a[M]||E==="array"&&M==="array")&&(D[D.length]=M);}if(D.length)return D}else {if(a[x])return [x];if(E==="array"&&x==="array")return ["array"]}}function i(E){for(var x={},D=0;D<E.length;D++)x[E[D]]=true;return x}var l=/^[a-z$_][a-z$_0-9]*$/i,o=/'|\\/g;function c(E){return typeof E=="number"?"["+E+"]":l.test(E)?"."+E:"['"+h(E)+"']"}function h(E){return E.replace(o,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function f(E,x){x+="[^0-9]";var D=E.match(new RegExp(x,"g"));return D?D.length:0}function m(E,x,D){return x+="([^0-9])",D=D.replace(/\$/g,"$$$$"),E.replace(new RegExp(x,"g"),D+"$1")}function b(E,x){if(typeof E=="boolean")return !E;for(var D in E)if(x[D])return true}function u(E,x,D){if(typeof E=="boolean")return !E&&D!="not";for(var L in E)if(L!=D&&x[L])return true}function p(E,x){if(typeof E!="boolean"){for(var D in E)if(!x[D])return D}}function _(E){return "'"+h(E)+"'"}function g(E,x,D,L){var M=D?"'/' + "+x+(L?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):L?"'[' + "+x+" + ']'":"'[\\'' + "+x+" + '\\']'";return R(E,M)}function S(E,x,D){var L=_(D?"/"+k(x):c(x));return R(E,L)}var A=/^\/(?:[^~]|~0|~1)*$/,I=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function P(E,x,D){var L,M,Q,ae;if(E==="")return "rootData";if(E[0]=="/"){if(!A.test(E))throw new Error("Invalid JSON-pointer: "+E);M=E,Q="rootData";}else {if(ae=E.match(I),!ae)throw new Error("Invalid JSON-pointer: "+E);if(L=+ae[1],M=ae[2],M=="#"){if(L>=x)throw new Error("Cannot access property/index "+L+" levels up, current level is "+x);return D[x-L]}if(L>x)throw new Error("Cannot access data "+L+" levels up, current level is "+x);if(Q="data"+(x-L||""),!M)return Q}for(var W=Q,ie=M.split("/"),X=0;X<ie.length;X++){var ee=ie[X];ee&&(Q+=c(j(ee)),W+=" && "+Q);}return W}function R(E,x){return E=='""'?x:(E+" + "+x).replace(/([^\\])' \+ '/g,"$1")}function O(E){return j(decodeURIComponent(E))}function C(E){return encodeURIComponent(k(E))}function k(E){return E.replace(/~/g,"~0").replace(/\//g,"~1")}function j(E){return E.replace(/~1/g,"/").replace(/~0/g,"~")}return aa}var sa,Gs;function Ys(){if(Gs)return sa;Gs=1;var s=jr();sa=e;function e(t){s.copy(t,this);}return sa}var na={exports:{}},Xs;function Ic(){if(Xs)return na.exports;Xs=1;var s=na.exports=function(a,r,i){typeof r=="function"&&(i=r,r={}),i=r.cb||i;var l=typeof i=="function"?i:i.pre||function(){},o=i.post||function(){};e(r,l,o,a,"",a);};s.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true},s.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true},s.propsKeywords={definitions:true,properties:true,patternProperties:true,dependencies:true},s.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function e(a,r,i,l,o,c,h,f,m,b){if(l&&typeof l=="object"&&!Array.isArray(l)){r(l,o,c,h,f,m,b);for(var u in l){var p=l[u];if(Array.isArray(p)){if(u in s.arrayKeywords)for(var _=0;_<p.length;_++)e(a,r,i,p[_],o+"/"+u+"/"+_,c,o,u,l,_);}else if(u in s.propsKeywords){if(p&&typeof p=="object")for(var g in p)e(a,r,i,p[g],o+"/"+u+"/"+t(g),c,o,u,l,g);}else (u in s.keywords||a.allKeys&&!(u in s.skipKeywords))&&e(a,r,i,p,o+"/"+u,c,o,u,l);}i(l,o,c,h,f,m,b);}}function t(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}return na.exports}var ia,en;function oa(){if(en)return ia;en=1;var s=Tc(),e=ra(),t=jr(),a=Ys(),r=Ic();ia=i,i.normalizeId=S,i.fullPath=p,i.url=A,i.ids=I,i.inlineRef=m,i.schema=l;function i(P,R,O){var C=this._refs[O];if(typeof C=="string")if(this._refs[C])C=this._refs[C];else return i.call(this,P,R,C);if(C=C||this._schemas[O],C instanceof a)return m(C.schema,this._opts.inlineRefs)?C.schema:C.validate||this._compile(C);var k=l.call(this,R,O),j,E,x;return k&&(j=k.schema,R=k.root,x=k.baseId),j instanceof a?E=j.validate||P.call(this,j.schema,R,void 0,x):j!==void 0&&(E=m(j,this._opts.inlineRefs)?j:P.call(this,j,R,void 0,x)),E}function l(P,R){var O=s.parse(R),C=_(O),k=p(this._getId(P.schema));if(Object.keys(P.schema).length===0||C!==k){var j=S(C),E=this._refs[j];if(typeof E=="string")return o.call(this,P,E,O);if(E instanceof a)E.validate||this._compile(E),P=E;else if(E=this._schemas[j],E instanceof a){if(E.validate||this._compile(E),j==S(R))return {schema:E,root:P,baseId:k};P=E;}else return;if(!P.schema)return;k=p(this._getId(P.schema));}return h.call(this,O,k,P.schema,P)}function o(P,R,O){var C=l.call(this,P,R);if(C){var k=C.schema,j=C.baseId;P=C.root;var E=this._getId(k);return E&&(j=A(j,E)),h.call(this,O,j,k,P)}}var c=t.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function h(P,R,O,C){if(P.fragment=P.fragment||"",P.fragment.slice(0,1)=="/"){for(var k=P.fragment.split("/"),j=1;j<k.length;j++){var E=k[j];if(E){if(E=t.unescapeFragment(E),O=O[E],O===void 0)break;var x;if(!c[E]&&(x=this._getId(O),x&&(R=A(R,x)),O.$ref)){var D=A(R,O.$ref),L=l.call(this,C,D);L&&(O=L.schema,C=L.root,R=L.baseId);}}}if(O!==void 0&&O!==C.schema)return {schema:O,root:C,baseId:R}}}var f=t.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function m(P,R){if(R===false)return false;if(R===void 0||R===true)return b(P);if(R)return u(P)<=R}function b(P){var R;if(Array.isArray(P)){for(var O=0;O<P.length;O++)if(R=P[O],typeof R=="object"&&!b(R))return false}else for(var C in P)if(C=="$ref"||(R=P[C],typeof R=="object"&&!b(R)))return false;return true}function u(P){var R=0,O;if(Array.isArray(P)){for(var C=0;C<P.length;C++)if(O=P[C],typeof O=="object"&&(R+=u(O)),R==1/0)return 1/0}else for(var k in P){if(k=="$ref")return 1/0;if(f[k])R++;else if(O=P[k],typeof O=="object"&&(R+=u(O)+1),R==1/0)return 1/0}return R}function p(P,R){R!==false&&(P=S(P));var O=s.parse(P);return _(O)}function _(P){return s.serialize(P).split("#")[0]+"#"}var g=/#\/?$/;function S(P){return P?P.replace(g,""):""}function A(P,R){return R=S(R),s.resolve(P,R)}function I(P){var R=S(this._getId(P)),O={"":R},C={"":p(R,false)},k={},j=this;return r(P,{allKeys:true},function(E,x,D,L,M,Q,ae){if(x!==""){var W=j._getId(E),ie=O[L],X=C[L]+"/"+M;if(ae!==void 0&&(X+="/"+(typeof ae=="number"?ae:t.escapeFragment(ae))),typeof W=="string"){W=ie=S(ie?s.resolve(ie,W):W);var ee=j._refs[W];if(typeof ee=="string"&&(ee=j._refs[ee]),ee&&ee.schema){if(!e(E,ee.schema))throw new Error('id "'+W+'" resolves to more than one schema')}else if(W!=S(X))if(W[0]=="#"){if(k[W]&&!e(E,k[W]))throw new Error('id "'+W+'" resolves to more than one schema');k[W]=E;}else j._refs[W]=X;}O[x]=ie,C[x]=X;}}),k}return ia}var la,rn;function ca(){if(rn)return la;rn=1;var s=oa();la={Validation:a(e),MissingRef:a(t)};function e(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=true;}t.message=function(r,i){return "can't resolve reference "+i+" from id "+r};function t(r,i,l){this.message=l||t.message(r,i),this.missingRef=s.url(r,i),this.missingSchema=s.normalizeId(s.fullPath(this.missingRef));}function a(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}return la}var ua,tn;function an(){return tn||(tn=1,ua=function(s,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:false,a=e.cmp&&(function(i){return function(l){return function(o,c){var h={key:o,value:l[o]},f={key:c,value:l[c]};return i(h,f)}}})(e.cmp),r=[];return (function i(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var o,c;if(Array.isArray(l)){for(c="[",o=0;o<l.length;o++)o&&(c+=","),c+=i(l[o])||"null";return c+"]"}if(l===null)return "null";if(r.indexOf(l)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var h=r.push(l)-1,f=Object.keys(l).sort(a&&a(l));for(c="",o=0;o<f.length;o++){var m=f[o],b=i(l[m]);b&&(c&&(c+=","),c+=JSON.stringify(m)+":"+b);}return r.splice(h,1),"{"+c+"}"}})(s)}),ua}var da,sn;function nn(){return sn||(sn=1,da=function(e,t,a){var r="",i=e.schema.$async===true,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var h="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(h);else throw new Error(h)}}if(e.isTop&&(r+=" var validate = ",i&&(e.async=true,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var t="false schema",f=e.level,m=e.dataLevel,b=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,R=!e.opts.allErrors,k,_="data"+(m||""),P="valid"+f;if(e.schema===false){e.isTop?R=true:r+=" var "+P+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(k||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&R?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";}else e.isTop?i?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+P+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var A=e.isTop,f=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var I="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; ";}else {var f=e.level,m=e.dataLevel,_="data"+(m||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;";}var P="valid"+f,R=!e.opts.allErrors,O="",C="",k,j=e.schema.type,E=Array.isArray(j);if(j&&e.opts.nullable&&e.schema.nullable===true&&(E?j.indexOf("null")==-1&&(j=j.concat("null")):j!="null"&&(j=[j,"null"],E=true)),E&&j.length==1&&(j=j[0],E=false),e.schema.$ref&&l){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==true&&(l=false,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'));}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),j){if(e.opts.coerceTypes)var x=e.util.coerceToTypes(e.opts.coerceTypes,j);var D=e.RULES.types[j];if(x||E||D===true||D&&!Ee(D)){var u=e.schemaPath+".type",p=e.errSchemaPath+"/type",u=e.schemaPath+".type",p=e.errSchemaPath+"/type",L=E?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[L](j,_,e.opts.strictNumbers,true)+") { ",x){var M="dataType"+f,Q="coerced"+f;r+=" var "+M+" = typeof "+_+"; var "+Q+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+M+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+M+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+Q+" = "+_+"; } "),r+=" if ("+Q+" !== undefined) ; ";var ae=x;if(ae)for(var W,ie=-1,X=ae.length-1;ie<X;)W=ae[ie+=1],W=="string"?r+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+Q+" = '' + "+_+"; else if ("+_+" === null) "+Q+" = ''; ":W=="number"||W=="integer"?(r+=" else if ("+M+" == 'boolean' || "+_+" === null || ("+M+" == 'string' && "+_+" && "+_+" == +"+_+" ",W=="integer"&&(r+=" && !("+_+" % 1)"),r+=")) "+Q+" = +"+_+"; "):W=="boolean"?r+=" else if ("+_+" === 'false' || "+_+" === 0 || "+_+" === null) "+Q+" = false; else if ("+_+" === 'true' || "+_+" === 1) "+Q+" = true; ":W=="null"?r+=" else if ("+_+" === '' || "+_+" === 0 || "+_+" === false) "+Q+" = null; ":e.opts.coerceTypes=="array"&&W=="array"&&(r+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+_+" == null) "+Q+" = ["+_+"]; ");r+=" else { ";var g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(k||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",E?r+=""+j.join(","):r+=""+j,r+="' } ",e.opts.messages!==false&&(r+=" , message: 'should be ",E?r+=""+j.join(","):r+=""+j,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&R?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+Q+" !== undefined) { ";var ee=m?"data"+(m-1||""):"parentData",Fe=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+_+" = "+Q+"; ",m||(r+="if ("+ee+" !== undefined)"),r+=" "+ee+"["+Fe+"] = "+Q+"; } ";}else {var g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(k||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",E?r+=""+j.join(","):r+=""+j,r+="' } ",e.opts.messages!==false&&(r+=" , message: 'should be ",E?r+=""+j.join(","):r+=""+j,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&R?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";}r+=" } ";}}if(e.schema.$ref&&!l)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",R&&(r+=" } if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",C+="}");else {var ke=e.RULES;if(ke){for(var D,Ce=-1,xe=ke.length-1;Ce<xe;)if(D=ke[Ce+=1],Ee(D)){if(D.type&&(r+=" if ("+e.util.checkDataType(D.type,_,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(D.type=="object"&&e.schema.properties){var b=e.schema.properties,Je=Object.keys(b),w=Je;if(w)for(var N,V=-1,Y=w.length-1;V<Y;){N=w[V+=1];var F=b[N];if(F.default!==void 0){var z=_+e.util.getProperty(N);if(e.compositeRule){if(e.opts.strictDefaults){var I="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}}else r+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+z+" === null || "+z+" === '' "),r+=" ) "+z+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(F.default)+" ":r+=" "+JSON.stringify(F.default)+" ",r+="; ";}}}else if(D.type=="array"&&Array.isArray(e.schema.items)){var ne=e.schema.items;if(ne){for(var F,ie=-1,le=ne.length-1;ie<le;)if(F=ne[ie+=1],F.default!==void 0){var z=_+"["+ie+"]";if(e.compositeRule){if(e.opts.strictDefaults){var I="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(I);else throw new Error(I)}}else r+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+z+" === null || "+z+" === '' "),r+=" ) "+z+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(F.default)+" ":r+=" "+JSON.stringify(F.default)+" ",r+="; ";}}}}var oe=D.rules;if(oe){for(var ye,fe=-1,pe=oe.length-1;fe<pe;)if(ye=oe[fe+=1],rr(ye)){var je=ye.code(e,ye.keyword,D.type);je&&(r+=" "+je+" ",R&&(O+="}"));}}if(R&&(r+=" "+O+" ",O=""),D.type&&(r+=" } ",j&&j===D.type&&!x)){r+=" else { ";var u=e.schemaPath+".type",p=e.errSchemaPath+"/type",g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(k||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",E?r+=""+j.join(","):r+=""+j,r+="' } ",e.opts.messages!==false&&(r+=" , message: 'should be ",E?r+=""+j.join(","):r+=""+j,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&R?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ";}R&&(r+=" if (errors === ",A?r+="0":r+="errs_"+f,r+=") { ",C+="}");}}}R&&(r+=" "+C+" "),A?(i?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+P+" = errors === errs_"+f+";";function Ee(we){for(var $e=we.rules,ze=0;ze<$e.length;ze++)if(rr($e[ze]))return true}function rr(we){return e.schema[we.keyword]!==void 0||we.implements&&qe(we)}function qe(we){for(var $e=we.implements,ze=0;ze<$e.length;ze++)if(e.schema[$e[ze]]!==void 0)return true}return r}),da}var ha,on;function Cc(){if(on)return ha;on=1;var s=oa(),e=jr(),t=ca(),a=an(),r=nn(),i=e.ucs2length,l=ra(),o=t.Validation;ha=c;function c(S,A,I,P){var R=this,O=this._opts,C=[void 0],k={},j=[],E={},x=[],D={},L=[];A=A||{schema:S,refVal:C,refs:k};var M=h.call(this,S,A,P),Q=this._compilations[M.index];if(M.compiling)return Q.callValidate=ee;var ae=this._formats,W=this.RULES;try{var ie=Fe(S,A,I,P);Q.validate=ie;var X=Q.callValidate;return X&&(X.schema=ie.schema,X.errors=null,X.refs=ie.refs,X.refVal=ie.refVal,X.root=ie.root,X.$async=ie.$async,O.sourceCode&&(X.source=ie.source)),ie}finally{f.call(this,S,A,P);}function ee(){var F=Q.validate,z=F.apply(this,arguments);return ee.errors=F.errors,z}function Fe(F,z,ne,le){var oe=!z||z&&z.schema==F;if(z.schema!=A.schema)return c.call(R,F,z,ne,le);var ye=F.$async===true,fe=r({isTop:true,schema:F,isRoot:oe,baseId:le,root:z,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:t.MissingRef,RULES:W,validate:r,util:e,resolve:s,resolveRef:ke,usePattern:N,useDefault:V,useCustomRule:Y,opts:O,formats:ae,logger:R.logger,self:R});fe=g(C,p)+g(j,b)+g(x,u)+g(L,_)+fe,O.processCode&&(fe=O.processCode(fe,F));var pe;try{var je=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",fe);pe=je(R,W,ae,A,C,x,L,l,i,o),C[0]=pe;}catch(Ee){throw R.logger.error("Error compiling schema, function code:",fe),Ee}return pe.schema=F,pe.errors=null,pe.refs=k,pe.refVal=C,pe.root=oe?pe:z,ye&&(pe.$async=true),O.sourceCode===true&&(pe.source={code:fe,patterns:j,defaults:x}),pe}function ke(F,z,ne){z=s.url(F,z);var le=k[z],oe,ye;if(le!==void 0)return oe=C[le],ye="refVal["+le+"]",w(oe,ye);if(!ne&&A.refs){var fe=A.refs[z];if(fe!==void 0)return oe=A.refVal[fe],ye=Ce(z,oe),w(oe,ye)}ye=Ce(z);var pe=s.call(R,Fe,A,z);if(pe===void 0){var je=I&&I[z];je&&(pe=s.inlineRef(je,O.inlineRefs)?je:c.call(R,je,A,I,F));}if(pe===void 0)xe(z);else return Je(z,pe),w(pe,ye)}function Ce(F,z){var ne=C.length;return C[ne]=z,k[F]=ne,"refVal"+ne}function xe(F){delete k[F];}function Je(F,z){var ne=k[F];C[ne]=z;}function w(F,z){return typeof F=="object"||typeof F=="boolean"?{code:z,schema:F,inline:true}:{code:z,$async:F&&!!F.$async}}function N(F){var z=E[F];return z===void 0&&(z=E[F]=j.length,j[z]=F),"pattern"+z}function V(F){switch(typeof F){case "boolean":case "number":return ""+F;case "string":return e.toQuotedString(F);case "object":if(F===null)return "null";var z=a(F),ne=D[z];return ne===void 0&&(ne=D[z]=x.length,x[ne]=F),"default"+ne}}function Y(F,z,ne,le){if(R._opts.validateSchema!==false){var oe=F.definition.dependencies;if(oe&&!oe.every(function($e){return Object.prototype.hasOwnProperty.call(ne,$e)}))throw new Error("parent schema must have all required keywords: "+oe.join(","));var ye=F.definition.validateSchema;if(ye){var fe=ye(z);if(!fe){var pe="keyword schema is invalid: "+R.errorsText(ye.errors);if(R._opts.validateSchema=="log")R.logger.error(pe);else throw new Error(pe)}}}var je=F.definition.compile,Ee=F.definition.inline,rr=F.definition.macro,qe;if(je)qe=je.call(R,z,ne,le);else if(rr)qe=rr.call(R,z,ne,le),O.validateSchema!==false&&R.validateSchema(qe,true);else if(Ee)qe=Ee.call(R,le,F.keyword,z,ne);else if(qe=F.definition.validate,!qe)return;if(qe===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var we=L.length;return L[we]=qe,{code:"customRule"+we,validate:qe}}}function h(S,A,I){var P=m.call(this,S,A,I);return P>=0?{index:P,compiling:true}:(P=this._compilations.length,this._compilations[P]={schema:S,root:A,baseId:I},{index:P,compiling:false})}function f(S,A,I){var P=m.call(this,S,A,I);P>=0&&this._compilations.splice(P,1);}function m(S,A,I){for(var P=0;P<this._compilations.length;P++){var R=this._compilations[P];if(R.schema==S&&R.root==A&&R.baseId==I)return P}return -1}function b(S,A){return "var pattern"+S+" = new RegExp("+e.toQuotedString(A[S])+");"}function u(S){return "var default"+S+" = defaults["+S+"];"}function p(S,A){return A[S]===void 0?"":"var refVal"+S+" = refVal["+S+"];"}function _(S){return "var customRule"+S+" = customRules["+S+"];"}function g(S,A){if(!S.length)return "";for(var I="",P=0;P<S.length;P++)I+=A(P,S);return I}return ha}var fa={exports:{}},ln;function kc(){if(ln)return fa.exports;ln=1;var s=fa.exports=function(){this._cache={};};return s.prototype.put=function(t,a){this._cache[t]=a;},s.prototype.get=function(t){return this._cache[t]},s.prototype.del=function(t){delete this._cache[t];},s.prototype.clear=function(){this._cache={};},fa.exports}var pa,cn;function jc(){if(cn)return pa;cn=1;var s=jr(),e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,t=[0,31,28,31,30,31,30,31,31,30,31,30,31],a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,r=/^(?=.{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,i=/^(?:[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,l=/^(?:[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,o=/^(?:(?:[^\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,c=/^(?:(?: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,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,m=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,b=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;pa=u;function u(C){return C=C=="full"?"full":"fast",s.copy(u[C])}u.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":o,url:c,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:r,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:O,uuid:h,"json-pointer":f,"json-pointer-uri-fragment":m,"relative-json-pointer":b},u.full={date:_,time:g,"date-time":A,uri:P,"uri-reference":l,"uri-template":o,url:c,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:r,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:O,uuid:h,"json-pointer":f,"json-pointer-uri-fragment":m,"relative-json-pointer":b};function p(C){return C%4===0&&(C%100!==0||C%400===0)}function _(C){var k=C.match(e);if(!k)return false;var j=+k[1],E=+k[2],x=+k[3];return E>=1&&E<=12&&x>=1&&x<=(E==2&&p(j)?29:t[E])}function g(C,k){var j=C.match(a);if(!j)return false;var E=j[1],x=j[2],D=j[3],L=j[5];return (E<=23&&x<=59&&D<=59||E==23&&x==59&&D==60)&&(!k||L)}var S=/t|\s/i;function A(C){var k=C.split(S);return k.length==2&&_(k[0])&&g(k[1],true)}var I=/\/|:/;function P(C){return I.test(C)&&i.test(C)}var R=/[^\\]\\Z/;function O(C){if(R.test(C))return false;try{return new RegExp(C),!0}catch{return false}}return pa}var ma,un;function Ac(){return un||(un=1,ma=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(l||""),m="valid"+i,b,u;if(o=="#"||o=="#/")e.isRoot?(b=e.async,u="validate"):(b=e.root.schema.$async===true,u="root.refVal[0]");else {var p=e.resolveRef(e.baseId,o,e.isRoot);if(p===void 0){var _=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(_);var g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==false&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(r+=" if (false) { ");}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),h&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,_)}else if(p.inline){var A=e.util.copy(e);A.level++;var I="valid"+A.level;A.schema=p.schema,A.schemaPath="",A.errSchemaPath=o;var P=e.validate(A).replace(/validate\.schema/g,p.code);r+=" "+P+" ",h&&(r+=" if ("+I+") { ");}else b=p.$async===true||e.async&&p.$async!==false,u=p.code;}if(u){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+u+".call(this, ":r+=" "+u+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var R=l?"data"+(l-1||""):"parentData",O=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+R+" , "+O+", rootData) ";var C=r;if(r=g.pop(),b){if(!e.async)throw new Error("async schema referenced by sync schema");h&&(r+=" var "+m+"; "),r+=" try { await "+C+"; ",h&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",h&&(r+=" "+m+" = false; "),r+=" } ",h&&(r+=" if ("+m+") { ");}else r+=" if (!"+C+") { if (vErrors === null) vErrors = "+u+".errors; else vErrors = vErrors.concat("+u+".errors); errors = vErrors.length; } ",h&&(r+=" else { ");}return r}),ma}var va,dn;function Dc(){return dn||(dn=1,va=function(e,t,a){var r=" ",i=e.schema[t],l=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h=e.util.copy(e),f="";h.level++;var m="valid"+h.level,b=h.baseId,u=true,p=i;if(p)for(var _,g=-1,S=p.length-1;g<S;)_=p[g+=1],(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===false:e.util.schemaHasRules(_,e.RULES.all))&&(u=false,h.schema=_,h.schemaPath=l+"["+g+"]",h.errSchemaPath=o+"/"+g,r+=" "+e.validate(h)+" ",h.baseId=b,c&&(r+=" if ("+m+") { ",f+="}"));return c&&(u?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}),va}var ga,hn;function Nc(){return hn||(hn=1,ga=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u="errs__"+i,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,S=o.every(function(k){return e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===false:e.util.schemaHasRules(k,e.RULES.all)});if(S){var A=p.baseId;r+=" var "+u+" = errors; var "+b+" = false; ";var I=e.compositeRule;e.compositeRule=p.compositeRule=true;var P=o;if(P)for(var R,O=-1,C=P.length-1;O<C;)R=P[O+=1],p.schema=R,p.schemaPath=c+"["+O+"]",p.errSchemaPath=h+"/"+O,r+=" "+e.validate(p)+" ",p.baseId=A,r+=" "+b+" = "+b+" || "+g+"; if (!"+b+") { ",_+="}";e.compositeRule=p.compositeRule=I,r+=" "+_+" if (!"+b+") { var err = ",e.createErrors!==false?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ");}else f&&(r+=" if (true) { ");return r}),ga}var ya,fn;function Fc(){return fn||(fn=1,ya=function(e,t,a){var r=" ",i=e.schema[t],l=e.errSchemaPath+"/"+t;e.opts.allErrors;var o=e.util.toQuotedString(i);return e.opts.$comment===true?r+=" console.log("+o+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+o+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}),ya}var _a,pn;function qc(){return pn||(pn=1,_a=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u=e.opts.$data&&o&&o.$data;u&&(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; "),u||(r+=" var schema"+i+" = validate.schema"+c+";"),r+="var "+b+" = equal("+m+", schema"+i+"); if (!"+b+") { ";var p=p||[];p.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==false&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=p.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}),_a}var ba,mn;function Lc(){return mn||(mn=1,ba=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u="errs__"+i,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,S="i"+i,A=p.dataLevel=e.dataLevel+1,I="data"+A,P=e.baseId,R=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===false:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+u+" = errors;var "+b+";",R){var O=e.compositeRule;e.compositeRule=p.compositeRule=true,p.schema=o,p.schemaPath=c,p.errSchemaPath=h,r+=" var "+g+" = false; for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,true);var C=m+"["+S+"]";p.dataPathArr[A]=S;var k=e.validate(p);p.baseId=P,e.util.varOccurences(k,I)<2?r+=" "+e.util.varReplace(k,I,C)+" ":r+=" var "+I+" = "+C+"; "+k+" ",r+=" if ("+g+") break; } ",e.compositeRule=p.compositeRule=O,r+=" "+_+" if (!"+g+") {";}else r+=" if ("+m+".length == 0) {";var j=j||[];j.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var E=r;return r=j.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+E+"]); ":r+=" validate.errors = ["+E+"]; return false; ":r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",R&&(r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}),ba}var Pa,vn;function Mc(){return vn||(vn=1,Pa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="errs__"+i,u=e.util.copy(e),p="";u.level++;var _="valid"+u.level,g={},S={},A=e.opts.ownProperties;for(O in o)if(O!="__proto__"){var I=o[O],P=Array.isArray(I)?S:g;P[O]=I;}r+="var "+b+" = errors;";var R=e.errorPath;r+="var missing"+i+";";for(var O in S)if(P=S[O],P.length){if(r+=" if ( "+m+e.util.getProperty(O)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(O)+"') "),f){r+=" && ( ";var C=P;if(C)for(var k,j=-1,E=C.length-1;j<E;){k=C[j+=1],j&&(r+=" || ");var x=e.util.getProperty(k),D=m+x;r+=" ( ( "+D+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(k)+"') "),r+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?k:x)+") ) ";}r+=")) { ";var L="missing"+i,M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(R,L,true):R+" + "+L);var Q=Q||[];Q.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { property: '"+e.util.escapeQuotes(O)+"', missingProperty: '"+M+"', depsCount: "+P.length+", deps: '"+e.util.escapeQuotes(P.length==1?P[0]:P.join(", "))+"' } ",e.opts.messages!==false&&(r+=" , message: 'should have ",P.length==1?r+="property "+e.util.escapeQuotes(P[0]):r+="properties "+e.util.escapeQuotes(P.join(", ")),r+=" when property "+e.util.escapeQuotes(O)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ae=r;r=Q.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ae+"]); ":r+=" validate.errors = ["+ae+"]; return false; ":r+=" var err = "+ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";}else {r+=" ) { ";var W=P;if(W)for(var k,ie=-1,X=W.length-1;ie<X;){k=W[ie+=1];var x=e.util.getProperty(k),M=e.util.escapeQuotes(k),D=m+x;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(R,k,e.opts.jsonPointers)),r+=" if ( "+D+" === undefined ",A&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(k)+"') "),r+=") { var err = ",e.createErrors!==false?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { property: '"+e.util.escapeQuotes(O)+"', missingProperty: '"+M+"', depsCount: "+P.length+", deps: '"+e.util.escapeQuotes(P.length==1?P[0]:P.join(", "))+"' } ",e.opts.messages!==false&&(r+=" , message: 'should have ",P.length==1?r+="property "+e.util.escapeQuotes(P[0]):r+="properties "+e.util.escapeQuotes(P.join(", ")),r+=" when property "+e.util.escapeQuotes(O)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ";}}r+=" } ",f&&(p+="}",r+=" else { ");}e.errorPath=R;var ee=u.baseId;for(var O in g){var I=g[O];(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===false:e.util.schemaHasRules(I,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(O)+" !== undefined ",A&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(O)+"') "),r+=") { ",u.schema=I,u.schemaPath=c+e.util.getProperty(O),u.errSchemaPath=h+"/"+e.util.escapeFragment(O),r+=" "+e.validate(u)+" ",u.baseId=ee,r+=" } ",f&&(r+=" if ("+_+") { ",p+="}"));}return f&&(r+=" "+p+" if ("+b+" == errors) {"),r}),Pa}var Sa,gn;function Zc(){return gn||(gn=1,Sa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u=e.opts.$data&&o&&o.$data;u&&(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ");var p="i"+i,_="schema"+i;u||(r+=" var "+_+" = validate.schema"+c+";"),r+="var "+b+";",u&&(r+=" if (schema"+i+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+i+")) "+b+" = false; else {"),r+=""+b+" = false;for (var "+p+"=0; "+p+"<"+_+".length; "+p+"++) if (equal("+m+", "+_+"["+p+"])) { "+b+" = true; break; }",u&&(r+=" } "),r+=" if (!"+b+") { ";var g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==false&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}),Sa}var Ea,yn;function zc(){return yn||(yn=1,Ea=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===false)return f&&(r+=" if (true) { "),r;var b=e.opts.$data&&o&&o.$data,u;b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o;var p=e.opts.unknownFormats,_=Array.isArray(p);if(b){var g="format"+i,S="isObject"+i,A="formatType"+i;r+=" var "+g+" = formats["+u+"]; var "+S+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+A+" = "+S+" && "+g+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+i+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" (",p!="ignore"&&(r+=" ("+u+" && !"+g+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),r+=") || "),r+=" ("+g+" && "+A+" == '"+a+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+i+" ? await "+g+"("+m+") : "+g+"("+m+")) ":r+=" "+g+"("+m+") ",r+=" : "+g+".test("+m+"))))) {";}else {var g=e.formats[o];if(!g){if(p=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(_&&p.indexOf(o)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,A=S&&g.type||"string";if(S){var I=g.async===true;g=g.validate;}if(A!=a)return f&&(r+=" if (true) { "),r;if(I){if(!e.async)throw new Error("async format in sync schema");var P="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+P+"("+m+"))) { ";}else {r+=" if (! ";var P="formats"+e.util.getProperty(o);S&&(P+=".validate"),typeof g=="function"?r+=" "+P+"("+m+") ":r+=" "+P+".test("+m+") ",r+=") { ";}}var R=R||[];R.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { format: ",b?r+=""+u:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==false&&(r+=` , message: 'should match format "`,b?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;return r=R.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}),Ea}var wa,_n;function Uc(){return _n||(_n=1,wa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u="errs__"+i,p=e.util.copy(e);p.level++;var _="valid"+p.level,g=e.schema.then,S=e.schema.else,A=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===false:e.util.schemaHasRules(g,e.RULES.all)),I=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===false:e.util.schemaHasRules(S,e.RULES.all)),P=p.baseId;if(A||I){var R;p.createErrors=false,p.schema=o,p.schemaPath=c,p.errSchemaPath=h,r+=" var "+u+" = errors; var "+b+" = true; ";var O=e.compositeRule;e.compositeRule=p.compositeRule=true,r+=" "+e.validate(p)+" ",p.baseId=P,p.createErrors=true,r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=p.compositeRule=O,A?(r+=" if ("+_+") { ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(p)+" ",p.baseId=P,r+=" "+b+" = "+_+"; ",A&&I?(R="ifClause"+i,r+=" var "+R+" = 'then'; "):R="'then'",r+=" } ",I&&(r+=" else { ")):r+=" if (!"+_+") { ",I&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(p)+" ",p.baseId=P,r+=" "+b+" = "+_+"; ",A&&I?(R="ifClause"+i,r+=" var "+R+" = 'else'; "):R="'else'",r+=" } "),r+=" if (!"+b+") { var err = ",e.createErrors!==false?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { failingKeyword: "+R+" } ",e.opts.messages!==false&&(r+=` , message: 'should match "' + `+R+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ");}else f&&(r+=" if (true) { ");return r}),wa}var Ra,bn;function Vc(){return bn||(bn=1,Ra=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u="errs__"+i,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,S="i"+i,A=p.dataLevel=e.dataLevel+1,I="data"+A,P=e.baseId;if(r+="var "+u+" = errors;var "+b+";",Array.isArray(o)){var R=e.schema.additionalItems;if(R===false){r+=" "+b+" = "+m+".length <= "+o.length+"; ";var O=h;h=e.errSchemaPath+"/additionalItems",r+=" if (!"+b+") { ";var C=C||[];C.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+o.length+" } ",e.opts.messages!==false&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var k=r;r=C.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+k+"]); ":r+=" validate.errors = ["+k+"]; return false; ":r+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h=O,f&&(_+="}",r+=" else { ");}var j=o;if(j){for(var E,x=-1,D=j.length-1;x<D;)if(E=j[x+=1],e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===false:e.util.schemaHasRules(E,e.RULES.all)){r+=" "+g+" = true; if ("+m+".length > "+x+") { ";var L=m+"["+x+"]";p.schema=E,p.schemaPath=c+"["+x+"]",p.errSchemaPath=h+"/"+x,p.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,true),p.dataPathArr[A]=x;var M=e.validate(p);p.baseId=P,e.util.varOccurences(M,I)<2?r+=" "+e.util.varReplace(M,I,L)+" ":r+=" var "+I+" = "+L+"; "+M+" ",r+=" } ",f&&(r+=" if ("+g+") { ",_+="}");}}if(typeof R=="object"&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===false:e.util.schemaHasRules(R,e.RULES.all))){p.schema=R,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+m+".length > "+o.length+") { for (var "+S+" = "+o.length+"; "+S+" < "+m+".length; "+S+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,true);var L=m+"["+S+"]";p.dataPathArr[A]=S;var M=e.validate(p);p.baseId=P,e.util.varOccurences(M,I)<2?r+=" "+e.util.varReplace(M,I,L)+" ":r+=" var "+I+" = "+L+"; "+M+" ",f&&(r+=" if (!"+g+") break; "),r+=" } } ",f&&(r+=" if ("+g+") { ",_+="}");}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===false:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=c,p.errSchemaPath=h,r+=" for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,true);var L=m+"["+S+"]";p.dataPathArr[A]=S;var M=e.validate(p);p.baseId=P,e.util.varOccurences(M,I)<2?r+=" "+e.util.varReplace(M,I,L)+" ":r+=" var "+I+" = "+L+"; "+M+" ",f&&(r+=" if (!"+g+") break; "),r+=" }";}return f&&(r+=" "+_+" if ("+u+" == errors) {"),r}),Ra}var xa,Pn;function Sn(){return Pn||(Pn=1,xa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,P,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o;var p=t=="maximum",_=p?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[_],S=e.opts.$data&&g&&g.$data,A=p?"<":">",I=p?">":"<",P=void 0;if(!(b||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(S||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(_+" must be number or boolean");if(S){var R=e.util.getData(g.$data,l,e.dataPathArr),O="exclusive"+i,C="exclType"+i,k="exclIsNumber"+i,j="op"+i,E="' + "+j+" + '";r+=" var schemaExcl"+i+" = "+R+"; ",R="schemaExcl"+i,r+=" var "+O+"; var "+C+" = typeof "+R+"; if ("+C+" != 'boolean' && "+C+" != 'undefined' && "+C+" != 'number') { ";var P=_,x=x||[];x.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(P||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+C+" == 'number' ? ( ("+O+" = "+u+" === undefined || "+R+" "+A+"= "+u+") ? "+m+" "+I+"= "+R+" : "+m+" "+I+" "+u+" ) : ( ("+O+" = "+R+" === true) ? "+m+" "+I+"= "+u+" : "+m+" "+I+" "+u+" ) || "+m+" !== "+m+") { var op"+i+" = "+O+" ? '"+A+"' : '"+A+"='; ",o===void 0&&(P=_,h=e.errSchemaPath+"/"+_,u=R,b=S);}else {var k=typeof g=="number",E=A;if(k&&b){var j="'"+E+"'";r+=" if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" ( "+u+" === undefined || "+g+" "+A+"= "+u+" ? "+m+" "+I+"= "+g+" : "+m+" "+I+" "+u+" ) || "+m+" !== "+m+") { ";}else {k&&o===void 0?(O=true,P=_,h=e.errSchemaPath+"/"+_,u=g,I+="="):(k&&(u=Math[p?"min":"max"](g,o)),g===(k?u:true)?(O=true,P=_,h=e.errSchemaPath+"/"+_,I+="="):(O=false,E+="="));var j="'"+E+"'";r+=" if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+" "+I+" "+u+" || "+m+" !== "+m+") { ";}}P=P||t;var x=x||[];x.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(P||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { comparison: "+j+", limit: "+u+", exclusive: "+O+" } ",e.opts.messages!==false&&(r+=" , message: 'should be "+E+" ",b?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;return r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}),xa}var $a,En;function wn(){return En||(En=1,$a=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;if(b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var p=t=="maxItems"?">":"<";r+="if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+".length "+p+" "+u+") { ";var _=t,g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+u+" } ",e.opts.messages!==false&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",b?r+="' + "+u+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}),$a}var Ta,Rn;function xn(){return Rn||(Rn=1,Ta=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;if(b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var p=t=="maxLength"?">":"<";r+="if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),e.opts.unicode===false?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+p+" "+u+") { ";var _=t,g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+u+" } ",e.opts.messages!==false&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",b?r+="' + "+u+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}),Ta}var Oa,$n;function Tn(){return $n||($n=1,Oa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;if(b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var p=t=="maxProperties"?">":"<";r+="if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" Object.keys("+m+").length "+p+" "+u+") { ";var _=t,g=g||[];g.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+u+" } ",e.opts.messages!==false&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",b?r+="' + "+u+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}),Oa}var Ia,On;function Hc(){return On||(On=1,Ia=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;if(b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o,!(b||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+i+";if (",b&&(r+=" "+u+" !== undefined && ( typeof "+u+" != 'number' || "),r+=" (division"+i+" = "+m+" / "+u+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+i+" !== parseInt(division"+i+") ",r+=" ) ",b&&(r+=" ) "),r+=" ) { ";var p=p||[];p.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { multipleOf: "+u+" } ",e.opts.messages!==false&&(r+=" , message: 'should be multiple of ",b?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=p.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}),Ia}var Ca,In;function Bc(){return In||(In=1,Ca=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="errs__"+i,u=e.util.copy(e);u.level++;var p="valid"+u.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===false:e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=c,u.errSchemaPath=h,r+=" var "+b+" = errors; ";var _=e.compositeRule;e.compositeRule=u.compositeRule=true,u.createErrors=false;var g;u.opts.allErrors&&(g=u.opts.allErrors,u.opts.allErrors=false),r+=" "+e.validate(u)+" ",u.createErrors=true,g&&(u.opts.allErrors=g),e.compositeRule=u.compositeRule=_,r+=" if ("+p+") { ";var S=S||[];S.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+b+"; if (vErrors !== null) { if ("+b+") vErrors.length = "+b+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ");}else r+=" var err = ",e.createErrors!==false?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",e.opts.messages!==false&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}),Ca}var ka,Cn;function Qc(){return Cn||(Cn=1,ka=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u="errs__"+i,p=e.util.copy(e),_="";p.level++;var g="valid"+p.level,S=p.baseId,A="prevValid"+i,I="passingSchemas"+i;r+="var "+u+" = errors , "+A+" = false , "+b+" = false , "+I+" = null; ";var P=e.compositeRule;e.compositeRule=p.compositeRule=true;var R=o;if(R)for(var O,C=-1,k=R.length-1;C<k;)O=R[C+=1],(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===false:e.util.schemaHasRules(O,e.RULES.all))?(p.schema=O,p.schemaPath=c+"["+C+"]",p.errSchemaPath=h+"/"+C,r+=" "+e.validate(p)+" ",p.baseId=S):r+=" var "+g+" = true; ",C&&(r+=" if ("+g+" && "+A+") { "+b+" = false; "+I+" = ["+I+", "+C+"]; } else { ",_+="}"),r+=" if ("+g+") { "+b+" = "+A+" = true; "+I+" = "+C+"; }";return e.compositeRule=p.compositeRule=P,r+=""+_+"if (!"+b+") { var err = ",e.createErrors!==false?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { passingSchemas: "+I+" } ",e.opts.messages!==false&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}),ka}var ja,kn;function Jc(){return kn||(kn=1,ja=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,u;b?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",u="schema"+i):u=o;var p=b?"(new RegExp("+u+"))":e.usePattern(o);r+="if ( ",b&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" !"+p+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { pattern: ",b?r+=""+u:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==false&&(r+=` , message: 'should match pattern "`,b?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var g=r;return r=_.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}),ja}var Aa,jn;function Kc(){return jn||(jn=1,Aa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="errs__"+i,u=e.util.copy(e),p="";u.level++;var _="valid"+u.level,g="key"+i,S="idx"+i,A=u.dataLevel=e.dataLevel+1,I="data"+A,P="dataProperties"+i,R=Object.keys(o||{}).filter(ie),O=e.schema.patternProperties||{},C=Object.keys(O).filter(ie),k=e.schema.additionalProperties,j=R.length||C.length,E=k===false,x=typeof k=="object"&&Object.keys(k).length,D=e.opts.removeAdditional,L=E||x||D,M=e.opts.ownProperties,Q=e.baseId,ae=e.schema.required;if(ae&&!(e.opts.$data&&ae.$data)&&ae.length<e.opts.loopRequired)var W=e.util.toHash(ae);function ie(Ga){return Ga!=="__proto__"}if(r+="var "+b+" = errors;var "+_+" = true;",M&&(r+=" var "+P+" = undefined;"),L){if(M?r+=" "+P+" = "+P+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+P+".length; "+S+"++) { var "+g+" = "+P+"["+S+"]; ":r+=" for (var "+g+" in "+m+") { ",j){if(r+=" var isAdditional"+i+" = !(false ",R.length)if(R.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+g+") ";else {var X=R;if(X)for(var ee,Fe=-1,ke=X.length-1;Fe<ke;)ee=X[Fe+=1],r+=" || "+g+" == "+e.util.toQuotedString(ee)+" ";}if(C.length){var Ce=C;if(Ce)for(var xe,Je=-1,w=Ce.length-1;Je<w;)xe=Ce[Je+=1],r+=" || "+e.usePattern(xe)+".test("+g+") ";}r+=" ); if (isAdditional"+i+") { ";}if(D=="all")r+=" delete "+m+"["+g+"]; ";else {var N=e.errorPath,V="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),E)if(D)r+=" delete "+m+"["+g+"]; ";else {r+=" "+_+" = false; ";var Y=h;h=e.errSchemaPath+"/additionalProperties";var F=F||[];F.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { additionalProperty: '"+V+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h=Y,f&&(r+=" break; ");}else if(x)if(D=="failing"){r+=" var "+b+" = errors; ";var ne=e.compositeRule;e.compositeRule=u.compositeRule=true,u.schema=k,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var le=m+"["+g+"]";u.dataPathArr[A]=g;var oe=e.validate(u);u.baseId=Q,e.util.varOccurences(oe,I)<2?r+=" "+e.util.varReplace(oe,I,le)+" ":r+=" var "+I+" = "+le+"; "+oe+" ",r+=" if (!"+_+") { errors = "+b+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+g+"]; } ",e.compositeRule=u.compositeRule=ne;}else {u.schema=k,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var le=m+"["+g+"]";u.dataPathArr[A]=g;var oe=e.validate(u);u.baseId=Q,e.util.varOccurences(oe,I)<2?r+=" "+e.util.varReplace(oe,I,le)+" ":r+=" var "+I+" = "+le+"; "+oe+" ",f&&(r+=" if (!"+_+") break; ");}e.errorPath=N;}j&&(r+=" } "),r+=" } ",f&&(r+=" if ("+_+") { ",p+="}");}var ye=e.opts.useDefaults&&!e.compositeRule;if(R.length){var fe=R;if(fe)for(var ee,pe=-1,je=fe.length-1;pe<je;){ee=fe[pe+=1];var Ee=o[ee];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===false:e.util.schemaHasRules(Ee,e.RULES.all)){var rr=e.util.getProperty(ee),le=m+rr,qe=ye&&Ee.default!==void 0;u.schema=Ee,u.schemaPath=c+rr,u.errSchemaPath=h+"/"+e.util.escapeFragment(ee),u.errorPath=e.util.getPath(e.errorPath,ee,e.opts.jsonPointers),u.dataPathArr[A]=e.util.toQuotedString(ee);var oe=e.validate(u);if(u.baseId=Q,e.util.varOccurences(oe,I)<2){oe=e.util.varReplace(oe,I,le);var we=le;}else {var we=I;r+=" var "+I+" = "+le+"; ";}if(qe)r+=" "+oe+" ";else {if(W&&W[ee]){r+=" if ( "+we+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ee)+"') "),r+=") { "+_+" = false; ";var N=e.errorPath,Y=h,$e=e.util.escapeQuotes(ee);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,ee,e.opts.jsonPointers)),h=e.errSchemaPath+"/required";var F=F||[];F.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+$e+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+$e+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var z=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h=Y,e.errorPath=N,r+=" } else { ";}else f?(r+=" if ( "+we+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ee)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+we+" !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(ee)+"') "),r+=" ) { ");r+=" "+oe+" } ";}}f&&(r+=" if ("+_+") { ",p+="}");}}if(C.length){var ze=C;if(ze)for(var xe,Rt=-1,Wa=ze.length-1;Rt<Wa;){xe=ze[Rt+=1];var Ee=O[xe];if(e.opts.strictKeywords?typeof Ee=="object"&&Object.keys(Ee).length>0||Ee===false:e.util.schemaHasRules(Ee,e.RULES.all)){u.schema=Ee,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(xe),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(xe),M?r+=" "+P+" = "+P+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+P+".length; "+S+"++) { var "+g+" = "+P+"["+S+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" if ("+e.usePattern(xe)+".test("+g+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var le=m+"["+g+"]";u.dataPathArr[A]=g;var oe=e.validate(u);u.baseId=Q,e.util.varOccurences(oe,I)<2?r+=" "+e.util.varReplace(oe,I,le)+" ":r+=" var "+I+" = "+le+"; "+oe+" ",f&&(r+=" if (!"+_+") break; "),r+=" } ",f&&(r+=" else "+_+" = true; "),r+=" } ",f&&(r+=" if ("+_+") { ",p+="}");}}}return f&&(r+=" "+p+" if ("+b+" == errors) {"),r}),Aa}var Da,An;function Wc(){return An||(An=1,Da=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="errs__"+i,u=e.util.copy(e),p="";u.level++;var _="valid"+u.level;if(r+="var "+b+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===false:e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=c,u.errSchemaPath=h;var g="key"+i,S="idx"+i,A="i"+i,I="' + "+g+" + '",P=u.dataLevel=e.dataLevel+1,R="data"+P,O="dataProperties"+i,C=e.opts.ownProperties,k=e.baseId;C&&(r+=" var "+O+" = undefined; "),C?r+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+O+".length; "+S+"++) { var "+g+" = "+O+"["+S+"]; ":r+=" for (var "+g+" in "+m+") { ",r+=" var startErrs"+i+" = errors; ";var j=g,E=e.compositeRule;e.compositeRule=u.compositeRule=true;var x=e.validate(u);u.baseId=k,e.util.varOccurences(x,R)<2?r+=" "+e.util.varReplace(x,R,j)+" ":r+=" var "+R+" = "+j+"; "+x+" ",e.compositeRule=u.compositeRule=E,r+=" if (!"+_+") { for (var "+A+"=startErrs"+i+"; "+A+"<errors; "+A+"++) { vErrors["+A+"].propertyName = "+g+"; } var err = ",e.createErrors!==false?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { propertyName: '"+I+"' } ",e.opts.messages!==false&&(r+=" , message: 'property name \\'"+I+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }";}return f&&(r+=" "+p+" if ("+b+" == errors) {"),r}),Da}var Na,Dn;function Gc(){return Dn||(Dn=1,Na=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u=e.opts.$data&&o&&o.$data;u&&(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ");var p="schema"+i;if(!u)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var _=[],g=o;if(g)for(var S,A=-1,I=g.length-1;A<I;){S=g[A+=1];var P=e.schema.properties[S];P&&(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===false:e.util.schemaHasRules(P,e.RULES.all))||(_[_.length]=S);}}else var _=o;if(u||_.length){var R=e.errorPath,O=u||_.length>=e.opts.loopRequired,C=e.opts.ownProperties;if(f)if(r+=" var missing"+i+"; ",O){u||(r+=" var "+p+" = validate.schema"+c+"; ");var k="i"+i,j="schema"+i+"["+k+"]",E="' + "+j+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(R,j,e.opts.jsonPointers)),r+=" var "+b+" = true; ",u&&(r+=" if (schema"+i+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+i+")) "+b+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+p+".length; "+k+"++) { "+b+" = "+m+"["+p+"["+k+"]] !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+p+"["+k+"]) "),r+="; if (!"+b+") break; } ",u&&(r+=" } "),r+=" if (!"+b+") { ";var x=x||[];x.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+E+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+E+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ";}else {r+=" if ( ";var L=_;if(L)for(var M,k=-1,Q=L.length-1;k<Q;){M=L[k+=1],k&&(r+=" || ");var ae=e.util.getProperty(M),W=m+ae;r+=" ( ( "+W+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:ae)+") ) ";}r+=") { ";var j="missing"+i,E="' + "+j+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(R,j,true):R+" + "+j);var x=x||[];x.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+E+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+E+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var D=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ";}else if(O){u||(r+=" var "+p+" = validate.schema"+c+"; ");var k="i"+i,j="schema"+i+"["+k+"]",E="' + "+j+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(R,j,e.opts.jsonPointers)),u&&(r+=" if ("+p+" && !Array.isArray("+p+")) { var err = ",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+E+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+E+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+p+" !== undefined) { "),r+=" for (var "+k+" = 0; "+k+" < "+p+".length; "+k+"++) { if ("+m+"["+p+"["+k+"]] === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+p+"["+k+"]) "),r+=") { var err = ",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+E+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+E+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",u&&(r+=" } ");}else {var ie=_;if(ie)for(var M,X=-1,ee=ie.length-1;X<ee;){M=ie[X+=1];var ae=e.util.getProperty(M),E=e.util.escapeQuotes(M),W=m+ae;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(R,M,e.opts.jsonPointers)),r+=" if ( "+W+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==false?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { missingProperty: '"+E+"' } ",e.opts.messages!==false&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+E+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ";}}e.errorPath=R;}else f&&(r+=" if (true) {");return r}),Na}var Fa,Nn;function Yc(){return Nn||(Nn=1,Fa=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m="data"+(l||""),b="valid"+i,u=e.opts.$data&&o&&o.$data,p;if(u?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",p="schema"+i):p=o,(o||u)&&e.opts.uniqueItems!==false){u&&(r+=" var "+b+"; if ("+p+" === false || "+p+" === undefined) "+b+" = true; else if (typeof "+p+" != 'boolean') "+b+" = false; else { "),r+=" var i = "+m+".length , "+b+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,g=Array.isArray(_);if(!_||_=="object"||_=="array"||g&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+b+" = false; break outer; } } } ";else {r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var S="checkDataType"+(g?"s":"");r+=" if ("+e.util[S](_,"item",e.opts.strictNumbers,true)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+b+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ";}r+=" } ",u&&(r+=" } "),r+=" if (!"+b+") { ";var A=A||[];A.push(r),r="",e.createErrors!==false?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",e.opts.messages!==false&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",u?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ");}else f&&(r+=" if (true) { ");return r}),Fa}var qa,Fn;function Xc(){return Fn||(Fn=1,qa={$ref:Ac(),allOf:Dc(),anyOf:Nc(),$comment:Fc(),const:qc(),contains:Lc(),dependencies:Mc(),enum:Zc(),format:zc(),if:Uc(),items:Vc(),maximum:Sn(),minimum:Sn(),maxItems:wn(),minItems:wn(),maxLength:xn(),minLength:xn(),maxProperties:Tn(),minProperties:Tn(),multipleOf:Hc(),not:Bc(),oneOf:Qc(),pattern:Jc(),properties:Kc(),propertyNames:Wc(),required:Gc(),uniqueItems:Yc(),validate:nn()}),qa}var La,qn;function eu(){if(qn)return La;qn=1;var s=Xc(),e=jr().toHash;return La=function(){var a=[{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"]}],r=["type","$comment"],i=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return a.all=e(r),a.types=e(l),a.forEach(function(o){o.rules=o.rules.map(function(c){var h;if(typeof c=="object"){var f=Object.keys(c)[0];h=c[f],c=f,h.forEach(function(b){r.push(b),a.all[b]=true;});}r.push(c);var m=a.all[c]={keyword:c,code:s[c],implements:h};return m}),a.all.$comment={keyword:"$comment",code:s.$comment},o.type&&(a.types[o.type]=o);}),a.keywords=e(r.concat(i)),a.custom={},a},La}var Ma,Ln;function ru(){if(Ln)return Ma;Ln=1;var s=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];return Ma=function(e,t){for(var a=0;a<t.length;a++){e=JSON.parse(JSON.stringify(e));var r=t[a].split("/"),i=e,l;for(l=1;l<r.length;l++)i=i[r[l]];for(l=0;l<s.length;l++){var o=s[l],c=i[o];c&&(i[o]={anyOf:[c,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]});}}return e},Ma}var Za,Mn;function tu(){if(Mn)return Za;Mn=1;var s=ca().MissingRef;Za=e;function e(t,a,r){var i=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof a=="function"&&(r=a,a=void 0);var l=o(t).then(function(){var h=i._addSchema(t,void 0,a);return h.validate||c(h)});return r&&l.then(function(h){r(null,h);},r),l;function o(h){var f=h.$schema;return f&&!i.getSchema(f)?e.call(i,{$ref:f},true):Promise.resolve()}function c(h){try{return i._compile(h)}catch(m){if(m instanceof s)return f(m);throw m}function f(m){var b=m.missingSchema;if(_(b))throw new Error("Schema "+b+" is loaded but "+m.missingRef+" cannot be resolved");var u=i._loadingSchemas[b];return u||(u=i._loadingSchemas[b]=i._opts.loadSchema(b),u.then(p,p)),u.then(function(g){if(!_(b))return o(g).then(function(){_(b)||i.addSchema(g,b,void 0,a);})}).then(function(){return c(h)});function p(){delete i._loadingSchemas[b];}function _(g){return i._refs[g]||i._schemas[g]}}}}return Za}var za,Zn;function au(){return Zn||(Zn=1,za=function(e,t,a){var r=" ",i=e.level,l=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,b="data"+(l||""),u="valid"+i,p="errs__"+i,_=e.opts.$data&&o&&o.$data,g;_?(r+=" var schema"+i+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",g="schema"+i):g=o;var S=this,A="definition"+i,I=S.definition,P="",R,O,C,k,j;if(_&&I.$data){j="keywordValidate"+i;var E=I.validateSchema;r+=" var "+A+" = RULES.custom['"+t+"'].definition; var "+j+" = "+A+".validate;";}else {if(k=e.useCustomRule(S,o,e.schema,e),!k)return;g="validate.schema"+c,j=k.code,R=I.compile,O=I.inline,C=I.macro;}var x=j+".errors",D="i"+i,L="ruleErr"+i,M=I.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(O||C||(r+=""+x+" = null;"),r+="var "+p+" = errors;var "+u+";",_&&I.$data&&(P+="}",r+=" if ("+g+" === undefined) { "+u+" = true; } else { ",E&&(P+="}",r+=" "+u+" = "+A+".validateSchema("+g+"); if ("+u+") { ")),O)I.statements?r+=" "+k.validate+" ":r+=" "+u+" = "+k.validate+"; ";else if(C){var Q=e.util.copy(e),P="";Q.level++;var ae="valid"+Q.level;Q.schema=k.validate,Q.schemaPath="";var W=e.compositeRule;e.compositeRule=Q.compositeRule=true;var ie=e.validate(Q).replace(/validate\.schema/g,j);e.compositeRule=Q.compositeRule=W,r+=" "+ie;}else {var X=X||[];X.push(r),r="",r+=" "+j+".call( ",e.opts.passContext?r+="this":r+="self",R||I.schema===false?r+=" , "+b+" ":r+=" , "+g+" , "+b+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var ee=l?"data"+(l-1||""):"parentData",Fe=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+ee+" , "+Fe+" , rootData ) ";var ke=r;r=X.pop(),I.errors===false?(r+=" "+u+" = ",M&&(r+="await "),r+=""+ke+"; "):M?(x="customErrors"+i,r+=" var "+x+" = null; try { "+u+" = await "+ke+"; } catch (e) { "+u+" = false; if (e instanceof ValidationError) "+x+" = e.errors; else throw e; } "):r+=" "+x+" = null; "+u+" = "+ke+"; ";}if(I.modifying&&(r+=" if ("+ee+") "+b+" = "+ee+"["+Fe+"];"),r+=""+P,I.valid)f&&(r+=" if (true) { ");else {r+=" if ( ",I.valid===void 0?(r+=" !",C?r+=""+ae:r+=""+u):r+=" "+!I.valid+" ",r+=") { ",m=S.keyword;var X=X||[];X.push(r),r="";var X=X||[];X.push(r),r="",e.createErrors!==false?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==false&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var Ce=r;r=X.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+Ce+"]); ":r+=" validate.errors = ["+Ce+"]; return false; ":r+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var xe=r;r=X.pop(),O?I.errors?I.errors!="full"&&(r+=" for (var "+D+"="+p+"; "+D+"<errors; "+D+"++) { var "+L+" = vErrors["+D+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+h+'"; } ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+b+"; "),r+=" } "):I.errors===false?r+=" "+xe+" ":(r+=" if ("+p+" == errors) { "+xe+" } else { for (var "+D+"="+p+"; "+D+"<errors; "+D+"++) { var "+L+" = vErrors["+D+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+h+'"; } ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+b+"; "),r+=" } } "):C?(r+=" var err = ",e.createErrors!==false?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==false&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):I.errors===false?r+=" "+xe+" ":(r+=" if (Array.isArray("+x+")) { if (vErrors === null) vErrors = "+x+"; else vErrors = vErrors.concat("+x+"); errors = vErrors.length; for (var "+D+"="+p+"; "+D+"<errors; "+D+"++) { var "+L+" = vErrors["+D+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; "+L+'.schemaPath = "'+h+'"; ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+b+"; "),r+=" } } else { "+xe+" } "),r+=" } ",f&&(r+=" else { ");}return r}),za}const zn={$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:true,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:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},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:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},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:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},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:true};var Ua,Un;function su(){if(Un)return Ua;Un=1;var s=zn;return Ua={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:s.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:s.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"}]}}},Ua}var Va,Vn;function nu(){if(Vn)return Va;Vn=1;var s=/^[a-z_$][a-z0-9_$-]*$/i,e=au(),t=su();Va={add:a,get:r,remove:i,validate:l};function a(o,c){var h=this.RULES;if(h.keywords[o])throw new Error("Keyword "+o+" is already defined");if(!s.test(o))throw new Error("Keyword "+o+" is not a valid identifier");if(c){this.validateKeyword(c,true);var f=c.type;if(Array.isArray(f))for(var m=0;m<f.length;m++)u(o,f[m],c);else u(o,f,c);var b=c.metaSchema;b&&(c.$data&&this._opts.$data&&(b={anyOf:[b,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),c.validateSchema=this.compile(b,true));}h.keywords[o]=h.all[o]=true;function u(p,_,g){for(var S,A=0;A<h.length;A++){var I=h[A];if(I.type==_){S=I;break}}S||(S={type:_,rules:[]},h.push(S));var P={keyword:p,definition:g,custom:true,code:e,implements:g.implements};S.rules.push(P),h.custom[p]=P;}return this}function r(o){var c=this.RULES.custom[o];return c?c.definition:this.RULES.keywords[o]||false}function i(o){var c=this.RULES;delete c.keywords[o],delete c.all[o],delete c.custom[o];for(var h=0;h<c.length;h++)for(var f=c[h].rules,m=0;m<f.length;m++)if(f[m].keyword==o){f.splice(m,1);break}return this}function l(o,c){l.errors=null;var h=this._validateKeyword=this._validateKeyword||this.compile(t,true);if(h(o))return true;if(l.errors=h.errors,c)throw new Error("custom keyword definition is invalid: "+this.errorsText(h.errors));return false}return Va}const iu={$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:false};var Ha,Hn;function ou(){if(Hn)return Ha;Hn=1;var s=Cc(),e=oa(),t=kc(),a=Ys(),r=an(),i=jc(),l=eu(),o=ru(),c=jr();Ha=p,p.prototype.validate=_,p.prototype.compile=g,p.prototype.addSchema=S,p.prototype.addMetaSchema=A,p.prototype.validateSchema=I,p.prototype.getSchema=R,p.prototype.removeSchema=k,p.prototype.addFormat=W,p.prototype.errorsText=ae,p.prototype._addSchema=E,p.prototype._compile=x,p.prototype.compileAsync=tu();var h=nu();p.prototype.addKeyword=h.add,p.prototype.getKeyword=h.get,p.prototype.removeKeyword=h.remove,p.prototype.validateKeyword=h.validate;var f=ca();p.ValidationError=f.Validation,p.MissingRefError=f.MissingRef,p.$dataMetaSchema=o;var m="http://json-schema.org/draft-07/schema",b=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],u=["/properties"];function p(w){if(!(this instanceof p))return new p(w);w=this._opts=c.copy(w)||{},xe(this),this._schemas={},this._refs={},this._fragments={},this._formats=i(w.format),this._cache=w.cache||new t,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=D(w),w.loopRequired=w.loopRequired||1/0,w.errorDataPath=="property"&&(w._errorDataPathProperty=true),w.serialize===void 0&&(w.serialize=r),this._metaOpts=Ce(this),w.formats&&ee(this),w.keywords&&Fe(this),ie(this),typeof w.meta=="object"&&this.addMetaSchema(w.meta),w.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),X(this);}function _(w,N){var V;if(typeof w=="string"){if(V=this.getSchema(w),!V)throw new Error('no schema with key or ref "'+w+'"')}else {var Y=this._addSchema(w);V=Y.validate||this._compile(Y);}var F=V(N);return V.$async!==true&&(this.errors=V.errors),F}function g(w,N){var V=this._addSchema(w,void 0,N);return V.validate||this._compile(V)}function S(w,N,V,Y){if(Array.isArray(w)){for(var F=0;F<w.length;F++)this.addSchema(w[F],void 0,V,Y);return this}var z=this._getId(w);if(z!==void 0&&typeof z!="string")throw new Error("schema id must be string");return N=e.normalizeId(N||z),ke(this,N),this._schemas[N]=this._addSchema(w,V,Y,true),this}function A(w,N,V){return this.addSchema(w,N,V,true),this}function I(w,N){var V=w.$schema;if(V!==void 0&&typeof V!="string")throw new Error("$schema must be a string");if(V=V||this._opts.defaultMeta||P(this),!V)return this.logger.warn("meta-schema not available"),this.errors=null,true;var Y=this.validate(V,w);if(!Y&&N){var F="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(F);else throw new Error(F)}return Y}function P(w){var N=w._opts.meta;return w._opts.defaultMeta=typeof N=="object"?w._getId(N)||N:w.getSchema(m)?m:void 0,w._opts.defaultMeta}function R(w){var N=C(this,w);switch(typeof N){case "object":return N.validate||this._compile(N);case "string":return this.getSchema(N);case "undefined":return O(this,w)}}function O(w,N){var V=e.schema.call(w,{schema:{}},N);if(V){var Y=V.schema,F=V.root,z=V.baseId,ne=s.call(w,Y,F,void 0,z);return w._fragments[N]=new a({ref:N,fragment:true,schema:Y,root:F,baseId:z,validate:ne}),ne}}function C(w,N){return N=e.normalizeId(N),w._schemas[N]||w._refs[N]||w._fragments[N]}function k(w){if(w instanceof RegExp)return j(this,this._schemas,w),j(this,this._refs,w),this;switch(typeof w){case "undefined":return j(this,this._schemas),j(this,this._refs),this._cache.clear(),this;case "string":var N=C(this,w);return N&&this._cache.del(N.cacheKey),delete this._schemas[w],delete this._refs[w],this;case "object":var V=this._opts.serialize,Y=V?V(w):w;this._cache.del(Y);var F=this._getId(w);F&&(F=e.normalizeId(F),delete this._schemas[F],delete this._refs[F]);}return this}function j(w,N,V){for(var Y in N){var F=N[Y];!F.meta&&(!V||V.test(Y))&&(w._cache.del(F.cacheKey),delete N[Y]);}}function E(w,N,V,Y){if(typeof w!="object"&&typeof w!="boolean")throw new Error("schema should be object or boolean");var F=this._opts.serialize,z=F?F(w):w,ne=this._cache.get(z);if(ne)return ne;Y=Y||this._opts.addUsedSchema!==false;var le=e.normalizeId(this._getId(w));le&&Y&&ke(this,le);var oe=this._opts.validateSchema!==false&&!N,ye;oe&&!(ye=le&&le==e.normalizeId(w.$schema))&&this.validateSchema(w,true);var fe=e.ids.call(this,w),pe=new a({id:le,schema:w,localRefs:fe,cacheKey:z,meta:V});return le[0]!="#"&&Y&&(this._refs[le]=pe),this._cache.put(z,pe),oe&&ye&&this.validateSchema(w,true),pe}function x(w,N){if(w.compiling)return w.validate=F,F.schema=w.schema,F.errors=null,F.root=N||F,w.schema.$async===true&&(F.$async=true),F;w.compiling=true;var V;w.meta&&(V=this._opts,this._opts=this._metaOpts);var Y;try{Y=s.call(this,w.schema,N,w.localRefs);}catch(z){throw delete w.validate,z}finally{w.compiling=false,w.meta&&(this._opts=V);}return w.validate=Y,w.refs=Y.refs,w.refVal=Y.refVal,w.root=Y.root,Y;function F(){var z=w.validate,ne=z.apply(this,arguments);return F.errors=z.errors,ne}}function D(w){switch(w.schemaId){case "auto":return Q;case "id":return L;default:return M}}function L(w){return w.$id&&this.logger.warn("schema $id ignored",w.$id),w.id}function M(w){return w.id&&this.logger.warn("schema id ignored",w.id),w.$id}function Q(w){if(w.$id&&w.id&&w.$id!=w.id)throw new Error("schema $id is different from id");return w.$id||w.id}function ae(w,N){if(w=w||this.errors,!w)return "No errors";N=N||{};for(var V=N.separator===void 0?", ":N.separator,Y=N.dataVar===void 0?"data":N.dataVar,F="",z=0;z<w.length;z++){var ne=w[z];ne&&(F+=Y+ne.dataPath+" "+ne.message+V);}return F.slice(0,-V.length)}function W(w,N){return typeof N=="string"&&(N=new RegExp(N)),this._formats[w]=N,this}function ie(w){var N;if(w._opts.$data&&(N=iu,w.addMetaSchema(N,N.$id,true)),w._opts.meta!==false){var V=zn;w._opts.$data&&(V=o(V,u)),w.addMetaSchema(V,m,true),w._refs["http://json-schema.org/schema"]=m;}}function X(w){var N=w._opts.schemas;if(N)if(Array.isArray(N))w.addSchema(N);else for(var V in N)w.addSchema(N[V],V);}function ee(w){for(var N in w._opts.formats){var V=w._opts.formats[N];w.addFormat(N,V);}}function Fe(w){for(var N in w._opts.keywords){var V=w._opts.keywords[N];w.addKeyword(N,V);}}function ke(w,N){if(w._schemas[N]||w._refs[N])throw new Error('schema with key or id "'+N+'" already exists')}function Ce(w){for(var N=c.copy(w._opts),V=0;V<b.length;V++)delete N[b[V]];return N}function xe(w){var N=w._opts.logger;if(N===false)w.logger={log:Je,warn:Je,error:Je};else {if(N===void 0&&(N=console),!(typeof N=="object"&&N.log&&N.warn&&N.error))throw new Error("logger must implement log, warn and error methods");w.logger=N;}}function Je(){}return Ha}var lu=ou();const cu=xc(lu);class uu extends wc{constructor(e,t){var a;super(t),this._serverInfo=e,this._capabilities=(a=t?.capabilities)!==null&&a!==void 0?a:{},this._instructions=t?.instructions,this.setRequestHandler(Ds,r=>this._oninitialize(r)),this.setNotificationHandler(Ns,()=>{var r;return (r=this.oninitialized)===null||r===void 0?void 0:r.call(this)});}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Rc(this._capabilities,e);}assertCapabilityForMethod(e){var t,a,r;switch(e){case "sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case "elicitation/create":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case "roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case "notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case "notifications/resources/updated":case "notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case "notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case "notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case "sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case "logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case "prompts/get":case "prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case "resources/list":case "resources/templates/list":case "resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case "tools/call":case "tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break}}async _oninitialize(e){const t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Il.includes(t)?t:xs,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Lt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Vs,t)}async elicitInput(e,t){const a=await this.request({method:"elicitation/create",params:e},Hs,t);if(a.action==="accept"&&a.content)try{const r=new cu,i=r.compile(e.requestedSchema);if(!i(a.content))throw new Re(Se.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(i.errors)}`)}catch(r){throw r instanceof Re?r:new Re(Se.InternalError,`Error validating elicitation response: ${r}`)}return a}async listRoots(e,t){return this.request({method:"roots/list",params:e},Bs,t)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const du=Symbol("Let zodToJsonSchema decide on which parser to use"),Bn={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:true,rejectedAdditionalProperties:false,definitionPath:"definitions",target:"jsonSchema7",strictUnions:false,definitions:{},errorMessages:false,markdownDescription:false,patternStrategy:"escape",applyRegexFlags:false,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},hu=s=>typeof s=="string"?{...Bn,name:s}:{...Bn,...s},fu=s=>{const e=hu(s),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return {...e,flags:{hasReferencedOpenAiAnyType:false},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([a,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,a],jsonSchema:void 0}]))}};function Qn(s,e,t,a){a?.errorMessages&&t&&(s.errorMessage={...s.errorMessage,[e]:t});}function me(s,e,t,a,r){s[e]=t,Qn(s,e,a,r);}const Jn=(s,e)=>{let t=0;for(;t<s.length&&t<e.length&&s[t]===e[t];t++);return [(s.length-t).toString(),...e.slice(t)].join("/")};function Ze(s){if(s.target!=="openAi")return {};const e=[...s.basePath,s.definitionPath,s.openAiAnyTypeName];return s.flags.hasReferencedOpenAiAnyType=true,{$ref:s.$refStrategy==="relative"?Jn(e,s.currentPath):e.join("/")}}function pu(s,e){const t={type:"array"};return s.type?._def&&s.type?._def?.typeName!==Z.ZodAny&&(t.items=he(s.type._def,{...e,currentPath:[...e.currentPath,"items"]})),s.minLength&&me(t,"minItems",s.minLength.value,s.minLength.message,e),s.maxLength&&me(t,"maxItems",s.maxLength.value,s.maxLength.message,e),s.exactLength&&(me(t,"minItems",s.exactLength.value,s.exactLength.message,e),me(t,"maxItems",s.exactLength.value,s.exactLength.message,e)),t}function mu(s,e){const t={type:"integer",format:"int64"};if(!s.checks)return t;for(const a of s.checks)switch(a.kind){case "min":e.target==="jsonSchema7"?a.inclusive?me(t,"minimum",a.value,a.message,e):me(t,"exclusiveMinimum",a.value,a.message,e):(a.inclusive||(t.exclusiveMinimum=true),me(t,"minimum",a.value,a.message,e));break;case "max":e.target==="jsonSchema7"?a.inclusive?me(t,"maximum",a.value,a.message,e):me(t,"exclusiveMaximum",a.value,a.message,e):(a.inclusive||(t.exclusiveMaximum=true),me(t,"maximum",a.value,a.message,e));break;case "multipleOf":me(t,"multipleOf",a.value,a.message,e);break}return t}function vu(){return {type:"boolean"}}function Kn(s,e){return he(s.type._def,e)}const gu=(s,e)=>he(s.innerType._def,e);function Wn(s,e,t){const a=t??e.dateStrategy;if(Array.isArray(a))return {anyOf:a.map((r,i)=>Wn(s,e,r))};switch(a){case "string":case "format:date-time":return {type:"string",format:"date-time"};case "format:date":return {type:"string",format:"date"};case "integer":return yu(s,e)}}const yu=(s,e)=>{const t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(const a of s.checks)switch(a.kind){case "min":me(t,"minimum",a.value,a.message,e);break;case "max":me(t,"maximum",a.value,a.message,e);break}return t};function _u(s,e){return {...he(s.innerType._def,e),default:s.defaultValue()}}function bu(s,e){return e.effectStrategy==="input"?he(s.schema._def,e):Ze(e)}function Pu(s){return {type:"string",enum:Array.from(s.values)}}const Su=s=>"type"in s&&s.type==="string"?false:"allOf"in s;function Eu(s,e){const t=[he(s.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(s.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i);let a=e.target==="jsonSchema2019-09"?{unevaluatedProperties:false}:void 0;const r=[];return t.forEach(i=>{if(Su(i))r.push(...i.allOf),i.unevaluatedProperties===void 0&&(a=void 0);else {let l=i;if("additionalProperties"in i&&i.additionalProperties===false){const{additionalProperties:o,...c}=i;l=c;}else a=void 0;r.push(l);}}),r.length?{allOf:r,...a}:void 0}function wu(s,e){const t=typeof s.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(s.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[s.value]}:{type:t==="bigint"?"integer":t,const:s.value}}let Ba;const Xe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ba===void 0&&(Ba=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ba),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Gn(s,e){const t={type:"string"};if(s.checks)for(const a of s.checks)switch(a.kind){case "min":me(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,a.value):a.value,a.message,e);break;case "max":me(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,a.value):a.value,a.message,e);break;case "email":switch(e.emailStrategy){case "format:email":er(t,"email",a.message,e);break;case "format:idn-email":er(t,"idn-email",a.message,e);break;case "pattern:zod":Ne(t,Xe.email,a.message,e);break}break;case "url":er(t,"uri",a.message,e);break;case "uuid":er(t,"uuid",a.message,e);break;case "regex":Ne(t,a.regex,a.message,e);break;case "cuid":Ne(t,Xe.cuid,a.message,e);break;case "cuid2":Ne(t,Xe.cuid2,a.message,e);break;case "startsWith":Ne(t,RegExp(`^${Qa(a.value,e)}`),a.message,e);break;case "endsWith":Ne(t,RegExp(`${Qa(a.value,e)}$`),a.message,e);break;case "datetime":er(t,"date-time",a.message,e);break;case "date":er(t,"date",a.message,e);break;case "time":er(t,"time",a.message,e);break;case "duration":er(t,"duration",a.message,e);break;case "length":me(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,a.value):a.value,a.message,e),me(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,a.value):a.value,a.message,e);break;case "includes":{Ne(t,RegExp(Qa(a.value,e)),a.message,e);break}case "ip":{a.version!=="v6"&&er(t,"ipv4",a.message,e),a.version!=="v4"&&er(t,"ipv6",a.message,e);break}case "base64url":Ne(t,Xe.base64url,a.message,e);break;case "jwt":Ne(t,Xe.jwt,a.message,e);break;case "cidr":{a.version!=="v6"&&Ne(t,Xe.ipv4Cidr,a.message,e),a.version!=="v4"&&Ne(t,Xe.ipv6Cidr,a.message,e);break}case "emoji":Ne(t,Xe.emoji(),a.message,e);break;case "ulid":{Ne(t,Xe.ulid,a.message,e);break}case "base64":{switch(e.base64Strategy){case "format:binary":{er(t,"binary",a.message,e);break}case "contentEncoding:base64":{me(t,"contentEncoding","base64",a.message,e);break}case "pattern:zod":{Ne(t,Xe.base64,a.message,e);break}}break}case "nanoid":Ne(t,Xe.nanoid,a.message,e);}return t}function Qa(s,e){return e.patternStrategy==="escape"?xu(s):s}const Ru=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function xu(s){let e="";for(let t=0;t<s.length;t++)Ru.has(s[t])||(e+="\\"),e+=s[t];return e}function er(s,e,t,a){s.format||s.anyOf?.some(r=>r.format)?(s.anyOf||(s.anyOf=[]),s.format&&(s.anyOf.push({format:s.format,...s.errorMessage&&a.errorMessages&&{errorMessage:{format:s.errorMessage.format}}}),delete s.format,s.errorMessage&&(delete s.errorMessage.format,Object.keys(s.errorMessage).length===0&&delete s.errorMessage)),s.anyOf.push({format:e,...t&&a.errorMessages&&{errorMessage:{format:t}}})):me(s,"format",e,t,a);}function Ne(s,e,t,a){s.pattern||s.allOf?.some(r=>r.pattern)?(s.allOf||(s.allOf=[]),s.pattern&&(s.allOf.push({pattern:s.pattern,...s.errorMessage&&a.errorMessages&&{errorMessage:{pattern:s.errorMessage.pattern}}}),delete s.pattern,s.errorMessage&&(delete s.errorMessage.pattern,Object.keys(s.errorMessage).length===0&&delete s.errorMessage)),s.allOf.push({pattern:Yn(e,a),...t&&a.errorMessages&&{errorMessage:{pattern:t}}})):me(s,"pattern",Yn(e,a),t,a);}function Yn(s,e){if(!e.applyRegexFlags||!s.flags)return s.source;const t={i:s.flags.includes("i"),m:s.flags.includes("m"),s:s.flags.includes("s")},a=t.i?s.source.toLowerCase():s.source;let r="",i=false,l=false,o=false;for(let c=0;c<a.length;c++){if(i){r+=a[c],i=false;continue}if(t.i){if(l){if(a[c].match(/[a-z]/)){o?(r+=a[c],r+=`${a[c-2]}-${a[c]}`.toUpperCase(),o=false):a[c+1]==="-"&&a[c+2]?.match(/[a-z]/)?(r+=a[c],o=true):r+=`${a[c]}${a[c].toUpperCase()}`;continue}}else if(a[c].match(/[a-z]/)){r+=`[${a[c]}${a[c].toUpperCase()}]`;continue}}if(t.m){if(a[c]==="^"){r+=`(^|(?<=[\r
|
|
19
|
+
]))`;continue}else if(a[c]==="$"){r+=`($|(?=[\r
|
|
20
|
+
]))`;continue}}if(t.s&&a[c]==="."){r+=l?`${a[c]}\r
|
|
21
|
+
`:`[${a[c]}\r
|
|
22
|
+
]`;continue}r+=a[c],a[c]==="\\"?i=true:l&&a[c]==="]"?l=false:!l&&a[c]==="["&&(l=true);}try{new RegExp(r);}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),s.source}return r}function Xn(s,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&s.keyType?._def.typeName===Z.ZodEnum)return {type:"object",required:s.keyType._def.values,properties:s.keyType._def.values.reduce((a,r)=>({...a,[r]:he(s.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??Ze(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const t={type:"object",additionalProperties:he(s.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(s.keyType?._def.typeName===Z.ZodString&&s.keyType._def.checks?.length){const{type:a,...r}=Gn(s.keyType._def,e);return {...t,propertyNames:r}}else {if(s.keyType?._def.typeName===Z.ZodEnum)return {...t,propertyNames:{enum:s.keyType._def.values}};if(s.keyType?._def.typeName===Z.ZodBranded&&s.keyType._def.type._def.typeName===Z.ZodString&&s.keyType._def.type._def.checks?.length){const{type:a,...r}=Kn(s.keyType._def,e);return {...t,propertyNames:r}}}return t}function $u(s,e){if(e.mapStrategy==="record")return Xn(s,e);const t=he(s.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ze(e),a=he(s.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ze(e);return {type:"array",maxItems:125,items:{type:"array",items:[t,a],minItems:2,maxItems:2}}}function Tu(s){const e=s.values,a=Object.keys(s.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),r=Array.from(new Set(a.map(i=>typeof i)));return {type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:a}}function Ou(s){return s.target==="openAi"?void 0:{not:Ze({...s,currentPath:[...s.currentPath,"not"]})}}function Iu(s){return s.target==="openApi3"?{enum:["null"],nullable:true}:{type:"null"}}const Et={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Cu(s,e){if(e.target==="openApi3")return ei(s,e);const t=s.options instanceof Map?Array.from(s.options.values()):s.options;if(t.every(a=>a._def.typeName in Et&&(!a._def.checks||!a._def.checks.length))){const a=t.reduce((r,i)=>{const l=Et[i._def.typeName];return l&&!r.includes(l)?[...r,l]:r},[]);return {type:a.length>1?a:a[0]}}else if(t.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){const a=t.reduce((r,i)=>{const l=typeof i._def.value;switch(l){case "string":case "number":case "boolean":return [...r,l];case "bigint":return [...r,"integer"];case "object":if(i._def.value===null)return [...r,"null"];case "symbol":case "undefined":case "function":default:return r}},[]);if(a.length===t.length){const r=a.filter((i,l,o)=>o.indexOf(i)===l);return {type:r.length>1?r:r[0],enum:t.reduce((i,l)=>i.includes(l._def.value)?i:[...i,l._def.value],[])}}}else if(t.every(a=>a._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((a,r)=>[...a,...r._def.values.filter(i=>!a.includes(i))],[])};return ei(s,e)}const ei=(s,e)=>{const t=(s.options instanceof Map?Array.from(s.options.values()):s.options).map((a,r)=>he(a._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return t.length?{anyOf:t}:void 0};function ku(s,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(s.innerType._def.typeName)&&(!s.innerType._def.checks||!s.innerType._def.checks.length))return e.target==="openApi3"?{type:Et[s.innerType._def.typeName],nullable:true}:{type:[Et[s.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const a=he(s.innerType._def,{...e,currentPath:[...e.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:true}:a&&{...a,nullable:true}}const t=he(s.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function ju(s,e){const t={type:"number"};if(!s.checks)return t;for(const a of s.checks)switch(a.kind){case "int":t.type="integer",Qn(t,"type",a.message,e);break;case "min":e.target==="jsonSchema7"?a.inclusive?me(t,"minimum",a.value,a.message,e):me(t,"exclusiveMinimum",a.value,a.message,e):(a.inclusive||(t.exclusiveMinimum=true),me(t,"minimum",a.value,a.message,e));break;case "max":e.target==="jsonSchema7"?a.inclusive?me(t,"maximum",a.value,a.message,e):me(t,"exclusiveMaximum",a.value,a.message,e):(a.inclusive||(t.exclusiveMaximum=true),me(t,"maximum",a.value,a.message,e));break;case "multipleOf":me(t,"multipleOf",a.value,a.message,e);break}return t}function Au(s,e){const t=e.target==="openAi",a={type:"object",properties:{}},r=[],i=s.shape();for(const o in i){let c=i[o];if(c===void 0||c._def===void 0)continue;let h=Nu(c);h&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),h=false);const f=he(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});f!==void 0&&(a.properties[o]=f,h||r.push(o));}r.length&&(a.required=r);const l=Du(s,e);return l!==void 0&&(a.additionalProperties=l),a}function Du(s,e){if(s.catchall._def.typeName!=="ZodNever")return he(s.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(s.unknownKeys){case "passthrough":return e.allowedAdditionalProperties;case "strict":return e.rejectedAdditionalProperties;case "strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Nu(s){try{return s.isOptional()}catch{return true}}const Fu=(s,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return he(s.innerType._def,e);const t=he(s.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:Ze(e)},t]}:Ze(e)},qu=(s,e)=>{if(e.pipeStrategy==="input")return he(s.in._def,e);if(e.pipeStrategy==="output")return he(s.out._def,e);const t=he(s.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),a=he(s.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,a].filter(r=>r!==void 0)}};function Lu(s,e){return he(s.type._def,e)}function Mu(s,e){const a={type:"array",uniqueItems:true,items:he(s.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return s.minSize&&me(a,"minItems",s.minSize.value,s.minSize.message,e),s.maxSize&&me(a,"maxItems",s.maxSize.value,s.maxSize.message,e),a}function Zu(s,e){return s.rest?{type:"array",minItems:s.items.length,items:s.items.map((t,a)=>he(t._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((t,a)=>a===void 0?t:[...t,a],[]),additionalItems:he(s.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:s.items.length,maxItems:s.items.length,items:s.items.map((t,a)=>he(t._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((t,a)=>a===void 0?t:[...t,a],[])}}function zu(s){return {not:Ze(s)}}function Uu(s){return Ze(s)}const Vu=(s,e)=>he(s.innerType._def,e),Hu=(s,e,t)=>{switch(e){case Z.ZodString:return Gn(s,t);case Z.ZodNumber:return ju(s,t);case Z.ZodObject:return Au(s,t);case Z.ZodBigInt:return mu(s,t);case Z.ZodBoolean:return vu();case Z.ZodDate:return Wn(s,t);case Z.ZodUndefined:return zu(t);case Z.ZodNull:return Iu(t);case Z.ZodArray:return pu(s,t);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return Cu(s,t);case Z.ZodIntersection:return Eu(s,t);case Z.ZodTuple:return Zu(s,t);case Z.ZodRecord:return Xn(s,t);case Z.ZodLiteral:return wu(s,t);case Z.ZodEnum:return Pu(s);case Z.ZodNativeEnum:return Tu(s);case Z.ZodNullable:return ku(s,t);case Z.ZodOptional:return Fu(s,t);case Z.ZodMap:return $u(s,t);case Z.ZodSet:return Mu(s,t);case Z.ZodLazy:return ()=>s.getter()._def;case Z.ZodPromise:return Lu(s,t);case Z.ZodNaN:case Z.ZodNever:return Ou(t);case Z.ZodEffects:return bu(s,t);case Z.ZodAny:return Ze(t);case Z.ZodUnknown:return Uu(t);case Z.ZodDefault:return _u(s,t);case Z.ZodBranded:return Kn(s,t);case Z.ZodReadonly:return Vu(s,t);case Z.ZodCatch:return gu(s,t);case Z.ZodPipeline:return qu(s,t);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return (a=>{})()}};function he(s,e,t=false){const a=e.seen.get(s);if(e.override){const o=e.override?.(s,e,a,t);if(o!==du)return o}if(a&&!t){const o=Bu(a,e);if(o!==void 0)return o}const r={def:s,path:e.currentPath,jsonSchema:void 0};e.seen.set(s,r);const i=Hu(s,s.typeName,e),l=typeof i=="function"?he(i(),e):i;if(l&&Qu(s,e,l),e.postProcess){const o=e.postProcess(l,s,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}const Bu=(s,e)=>{switch(e.$refStrategy){case "root":return {$ref:s.path.join("/")};case "relative":return {$ref:Jn(e.currentPath,s.path)};case "none":case "seen":return s.path.length<e.currentPath.length&&s.path.every((t,a)=>e.currentPath[a]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Ze(e)):e.$refStrategy==="seen"?Ze(e):void 0}},Qu=(s,e,t)=>(s.description&&(t.description=s.description,e.markdownDescription&&(t.markdownDescription=s.description)),t),ri=(s,e)=>{const t=fu(e);let a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[h,f])=>({...c,[h]:he(f._def,{...t,currentPath:[...t.basePath,t.definitionPath,h]},true)??Ze(t)}),{}):void 0;const r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=he(s._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},false)??Ze(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(i.title=l),t.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[t.openAiAnyTypeName]||(a[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));const o=r===void 0?a?{...i,[t.definitionPath]:a}:i:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...a,[r]:i}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Ja;(function(s){s.Completable="McpCompletable";})(Ja||(Ja={}));class Ka extends se{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}Ka.create=(s,e)=>new Ka({type:s,typeName:Ja.Completable,complete:e.complete,...Ju(e)});function Ju(s){if(!s)return {};const{errorMap:e,invalid_type_error:t,required_error:a,description:r}=s;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(l,o)=>{var c,h;const{message:f}=s;return l.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:(c=f??a)!==null&&c!==void 0?c:o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:(h=f??t)!==null&&h!==void 0?h:o.defaultError}},description:r}}class Ku{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=false,this._completionHandlerInitialized=false,this._resourceHandlersInitialized=false,this._promptHandlersInitialized=false,this.server=new uu(e,t);}async connect(e){return await this.server.connect(e)}async close(){await this.server.close();}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Gt.shape.method.value),this.server.assertCanSetRequestHandler(Yt.shape.method.value),this.server.registerCapabilities({tools:{listChanged:true}}),this.server.setRequestHandler(Gt,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{const a={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?ri(t.inputSchema,{strictUnions:true}):Wu,annotations:t.annotations};return t.outputSchema&&(a.outputSchema=ri(t.outputSchema,{strictUnions:true})),a})})),this.server.setRequestHandler(Yt,async(e,t)=>{const a=this._registeredTools[e.params.name];if(!a)throw new Re(Se.InvalidParams,`Tool ${e.params.name} not found`);if(!a.enabled)throw new Re(Se.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(a.inputSchema){const i=await a.inputSchema.safeParseAsync(e.params.arguments);if(!i.success)throw new Re(Se.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${i.error.message}`);const l=i.data,o=a.callback;try{r=await Promise.resolve(o(l,t));}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:true};}}else {const i=a.callback;try{r=await Promise.resolve(i(t));}catch(l){r={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:true};}}if(a.outputSchema&&!r.isError){if(!r.structuredContent)throw new Re(Se.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const i=await a.outputSchema.safeParseAsync(r.structuredContent);if(!i.success)throw new Re(Se.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${i.error.message}`)}return r}),this._toolHandlersInitialized=true);}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xt.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Xt,async e=>{switch(e.params.ref.type){case "ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case "ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new Re(Se.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=true);}async handlePromptCompletion(e,t){const a=this._registeredPrompts[t.name];if(!a)throw new Re(Se.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new Re(Se.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return wt;const r=a.argsSchema.shape[e.params.argument.name];if(!(r instanceof Ka))return wt;const l=await r._def.complete(e.params.argument.value,e.params.context);return ai(l)}async handleResourceCompletion(e,t){const a=Object.values(this._registeredResourceTemplates).find(l=>l.resourceTemplate.uriTemplate.toString()===t.uri);if(!a){if(this._registeredResources[t.uri])return wt;throw new Re(Se.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=a.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return wt;const i=await r(e.params.argument.value,e.params.context);return ai(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ut.shape.method.value),this.server.assertCanSetRequestHandler(Vt.shape.method.value),this.server.assertCanSetRequestHandler(Ht.shape.method.value),this.server.registerCapabilities({resources:{listChanged:true}}),this.server.setRequestHandler(Ut,async(e,t)=>{const a=Object.entries(this._registeredResources).filter(([i,l])=>l.enabled).map(([i,l])=>({uri:i,name:l.name,...l.metadata})),r=[];for(const i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;const l=await i.resourceTemplate.listCallback(t);for(const o of l.resources)r.push({...i.metadata,...o});}return {resources:[...a,...r]}}),this.server.setRequestHandler(Vt,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,a])=>({name:t,uriTemplate:a.resourceTemplate.uriTemplate.toString(),...a.metadata}))})),this.server.setRequestHandler(Ht,async(e,t)=>{const a=new URL(e.params.uri),r=this._registeredResources[a.toString()];if(r){if(!r.enabled)throw new Re(Se.InvalidParams,`Resource ${a} disabled`);return r.readCallback(a,t)}for(const i of Object.values(this._registeredResourceTemplates)){const l=i.resourceTemplate.uriTemplate.match(a.toString());if(l)return i.readCallback(a,l,t)}throw new Re(Se.InvalidParams,`Resource ${a} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=true);}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Bt.shape.method.value),this.server.assertCanSetRequestHandler(Qt.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:true}}),this.server.setRequestHandler(Bt,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Yu(t.argsSchema):void 0}))})),this.server.setRequestHandler(Qt,async(e,t)=>{const a=this._registeredPrompts[e.params.name];if(!a)throw new Re(Se.InvalidParams,`Prompt ${e.params.name} not found`);if(!a.enabled)throw new Re(Se.InvalidParams,`Prompt ${e.params.name} disabled`);if(a.argsSchema){const r=await a.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new Re(Se.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);const i=r.data,l=a.callback;return await Promise.resolve(l(i,t))}else {const r=a.callback;return await Promise.resolve(r(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=true);}resource(e,t,...a){let r;typeof a[0]=="object"&&(r=a.shift());const i=a[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const l=this._createRegisteredResource(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}else {if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const l=this._createRegisteredResourceTemplate(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),l}}registerResource(e,t,a,r){if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const i=this._createRegisteredResource(e,a.title,t,a,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else {if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,a.title,t,a,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,a,r,i){const l={name:e,title:t,metadata:r,readCallback:i,enabled:true,disable:()=>l.update({enabled:false}),enable:()=>l.update({enabled:true}),remove:()=>l.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==a&&(delete this._registeredResources[a],o.uri&&(this._registeredResources[o.uri]=l)),typeof o.name<"u"&&(l.name=o.name),typeof o.title<"u"&&(l.title=o.title),typeof o.metadata<"u"&&(l.metadata=o.metadata),typeof o.callback<"u"&&(l.readCallback=o.callback),typeof o.enabled<"u"&&(l.enabled=o.enabled),this.sendResourceListChanged();}};return this._registeredResources[a]=l,l}_createRegisteredResourceTemplate(e,t,a,r,i){const l={resourceTemplate:a,title:t,metadata:r,readCallback:i,enabled:true,disable:()=>l.update({enabled:false}),enable:()=>l.update({enabled:true}),remove:()=>l.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=l)),typeof o.title<"u"&&(l.title=o.title),typeof o.template<"u"&&(l.resourceTemplate=o.template),typeof o.metadata<"u"&&(l.metadata=o.metadata),typeof o.callback<"u"&&(l.readCallback=o.callback),typeof o.enabled<"u"&&(l.enabled=o.enabled),this.sendResourceListChanged();}};return this._registeredResourceTemplates[e]=l,l}_createRegisteredPrompt(e,t,a,r,i){const l={title:t,description:a,argsSchema:r===void 0?void 0:n.object(r),callback:i,enabled:true,disable:()=>l.update({enabled:false}),enable:()=>l.update({enabled:true}),remove:()=>l.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=l)),typeof o.title<"u"&&(l.title=o.title),typeof o.description<"u"&&(l.description=o.description),typeof o.argsSchema<"u"&&(l.argsSchema=n.object(o.argsSchema)),typeof o.callback<"u"&&(l.callback=o.callback),typeof o.enabled<"u"&&(l.enabled=o.enabled),this.sendPromptListChanged();}};return this._registeredPrompts[e]=l,l}_createRegisteredTool(e,t,a,r,i,l,o){const c={title:t,description:a,inputSchema:r===void 0?void 0:n.object(r),outputSchema:i===void 0?void 0:n.object(i),annotations:l,callback:o,enabled:true,disable:()=>c.update({enabled:false}),enable:()=>c.update({enabled:true}),remove:()=>c.update({name:null}),update:h=>{typeof h.name<"u"&&h.name!==e&&(delete this._registeredTools[e],h.name&&(this._registeredTools[h.name]=c)),typeof h.title<"u"&&(c.title=h.title),typeof h.description<"u"&&(c.description=h.description),typeof h.paramsSchema<"u"&&(c.inputSchema=n.object(h.paramsSchema)),typeof h.callback<"u"&&(c.callback=h.callback),typeof h.annotations<"u"&&(c.annotations=h.annotations),typeof h.enabled<"u"&&(c.enabled=h.enabled),this.sendToolListChanged();}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let a,r,i,l;if(typeof t[0]=="string"&&(a=t.shift()),t.length>1){const c=t[0];ti(c)?(r=t.shift(),t.length>1&&typeof t[0]=="object"&&t[0]!==null&&!ti(t[0])&&(l=t.shift())):typeof c=="object"&&c!==null&&(l=t.shift());}const o=t[0];return this._createRegisteredTool(e,void 0,a,r,i,l,o)}registerTool(e,t,a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:r,description:i,inputSchema:l,outputSchema:o,annotations:c}=t;return this._createRegisteredTool(e,r,i,l,o,c,a)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let a;typeof t[0]=="string"&&(a=t.shift());let r;t.length>1&&(r=t.shift());const i=t[0],l=this._createRegisteredPrompt(e,void 0,a,r,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}registerPrompt(e,t,a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:r,description:i,argsSchema:l}=t,o=this._createRegisteredPrompt(e,r,i,l,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged();}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged();}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged();}}const Wu={type:"object",properties:{}};function ti(s){return typeof s!="object"||s===null?false:Object.keys(s).length===0||Object.values(s).some(Gu)}function Gu(s){return s!==null&&typeof s=="object"&&"parse"in s&&typeof s.parse=="function"&&"safeParse"in s&&typeof s.safeParse=="function"}function Yu(s){return Object.entries(s.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))}function ai(s){return {completion:{values:s.slice(0,100),total:s.length,hasMore:s.length>100}}}const wt={completion:{values:[],hasMore:false}};function Xu(s){if(!s)try{const e=window.location.hostname||"localhost";window.mcp=new Ku({name:e,version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),window.mcp.registerTool("get_current_website_title",{description:"Get the title of the current website"},async()=>{try{return {content:[{type:"text",text:document.title||"Untitled"}]}}catch(a){return console.error("Error in get_current_website_title tool:",a),{content:[{type:"text",text:`Error getting website title ${a instanceof Error?a.message:String(a)}`}],isError:!0}}});const t=new Ol({allowedOrigins:["*"]});window.mcp.connect(t);}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw new Error(`Failed to initialize MCP server: ${t}`)}}function ed(s){if(typeof window>"u"){console.warn("initializeGlobalMCP called in non-browser environment; skipping.");return}if(s&&window.mcp){console.warn("MCP server already initialized; skipping.");return}try{Xu(s),s=!0;}catch(e){throw console.error("Failed to initialize global MCP:",e),e}}let si=false;if(typeof window<"u"&&typeof document<"u")try{ed(si),typeof window.mcp<"u"?(si=!0,console.log("window.mcp",window.mcp),console.log("✅ MCP Ready!")):console.error("❌ MCP Not Ready!");}catch(s){console.error("Auto-initialization of global MCP failed:",s);}})();
|
|
23
|
+
|
|
24
|
+
})();
|