-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAjv.js
9 lines (9 loc) · 99.4 KB
/
Ajv.js
1
2
3
4
5
6
7
8
9
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).av7={})}(this,(function(e){"use strict";class t{}const r=/^[a-z$_][a-z$_0-9]*$/i;class s extends t{constructor(e){if(super(),!r.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}const o=new n("");function a(e,...t){const r=[e[0]];let s=0;for(;s<t.length;)d(r,t[s]),r.push(e[++s]);return new n(r)}const i=new n("+");function c(e,...t){const r=[f(e[0])];let s=0;for(;s<t.length;)r.push(i),d(r,t[s]),r.push(i,f(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){const r=l(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function d(e,t){var r;t instanceof n?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:f(Array.isArray(r)?r.join(","):r))}function l(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof s||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof s?void 0:`"${e}${t.slice(1)}`}function h(e,t){return t.emptyStr()?e:e.emptyStr()?t:c`${e}${t}`}function u(e){return new n(f(e))}function f(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function p(e){return"string"==typeof e&&r.test(e)?new n(`.${e}`):a`[${e}]`}class m extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var y;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(y||(y={}));const $={const:new s("const"),let:new s("let"),var:new s("var")};class v{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s?e:this.name(e)}name(e){return new s(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}class g extends s{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=a`.${new s(t)}[${r}]`}}const w=a`\n`;class b extends v{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?w:o}}get(){return this._scope}name(e){return new g(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:n}=s,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[n];if(a){const e=a.get(o);if(e)return e}else a=this._values[n]=new Map;a.set(o,s);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,s.setValue(t,{property:n,itemIndex:c}),s}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return a`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,t,r={},s){let n=o;for(const o in e){const i=e[o];if(!i)continue;const c=r[o]=r[o]||new Map;i.forEach((e=>{if(c.has(e))return;c.set(e,y.Started);let r=t(e);if(r){const t=this.opts.es5?$.var:$.const;n=a`${n}${t} ${e} = ${r};${this.opts._n}`}else{if(!(r=null==s?void 0:s(e)))throw new m(e);n=a`${n}${r}${this.opts._n}`}c.set(e,y.Completed)}))}return n}}const E={GT:new n(">"),GTE:new n(">="),LT:new n("<"),LTE:new n("<="),EQ:new n("==="),NEQ:new n("!=="),NOT:new n("!"),OR:new n("||"),AND:new n("&&"),ADD:new n("+")};class S{optimizeNodes(){return this}optimizeNames(e,t){return this}}class k extends S{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?$.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,e,t)),this}get names(){return this.rhs instanceof t?this.rhs.names:{}}}class _ extends S{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s)||e[this.lhs.str]||this.sideEffects)return this.rhs=J(this.rhs,e,t),this}get names(){return W(this.lhs instanceof s?{}:{...this.lhs.names},this.rhs)}}class P extends _{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class N extends S{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class C extends S{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class j extends S{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class x extends S{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=J(this.code,e,t),this}get names(){return this.code instanceof t?this.code.names:{}}}class I extends S{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;for(;s--;){const n=r[s];n.optimizeNames(e,t)||(B(e,n.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>H(e,t.names)),{})}}class T extends I{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class A extends I{}class O extends T{}O.kind="else";class R extends T{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new O(e):e}return t?!1===e?t instanceof R?t:t.nodes:this.nodes.length?this:new R(Q(e),t instanceof R?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=J(this.condition,e,t),this}get names(){const e=super.names;return W(e,this.condition),this.else&&H(e,this.else.names),e}}R.kind="if";class D extends T{}D.kind="for";class q extends D{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=J(this.iteration,e,t),this}get names(){return H(super.names,this.iteration.names)}}class z extends D{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){const t=e.es5?$.var:this.varKind,{name:r,from:s,to:n}=this;return`for(${t} ${r}=${s}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){const e=W(super.names,this.from);return W(e,this.to)}}class V extends D{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=J(this.iterable,e,t),this}get names(){return H(super.names,this.iterable.names)}}class F extends T{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}F.kind="func";class L extends I{render(e){return"return "+super.render(e)}}L.kind="return";class U extends T{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&H(e,this.catch.names),this.finally&&H(e,this.finally.names),e}}class M extends T{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}M.kind="catch";class K extends T{render(e){return"finally"+super.render(e)}}K.kind="finally";class G{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new v({parent:e}),this._nodes=[new A]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const n=this._scope.toName(t);return void 0!==r&&s&&(this._constants[n.str]=r),this._leafNode(new k(e,n,r)),n}const(e,t,r){return this._def($.const,e,t,r)}let(e,t,r){return this._def($.let,e,t,r)}var(e,t,r){return this._def($.var,e,t,r)}assign(e,t,r){return this._leafNode(new _(e,t,r))}add(e,t){return this._leafNode(new P(e,E.ADD,t))}code(e){return"function"==typeof e?e():e!==o&&this._leafNode(new x(e)),this}object(...e){const t=["{"];for(const[r,s]of e)t.length>1&&t.push(","),t.push(r),(r!==s||this.opts.es5)&&(t.push(":"),d(t,s));return t.push("}"),new n(t)}if(e,t,r){if(this._blockNode(new R(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new R(e))}else(){return this._elseNode(new O)}endIf(){return this._endBlockNode(R,O)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new q(e),t)}forRange(e,t,r,s,n=(this.opts.es5?$.var:$.let)){const o=this._scope.toName(e);return this._for(new z(n,o,t,r),(()=>s(o)))}forOf(e,t,r,n=$.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s?t:this.var("_arr",t);return this.forRange("_i",0,a`${e}.length`,(t=>{this.var(o,a`${e}[${t}]`),r(o)}))}return this._for(new V("of",n,o,t),(()=>r(o)))}forIn(e,t,r,s=(this.opts.es5?$.var:$.const)){if(this.opts.ownProperties)return this.forOf(e,a`Object.keys(${t})`,r);const n=this._scope.toName(e);return this._for(new V("in",s,n,t),(()=>r(n)))}endFor(){return this._endBlockNode(D)}label(e){return this._leafNode(new N(e))}break(e){return this._leafNode(new C(e))}return(e){const t=new L;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(L)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new U;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new M(e),t(e)}return r&&(this._currNode=s.finally=new K,this.code(r)),this._endBlockNode(M,K)}throw(e){return this._leafNode(new j(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=o,r,s){return this._blockNode(new F(e,t,r)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(F)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof R))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}}function H(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function W(e,r){return r instanceof t?H(e,r.names):e}function J(e,t,r){return e instanceof s?a(e):(o=e)instanceof n&&o._items.some((e=>e instanceof s&&1===t[e.str]&&void 0!==r[e.str]))?new n(e._items.reduce(((e,t)=>(t instanceof s&&(t=a(t)),t instanceof n?e.push(...t._items):e.push(t),e)),[])):e;var o;function a(e){const s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function B(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function Q(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:a`!${re(e)}`}const Z=te(E.AND);function Y(...e){return e.reduce(Z)}const X=te(E.OR);function ee(...e){return e.reduce(X)}function te(e){return(t,r)=>t===o?r:r===o?t:a`${re(t)} ${e} ${re(r)}`}function re(e){return e instanceof s?e:a`(${e})`}function se(e){const t={};for(const r of e)t[r]=!0;return t}function ne(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(oe(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}(t,e.self.RULES.all))}function oe(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=s.RULES.keywords;for(const r in t)n[r]||be(e,`unknown keyword: "${r}"`)}function ae(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1}function ie({topSchemaRef:e,schemaPath:t},r,s,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return a`${r}`}return a`${e}${t}${p(s)}`}function ce(e){return he(decodeURIComponent(e))}function de(e){return encodeURIComponent(le(e))}function le(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function he(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function ue(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}function fe({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,a,i,c)=>{const d=void 0===i?a:i instanceof s?(a instanceof s?e(o,a,i):t(o,a,i),i):a instanceof s?(t(o,i,a),a):r(a,i);return c!==s||d instanceof s?d:n(o,d)}}const pe={props:fe({mergeNames:(e,t,r)=>e.if(a`${r} !== true && ${t} !== undefined`,(()=>{e.if(a`${t} === true`,(()=>e.assign(r,!0)),(()=>e.assign(r,a`${r} || {}`).code(a`Object.assign(${r}, ${t})`)))})),mergeToName:(e,t,r)=>e.if(a`${r} !== true`,(()=>{!0===t?e.assign(r,!0):(e.assign(r,a`${r} || {}`),ye(e,r,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:me}),items:fe({mergeNames:(e,t,r)=>e.if(a`${r} !== true && ${t} !== undefined`,(()=>e.assign(r,a`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`))),mergeToName:(e,t,r)=>e.if(a`${r} !== true`,(()=>e.assign(r,!0===t||a`${r} > ${t} ? ${r} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function me(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",a`{}`);return void 0!==t&&ye(e,r,t),r}function ye(e,t,r){Object.keys(r).forEach((r=>e.assign(a`${t}${p(r)}`,!0)))}const $e={};function ve(e,t){return e.scopeValue("func",{ref:t,code:$e[t.code]||($e[t.code]=new n(t.code))})}var ge;function we(e,t,r){if(e instanceof s){const s=t===ge.Num;return r?s?a`"[" + ${e} + "]"`:a`"['" + ${e} + "']"`:s?a`"/" + ${e}`:a`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?p(e).toString():"/"+le(e)}function be(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}!function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(ge||(ge={}));const Ee={data:new s("data"),valCxt:new s("valCxt"),instancePath:new s("instancePath"),parentData:new s("parentData"),parentDataProperty:new s("parentDataProperty"),rootData:new s("rootData"),dynamicAnchors:new s("dynamicAnchors"),vErrors:new s("vErrors"),errors:new s("errors"),this:new s("this"),self:new s("self"),scope:new s("scope"),json:new s("json"),jsonPos:new s("jsonPos"),jsonLen:new s("jsonLen"),jsonPart:new s("jsonPart")},Se={message:({keyword:e})=>c`should pass "${e}" keyword validation`},ke={message:({keyword:e,schemaType:t})=>t?c`"${e}" keyword must be ${t} ($data)`:c`"${e}" keyword is invalid ($data)`};function _e(e,t=Se,r,s){const{it:n}=e,{gen:o,compositeRule:i,allErrors:c}=n,d=xe(e,t,r);(null!=s?s:i||c)?Ne(o,d):Ce(n,a`[${d}]`)}function Pe(e,t=Se,r){const{it:s}=e,{gen:n,compositeRule:o,allErrors:a}=s;Ne(n,xe(e,t,r)),o||a||Ce(s,Ee.vErrors)}function Ne(e,t){const r=e.const("err",t);e.if(a`${Ee.vErrors} === null`,(()=>e.assign(Ee.vErrors,a`[${r}]`)),a`${Ee.vErrors}.push(${r})`),e.code(a`${Ee.errors}++`)}function Ce(e,t){const{gen:r,validateName:s,schemaEnv:n}=e;n.$async?r.throw(a`new ${e.ValidationError}(${t})`):(r.assign(a`${s}.errors`,t),r.return(!1))}const je={keyword:new s("keyword"),schemaPath:new s("schemaPath"),params:new s("params"),propertyName:new s("propertyName"),message:new s("message"),schema:new s("schema"),parentSchema:new s("parentSchema")};function xe(e,t,r){const{createErrors:s}=e.it;return!1===s?a`{}`:function(e,t,r={}){const{gen:s,it:n}=e,o=[Ie(n,r),Te(e,r)];return function(e,{params:t,message:r},s){const{keyword:n,data:o,schemaValue:i,it:c}=e,{opts:d,propertyName:l,topSchemaRef:h,schemaPath:u}=c;s.push([je.keyword,n],[je.params,"function"==typeof t?t(e):t||a`{}`]),d.messages&&s.push([je.message,"function"==typeof r?r(e):r]);d.verbose&&s.push([je.schema,i],[je.parentSchema,a`${h}${u}`],[Ee.data,o]);l&&s.push([je.propertyName,l])}(e,t,o),s.object(...o)}(e,t,r)}function Ie({errorPath:e},{instancePath:t}){const r=t?c`${e}${we(t,ge.Str)}`:e;return[Ee.instancePath,h(Ee.instancePath,r)]}function Te({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:s}){let n=s?t:c`${t}/${e}`;return r&&(n=c`${n}${we(r,ge.Str)}`),[je.schemaPath,n]}const Ae={message:"boolean schema is false"};function Oe(e,t){const{gen:r,data:s}=e;_e({gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Ae,void 0,t)}const Re=new Set(["string","number","integer","boolean","null","object","array"]);function De(e){return"string"==typeof e&&Re.has(e)}function qe(e,t){return t.rules.some((t=>ze(e,t)))}function ze(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}var Ve;function Fe(e){const t=Le(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t}function Le(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(De))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}function Ue(e,t){const{gen:r,data:s,opts:n}=e,o=function(e,t){return t?e.filter((e=>Me.has(e)||"array"===t&&"array"===e)):[]}(t,n.coerceTypes),i=t.length>0&&!(0===o.length&&1===t.length&&function({schema:e,self:t},r){const s=t.RULES.types[r];return s&&!0!==s&&qe(e,s)}(e,t[0]));if(i){const i=Ge(t,s,n.strictNumbers,Ve.Wrong);r.if(i,(()=>{o.length?function(e,t,r){const{gen:s,data:n,opts:o}=e,i=s.let("dataType",a`typeof ${n}`),c=s.let("coerced",a`undefined`);"array"===o.coerceTypes&&s.if(a`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,(()=>s.assign(n,a`${n}[0]`).assign(i,a`typeof ${n}`).if(Ge(t,n,o.strictNumbers),(()=>s.assign(c,n)))));s.if(a`${c} !== undefined`);for(const e of r)(Me.has(e)||"array"===e&&"array"===o.coerceTypes)&&d(e);function d(e){switch(e){case"string":return void s.elseIf(a`${i} == "number" || ${i} == "boolean"`).assign(c,a`"" + ${n}`).elseIf(a`${n} === null`).assign(c,a`""`);case"number":return void s.elseIf(a`${i} == "boolean" || ${n} === null
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(c,a`+${n}`);case"integer":return void s.elseIf(a`${i} === "boolean" || ${n} === null
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(c,a`+${n}`);case"boolean":return void s.elseIf(a`${n} === "false" || ${n} === 0 || ${n} === null`).assign(c,!1).elseIf(a`${n} === "true" || ${n} === 1`).assign(c,!0);case"null":return s.elseIf(a`${n} === "" || ${n} === 0 || ${n} === false`),void s.assign(c,null);case"array":s.elseIf(a`${i} === "string" || ${i} === "number"
|| ${i} === "boolean" || ${n} === null`).assign(c,a`[${n}]`)}}s.else(),We(e),s.endIf(),s.if(a`${c} !== undefined`,(()=>{s.assign(n,c),function({gen:e,parentData:t,parentDataProperty:r},s){e.if(a`${t} !== undefined`,(()=>e.assign(a`${t}[${r}]`,s)))}(e,c)}))}(e,t,o):We(e)}))}return i}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(Ve||(Ve={}));const Me=new Set(["string","number","integer","boolean","null"]);function Ke(e,t,r,s=Ve.Correct){const n=s===Ve.Correct?E.EQ:E.NEQ;let i;switch(e){case"null":return a`${t} ${n} null`;case"array":i=a`Array.isArray(${t})`;break;case"object":i=a`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(a`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return a`typeof ${t} ${n} ${e}`}return s===Ve.Correct?i:Q(i);function c(e=o){return Y(a`typeof ${t} == "number"`,e,r?a`isFinite(${t})`:o)}}function Ge(e,t,r,s){if(1===e.length)return Ke(e[0],t,r,s);let n;const i=se(e);if(i.array&&i.object){const e=a`typeof ${t} != "object"`;n=i.null?e:a`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else n=o;i.number&&delete i.integer;for(const e in i)n=Y(n,Ke(e,t,r,s));return n}const He={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a`{type: ${e}}`:a`{type: ${t}}`};function We(e){_e(function(e){const{gen:t,data:r,schema:s}=e,n=ie(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:e}}(e),He)}function Je(e,t,r){const{gen:s,compositeRule:n,data:o,opts:i}=e;if(void 0===r)return;const c=a`${o}${p(t)}`;if(n)return void be(e,`default is ignored for: ${c}`);let d=a`${c} === undefined`;"empty"===i.useDefaults&&(d=a`${d} || ${c} === null || ${c} === ""`),s.if(d,a`${c} = ${u(r)}`)}function Be(e,t){const{gen:r,data:s,it:n}=e;r.if(et(r,s,t,n.opts.ownProperties),(()=>{e.setParams({missingProperty:a`${t}`},!0),e.error()}))}function Qe({gen:e,data:t,it:{opts:r}},s,n){return ee(...s.map((s=>Y(et(e,t,s,r.ownProperties),a`${n} = ${s}`))))}function Ze(e,t){e.setParams({missingProperty:t},!0),e.error()}function Ye(e,t,r){return a`${function(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a`Object.prototype.hasOwnProperty`})}(e)}.call(${t}, ${r})`}function Xe(e,t,r,s){const n=a`${t}${p(r)} !== undefined`;return s?a`${n} && ${Ye(e,t,r)}`:n}function et(e,t,r,s){const n=a`${t}${p(r)} === undefined`;return s?ee(n,Q(Ye(e,t,r))):n}function tt(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}function rt({schemaCode:e,data:t,it:{gen:r,topSchemaRef:s,schemaPath:n,errorPath:i},it:c},d,l,u){const f=u?a`${e}, ${t}, ${s}${n}`:t,p=[[Ee.instancePath,h(Ee.instancePath,i)],[Ee.parentData,c.parentData],[Ee.parentDataProperty,c.parentDataProperty],[Ee.rootData,Ee.rootData]];c.opts.dynamicRef&&p.push([Ee.dynamicAnchors,Ee.dynamicAnchors]);const m=a`${f}, ${r.object(...p)}`;return l!==o?a`${d}.call(${l}, ${m})`:a`${d}(${m})`}function st({gen:e,it:{opts:t}},r){const s=t.unicodeRegExp?"u":"";return e.scopeValue("pattern",{key:r,ref:new RegExp(r,s),code:a`new RegExp(${r}, ${s})`})}function nt(e){const{gen:t,data:r,keyword:s,it:n}=e,o=t.name("valid");if(n.allErrors){const e=t.let("valid",!0);return i((()=>t.assign(e,!1))),e}return t.var(o,!0),i((()=>t.break())),o;function i(n){const i=t.const("len",a`${r}.length`);t.forRange("i",0,i,(r=>{e.subschema({keyword:s,dataProp:r,dataPropType:ge.Num},o),t.if(Q(o),n)}))}}function ot(e,t){var r;const{gen:s,keyword:n,schema:i,parentSchema:d,$data:l,it:u}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(u,t);const f=!l&&t.compile?t.compile.call(u.self,i,d,u):t.validate,p=it(s,n,f),m=s.let("valid");function y(r=(t.async?a`await `:o)){const n=u.opts.passContext?Ee.this:Ee.self,i=!("compile"in t&&!l||!1===t.schema);s.assign(m,a`${r}${rt(e,p,n,i)}`,t.modifying)}function $(e){var r;s.if(Q(null!==(r=t.valid)&&void 0!==r?r:m),e)}e.block$data(m,(function(){if(!1===t.errors)y(),t.modifying&&at(e),$((()=>e.error()));else{const r=t.async?function(){const e=s.let("ruleErrs",null);return s.try((()=>y(a`await `)),(t=>s.assign(m,!1).if(a`${t} instanceof ${u.ValidationError}`,(()=>s.assign(e,a`${t}.errors`)),(()=>s.throw(t))))),e}():function(){const e=a`${p}.errors`;return s.assign(e,null),y(o),e}();t.modifying&&at(e),$((()=>function(e,t){const{gen:r}=e;r.if(a`Array.isArray(${t})`,(()=>{r.assign(Ee.vErrors,a`${Ee.vErrors} === null ? ${t} : ${Ee.vErrors}.concat(${t})`).assign(Ee.errors,a`${Ee.vErrors}.length`),function({gen:e,keyword:t,schemaValue:r,data:s,errsCount:n,it:o}){if(void 0===n)throw new Error("ajv implementation error");const i=e.name("err");e.forRange("i",n,Ee.errors,(n=>{e.const(i,a`${Ee.vErrors}[${n}]`),e.if(a`${i}.instancePath === undefined`,(()=>e.assign(a`${i}.instancePath`,h(Ee.instancePath,o.errorPath)))),e.assign(a`${i}.schemaPath`,c`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign(a`${i}.schema`,r),e.assign(a`${i}.data`,s))}))}(e)}),(()=>e.error()))}(e,r)))}})),e.ok(null!==(r=t.valid)&&void 0!==r?r:m)}function at(e){const{gen:t,data:r,it:s}=e;t.if(s.parentData,(()=>t.assign(r,a`${s.parentData}[${s.parentDataProperty}]`)))}function it(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:u(r)})}var ct=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,o;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;0!=n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},dt=Object.freeze(Object.assign(Object.create(null),ct,{default:ct}));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function lt(e){var t={exports:{}};return e(t,t.exports),t.exports}var ht=lt((function(e){var t=e.exports=function(e,t,s){"function"==typeof t&&(s=t,t={}),r(t,"function"==typeof(s=t.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function r(e,n,o,a,i,c,d,l,h,u){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var f in n(a,i,c,d,l,h,u),a){var p=a[f];if(Array.isArray(p)){if(f in t.arrayKeywords)for(var m=0;m<p.length;m++)r(e,n,o,p[m],i+"/"+f+"/"+m,c,i,f,a,m)}else if(f in t.propsKeywords){if(p&&"object"==typeof p)for(var y in p)r(e,n,o,p[y],i+"/"+f+"/"+s(y),c,i,f,a,y)}else(f in t.keywords||e.allKeys&&!(f in t.skipKeywords))&&r(e,n,o,p,i+"/"+f,c,i,f,a)}o(a,i,c,d,l,h,u)}}function s(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}})),ut=Object.freeze(Object.assign(Object.create(null),ht,{default:ht})),ft=lt((function(e,t){!function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var s=t.length-1,n=1;n<s;++n)t[n]=t[n].slice(1,-1);return t[s]=t[s].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function s(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function n(e){return e.toUpperCase()}function o(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function a(e,t){var r=e;if(t)for(var s in t)r[s]=t[s];return r}function i(e){var s="[A-Za-z]",n="[0-9]",o=t(n,"[A-Fa-f]"),a=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),i="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=t("[\\:\\/\\?\\#\\[\\]\\@]",i),d=e?"[\\uE000-\\uF8FF]":"[]",l=t(s,n,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");r(s+t(s,n,"[\\+\\-\\.]")+"*"),r(r(a+"|"+t(l,i,"[\\:]"))+"*");var h=r(r("25[0-5]")+"|"+r("2[0-4]"+n)+"|"+r("1"+n+n)+"|"+r("0?[1-9]"+n)+"|0?0?"+n),u=r(h+"\\."+h+"\\."+h+"\\."+h),f=r(o+"{1,4}"),p=r(r(f+"\\:"+f)+"|"+u),m=r(r(f+"\\:")+"{6}"+p),y=r("\\:\\:"+r(f+"\\:")+"{5}"+p),$=r(r(f)+"?\\:\\:"+r(f+"\\:")+"{4}"+p),v=r(r(r(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+r(f+"\\:")+"{3}"+p),g=r(r(r(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+r(f+"\\:")+"{2}"+p),w=r(r(r(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+p),b=r(r(r(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+p),E=r(r(r(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),S=r(r(r(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),k=r([m,y,$,v,g,w,b,E,S].join("|")),_=r(r(l+"|"+a)+"+");r("[vV]"+o+"+\\."+t(l,i,"[\\:]")+"+"),r(r(a+"|"+t(l,i))+"*");var P=r(a+"|"+t(l,i,"[\\:\\@]"));return r(r(a+"|"+t(l,i,"[\\@]"))+"+"),r(r(P+"|"+t("[\\/\\?]",d))+"*"),{NOT_SCHEME:new RegExp(t("[^]",s,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",l,i),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",l,i),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",l,i),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",l,i),"g"),NOT_QUERY:new RegExp(t("[^\\%]",l,i,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",l,i,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",l,i),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(a,"g"),IPV4ADDRESS:new RegExp("^("+u+")$"),IPV6ADDRESS:new RegExp("^\\[?("+k+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+_+")")+"?\\]?$")}}var c=i(!1),d=i(!0),l=function(){function e(e,t){var r=[],s=!0,n=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(s=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);s=!0);}catch(e){n=!0,o=e}finally{try{!s&&i.return&&i.return()}finally{if(n)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=2147483647,f=36,p=1,m=26,y=38,$=700,v=72,g=128,w="-",b=/^xn--/,E=/[^\0-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,k={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=f-p,P=Math.floor,N=String.fromCharCode;function C(e){throw new RangeError(k[e])}function j(e,t){for(var r=[],s=e.length;s--;)r[s]=t(e[s]);return r}function x(e,t){var r=e.split("@"),s="";return r.length>1&&(s=r[0]+"@",e=r[1]),s+j((e=e.replace(S,".")).split("."),t).join(".")}function I(e){for(var t=[],r=0,s=e.length;r<s;){var n=e.charCodeAt(r++);if(n>=55296&&n<=56319&&r<s){var o=e.charCodeAt(r++);56320==(64512&o)?t.push(((1023&n)<<10)+(1023&o)+65536):(t.push(n),r--)}else t.push(n)}return t}var T=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f},A=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},O=function(e,t,r){var s=0;for(e=r?P(e/$):e>>1,e+=P(e/t);e>_*m>>1;s+=f)e=P(e/_);return P(s+(_+1)*e/(e+y))},R=function(e){var t=[],r=e.length,s=0,n=g,o=v,a=e.lastIndexOf(w);a<0&&(a=0);for(var i=0;i<a;++i)e.charCodeAt(i)>=128&&C("not-basic"),t.push(e.charCodeAt(i));for(var c=a>0?a+1:0;c<r;){for(var d=s,l=1,h=f;;h+=f){c>=r&&C("invalid-input");var y=T(e.charCodeAt(c++));(y>=f||y>P((u-s)/l))&&C("overflow"),s+=y*l;var $=h<=o?p:h>=o+m?m:h-o;if(y<$)break;var b=f-$;l>P(u/b)&&C("overflow"),l*=b}var E=t.length+1;o=O(s-d,E,0==d),P(s/E)>u-n&&C("overflow"),n+=P(s/E),s%=E,t.splice(s++,0,n)}return String.fromCodePoint.apply(String,t)},D=function(e){var t=[],r=(e=I(e)).length,s=g,n=0,o=v,a=!0,i=!1,c=void 0;try{for(var d,l=e[Symbol.iterator]();!(a=(d=l.next()).done);a=!0){var h=d.value;h<128&&t.push(N(h))}}catch(e){i=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw c}}var y=t.length,$=y;for(y&&t.push(w);$<r;){var b=u,E=!0,S=!1,k=void 0;try{for(var _,j=e[Symbol.iterator]();!(E=(_=j.next()).done);E=!0){var x=_.value;x>=s&&x<b&&(b=x)}}catch(e){S=!0,k=e}finally{try{!E&&j.return&&j.return()}finally{if(S)throw k}}var T=$+1;b-s>P((u-n)/T)&&C("overflow"),n+=(b-s)*T,s=b;var R=!0,D=!1,q=void 0;try{for(var z,V=e[Symbol.iterator]();!(R=(z=V.next()).done);R=!0){var F=z.value;if(F<s&&++n>u&&C("overflow"),F==s){for(var L=n,U=f;;U+=f){var M=U<=o?p:U>=o+m?m:U-o;if(L<M)break;var K=L-M,G=f-M;t.push(N(A(M+K%G,0))),L=P(K/G)}t.push(N(A(L,0))),o=O(n,T,$==y),n=0,++$}}}catch(e){D=!0,q=e}finally{try{!R&&V.return&&V.return()}finally{if(D)throw q}}++n,++s}return t.join("")},q=function(e){return x(e,(function(e){return b.test(e)?R(e.slice(4).toLowerCase()):e}))},z=function(e){return x(e,(function(e){return E.test(e)?"xn--"+D(e):e}))},V={version:"2.1.0",ucs2:{decode:I,encode:function(e){return String.fromCodePoint.apply(String,h(e))}},decode:R,encode:D,toASCII:z,toUnicode:q},F={};function L(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function U(e){for(var t="",r=0,s=e.length;r<s;){var n=parseInt(e.substr(r+1,2),16);if(n<128)t+=String.fromCharCode(n),r+=3;else if(n>=194&&n<224){if(s-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&n)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(n>=224){if(s-r>=9){var a=parseInt(e.substr(r+4,2),16),i=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&n)<<12|(63&a)<<6|63&i)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function M(e,t){function r(e){var r=U(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,L).replace(t.PCT_ENCODED,n)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,L).replace(t.PCT_ENCODED,n)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,L).replace(t.PCT_ENCODED,n)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,L).replace(t.PCT_ENCODED,n)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,L).replace(t.PCT_ENCODED,n)),e}function K(e){return e.replace(/^0*(.*)/,"$1")||"0"}function G(e,t){var r=e.match(t.IPV4ADDRESS)||[],s=l(r,2)[1];return s?s.split(".").map(K).join("."):e}function H(e,t){var r=e.match(t.IPV6ADDRESS)||[],s=l(r,3),n=s[1],o=s[2];if(n){for(var a=n.toLowerCase().split("::").reverse(),i=l(a,2),c=i[0],d=i[1],h=d?d.split(":").map(K):[],u=c.split(":").map(K),f=t.IPV4ADDRESS.test(u[u.length-1]),p=f?7:8,m=u.length-p,y=Array(p),$=0;$<p;++$)y[$]=h[$]||u[m+$]||"";f&&(y[p-1]=G(y[p-1],t));var v=y.reduce((function(e,t,r){if(!t||"0"===t){var s=e[e.length-1];s&&s.index+s.length===r?s.length++:e.push({index:r,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],g=void 0;if(v&&v.length>1){var w=y.slice(0,v.index),b=y.slice(v.index+v.length);g=w.join(":")+"::"+b.join(":")}else g=y.join(":");return o&&(g+="%"+o),g}return e}var W=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,J=void 0==="".match(/(){0}/)[1];function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},s=!1!==t.iri?d:c;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var n=e.match(W);if(n){J?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==e.indexOf("@")?n[3]:void 0,r.host=-1!==e.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==e.indexOf("?")?n[7]:void 0,r.fragment=-1!==e.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=H(G(r.host,s),s)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=F[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)M(r,s);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=V.toASCII(r.host.replace(s.PCT_ENCODED,U).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}M(r,c)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function Q(e,t){var r=!1!==t.iri?d:c,s=[];return void 0!==e.userinfo&&(s.push(e.userinfo),s.push("@")),void 0!==e.host&&s.push(H(G(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(s.push(":"),s.push(String(e.port))),s.length?s.join(""):void 0}var Z=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(Z))e=e.replace(Z,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var s=r[0];e=e.slice(s.length),t.push(s)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?d:c,s=[],n=F[(t.scheme||e.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||n&&n.domainHost)try{e.host=t.iri?V.toUnicode(e.host):V.toASCII(e.host.replace(r.PCT_ENCODED,U).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}M(e,r),"suffix"!==t.reference&&e.scheme&&(s.push(e.scheme),s.push(":"));var o=Q(e,t);if(void 0!==o&&("suffix"!==t.reference&&s.push("//"),s.push(o),e.path&&"/"!==e.path.charAt(0)&&s.push("/")),void 0!==e.path){var a=e.path;t.absolutePath||n&&n.absolutePath||(a=te(a)),void 0===o&&(a=a.replace(/^\/\//,"/%2F")),s.push(a)}return void 0!==e.query&&(s.push("?"),s.push(e.query)),void 0!==e.fragment&&(s.push("#"),s.push(e.fragment)),s.join("")}function se(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={};return arguments[3]||(e=B(re(e,r),r),t=B(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=te(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=te(t.path||""),s.query=t.query):(t.path?("/"===t.path.charAt(0)?s.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=te(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function ne(e,t,r){var s=a({scheme:"null"},r);return re(se(B(e,s),B(t,s),s,!0),s)}function oe(e,t){return"string"==typeof e?e=re(B(e,t),t):"object"===s(e)&&(e=B(re(e,t),t)),e}function ae(e,t,r){return"string"==typeof e?e=re(B(e,r),r):"object"===s(e)&&(e=re(e,r)),"string"==typeof t?t=re(B(t,r),r):"object"===s(t)&&(t=re(t,r)),e===t}function ie(e,t){return e&&e.toString().replace(t&&t.iri?d.ESCAPE:c.ESCAPE,L)}function ce(e,t){return e&&e.toString().replace(t&&t.iri?d.PCT_ENCODED:c.PCT_ENCODED,U)}var de={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function he(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var ue={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=he(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(he(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),s=l(r,2),n=s[0],o=s[1];e.path=n&&"/"!==n?n:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},fe={scheme:"wss",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize},pe={},me="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ye="[0-9A-Fa-f]",$e=r(r("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+r("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+r("%"+ye+ye)),ve="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ge=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",be=new RegExp(me,"g"),Ee=new RegExp($e,"g"),Se=new RegExp(t("[^]",ve,"[\\.]",'[\\"]',ge),"g"),ke=new RegExp(t("[^]",me,we),"g"),_e=ke;function Pe(e){var t=U(e);return t.match(be)?t:e}var Ne={scheme:"mailto",parse:function(e,t){var r=e,s=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,o={},a=r.query.split("&"),i=0,c=a.length;i<c;++i){var d=a[i].split("=");switch(d[0]){case"to":for(var l=d[1].split(","),h=0,u=l.length;h<u;++h)s.push(l[h]);break;case"subject":r.subject=ce(d[1],t);break;case"body":r.body=ce(d[1],t);break;default:n=!0,o[ce(d[0],t)]=ce(d[1],t)}}n&&(r.headers=o)}r.query=void 0;for(var f=0,p=s.length;f<p;++f){var m=s[f].split("@");if(m[0]=ce(m[0]),t.unicodeSupport)m[1]=ce(m[1],t).toLowerCase();else try{m[1]=V.toASCII(ce(m[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}s[f]=m.join("@")}return r},serialize:function(e,t){var r=e,s=o(e.to);if(s){for(var a=0,i=s.length;a<i;++a){var c=String(s[a]),d=c.lastIndexOf("@"),l=c.slice(0,d).replace(Ee,Pe).replace(Ee,n).replace(Se,L),h=c.slice(d+1);try{h=t.iri?V.toUnicode(h):V.toASCII(ce(h,t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}s[a]=l+"@"+h}r.path=s.join(",")}var u=e.headers=e.headers||{};e.subject&&(u.subject=e.subject),e.body&&(u.body=e.body);var f=[];for(var p in u)u[p]!==pe[p]&&f.push(p.replace(Ee,Pe).replace(Ee,n).replace(ke,L)+"="+u[p].replace(Ee,Pe).replace(Ee,n).replace(_e,L));return f.length&&(r.query=f.join("&")),r}},Ce=/^([^\:]+)\:(.*)/,je={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(Ce),s=e;if(r){var n=t.scheme||s.scheme||"urn",o=r[1].toLowerCase(),a=r[2],i=n+":"+(t.nid||o),c=F[i];s.nid=o,s.nss=a,s.path=void 0,c&&(s=c.parse(s,t))}else s.error=s.error||"URN can not be parsed.";return s},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",s=e.nid,n=r+":"+(t.nid||s),o=F[n];o&&(e=o.serialize(e,t));var a=e,i=e.nss;return a.path=(s||t.nid)+":"+i,a}},xe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ie={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(xe)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};F[de.scheme]=de,F[le.scheme]=le,F[ue.scheme]=ue,F[fe.scheme]=fe,F[Ne.scheme]=Ne,F[je.scheme]=je,F[Ie.scheme]=Ie,e.SCHEMES=F,e.pctEncChar=L,e.pctDecChars=U,e.parse=B,e.removeDotSegments=te,e.serialize=re,e.resolveComponents=se,e.resolve=ne,e.normalize=oe,e.equal=ae,e.escapeComponent=ie,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}(t)}));const pt=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function mt(e,t=!0){return"boolean"==typeof e||(!0===t?!$t(e):!!t&&vt(e)<=t)}const yt=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function $t(e){for(const t in e){if(yt.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some($t))return!0;if("object"==typeof r&&$t(r))return!0}return!1}function vt(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!pt.has(r)&&("object"==typeof e[r]&&ue(e[r],(e=>t+=vt(e))),t===1/0))return 1/0}return t}function gt(e="",t){!1!==t&&(e=Et(e));return wt(ft.parse(e))}function wt(e){return ft.serialize(e).split("#")[0]+"#"}const bt=/#\/?$/;function Et(e){return e?e.replace(bt,""):""}function St(e,t){return t=Et(t),ft.resolve(e,t)}const kt=/^[a-z_][-a-z0-9._]*$/i;function _t(e){if("boolean"==typeof e)return{};const{schemaId:t}=this.opts,r=Et(e[t]),s={"":r},n=gt(r,!1),o={},a=new Set;return ut(e,{allKeys:!0},((e,r,d,l)=>{if(void 0===l)return;const h=n+r;let u=s[l];function f(t){if(t=Et(u?ft.resolve(u,t):t),a.has(t))throw c(t);a.add(t);let r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?i(e,r.schema,t):t!==Et(h)&&("#"===t[0]?(i(e,o[t],t),o[t]=e):this.refs[t]=h),t}function p(e){if("string"==typeof e){if(!kt.test(e))throw new Error(`invalid anchor "${e}"`);f.call(this,`#${e}`)}}"string"==typeof e[t]&&(u=f.call(this,e[t])),p.call(this,e.$anchor),p.call(this,e.$dynamicAnchor),s[r]=u})),o;function i(e,t,r){if(void 0!==t&&!dt(e,t))throw c(r)}function c(e){return new Error(`reference "${e}" resolves to more than one schema`)}}function Pt(e){It(e)&&(Tt(e),xt(e))?function(e){const{schema:t,opts:r,gen:n}=e;Nt(e,(()=>{r.$comment&&t.$comment&&Ot(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&be(e,"default is ignored in the schema root")}(e),n.let(Ee.vErrors,null),n.let(Ee.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",a`${r}.evaluated`),t.if(a`${e.evaluated}.dynamicProps`,(()=>t.assign(a`${e.evaluated}.props`,a`undefined`))),t.if(a`${e.evaluated}.dynamicItems`,(()=>t.assign(a`${e.evaluated}.items`,a`undefined`)))}(e),At(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if(a`${Ee.errors} === 0`,(()=>t.return(Ee.data)),(()=>t.throw(a`new ${o}(${Ee.vErrors})`))):(t.assign(a`${n}.errors`,Ee.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof s&&e.assign(a`${t}.props`,r);n instanceof s&&e.assign(a`${t}.items`,n)}(e),t.return(a`${Ee.errors} === 0`))}(e)}))}(e):Nt(e,(()=>function(e){const{gen:t,schema:r,validateName:s}=e;!1===r?Oe(e,!1):"object"==typeof r&&!0===r.$async?t.return(Ee.data):(t.assign(a`${s}.errors`,null),t.return(!0))}(e)))}function Nt({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},i){n.code.es5?e.func(t,a`${Ee.data}, ${Ee.valCxt}`,s.$async,(()=>{e.code(a`"use strict"; ${Ct(r,n)}`),function(e,t){e.if(Ee.valCxt,(()=>{e.var(Ee.instancePath,a`${Ee.valCxt}.${Ee.instancePath}`),e.var(Ee.parentData,a`${Ee.valCxt}.${Ee.parentData}`),e.var(Ee.parentDataProperty,a`${Ee.valCxt}.${Ee.parentDataProperty}`),e.var(Ee.rootData,a`${Ee.valCxt}.${Ee.rootData}`),t.dynamicRef&&e.var(Ee.dynamicAnchors,a`${Ee.valCxt}.${Ee.dynamicAnchors}`)}),(()=>{e.var(Ee.instancePath,a`""`),e.var(Ee.parentData,a`undefined`),e.var(Ee.parentDataProperty,a`undefined`),e.var(Ee.rootData,Ee.data),t.dynamicRef&&e.var(Ee.dynamicAnchors,a`{}`)}))}(e,n),e.code(i)})):e.func(t,a`${Ee.data}, ${function(e){return a`{${Ee.instancePath}="", ${Ee.parentData}, ${Ee.parentDataProperty}, ${Ee.rootData}=${Ee.data}${e.dynamicRef?a`, ${Ee.dynamicAnchors}={}`:o}}={}`}(n)}`,s.$async,(()=>e.code(Ct(r,n)).code(i)))}function Ct(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?a`/*# sourceURL=${r} */`:o}function jt(e,t){It(e)&&(Tt(e),xt(e))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&Ot(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=St(e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=s.const("_errs",Ee.errors);At(e,o),s.var(t,a`${o} === ${Ee.errors}`)}(e,t):function(e,t){const{gen:r,schema:s}=e;!1===s?(r.var(t,!1),Oe(e)):r.var(t,!0)}(e,t)}function xt({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function It(e){return"boolean"!=typeof e.schema}function Tt(e){oe(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&ae(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function At(e,t){if(e.opts.jtd)return Rt(e,[],!1,t);const r=Fe(e.schema);Rt(e,r,!Ue(e,r),t)}function Ot({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const o=r.$comment;if(!0===n.$comment)e.code(a`${Ee.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=c`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(a`${Ee.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function Rt(e,t,r,s){const{gen:n,schema:o,data:i,allErrors:c,opts:d,self:l}=e,{RULES:h}=l;function u(l){qe(o,l)&&(l.type?(n.if(Ke(l.type,i,d.strictNumbers)),Dt(e,l),1===t.length&&t[0]===l.type&&r&&(n.else(),We(e)),n.endIf()):Dt(e,l),c||n.if(a`${Ee.errors} === ${s||0}`))}!o.$ref||!d.ignoreKeywordsWithRef&&ae(o,h)?(d.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{zt(e.dataTypes,t)||Vt(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),e.dataTypes=e.dataTypes.filter((e=>zt(t,e)))})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&Vt(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const r=e.self.RULES.all;for(const s in r){const n=r[s];if("object"==typeof n&&ze(e.schema,n)){const{type:r}=n.definition;r.length&&!r.some((e=>qt(t,e)))&&Vt(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(e,e.dataTypes)}(e,t),n.block((()=>{for(const e of h.rules)u(e);u(h.post)}))):n.block((()=>Lt(e,"$ref",h.all.$ref.definition)))}function Dt(e,t){const{gen:r,schema:s,opts:{useDefaults:n}}=e;n&&function(e,t){const{properties:r,items:s}=e.schema;if("object"===t&&r)for(const t in r)Je(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach(((t,r)=>Je(e,r,t.default)))}(e,t.type),r.block((()=>{for(const r of t.rules)ze(s,r)&&Lt(e,r.keyword,r.definition,t.type)}))}function qt(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function zt(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function Vt(e,t){be(e,t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,e.opts.strictTypes)}class Ft{constructor(e,t,r){if(function({schema:e,opts:t,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const a=n.dependencies;if(null==a?void 0:a.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=ie(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",function(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let n,o;if(""===e)return Ee.rootData;if("/"===e[0]){if(!Ut.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=Ee.rootData}else{const a=Mt.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(n=a[2],"#"===n){if(i>=t)throw new Error(d("property/index",i));return s[t-i]}if(i>t)throw new Error(d("data",i));if(o=r[t-i],!n)return o}let i=o;const c=n.split("/");for(const e of c)e&&(o=a`${o}${p(he(e))}`,i=a`${i} && ${o}`);return i;function d(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}(this.$data,e));else if(this.schemaCode=this.schemaValue,!function(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e))}(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",Ee.errors))}result(e,t,r){this.gen.if(Q(e)),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.result(e,void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(a`${t} !== undefined && (${ee(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?Pe:_e)(this,this.def.error,t)}$dataError(){_e(this,this.def.$dataError||ke)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');var e,t;e=this.gen,t=this.errsCount,e.assign(Ee.errors,t),e.if(a`${Ee.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(a`${Ee.vErrors}.length`,t)),(()=>e.assign(Ee.vErrors,null)))))}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=o){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=o,t=o){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:i}=this;r.if(ee(a`${s} === undefined`,t)),e!==o&&r.assign(e,!0),(n.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==o&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return ee(function(){if(r.length){if(!(t instanceof s))throw new Error("ajv implementation error");return a`${Ge(Array.isArray(r)?r:[r],t,i.opts.strictNumbers,Ve.Wrong)}`}return o}(),function(){if(n.validateSchema){return a`!${e.scopeValue("validate$data",{ref:n.validateSchema})}(${t})`}return o}())}subschema(e,t){const r=function(e,{keyword:t,schemaProp:r,schema:s,schemaPath:n,errSchemaPath:o,topSchemaRef:i}){if(void 0!==t&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const s=e.schema[t];return void 0===r?{schema:s,schemaPath:a`${e.schemaPath}${p(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:a`${e.schemaPath}${p(t)}${p(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${de(r)}`}}if(void 0!==s){if(void 0===n||void 0===o||void 0===i)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:n,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}(this.it,e);!function(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:d}){if(void 0!==o&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==r){const{errorPath:s,dataPathArr:o,opts:i}=t;h(l.let("data",a`${t.data}${p(r)}`,!0)),e.errorPath=c`${s}${we(r,n,i.jsPropertySyntax)}`,e.parentDataProperty=a`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}void 0!==o&&(h(o instanceof s?o:l.let("data",o,!0)),void 0!==d&&(e.propertyName=d));function h(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}i&&(e.dataTypes=i)}(r,this.it,e),function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){void 0!==s&&(e.compositeRule=s),void 0!==n&&(e.createErrors=n),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}(r,e);const n={...this.it,...r,items:void 0,props:void 0};return jt(n,t),n}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=pe.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=pe.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,s))),!0}}function Lt(e,t,r,s){const n=new Ft(e,r,t);"code"in r?r.code(n,s):n.$data&&r.validate?ot(n,r):"macro"in r?function(e,t){const{gen:r,keyword:s,schema:n,parentSchema:a,it:i}=e,c=t.macro.call(i.self,n,a,i),d=it(r,s,c);!1!==i.opts.validateSchema&&i.self.validateSchema(c,!0);const l=r.name("valid");e.subschema({schema:c,schemaPath:o,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:d,compositeRule:!0},l),e.pass(l,(()=>e.error(!0)))}(n,r):(r.compile||r.validate)&&ot(n,r)}const Ut=/^\/(?:[^~]|~0|~1)*$/,Mt=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;class Kt extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}class Gt extends Error{constructor(e,t,r){super(r||`can't resolve reference ${t} from id ${e}`),this.missingRef=St(e,t),this.missingSchema=Et(gt(this.missingRef))}}class Ht{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:Et(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function Wt(e){const t=Qt.call(this,e);if(t)return t;const r=gt(e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:c}=this.opts,d=new G(this.scope,{es5:n,lines:i,ownProperties:c});let l;e.$async&&(l=d.scopeValue("Error",{ref:Kt,code:a`require("ajv/dist/runtime/validation_error").default`}));const h=d.scopeName("validate");e.validateName=h;const f={gen:d,allErrors:this.opts.allErrors,data:Ee.data,parentData:Ee.parentData,parentDataProperty:Ee.parentDataProperty,dataNames:[Ee.data],dataPathArr:[o],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:u(e.schema)}:{ref:e.schema}),validateName:h,ValidationError:l,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:o,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:a`""`,opts:this.opts,self:this};let p;try{this._compilations.add(e),Pt(f),d.optimize(this.opts.code.optimize);const t=d.toString();p=`${d.scopeRefs(Ee.scope)}return ${t}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const r=new Function(`${Ee.self}`,`${Ee.scope}`,p)(this,this.scope.get());if(this.scope.value(h,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:h,validateCode:t,scopeValues:d._values}),this.opts.unevaluated){const{props:e,items:t}=f;r.evaluated={props:e instanceof s?void 0:e,items:t instanceof s?void 0:t,dynamicProps:e instanceof s,dynamicItems:t instanceof s},r.source&&(r.source.evaluated=u(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),t}finally{this._compilations.delete(e)}}function Jt(e,t,r){var s;r=St(t,r);const n=e.refs[r];if(n)return n;let o=Zt.call(this,e,r);if(void 0===o){const n=null===(s=e.localRefs)||void 0===s?void 0:s[r],{schemaId:a}=this.opts;n&&(o=new Ht({schema:n,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=Bt.call(this,o):void 0}function Bt(e){return mt(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Wt.call(this,e)}function Qt(e){for(const s of this._compilations)if(r=e,(t=s).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s;var t,r}function Zt(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||Yt.call(this,e,t)}function Yt(e,t){const r=ft.parse(t),s=wt(r);let n=gt(e.baseId);if(Object.keys(e.schema).length>0&&s===n)return er.call(this,r,e);const o=Et(s),a=this.refs[o]||this.schemas[o];if("string"==typeof a){const t=Yt.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return er.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||Wt.call(this,a),o===Et(t)){const{schema:t}=a,{schemaId:r}=this.opts,s=t[r];return s&&(n=St(n,s)),new Ht({schema:t,schemaId:r,root:e,baseId:n})}return er.call(this,r,a)}}const Xt=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function er(e,{baseId:t,schema:r,root:s}){var n;if("/"!==(null===(n=e.fragment)||void 0===n?void 0:n[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;if(void 0===(r=r[ce(s)]))return;const e="object"==typeof r&&r[this.opts.schemaId];!Xt.has(s)&&e&&(t=St(t,e))}let o;if("boolean"!=typeof r&&r.$ref&&!ae(r,this.RULES)){const e=St(t,r.$ref);o=Yt.call(this,s,e)}const{schemaId:a}=this.opts;return o=o||new Ht({schema:r,schemaId:a,root:s,baseId:t}),o.schema!==o.root.schema?o:void 0}var tr="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",rr="Meta-schema for $data reference (JSON AnySchema extension proposal)",sr="object",nr=["$data"],or={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},ar={$id:tr,description:rr,type:sr,required:nr,properties:or,additionalProperties:false},ir=Object.freeze({__proto__:null,$id:tr,description:rr,type:sr,required:nr,properties:or,additionalProperties:false,default:ar});const cr=["removeAdditional","useDefaults","coerceTypes"],dr=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),lr={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},hr={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function ur(e){var t,r,s,n,o,a,i,c,d,l,h,u,f,p,m,y,$,v,g,w,b;const E=e.strict,S=null===(t=e.code)||void 0===t?void 0:t.optimize,k=!0===S||void 0===S?1:S||0;return{strictSchema:null===(s=null!==(r=e.strictSchema)&&void 0!==r?r:E)||void 0===s||s,strictNumbers:null===(o=null!==(n=e.strictNumbers)&&void 0!==n?n:E)||void 0===o||o,strictTypes:null!==(i=null!==(a=e.strictTypes)&&void 0!==a?a:E)&&void 0!==i?i:"log",strictTuples:null!==(d=null!==(c=e.strictTuples)&&void 0!==c?c:E)&&void 0!==d?d:"log",strictRequired:null!==(h=null!==(l=e.strictRequired)&&void 0!==l?l:E)&&void 0!==h&&h,code:e.code?{...e.code,optimize:k}:{optimize:k},loopRequired:null!==(u=e.loopRequired)&&void 0!==u?u:200,loopEnum:null!==(f=e.loopEnum)&&void 0!==f?f:200,meta:null===(p=e.meta)||void 0===p||p,messages:null===(m=e.messages)||void 0===m||m,inlineRefs:null===(y=e.inlineRefs)||void 0===y||y,schemaId:null!==($=e.schemaId)&&void 0!==$?$:"$id",addUsedSchema:null===(v=e.addUsedSchema)||void 0===v||v,validateSchema:null===(g=e.validateSchema)||void 0===g||g,validateFormats:null===(w=e.validateFormats)||void 0===w||w,unicodeRegExp:null===(b=e.unicodeRegExp)||void 0===b||b}}class fr{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...ur(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new b({scope:{},prefixes:dr,es5:t,lines:r}),this.logger=function(e){if(!1===e)return wr;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}(),pr.call(this,lr,e,"NOT SUPPORTED"),pr.call(this,hr,e,"DEPRECATED","warn"),this._metaOpts=gr.call(this),e.formats&&$r.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&vr.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),yr.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=ir;"id"===r&&(s={...ir},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await n.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof Gt))throw t;return a.call(this,t),await i.call(this,t.missingSchema),o.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function i(e){const r=await c.call(this,e);this.refs[e]||await n.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,s);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=Et(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=mr.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,s=new Ht({schema:{},schemaId:r});if(t=Yt.call(this,s,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=mr.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=Et(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(Er.call(this,r,t),!t)return ue(r,(e=>Sr.call(this,e))),this;_r.call(this,t);const s={...t,type:Le(t.type),schemaType:Le(t.schemaType)};return ue(r,0===s.type.length?e=>Sr.call(this,e,s):e=>s.type.forEach((t=>Sr.call(this,e,s,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,o=n[e];s&&o&&(n[e]=Nr(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];t&&!t.test(r)||("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:a}=this.opts;if("object"==typeof e)o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let i=this._cache.get(e);if(void 0!==i)return i;const c=_t.call(this,e);return r=Et(o||r),i=new Ht({schema:e,schemaId:a,meta:t,baseId:r,localRefs:c}),this._cache.set(i.schema,i),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=i),s&&this.validateSchema(e,!0),i}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Wt.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{Wt.call(this,e)}finally{this.opts=t}}}function pr(e,t,r,s="error"){for(const n in e){const o=n;o in t&&this.logger[s](`${r}: option ${n}. ${e[o]}`)}}function mr(e){return e=Et(e),this.schemas[e]||this.refs[e]}function yr(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function $r(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function vr(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function gr(){const e={...this.opts};for(const t of cr)delete e[t];return e}fr.ValidationError=Kt,fr.MissingRefError=Gt;const wr={log(){},warn(){},error(){}};const br=/^[a-z_$][a-z0-9_$:-]*$/i;function Er(e,t){const{RULES:r}=this;if(ue(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!br.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Sr(e,t,r){var s;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=n?o.post:o.rules.find((({type:e})=>e===r));if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:Le(t.type),schemaType:Le(t.schemaType)}};t.before?kr.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,null===(s=t.implements)||void 0===s||s.forEach((e=>this.addKeyword(e)))}function kr(e,t,r){const s=e.rules.findIndex((e=>e.keyword===r));s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function _r(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=Nr(t)),e.validateSchema=this.compile(t,!0))}const Pr={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nr(e){return{anyOf:[e,Pr]}}function Cr(e,t,r,n){const{gen:i,it:c}=e,{allErrors:d,schemaEnv:l,opts:h}=c,u=h.passContext?Ee.this:o;function f(e){const t=a`${e}.errors`;i.assign(Ee.vErrors,a`${Ee.vErrors} === null ? ${t} : ${Ee.vErrors}.concat(${t})`),i.assign(Ee.errors,a`${Ee.vErrors}.length`)}function p(e){var t;if(!c.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(n&&!n.dynamicProps)void 0!==n.props&&(c.props=pe.props(i,n.props,c.props));else{const t=i.var("props",a`${e}.evaluated.props`);c.props=pe.props(i,t,c.props,s)}if(!0!==c.items)if(n&&!n.dynamicItems)void 0!==n.items&&(c.items=pe.items(i,n.items,c.items));else{const t=i.var("items",a`${e}.evaluated.items`);c.items=pe.items(i,t,c.items,s)}}n?function(){if(!l.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try((()=>{i.code(a`await ${rt(e,t,u)}`),p(t),d||i.assign(r,!0)}),(e=>{i.if(a`!(${e} instanceof ${c.ValidationError})`,(()=>i.throw(e))),f(e),d||i.assign(r,!1)})),e.ok(r)}():e.result(rt(e,t,u),(()=>p(t)),(()=>f(t)))}const jr=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",{keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}},{keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:s}=e,{baseId:n,schemaEnv:i,validateName:c,opts:d,self:l}=s,{root:h}=i;if(("#"===r||"#/"===r)&&n===h.baseId)return function(){if(i===h)return Cr(e,c,i,i.$async);const r=t.scopeValue("root",{ref:h});return Cr(e,a`${r}.validate`,h,h.$async)}();const f=Jt.call(l,h,n,r);if(void 0===f)throw new Gt(n,r);return f instanceof Ht?function(t){const r=function(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):a`${r.scopeValue("wrapper",{ref:t})}.validate`}(e,t);Cr(e,r,t,t.$async)}(f):function(s){const n=t.scopeValue("schema",!0===d.code.source?{ref:s,code:u(s)}:{ref:s}),a=t.name("valid"),i=e.subschema({schema:s,dataTypes:[],schemaPath:o,topSchemaRef:n,errSchemaPath:r},a);e.mergeEvaluated(i),e.ok(a)}(f)}}],xr={maximum:{okStr:"<=",ok:E.LTE,fail:E.GT},minimum:{okStr:">=",ok:E.GTE,fail:E.LT},exclusiveMaximum:{okStr:"<",ok:E.LT,fail:E.GTE},exclusiveMinimum:{okStr:">",ok:E.GT,fail:E.LTE}},Ir={message:({keyword:e,schemaCode:t})=>c`must be ${xr[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>a`{comparison: ${xr[e].okStr}, limit: ${t}}`},Tr={keyword:Object.keys(xr),type:"number",schemaType:"number",$data:!0,error:Ir,code(e){const{keyword:t,data:r,schemaCode:s}=e;e.fail$data(a`${r} ${xr[t].fail} ${s} || isNaN(${r})`)}},Ar={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>c`must be multiple of ${e}`,params:({schemaCode:e})=>a`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:s,it:n}=e,o=n.opts.multipleOfPrecision,i=t.let("res"),c=o?a`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:a`${i} !== parseInt(${i})`;e.fail$data(a`(${s} === 0 || (${i} = ${r}/${s}, ${c}))`)}};function Or(e){const t=e.length;let r,s=0,n=0;for(;n<t;)s++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return s}Or.code='require("ajv/dist/runtime/ucs2length").default';const Rr={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>c`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>a`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:s,it:n}=e,o="maxLength"===t?E.GT:E.LT,i=!1===n.opts.unicode?a`${r}.length`:a`${ve(e.gen,Or)}(${r})`;e.fail$data(a`${i} ${o} ${s}`)}},Dr={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>c`must match pattern "${e}"`,params:({schemaCode:e})=>a`{pattern: ${e}}`},code(e){const{data:t,$data:r,schema:s,schemaCode:n,it:o}=e,i=o.opts.unicodeRegExp?"u":"",c=r?a`(new RegExp(${n}, ${i}))`:st(e,s);e.fail$data(a`!${c}.test(${t})`)}},qr={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>c`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>a`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:s}=e,n="maxProperties"===t?E.GT:E.LT;e.fail$data(a`Object.keys(${r}).length ${n} ${s}`)}},zr={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>c`must have required property '${e}'`,params:({params:{missingProperty:e}})=>a`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:s,data:n,$data:a,it:i}=e,{opts:c}=i;if(!a&&0===r.length)return;const d=r.length>=c.loopRequired;if(i.allErrors?function(){if(d||a)e.block$data(o,l);else for(const t of r)Be(e,t)}():function(){const i=t.let("missing");if(d||a){const r=t.let("valid",!0);e.block$data(r,(()=>function(r,a){e.setParams({missingProperty:r}),t.forOf(r,s,(()=>{t.assign(a,Xe(t,n,r,c.ownProperties)),t.if(Q(a),(()=>{e.error(),t.break()}))}),o)}(i,r))),e.ok(r)}else t.if(Qe(e,r,i)),Ze(e,i),t.else()}(),c.strictRequired){const t=e.parentSchema.properties,{definedProperties:s}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!s.has(e)){be(i,`required property "${e}" is not defined at "${i.schemaEnv.baseId+i.errSchemaPath}" (strictRequired)`,i.opts.strictRequired)}}function l(){t.forOf("prop",s,(r=>{e.setParams({missingProperty:r}),t.if(et(t,n,r,c.ownProperties),(()=>e.error()))}))}}},Vr={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>c`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>a`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:s}=e,n="maxItems"===t?E.GT:E.LT;e.fail$data(a`${r}.length ${n} ${s}`)}};ct.code='require("ajv/dist/runtime/equal").default';const Fr={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>c`must NOT have more than ${e} items`,params:({params:{len:e}})=>a`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?Lr(e,s):be(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function Lr(e,t){const{gen:r,schema:s,data:n,keyword:o,it:i}=e;i.items=!0;const c=r.const("len",a`${n}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(a`${c} <= ${t.length}`);else if("object"==typeof s&&!ne(i,s)){const s=r.var("valid",a`${c} <= ${t.length}`);r.if(Q(s),(()=>function(s){r.forRange("i",t.length,c,(t=>{e.subschema({keyword:o,dataProp:t,dataPropType:ge.Num},s),i.allErrors||r.if(Q(s),(()=>r.break()))}))}(s))),e.ok(s)}}const Ur={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Mr(e,"additionalItems",t);r.items=!0,ne(r,t)||e.ok(nt(e))}};function Mr(e,t,r=e.schema){const{gen:s,parentSchema:n,data:o,keyword:i,it:c}=e;!function(e){const{opts:s,errSchemaPath:n}=c,o=r.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(s.strictTuples&&!a){be(c,`"${i}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${n}"`,s.strictTuples)}}(n),c.opts.unevaluated&&r.length&&!0!==c.items&&(c.items=pe.items(s,r.length,c.items));const d=s.name("valid"),l=s.const("len",a`${o}.length`);r.forEach(((t,r)=>{ne(c,t)||(s.if(a`${l} > ${r}`,(()=>e.subschema({keyword:i,schemaProp:r,dataProp:r},d))),e.ok(d))}))}const Kr={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>Mr(e,"items")},Gr={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>c`must NOT have more than ${e} items`,params:({params:{len:e}})=>a`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:s}=e,{prefixItems:n}=r;s.items=!0,ne(s,t)||(n?Lr(e,n):e.ok(nt(e)))}},Hr={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?c`must contain at least ${e} valid item(s)`:c`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?a`{minContains: ${e}}`:a`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:s,data:n,it:o}=e;let i,c;const{minContains:d,maxContains:l}=s;o.opts.next?(i=void 0===d?1:d,c=l):i=1;const h=t.const("len",a`${n}.length`);if(e.setParams({min:i,max:c}),void 0===c&&0===i)return void be(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&i>c)return be(o,'"minContains" > "maxContains" is always invalid'),void e.fail();if(ne(o,r)){let t=a`${h} >= ${i}`;return void 0!==c&&(t=a`${t} && ${h} <= ${c}`),void e.pass(t)}o.items=!0;const u=t.name("valid");if(void 0===c&&1===i)f(u,(()=>t.if(u,(()=>t.break()))));else{t.let(u,!1);const e=t.name("_valid"),r=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(a`${e}++`),void 0===c?t.if(a`${e} >= ${i}`,(()=>t.assign(u,!0).break())):(t.if(a`${e} > ${c}`,(()=>t.assign(u,!1).break())),1===i?t.assign(u,!0):t.if(a`${e} >= ${i}`,(()=>t.assign(u,!0))))}(r)))))}function f(r,s){t.forRange("i",0,h,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:ge.Num,compositeRule:!0},r),s()}))}e.result(u,(()=>e.reset()))}},Wr={keyword:"dependencies",type:"object",schemaType:"object",error:{message:({params:{property:e,depsCount:t,deps:r}})=>c`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:s}})=>a`{property: ${e},
missingProperty: ${s},
depsCount: ${t},
deps: ${r}}`},code(e){const[t,r]=function({schema:e}){const t={},r={};for(const s in e){if("__proto__"===s)continue;(Array.isArray(e[s])?t:r)[s]=e[s]}return[t,r]}(e);!function(e,t=e.schema){const{gen:r,data:s,it:n}=e;if(0===Object.keys(t).length)return;const o=r.let("missing");for(const i in t){const c=t[i];if(0===c.length)continue;const d=Xe(r,s,i,n.opts.ownProperties);e.setParams({property:i,depsCount:c.length,deps:c.join(", ")}),n.allErrors?r.if(d,(()=>{for(const t of c)Be(e,t)})):(r.if(a`${d} && (${Qe(e,c,o)})`),Ze(e,o),r.else())}}(e,t),function(e,t=e.schema){const{gen:r,data:s,keyword:n,it:o}=e,a=r.name("valid");for(const i in t)ne(o,t[i])||(r.if(Xe(r,s,i,o.opts.ownProperties),(()=>{const t=e.subschema({keyword:n,schemaProp:i},a);e.mergeValidEvaluated(t,a)}),(()=>r.var(a,!0))),e.ok(a))}(e,r)}};const Jr={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>a`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:s,it:n}=e;if(ne(n,r))return;const o=t.name("valid");t.forIn("key",s,(r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if(Q(o),(()=>{e.error(!0),n.allErrors||t.break()}))})),e.ok(o)}},Br={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>a`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:s,data:n,errsCount:i,it:c}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:d,opts:l}=c;if(c.props=!0,"all"!==l.removeAdditional&&ne(c,r))return;const h=tt(s.properties),u=tt(s.patternProperties);function f(e){t.code(a`delete ${n}[${e}]`)}function p(s){if("all"===l.removeAdditional||l.removeAdditional&&!1===r)f(s);else{if(!1===r)return e.setParams({additionalProperty:s}),e.error(),void(d||t.break());if("object"==typeof r&&!ne(c,r)){const r=t.name("valid");"failing"===l.removeAdditional?(m(s,r,!1),t.if(Q(r),(()=>{e.reset(),f(s)}))):(m(s,r),d||t.if(Q(r),(()=>t.break())))}}}function m(t,r,s){const n={keyword:"additionalProperties",dataProp:t,dataPropType:ge.Str};!1===s&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}t.forIn("key",n,(r=>{h.length||u.length?t.if(function(r){let n;if(h.length>8){const e=ie(c,s.properties,"properties");n=Ye(t,e,r)}else n=h.length?ee(...h.map((e=>a`${r} === ${e}`))):o;return u.length&&(n=ee(n,...u.map((t=>a`${st(e,t)}.test(${r})`)))),Q(n)}(r),(()=>p(r))):p(r)})),e.ok(a`${i} === ${Ee.errors}`)}},Qr={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:s,data:n,it:o}=e;"all"===o.opts.removeAdditional&&void 0===s.additionalProperties&&Br.code(new Ft(o,Br,"additionalProperties"));const a=tt(r);for(const e of a)o.definedProperties.add(e);o.opts.unevaluated&&a.length&&!0!==o.props&&(o.props=pe.props(t,se(a),o.props));const i=a.filter((e=>!ne(o,r[e])));if(0===i.length)return;const c=t.name("valid");for(const r of i)d(r)?l(r):(t.if(Xe(t,n,r,o.opts.ownProperties)),l(r),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(c);function d(e){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[e].default}function l(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}},Zr={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:c}=i,d=function(e,t){return tt(t).filter((r=>!ne(e,t[r])))}(i,r);if(0===d.length)return;const l=c.strictSchema&&!c.allowMatchingProperties&&o.properties,h=t.name("valid");!0===i.props||i.props instanceof s||(i.props=me(t,i.props));const{props:u}=i;function f(e){for(const t in l)new RegExp(e).test(t)&&be(i,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function p(r){t.forIn("key",n,(s=>{t.if(a`${st(e,r)}.test(${s})`,(()=>{e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:ge.Str},h),i.opts.unevaluated&&!0!==u?t.assign(a`${u}[${s}]`,!0):i.allErrors||t.if(Q(h),(()=>t.break()))}))}))}!function(){for(const e of d)l&&f(e),i.allErrors?p(e):(t.var(h,!0),p(e),t.if(h))}()}},Yr={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:s}=e;if(ne(s,r))return void e.fail();const n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.result(n,(()=>e.error()),(()=>e.reset()))},error:{message:"must NOT be valid"}},Xr={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:function(e){const{gen:t,schema:r,keyword:s,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((e=>ne(n,e)))&&!n.opts.unevaluated)return;const o=t.let("valid",!1),i=t.name("_valid");t.block((()=>r.forEach(((r,n)=>{const c=e.subschema({keyword:s,schemaProp:n,compositeRule:!0},i);t.assign(o,a`${o} || ${i}`);e.mergeValidEvaluated(c,i)||t.if(Q(o))})))),e.result(o,(()=>e.reset()),(()=>e.error(!0)))},error:{message:"must match a schema in anyOf"}},es={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>a`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const i=r,c=t.let("valid",!1),d=t.let("passing",null),l=t.name("_valid");e.setParams({passing:d}),t.block((function(){i.forEach(((r,n)=>{let i;ne(o,r)?t.var(l,!0):i=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},l),n>0&&t.if(a`${l} && ${c}`).assign(c,!1).assign(d,a`[${d}, ${n}]`).else(),t.if(l,(()=>{t.assign(c,!0),t.assign(d,n),i&&e.mergeEvaluated(i,s)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}},ts={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=t.name("valid");r.forEach(((t,r)=>{if(ne(s,t))return;const o=e.subschema({keyword:"allOf",schemaProp:r},n);e.ok(n),e.mergeEvaluated(o)}))}},rs={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>c`must match "${e.ifClause}" schema`,params:({params:e})=>a`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:s}=e;void 0===r.then&&void 0===r.else&&be(s,'"if" without "then" and "else" is ignored');const n=ss(s,"then"),o=ss(s,"else");if(!n&&!o)return;const i=t.let("valid",!0),c=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(t)}(),e.reset(),n&&o){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(c,d("then",r),d("else",r))}else n?t.if(c,d("then")):t.if(Q(c),d("else"));function d(r,s){return()=>{const n=e.subschema({keyword:r},c);t.assign(i,c),e.mergeValidEvaluated(n,i),s?t.assign(s,a`${r}`):e.setParams({ifClause:r})}}e.pass(i,(()=>e.error(!0)))}};function ss(e,t){const r=e.schema[t];return void 0!==r&&!ne(e,r)}const ns={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&be(r,`"${e}" without "if" is ignored`)}};const os=[{keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>c`must match format "${e}"`,params:({schemaCode:e})=>a`{format: ${e}}`},code(e,t){const{gen:r,data:s,$data:i,schema:c,schemaCode:d,it:l}=e,{opts:h,errSchemaPath:u,schemaEnv:f,self:m}=l;h.validateFormats&&(i?function(){const n=r.scopeValue("formats",{ref:m.formats,code:h.code.formats}),i=r.const("fDef",a`${n}[${d}]`),c=r.let("fType"),l=r.let("format");r.if(a`typeof ${i} == "object" && !(${i} instanceof RegExp)`,(()=>r.assign(c,a`${i}.type || "string"`).assign(l,a`${i}.validate`)),(()=>r.assign(c,a`"string"`).assign(l,i))),e.fail$data(ee(!1===h.strictSchema?o:a`${d} && !${l}`,function(){const e=f.$async?a`(${i}.async ? await ${l}(${s}) : ${l}(${s}))`:a`${l}(${s})`,r=a`(typeof ${l} == "function" ? ${e} : ${l}.test(${s}))`;return a`${l} && ${l} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=m.formats[c];if(!o)return void function(){if(!1===h.strictSchema)return void m.logger.warn(e());throw new Error(e());function e(){return`unknown format "${c}" ignored in schema at path "${u}"`}}();if(!0===o)return;const[i,d,l]=function(e){const t=e instanceof RegExp?(o=e,new n(o.toString())):h.code.formats?a`${h.code.formats}${p(c)}`:void 0,s=r.scopeValue("formats",{key:c,ref:e,code:t});var o;if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,a`${s}.validate`];return["string",e,s]}(o);i===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!f.$async)throw new Error("async format in sync schema");return a`await ${l}(${s})`}return"function"==typeof d?a`${l}(${s})`:a`${l}.test(${s})`}())}())}}],as=[jr,[Tr,Ar,Rr,Dr,qr,zr,Vr,{keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>c`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>a`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:s,schema:n,parentSchema:o,schemaCode:i,it:c}=e;if(!s&&!n)return;const d=t.let("valid"),l=o.items?Fe(o.items):[];function h(s,n){const o=t.name("item"),i=Ge(l,o,c.opts.strictNumbers,Ve.Wrong),h=t.const("indices",a`{}`);t.for(a`;${s}--;`,(()=>{t.let(o,a`${r}[${s}]`),t.if(i,a`continue`),l.length>1&&t.if(a`typeof ${o} == "string"`,a`${o} += "_"`),t.if(a`typeof ${h}[${o}] == "number"`,(()=>{t.assign(n,a`${h}[${o}]`),e.error(),t.assign(d,!1).break()})).code(a`${h}[${o}] = ${s}`)}))}function u(s,n){const o=ve(t,dt),i=t.name("outer");t.label(i).for(a`;${s}--;`,(()=>t.for(a`${n} = ${s}; ${n}--;`,(()=>t.if(a`${o}(${r}[${s}], ${r}[${n}])`,(()=>{e.error(),t.assign(d,!1).break(i)}))))))}e.block$data(d,(function(){const s=t.let("i",a`${r}.length`),n=t.let("j");e.setParams({i:s,j:n}),t.assign(d,!0),t.if(a`${s} > 1`,(()=>(l.length>0&&!l.some((e=>"object"===e||"array"===e))?h:u)(s,n)))}),a`${i} === false`),e.ok(d)}},{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},{keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>a`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:s,schemaCode:n,schema:o}=e;s||o&&"object"==typeof o?e.fail$data(a`!${ve(t,dt)}(${r}, ${n})`):e.fail(a`${o} !== ${r}`)}},{keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>a`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:s,schema:n,schemaCode:o,it:i}=e;if(!s&&0===n.length)throw new Error("enum must have non-empty array");const c=n.length>=i.opts.loopEnum,d=ve(t,dt);let l;if(c||s)l=t.let("valid"),e.block$data(l,(function(){t.assign(l,!1),t.forOf("v",o,(e=>t.if(a`${d}(${r}, ${e})`,(()=>t.assign(l,!0).break()))))}));else{if(!Array.isArray(n))throw new Error("ajv implementation error");const e=t.const("vSchema",o);l=ee(...n.map(((t,s)=>function(e,t){const s=n[t];return"object"==typeof s&&null!==s?a`${d}(${r}, ${e}[${t}])`:a`${r} === ${s}`}(e,s))))}e.pass(l)}}],function(e=!1){const t=[Yr,Xr,es,ts,rs,ns,Jr,Br,Wr,Qr,Zr];return e?t.push(Kr,Gr):t.push(Fr,Ur),t.push(Hr),t}(),os,["title","description","default","deprecated","readOnly","writeOnly","examples"],["contentMediaType","contentEncoding","contentSchema"]];var is;!function(e){e.Tag="tag",e.Mapping="mapping"}(is||(is={}));const cs={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===is.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>a`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:c}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const d=n.propertyName;if("string"!=typeof d)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!c)throw new Error("discriminator: requires oneOf keyword");const l=t.let("valid",!1),h=t.const("tag",a`${r}${p(d)}`);function u(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,s),n}t.if(a`typeof ${h} == "string"`,(()=>function(){const r=function(){var e;const t={},r=n(o);let s=!0;for(let t=0;t<c.length;t++){const o=c[t],i=null===(e=o.properties)||void 0===e?void 0:e[d];if("object"!=typeof i)throw new Error(`discriminator: oneOf schemas must have "properties/${d}"`);s=s&&(r||n(o)),a(i,t)}if(!s)throw new Error(`discriminator: "${d}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(d)}function a(e,t){if(e.const)i(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${d}" must have "const" or "enum"`);for(const r of e.enum)i(r,t)}}function i(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${d}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(a`${h} === ${e}`),t.assign(l,u(r[e]));t.else(),e.error(!1,{discrError:is.Mapping,tag:h,tagName:d}),t.endIf()}()),(()=>e.error(!1,{discrError:is.Tag,tag:h,tagName:d}))),e.ok(l)}};var ds="http://json-schema.org/draft-07/schema#",ls="http://json-schema.org/draft-07/schema#",hs="Core schema meta-schema",us={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},fs=["object","boolean"],ps={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},ms={$schema:ds,$id:ls,title:hs,definitions:us,type:fs,properties:ps,default:!0},ys=Object.freeze({__proto__:null,$schema:ds,$id:ls,title:hs,definitions:us,type:fs,properties:ps,default:ms});const $s=["/properties"],vs="http://json-schema.org/draft-07/schema";class gs extends fr{_addVocabularies(){super._addVocabularies(),as.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(cs)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(ys,$s):ys;this.addMetaSchema(e,vs,!1),this.refs["http://json-schema.org/schema"]=vs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(vs)?vs:void 0)}}module.exports=e=gs,Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=G,e.KeywordCxt=Ft,e.Name=s,e._=a,e.default=gs,e.nil=o,e.str=c,e.stringify=u,Object.defineProperty(e,"__esModule",{value:!0})}));
export default Ajv;
//# sourceMappingURL=ajv7.min.js.map