@opentiny/next-sdk 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebMcpClient.ts +15 -3
- package/agent/AgentModelProvider.ts +39 -10
- package/agent/type.ts +1 -1
- package/dist/WebMcpClient.d.ts +1 -1
- package/dist/WebMcpClient.js +12 -2
- package/dist/agent/AgentModelProvider.d.ts +6 -0
- package/dist/agent/AgentModelProvider.js +28 -6
- package/dist/agent/type.d.ts +1 -1
- package/dist/index.es.dev.js +731 -658
- package/dist/index.es.js +5832 -5788
- package/dist/index.umd.dev.js +731 -658
- package/dist/index.umd.js +29 -29
- package/dist/mcpsdk@1.17.0.es.js +4329 -4334
- package/dist/mcpsdk@1.17.0.js +8 -8
- package/dist/webagent.dev.js +25 -4
- package/dist/webagent.es.dev.js +25 -4
- package/dist/webagent.es.js +17 -10
- package/dist/webagent.js +1 -1
- package/dist/webmcp-full.dev.js +693 -641
- package/dist/webmcp-full.es.dev.js +693 -641
- package/dist/webmcp-full.es.js +3270 -3233
- package/dist/webmcp-full.js +8 -8
- package/dist/webmcp.dev.js +630 -631
- package/dist/webmcp.es.dev.js +629 -629
- package/dist/webmcp.es.js +560 -568
- package/dist/webmcp.js +1 -1
- package/package.json +2 -2
package/dist/mcpsdk@1.17.0.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(O,Br){typeof exports=="object"&&typeof module<"u"?Br(exports):typeof define=="function"&&define.amd?define(["exports"],Br):(O=typeof globalThis<"u"?globalThis:O||self,Br(O.MCPSDK={}))})(this,function(O){"use strict";var Br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Do(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ws={exports:{}},xo={},Lt={},lr={},Jr={},be={},Qr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends e{constructor($){if(super(),!t.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends e{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((w,E)=>`${w}${E}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((w,E)=>(E instanceof a&&(w[E.str]=(w[E.str]||0)+1),w),{})}}t._Code=s,t.nil=new s("");function r(v,...$){const w=[v[0]];let E=0;for(;E<$.length;)i(w,$[E]),w.push(v[++E]);return new s(w)}t._=r;const n=new s("+");function o(v,...$){const w=[d(v[0])];let E=0;for(;E<$.length;)w.push(n),i(w,$[E]),w.push(n,d(v[++E]));return l(w),new s(w)}t.str=o;function i(v,$){$ instanceof s?v.push(...$._items):$ instanceof a?v.push($):v.push(f($))}t.addCodeArg=i;function l(v){let $=1;for(;$<v.length-1;){if(v[$]===n){const w=c(v[$-1],v[$+1]);if(w!==void 0){v.splice($-1,3,w);continue}v[$++]="+"}$++}}function c(v,$){if($==='""')return v;if(v==='""')return $;if(typeof v=="string")return $ instanceof a||v[v.length-1]!=='"'?void 0:typeof $!="string"?`${v.slice(0,-1)}${$}"`:$[0]==='"'?v.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(v instanceof a))return`"${v}${$.slice(1)}`}function u(v,$){return $.emptyStr()?v:v.emptyStr()?$:o`${v}${$}`}t.strConcat=u;function f(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:d(Array.isArray(v)?v.join(","):v)}function g(v){return new s(d(v))}t.stringify=g;function d(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=d;function m(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new s(`.${v}`):r`[${v}]`}t.getProperty=m;function p(v){if(typeof v=="string"&&t.IDENTIFIER.test(v))return new s(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}t.getEsmExportName=p;function h(v){return new s(v.toString())}t.regexpCode=h})(Qr);var Xs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Qr;class a extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var s;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class r{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,f;if(!((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0)&&f.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=r;class n extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:f}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${f}]`}}t.ValueScopeName=n;const o=(0,e._)`\n`;class i extends r{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?o:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,u){var f;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(c),{prefix:d}=g,m=(f=u.key)!==null&&f!==void 0?f:u.ref;let p=this._values[d];if(p){const $=p.get(m);if($)return $}else p=this._values[d]=new Map;p.set(m,g);const h=this._scope[d]||(this._scope[d]=[]),v=h.length;return h[v]=u.ref,g.setValue(u,{property:d,itemIndex:v}),g}getValue(c,u){const f=this._values[c];if(f)return f.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${c}${f.scopePath}`})}scopeCode(c=this._values,u,f){return this._reduceValues(c,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},u,f)}_reduceValues(c,u,f={},g){let d=e.nil;for(const m in c){const p=c[m];if(!p)continue;const h=f[m]=f[m]||new Map;p.forEach(v=>{if(h.has(v))return;h.set(v,s.Started);let $=u(v);if($){const w=this.opts.es5?t.varKinds.var:t.varKinds.const;d=(0,e._)`${d}${w} ${v} = ${$};${this.opts._n}`}else if($=g==null?void 0:g(v))d=(0,e._)`${d}${$}${this.opts._n}`;else throw new a(v);h.set(v,s.Completed)})}return d}}t.ValueScope=i})(Xs),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Qr,a=Xs;var s=Qr;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var r=Xs;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class n{optimizeNodes(){return this}optimizeNames(y,b){return this}}class o extends n{constructor(y,b,x){super(),this.varKind=y,this.name=b,this.rhs=x}render({es5:y,_n:b}){const x=y?a.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${G};`+b}optimizeNames(y,b){if(y[this.name.str])return this.rhs&&(this.rhs=F(this.rhs,y,b)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class i extends n{constructor(y,b,x){super(),this.lhs=y,this.rhs=b,this.sideEffects=x}render({_n:y}){return`${this.lhs} = ${this.rhs};`+y}optimizeNames(y,b){if(!(this.lhs instanceof e.Name&&!y[this.lhs.str]&&!this.sideEffects))return this.rhs=F(this.rhs,y,b),this}get names(){const y=this.lhs instanceof e.Name?{}:{...this.lhs.names};return U(y,this.rhs)}}class l extends i{constructor(y,b,x,G){super(y,x,G),this.op=b}render({_n:y}){return`${this.lhs} ${this.op}= ${this.rhs};`+y}}class c extends n{constructor(y){super(),this.label=y,this.names={}}render({_n:y}){return`${this.label}:`+y}}class u extends n{constructor(y){super(),this.label=y,this.names={}}render({_n:y}){return`break${this.label?` ${this.label}`:""};`+y}}class f extends n{constructor(y){super(),this.error=y}render({_n:y}){return`throw ${this.error};`+y}get names(){return this.error.names}}class g extends n{constructor(y){super(),this.code=y}render({_n:y}){return`${this.code};`+y}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(y,b){return this.code=F(this.code,y,b),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends n{constructor(y=[]){super(),this.nodes=y}render(y){return this.nodes.reduce((b,x)=>b+x.render(y),"")}optimizeNodes(){const{nodes:y}=this;let b=y.length;for(;b--;){const x=y[b].optimizeNodes();Array.isArray(x)?y.splice(b,1,...x):x?y[b]=x:y.splice(b,1)}return y.length>0?this:void 0}optimizeNames(y,b){const{nodes:x}=this;let G=x.length;for(;G--;){const te=x[G];te.optimizeNames(y,b)||(ne(y,te.names),x.splice(G,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((y,b)=>Q(y,b.names),{})}}class m extends d{render(y){return"{"+y._n+super.render(y)+"}"+y._n}}class p extends d{}class h extends m{}h.kind="else";class v extends m{constructor(y,b){super(b),this.condition=y}render(y){let b=`if(${this.condition})`+super.render(y);return this.else&&(b+="else "+this.else.render(y)),b}optimizeNodes(){super.optimizeNodes();const y=this.condition;if(y===!0)return this.nodes;let b=this.else;if(b){const x=b.optimizeNodes();b=this.else=Array.isArray(x)?new h(x):x}if(b)return y===!1?b instanceof v?b:b.nodes:this.nodes.length?this:new v($e(y),b instanceof v?[b]:b.nodes);if(!(y===!1||!this.nodes.length))return this}optimizeNames(y,b){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(y,b),!!(super.optimizeNames(y,b)||this.else))return this.condition=F(this.condition,y,b),this}get names(){const y=super.names;return U(y,this.condition),this.else&&Q(y,this.else.names),y}}v.kind="if";class $ extends m{}$.kind="for";class w extends ${constructor(y){super(),this.iteration=y}render(y){return`for(${this.iteration})`+super.render(y)}optimizeNames(y,b){if(super.optimizeNames(y,b))return this.iteration=F(this.iteration,y,b),this}get names(){return Q(super.names,this.iteration.names)}}class E extends ${constructor(y,b,x,G){super(),this.varKind=y,this.name=b,this.from=x,this.to=G}render(y){const b=y.es5?a.varKinds.var:this.varKind,{name:x,from:G,to:te}=this;return`for(${b} ${x}=${G}; ${x}<${te}; ${x}++)`+super.render(y)}get names(){const y=U(super.names,this.from);return U(y,this.to)}}class k extends ${constructor(y,b,x,G){super(),this.loop=y,this.varKind=b,this.name=x,this.iterable=G}render(y){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(y)}optimizeNames(y,b){if(super.optimizeNames(y,b))return this.iterable=F(this.iterable,y,b),this}get names(){return Q(super.names,this.iterable.names)}}class D extends m{constructor(y,b,x){super(),this.name=y,this.args=b,this.async=x}render(y){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(y)}}D.kind="func";class H extends d{render(y){return"return "+super.render(y)}}H.kind="return";class z extends m{render(y){let b="try"+super.render(y);return this.catch&&(b+=this.catch.render(y)),this.finally&&(b+=this.finally.render(y)),b}optimizeNodes(){var y,b;return super.optimizeNodes(),(y=this.catch)===null||y===void 0||y.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(y,b){var x,G;return super.optimizeNames(y,b),(x=this.catch)===null||x===void 0||x.optimizeNames(y,b),(G=this.finally)===null||G===void 0||G.optimizeNames(y,b),this}get names(){const y=super.names;return this.catch&&Q(y,this.catch.names),this.finally&&Q(y,this.finally.names),y}}class Z extends m{constructor(y){super(),this.error=y}render(y){return`catch(${this.error})`+super.render(y)}}Z.kind="catch";class X extends m{render(y){return"finally"+super.render(y)}}X.kind="finally";class Y{constructor(y,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
|
|
2
|
-
`:""},this._extScope=y,this._scope=new a.Scope({parent:y}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,b){const x=this._extScope.value(y,b);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(y,b){return this._extScope.getValue(y,b)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,b,x,G){const te=this._scope.toName(b);return x!==void 0&&G&&(this._constants[te.str]=x),this._leafNode(new o(y,te,x)),te}const(y,b,x){return this._def(a.varKinds.const,y,b,x)}let(y,b,x){return this._def(a.varKinds.let,y,b,x)}var(y,b,x){return this._def(a.varKinds.var,y,b,x)}assign(y,b,x){return this._leafNode(new i(y,b,x))}add(y,b){return this._leafNode(new l(y,t.operators.ADD,b))}code(y){return typeof y=="function"?y():y!==e.nil&&this._leafNode(new g(y)),this}object(...y){const b=["{"];for(const[x,G]of y)b.length>1&&b.push(","),b.push(x),(x!==G||this.opts.es5)&&(b.push(":"),(0,e.addCodeArg)(b,G));return b.push("}"),new e._Code(b)}if(y,b,x){if(this._blockNode(new v(y)),b&&x)this.code(b).else().code(x).endIf();else if(b)this.code(b).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new v(y))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(y,b){return this._blockNode(y),b&&this.code(b).endFor(),this}for(y,b){return this._for(new w(y),b)}forRange(y,b,x,G,te=this.opts.es5?a.varKinds.var:a.varKinds.let){const me=this._scope.toName(y);return this._for(new E(te,me,b,x),()=>G(me))}forOf(y,b,x,G=a.varKinds.const){const te=this._scope.toName(y);if(this.opts.es5){const me=b instanceof e.Name?b:this.var("_arr",b);return this.forRange("_i",0,(0,e._)`${me}.length`,ce=>{this.var(te,(0,e._)`${me}[${ce}]`),x(te)})}return this._for(new k("of",G,te,b),()=>x(te))}forIn(y,b,x,G=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,(0,e._)`Object.keys(${b})`,x);const te=this._scope.toName(y);return this._for(new k("in",G,te,b),()=>x(te))}endFor(){return this._endBlockNode($)}label(y){return this._leafNode(new c(y))}break(y){return this._leafNode(new u(y))}return(y){const b=new H;if(this._blockNode(b),this.code(y),b.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(H)}try(y,b,x){if(!b&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');const G=new z;if(this._blockNode(G),this.code(y),b){const te=this.name("e");this._currNode=G.catch=new Z(te),b(te)}return x&&(this._currNode=G.finally=new X,this.code(x)),this._endBlockNode(Z,X)}throw(y){return this._leafNode(new f(y))}block(y,b){return this._blockStarts.push(this._nodes.length),y&&this.code(y).endBlock(b),this}endBlock(y){const b=this._blockStarts.pop();if(b===void 0)throw new Error("CodeGen: not in self-balancing block");const x=this._nodes.length-b;if(x<0||y!==void 0&&x!==y)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${y} expected`);return this._nodes.length=b,this}func(y,b=e.nil,x,G){return this._blockNode(new D(y,b,x)),G&&this.code(G).endFunc(),this}endFunc(){return this._endBlockNode(D)}optimize(y=1){for(;y-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,b){const x=this._currNode;if(x instanceof y||b&&x instanceof b)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${b?`${y.kind}/${b.kind}`:y.kind}"`)}_elseNode(y){const b=this._currNode;if(!(b instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=b.else=y,this}get _root(){return this._nodes[0]}get _currNode(){const y=this._nodes;return y[y.length-1]}set _currNode(y){const b=this._nodes;b[b.length-1]=y}}t.CodeGen=Y;function Q(I,y){for(const b in y)I[b]=(I[b]||0)+(y[b]||0);return I}function U(I,y){return y instanceof e._CodeOrName?Q(I,y.names):I}function F(I,y,b){if(I instanceof e.Name)return x(I);if(!G(I))return I;return new e._Code(I._items.reduce((te,me)=>(me instanceof e.Name&&(me=x(me)),me instanceof e._Code?te.push(...me._items):te.push(me),te),[]));function x(te){const me=b[te.str];return me===void 0||y[te.str]!==1?te:(delete y[te.str],me)}function G(te){return te instanceof e._Code&&te._items.some(me=>me instanceof e.Name&&y[me.str]===1&&b[me.str]!==void 0)}}function ne(I,y){for(const b in y)I[b]=(I[b]||0)-(y[b]||0)}function $e(I){return typeof I=="boolean"||typeof I=="number"||I===null?!I:(0,e._)`!${q(I)}`}t.not=$e;const he=T(t.operators.AND);function we(...I){return I.reduce(he)}t.and=we;const pe=T(t.operators.OR);function M(...I){return I.reduce(pe)}t.or=M;function T(I){return(y,b)=>y===e.nil?b:b===e.nil?y:(0,e._)`${q(y)} ${I} ${q(b)}`}function q(I){return I instanceof e.Name?I:(0,e._)`(${I})`}}(be);var re={};Object.defineProperty(re,"__esModule",{value:!0}),re.checkStrictMode=re.getErrorPath=re.Type=re.useFunc=re.setEvaluated=re.evaluatedPropsToName=re.mergeEvaluated=re.eachItem=re.unescapeJsonPointer=re.escapeJsonPointer=re.escapeFragment=re.unescapeFragment=re.schemaRefOrVal=re.schemaHasRulesButRef=re.schemaHasRules=re.checkUnknownRules=re.alwaysValidSchema=re.toHash=void 0;const Ae=be,gd=Qr;function yd(t){const e={};for(const a of t)e[a]=!0;return e}re.toHash=yd;function _d(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Mo(t,e),!Lo(e,t.self.RULES.all))}re.alwaysValidSchema=_d;function Mo(t,e=t.schema){const{opts:a,self:s}=t;if(!a.strictSchema||typeof e=="boolean")return;const r=s.RULES.keywords;for(const n in e)r[n]||zo(t,`unknown keyword: "${n}"`)}re.checkUnknownRules=Mo;function Lo(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}re.schemaHasRules=Lo;function $d(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(a!=="$ref"&&e.all[a])return!0;return!1}re.schemaHasRulesButRef=$d;function wd({topSchemaRef:t,schemaPath:e},a,s,r){if(!r){if(typeof a=="number"||typeof a=="boolean")return a;if(typeof a=="string")return(0,Ae._)`${a}`}return(0,Ae._)`${t}${e}${(0,Ae.getProperty)(s)}`}re.schemaRefOrVal=wd;function bd(t){return Fo(decodeURIComponent(t))}re.unescapeFragment=bd;function Pd(t){return encodeURIComponent(Ys(t))}re.escapeFragment=Pd;function Ys(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}re.escapeJsonPointer=Ys;function Fo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}re.unescapeJsonPointer=Fo;function Ed(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}re.eachItem=Ed;function qo({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,o,i)=>{const l=o===void 0?n:o instanceof Ae.Name?(n instanceof Ae.Name?t(r,n,o):e(r,n,o),o):n instanceof Ae.Name?(e(r,o,n),n):a(n,o);return i===Ae.Name&&!(l instanceof Ae.Name)?s(r,l):l}}re.mergeEvaluated={props:qo({mergeNames:(t,e,a)=>t.if((0,Ae._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,Ae._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,Ae._)`${a} || {}`).code((0,Ae._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,Ae._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,Ae._)`${a} || {}`),en(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Uo}),items:qo({mergeNames:(t,e,a)=>t.if((0,Ae._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,Ae._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,Ae._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,Ae._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Uo(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,Ae._)`{}`);return e!==void 0&&en(t,a,e),a}re.evaluatedPropsToName=Uo;function en(t,e,a){Object.keys(a).forEach(s=>t.assign((0,Ae._)`${e}${(0,Ae.getProperty)(s)}`,!0))}re.setEvaluated=en;const Vo={};function Sd(t,e){return t.scopeValue("func",{ref:e,code:Vo[e.code]||(Vo[e.code]=new gd._Code(e.code))})}re.useFunc=Sd;var tn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(tn||(re.Type=tn={}));function Rd(t,e,a){if(t instanceof Ae.Name){const s=e===tn.Num;return a?s?(0,Ae._)`"[" + ${t} + "]"`:(0,Ae._)`"['" + ${t} + "']"`:s?(0,Ae._)`"/" + ${t}`:(0,Ae._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,Ae.getProperty)(t).toString():"/"+Ys(t)}re.getErrorPath=Rd;function zo(t,e,a=t.opts.strictSchema){if(a){if(e=`strict mode: ${e}`,a===!0)throw new Error(e);t.self.logger.warn(e)}}re.checkStrictMode=zo;var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});const nt=be,kd={data:new nt.Name("data"),valCxt:new nt.Name("valCxt"),instancePath:new nt.Name("instancePath"),parentData:new nt.Name("parentData"),parentDataProperty:new nt.Name("parentDataProperty"),rootData:new nt.Name("rootData"),dynamicAnchors:new nt.Name("dynamicAnchors"),vErrors:new nt.Name("vErrors"),errors:new nt.Name("errors"),this:new nt.Name("this"),self:new nt.Name("self"),scope:new nt.Name("scope"),json:new nt.Name("json"),jsonPos:new nt.Name("jsonPos"),jsonLen:new nt.Name("jsonLen"),jsonPart:new nt.Name("jsonPart")};Ct.default=kd,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=be,a=re,s=Ct;t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:v})=>v?(0,e.str)`"${h}" keyword must be ${v} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function r(h,v=t.keywordError,$,w){const{it:E}=h,{gen:k,compositeRule:D,allErrors:H}=E,z=f(h,v,$);w??(D||H)?l(k,z):c(E,(0,e._)`[${z}]`)}t.reportError=r;function n(h,v=t.keywordError,$){const{it:w}=h,{gen:E,compositeRule:k,allErrors:D}=w,H=f(h,v,$);l(E,H),k||D||c(w,s.default.vErrors)}t.reportExtraError=n;function o(h,v){h.assign(s.default.errors,v),h.if((0,e._)`${s.default.vErrors} !== null`,()=>h.if(v,()=>h.assign((0,e._)`${s.default.vErrors}.length`,v),()=>h.assign(s.default.vErrors,null)))}t.resetErrorsCount=o;function i({gen:h,keyword:v,schemaValue:$,data:w,errsCount:E,it:k}){if(E===void 0)throw new Error("ajv implementation error");const D=h.name("err");h.forRange("i",E,s.default.errors,H=>{h.const(D,(0,e._)`${s.default.vErrors}[${H}]`),h.if((0,e._)`${D}.instancePath === undefined`,()=>h.assign((0,e._)`${D}.instancePath`,(0,e.strConcat)(s.default.instancePath,k.errorPath))),h.assign((0,e._)`${D}.schemaPath`,(0,e.str)`${k.errSchemaPath}/${v}`),k.opts.verbose&&(h.assign((0,e._)`${D}.schema`,$),h.assign((0,e._)`${D}.data`,w))})}t.extendErrors=i;function l(h,v){const $=h.const("err",v);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${$}]`),(0,e._)`${s.default.vErrors}.push(${$})`),h.code((0,e._)`${s.default.errors}++`)}function c(h,v){const{gen:$,validateName:w,schemaEnv:E}=h;E.$async?$.throw((0,e._)`new ${h.ValidationError}(${v})`):($.assign((0,e._)`${w}.errors`,v),$.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(h,v,$){const{createErrors:w}=h.it;return w===!1?(0,e._)`{}`:g(h,v,$)}function g(h,v,$={}){const{gen:w,it:E}=h,k=[d(E,$),m(h,$)];return p(h,v,k),w.object(...k)}function d({errorPath:h},{instancePath:v}){const $=v?(0,e.str)`${h}${(0,a.getErrorPath)(v,a.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,$)]}function m({keyword:h,it:{errSchemaPath:v}},{schemaPath:$,parentSchema:w}){let E=w?v:(0,e.str)`${v}/${h}`;return $&&(E=(0,e.str)`${E}${(0,a.getErrorPath)($,a.Type.Str)}`),[u.schemaPath,E]}function p(h,{params:v,message:$},w){const{keyword:E,data:k,schemaValue:D,it:H}=h,{opts:z,propertyName:Z,topSchemaRef:X,schemaPath:Y}=H;w.push([u.keyword,E],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),z.messages&&w.push([u.message,typeof $=="function"?$(h):$]),z.verbose&&w.push([u.schema,D],[u.parentSchema,(0,e._)`${X}${Y}`],[s.default.data,k]),Z&&w.push([u.propertyName,Z])}}(Jr);var Ho;function Td(){if(Ho)return lr;Ho=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.boolOrEmptySchema=lr.topBoolOrEmptySchema=void 0;const t=Jr,e=be,a=Ct,s={message:"boolean schema is false"};function r(i){const{gen:l,schema:c,validateName:u}=i;c===!1?o(i,!1):typeof c=="object"&&c.$async===!0?l.return(a.default.data):(l.assign((0,e._)`${u}.errors`,null),l.return(!0))}lr.topBoolOrEmptySchema=r;function n(i,l){const{gen:c,schema:u}=i;u===!1?(c.var(l,!1),o(i)):c.var(l,!0)}lr.boolOrEmptySchema=n;function o(i,l){const{gen:c,data:u}=i,f={gen:c,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:i};(0,t.reportError)(f,s,void 0,l)}return lr}var Ge={},cr={};Object.defineProperty(cr,"__esModule",{value:!0}),cr.getRules=cr.isJSONType=void 0;const Od=["string","number","integer","boolean","null","object","array"],Cd=new Set(Od);function Id(t){return typeof t=="string"&&Cd.has(t)}cr.isJSONType=Id;function Nd(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}cr.getRules=Nd;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.shouldUseRule=Ft.shouldUseGroup=Ft.schemaHasRulesForType=void 0;function Ad({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&Zo(t,s)}Ft.schemaHasRulesForType=Ad;function Zo(t,e){return e.rules.some(a=>Ko(t,a))}Ft.shouldUseGroup=Zo;function Ko(t,e){var a;return t[e.keyword]!==void 0||((a=e.definition.implements)===null||a===void 0?void 0:a.some(s=>t[s]!==void 0))}Ft.shouldUseRule=Ko,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.reportTypeError=Ge.checkDataTypes=Ge.checkDataType=Ge.coerceAndCheckDataType=Ge.getJSONTypes=Ge.getSchemaTypes=Ge.DataType=void 0;const jd=cr,Dd=Ft,xd=Jr,ye=be,Bo=re;var Rr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Rr||(Ge.DataType=Rr={}));function Md(t){const e=Jo(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ge.getSchemaTypes=Md;function Jo(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(jd.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ge.getJSONTypes=Jo;function Ld(t,e){const{gen:a,data:s,opts:r}=t,n=Fd(e,r.coerceTypes),o=e.length>0&&!(n.length===0&&e.length===1&&(0,Dd.schemaHasRulesForType)(t,e[0]));if(o){const i=an(e,s,r.strictNumbers,Rr.Wrong);a.if(i,()=>{n.length?qd(t,e,n):sn(t)})}return o}Ge.coerceAndCheckDataType=Ld;const Qo=new Set(["string","number","integer","boolean","null"]);function Fd(t,e){return e?t.filter(a=>Qo.has(a)||e==="array"&&a==="array"):[]}function qd(t,e,a){const{gen:s,data:r,opts:n}=t,o=s.let("dataType",(0,ye._)`typeof ${r}`),i=s.let("coerced",(0,ye._)`undefined`);n.coerceTypes==="array"&&s.if((0,ye._)`${o} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>s.assign(r,(0,ye._)`${r}[0]`).assign(o,(0,ye._)`typeof ${r}`).if(an(e,r,n.strictNumbers),()=>s.assign(i,r))),s.if((0,ye._)`${i} !== undefined`);for(const c of a)(Qo.has(c)||c==="array"&&n.coerceTypes==="array")&&l(c);s.else(),sn(t),s.endIf(),s.if((0,ye._)`${i} !== undefined`,()=>{s.assign(r,i),Ud(t,i)});function l(c){switch(c){case"string":s.elseIf((0,ye._)`${o} == "number" || ${o} == "boolean"`).assign(i,(0,ye._)`"" + ${r}`).elseIf((0,ye._)`${r} === null`).assign(i,(0,ye._)`""`);return;case"number":s.elseIf((0,ye._)`${o} == "boolean" || ${r} === null
|
|
1
|
+
(function(T,Jr){typeof exports=="object"&&typeof module<"u"?Jr(exports):typeof define=="function"&&define.amd?define(["exports"],Jr):(T=typeof globalThis<"u"?globalThis:T||self,Jr(T.MCPSDK={}))})(this,function(T){"use strict";var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xs={exports:{}},Fo={},Lt={},cr={},Qr={},be={},Gr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends e{constructor($){if(super(),!t.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends e{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((P,R)=>`${P}${R}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((P,R)=>(R instanceof a&&(P[R.str]=(P[R.str]||0)+1),P),{})}}t._Code=s,t.nil=new s("");function r(v,...$){const P=[v[0]];let R=0;for(;R<$.length;)i(P,$[R]),P.push(v[++R]);return new s(P)}t._=r;const n=new s("+");function o(v,...$){const P=[d(v[0])];let R=0;for(;R<$.length;)P.push(n),i(P,$[R]),P.push(n,d(v[++R]));return l(P),new s(P)}t.str=o;function i(v,$){$ instanceof s?v.push(...$._items):$ instanceof a?v.push($):v.push(f($))}t.addCodeArg=i;function l(v){let $=1;for(;$<v.length-1;){if(v[$]===n){const P=c(v[$-1],v[$+1]);if(P!==void 0){v.splice($-1,3,P);continue}v[$++]="+"}$++}}function c(v,$){if($==='""')return v;if(v==='""')return $;if(typeof v=="string")return $ instanceof a||v[v.length-1]!=='"'?void 0:typeof $!="string"?`${v.slice(0,-1)}${$}"`:$[0]==='"'?v.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(v instanceof a))return`"${v}${$.slice(1)}`}function u(v,$){return $.emptyStr()?v:v.emptyStr()?$:o`${v}${$}`}t.strConcat=u;function f(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:d(Array.isArray(v)?v.join(","):v)}function g(v){return new s(d(v))}t.stringify=g;function d(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=d;function m(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new s(`.${v}`):r`[${v}]`}t.getProperty=m;function p(v){if(typeof v=="string"&&t.IDENTIFIER.test(v))return new s(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}t.getEsmExportName=p;function h(v){return new s(v.toString())}t.regexpCode=h})(Gr);var Ys={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Gr;class a extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var s;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class r{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,f;if(!((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0)&&f.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=r;class n extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:f}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${f}]`}}t.ValueScopeName=n;const o=(0,e._)`\n`;class i extends r{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?o:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,u){var f;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(c),{prefix:d}=g,m=(f=u.key)!==null&&f!==void 0?f:u.ref;let p=this._values[d];if(p){const $=p.get(m);if($)return $}else p=this._values[d]=new Map;p.set(m,g);const h=this._scope[d]||(this._scope[d]=[]),v=h.length;return h[v]=u.ref,g.setValue(u,{property:d,itemIndex:v}),g}getValue(c,u){const f=this._values[c];if(f)return f.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,e._)`${c}${f.scopePath}`})}scopeCode(c=this._values,u,f){return this._reduceValues(c,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},u,f)}_reduceValues(c,u,f={},g){let d=e.nil;for(const m in c){const p=c[m];if(!p)continue;const h=f[m]=f[m]||new Map;p.forEach(v=>{if(h.has(v))return;h.set(v,s.Started);let $=u(v);if($){const P=this.opts.es5?t.varKinds.var:t.varKinds.const;d=(0,e._)`${d}${P} ${v} = ${$};${this.opts._n}`}else if($=g==null?void 0:g(v))d=(0,e._)`${d}${$}${this.opts._n}`;else throw new a(v);h.set(v,s.Completed)})}return d}}t.ValueScope=i})(Ys),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Gr,a=Ys;var s=Gr;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var r=Ys;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class n{optimizeNodes(){return this}optimizeNames(y,w){return this}}class o extends n{constructor(y,w,D){super(),this.varKind=y,this.name=w,this.rhs=D}render({es5:y,_n:w}){const D=y?a.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${D} ${this.name}${G};`+w}optimizeNames(y,w){if(y[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,y,w)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class i extends n{constructor(y,w,D){super(),this.lhs=y,this.rhs=w,this.sideEffects=D}render({_n:y}){return`${this.lhs} = ${this.rhs};`+y}optimizeNames(y,w){if(!(this.lhs instanceof e.Name&&!y[this.lhs.str]&&!this.sideEffects))return this.rhs=L(this.rhs,y,w),this}get names(){const y=this.lhs instanceof e.Name?{}:{...this.lhs.names};return U(y,this.rhs)}}class l extends i{constructor(y,w,D,G){super(y,D,G),this.op=w}render({_n:y}){return`${this.lhs} ${this.op}= ${this.rhs};`+y}}class c extends n{constructor(y){super(),this.label=y,this.names={}}render({_n:y}){return`${this.label}:`+y}}class u extends n{constructor(y){super(),this.label=y,this.names={}}render({_n:y}){return`break${this.label?` ${this.label}`:""};`+y}}class f extends n{constructor(y){super(),this.error=y}render({_n:y}){return`throw ${this.error};`+y}get names(){return this.error.names}}class g extends n{constructor(y){super(),this.code=y}render({_n:y}){return`${this.code};`+y}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(y,w){return this.code=L(this.code,y,w),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends n{constructor(y=[]){super(),this.nodes=y}render(y){return this.nodes.reduce((w,D)=>w+D.render(y),"")}optimizeNodes(){const{nodes:y}=this;let w=y.length;for(;w--;){const D=y[w].optimizeNodes();Array.isArray(D)?y.splice(w,1,...D):D?y[w]=D:y.splice(w,1)}return y.length>0?this:void 0}optimizeNames(y,w){const{nodes:D}=this;let G=D.length;for(;G--;){const Y=D[G];Y.optimizeNames(y,w)||(ne(y,Y.names),D.splice(G,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((y,w)=>Q(y,w.names),{})}}class m extends d{render(y){return"{"+y._n+super.render(y)+"}"+y._n}}class p extends d{}class h extends m{}h.kind="else";class v extends m{constructor(y,w){super(w),this.condition=y}render(y){let w=`if(${this.condition})`+super.render(y);return this.else&&(w+="else "+this.else.render(y)),w}optimizeNodes(){super.optimizeNodes();const y=this.condition;if(y===!0)return this.nodes;let w=this.else;if(w){const D=w.optimizeNodes();w=this.else=Array.isArray(D)?new h(D):D}if(w)return y===!1?w instanceof v?w:w.nodes:this.nodes.length?this:new v($e(y),w instanceof v?[w]:w.nodes);if(!(y===!1||!this.nodes.length))return this}optimizeNames(y,w){var D;if(this.else=(D=this.else)===null||D===void 0?void 0:D.optimizeNames(y,w),!!(super.optimizeNames(y,w)||this.else))return this.condition=L(this.condition,y,w),this}get names(){const y=super.names;return U(y,this.condition),this.else&&Q(y,this.else.names),y}}v.kind="if";class $ extends m{}$.kind="for";class P extends ${constructor(y){super(),this.iteration=y}render(y){return`for(${this.iteration})`+super.render(y)}optimizeNames(y,w){if(super.optimizeNames(y,w))return this.iteration=L(this.iteration,y,w),this}get names(){return Q(super.names,this.iteration.names)}}class R extends ${constructor(y,w,D,G){super(),this.varKind=y,this.name=w,this.from=D,this.to=G}render(y){const w=y.es5?a.varKinds.var:this.varKind,{name:D,from:G,to:Y}=this;return`for(${w} ${D}=${G}; ${D}<${Y}; ${D}++)`+super.render(y)}get names(){const y=U(super.names,this.from);return U(y,this.to)}}class N extends ${constructor(y,w,D,G){super(),this.loop=y,this.varKind=w,this.name=D,this.iterable=G}render(y){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(y)}optimizeNames(y,w){if(super.optimizeNames(y,w))return this.iterable=L(this.iterable,y,w),this}get names(){return Q(super.names,this.iterable.names)}}class q extends m{constructor(y,w,D){super(),this.name=y,this.args=w,this.async=D}render(y){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(y)}}q.kind="func";class J extends d{render(y){return"return "+super.render(y)}}J.kind="return";class K extends m{render(y){let w="try"+super.render(y);return this.catch&&(w+=this.catch.render(y)),this.finally&&(w+=this.finally.render(y)),w}optimizeNodes(){var y,w;return super.optimizeNodes(),(y=this.catch)===null||y===void 0||y.optimizeNodes(),(w=this.finally)===null||w===void 0||w.optimizeNodes(),this}optimizeNames(y,w){var D,G;return super.optimizeNames(y,w),(D=this.catch)===null||D===void 0||D.optimizeNames(y,w),(G=this.finally)===null||G===void 0||G.optimizeNames(y,w),this}get names(){const y=super.names;return this.catch&&Q(y,this.catch.names),this.finally&&Q(y,this.finally.names),y}}class B extends m{constructor(y){super(),this.error=y}render(y){return`catch(${this.error})`+super.render(y)}}B.kind="catch";class te extends m{render(y){return"finally"+super.render(y)}}te.kind="finally";class re{constructor(y,w={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...w,_n:w.lines?`
|
|
2
|
+
`:""},this._extScope=y,this._scope=new a.Scope({parent:y}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,w){const D=this._extScope.value(y,w);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(y,w){return this._extScope.getValue(y,w)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,w,D,G){const Y=this._scope.toName(w);return D!==void 0&&G&&(this._constants[Y.str]=D),this._leafNode(new o(y,Y,D)),Y}const(y,w,D){return this._def(a.varKinds.const,y,w,D)}let(y,w,D){return this._def(a.varKinds.let,y,w,D)}var(y,w,D){return this._def(a.varKinds.var,y,w,D)}assign(y,w,D){return this._leafNode(new i(y,w,D))}add(y,w){return this._leafNode(new l(y,t.operators.ADD,w))}code(y){return typeof y=="function"?y():y!==e.nil&&this._leafNode(new g(y)),this}object(...y){const w=["{"];for(const[D,G]of y)w.length>1&&w.push(","),w.push(D),(D!==G||this.opts.es5)&&(w.push(":"),(0,e.addCodeArg)(w,G));return w.push("}"),new e._Code(w)}if(y,w,D){if(this._blockNode(new v(y)),w&&D)this.code(w).else().code(D).endIf();else if(w)this.code(w).endIf();else if(D)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new v(y))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(y,w){return this._blockNode(y),w&&this.code(w).endFor(),this}for(y,w){return this._for(new P(y),w)}forRange(y,w,D,G,Y=this.opts.es5?a.varKinds.var:a.varKinds.let){const me=this._scope.toName(y);return this._for(new R(Y,me,w,D),()=>G(me))}forOf(y,w,D,G=a.varKinds.const){const Y=this._scope.toName(y);if(this.opts.es5){const me=w instanceof e.Name?w:this.var("_arr",w);return this.forRange("_i",0,(0,e._)`${me}.length`,ce=>{this.var(Y,(0,e._)`${me}[${ce}]`),D(Y)})}return this._for(new N("of",G,Y,w),()=>D(Y))}forIn(y,w,D,G=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,(0,e._)`Object.keys(${w})`,D);const Y=this._scope.toName(y);return this._for(new N("in",G,Y,w),()=>D(Y))}endFor(){return this._endBlockNode($)}label(y){return this._leafNode(new c(y))}break(y){return this._leafNode(new u(y))}return(y){const w=new J;if(this._blockNode(w),this.code(y),w.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(J)}try(y,w,D){if(!w&&!D)throw new Error('CodeGen: "try" without "catch" and "finally"');const G=new K;if(this._blockNode(G),this.code(y),w){const Y=this.name("e");this._currNode=G.catch=new B(Y),w(Y)}return D&&(this._currNode=G.finally=new te,this.code(D)),this._endBlockNode(B,te)}throw(y){return this._leafNode(new f(y))}block(y,w){return this._blockStarts.push(this._nodes.length),y&&this.code(y).endBlock(w),this}endBlock(y){const w=this._blockStarts.pop();if(w===void 0)throw new Error("CodeGen: not in self-balancing block");const D=this._nodes.length-w;if(D<0||y!==void 0&&D!==y)throw new Error(`CodeGen: wrong number of nodes: ${D} vs ${y} expected`);return this._nodes.length=w,this}func(y,w=e.nil,D,G){return this._blockNode(new q(y,w,D)),G&&this.code(G).endFunc(),this}endFunc(){return this._endBlockNode(q)}optimize(y=1){for(;y-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,w){const D=this._currNode;if(D instanceof y||w&&D instanceof w)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${w?`${y.kind}/${w.kind}`:y.kind}"`)}_elseNode(y){const w=this._currNode;if(!(w instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=w.else=y,this}get _root(){return this._nodes[0]}get _currNode(){const y=this._nodes;return y[y.length-1]}set _currNode(y){const w=this._nodes;w[w.length-1]=y}}t.CodeGen=re;function Q(C,y){for(const w in y)C[w]=(C[w]||0)+(y[w]||0);return C}function U(C,y){return y instanceof e._CodeOrName?Q(C,y.names):C}function L(C,y,w){if(C instanceof e.Name)return D(C);if(!G(C))return C;return new e._Code(C._items.reduce((Y,me)=>(me instanceof e.Name&&(me=D(me)),me instanceof e._Code?Y.push(...me._items):Y.push(me),Y),[]));function D(Y){const me=w[Y.str];return me===void 0||y[Y.str]!==1?Y:(delete y[Y.str],me)}function G(Y){return Y instanceof e._Code&&Y._items.some(me=>me instanceof e.Name&&y[me.str]===1&&w[me.str]!==void 0)}}function ne(C,y){for(const w in y)C[w]=(C[w]||0)-(y[w]||0)}function $e(C){return typeof C=="boolean"||typeof C=="number"||C===null?!C:(0,e._)`!${F(C)}`}t.not=$e;const he=k(t.operators.AND);function we(...C){return C.reduce(he)}t.and=we;const pe=k(t.operators.OR);function x(...C){return C.reduce(pe)}t.or=x;function k(C){return(y,w)=>y===e.nil?w:w===e.nil?y:(0,e._)`${F(y)} ${C} ${F(w)}`}function F(C){return C instanceof e.Name?C:(0,e._)`(${C})`}}(be);var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.checkStrictMode=ee.getErrorPath=ee.Type=ee.useFunc=ee.setEvaluated=ee.evaluatedPropsToName=ee.mergeEvaluated=ee.eachItem=ee.unescapeJsonPointer=ee.escapeJsonPointer=ee.escapeFragment=ee.unescapeFragment=ee.schemaRefOrVal=ee.schemaHasRulesButRef=ee.schemaHasRules=ee.checkUnknownRules=ee.alwaysValidSchema=ee.toHash=void 0;const Ae=be,$d=Gr;function wd(t){const e={};for(const a of t)e[a]=!0;return e}ee.toHash=wd;function bd(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(qo(t,e),!Uo(e,t.self.RULES.all))}ee.alwaysValidSchema=bd;function qo(t,e=t.schema){const{opts:a,self:s}=t;if(!a.strictSchema||typeof e=="boolean")return;const r=s.RULES.keywords;for(const n in e)r[n]||Ko(t,`unknown keyword: "${n}"`)}ee.checkUnknownRules=qo;function Uo(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}ee.schemaHasRules=Uo;function Pd(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(a!=="$ref"&&e.all[a])return!0;return!1}ee.schemaHasRulesButRef=Pd;function Ed({topSchemaRef:t,schemaPath:e},a,s,r){if(!r){if(typeof a=="number"||typeof a=="boolean")return a;if(typeof a=="string")return(0,Ae._)`${a}`}return(0,Ae._)`${t}${e}${(0,Ae.getProperty)(s)}`}ee.schemaRefOrVal=Ed;function Sd(t){return Vo(decodeURIComponent(t))}ee.unescapeFragment=Sd;function Rd(t){return encodeURIComponent(en(t))}ee.escapeFragment=Rd;function en(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ee.escapeJsonPointer=en;function Vo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ee.unescapeJsonPointer=Vo;function kd(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}ee.eachItem=kd;function zo({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,o,i)=>{const l=o===void 0?n:o instanceof Ae.Name?(n instanceof Ae.Name?t(r,n,o):e(r,n,o),o):n instanceof Ae.Name?(e(r,o,n),n):a(n,o);return i===Ae.Name&&!(l instanceof Ae.Name)?s(r,l):l}}ee.mergeEvaluated={props:zo({mergeNames:(t,e,a)=>t.if((0,Ae._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,Ae._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,Ae._)`${a} || {}`).code((0,Ae._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,Ae._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,Ae._)`${a} || {}`),tn(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ho}),items:zo({mergeNames:(t,e,a)=>t.if((0,Ae._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,Ae._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,Ae._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,Ae._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ho(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,Ae._)`{}`);return e!==void 0&&tn(t,a,e),a}ee.evaluatedPropsToName=Ho;function tn(t,e,a){Object.keys(a).forEach(s=>t.assign((0,Ae._)`${e}${(0,Ae.getProperty)(s)}`,!0))}ee.setEvaluated=tn;const Zo={};function Td(t,e){return t.scopeValue("func",{ref:e,code:Zo[e.code]||(Zo[e.code]=new $d._Code(e.code))})}ee.useFunc=Td;var rn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(rn||(ee.Type=rn={}));function Od(t,e,a){if(t instanceof Ae.Name){const s=e===rn.Num;return a?s?(0,Ae._)`"[" + ${t} + "]"`:(0,Ae._)`"['" + ${t} + "']"`:s?(0,Ae._)`"/" + ${t}`:(0,Ae._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,Ae.getProperty)(t).toString():"/"+en(t)}ee.getErrorPath=Od;function Ko(t,e,a=t.opts.strictSchema){if(a){if(e=`strict mode: ${e}`,a===!0)throw new Error(e);t.self.logger.warn(e)}}ee.checkStrictMode=Ko;var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});const it=be,Cd={data:new it.Name("data"),valCxt:new it.Name("valCxt"),instancePath:new it.Name("instancePath"),parentData:new it.Name("parentData"),parentDataProperty:new it.Name("parentDataProperty"),rootData:new it.Name("rootData"),dynamicAnchors:new it.Name("dynamicAnchors"),vErrors:new it.Name("vErrors"),errors:new it.Name("errors"),this:new it.Name("this"),self:new it.Name("self"),scope:new it.Name("scope"),json:new it.Name("json"),jsonPos:new it.Name("jsonPos"),jsonLen:new it.Name("jsonLen"),jsonPart:new it.Name("jsonPart")};Ct.default=Cd,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=be,a=ee,s=Ct;t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:v})=>v?(0,e.str)`"${h}" keyword must be ${v} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function r(h,v=t.keywordError,$,P){const{it:R}=h,{gen:N,compositeRule:q,allErrors:J}=R,K=f(h,v,$);P??(q||J)?l(N,K):c(R,(0,e._)`[${K}]`)}t.reportError=r;function n(h,v=t.keywordError,$){const{it:P}=h,{gen:R,compositeRule:N,allErrors:q}=P,J=f(h,v,$);l(R,J),N||q||c(P,s.default.vErrors)}t.reportExtraError=n;function o(h,v){h.assign(s.default.errors,v),h.if((0,e._)`${s.default.vErrors} !== null`,()=>h.if(v,()=>h.assign((0,e._)`${s.default.vErrors}.length`,v),()=>h.assign(s.default.vErrors,null)))}t.resetErrorsCount=o;function i({gen:h,keyword:v,schemaValue:$,data:P,errsCount:R,it:N}){if(R===void 0)throw new Error("ajv implementation error");const q=h.name("err");h.forRange("i",R,s.default.errors,J=>{h.const(q,(0,e._)`${s.default.vErrors}[${J}]`),h.if((0,e._)`${q}.instancePath === undefined`,()=>h.assign((0,e._)`${q}.instancePath`,(0,e.strConcat)(s.default.instancePath,N.errorPath))),h.assign((0,e._)`${q}.schemaPath`,(0,e.str)`${N.errSchemaPath}/${v}`),N.opts.verbose&&(h.assign((0,e._)`${q}.schema`,$),h.assign((0,e._)`${q}.data`,P))})}t.extendErrors=i;function l(h,v){const $=h.const("err",v);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${$}]`),(0,e._)`${s.default.vErrors}.push(${$})`),h.code((0,e._)`${s.default.errors}++`)}function c(h,v){const{gen:$,validateName:P,schemaEnv:R}=h;R.$async?$.throw((0,e._)`new ${h.ValidationError}(${v})`):($.assign((0,e._)`${P}.errors`,v),$.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function f(h,v,$){const{createErrors:P}=h.it;return P===!1?(0,e._)`{}`:g(h,v,$)}function g(h,v,$={}){const{gen:P,it:R}=h,N=[d(R,$),m(h,$)];return p(h,v,N),P.object(...N)}function d({errorPath:h},{instancePath:v}){const $=v?(0,e.str)`${h}${(0,a.getErrorPath)(v,a.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,$)]}function m({keyword:h,it:{errSchemaPath:v}},{schemaPath:$,parentSchema:P}){let R=P?v:(0,e.str)`${v}/${h}`;return $&&(R=(0,e.str)`${R}${(0,a.getErrorPath)($,a.Type.Str)}`),[u.schemaPath,R]}function p(h,{params:v,message:$},P){const{keyword:R,data:N,schemaValue:q,it:J}=h,{opts:K,propertyName:B,topSchemaRef:te,schemaPath:re}=J;P.push([u.keyword,R],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),K.messages&&P.push([u.message,typeof $=="function"?$(h):$]),K.verbose&&P.push([u.schema,q],[u.parentSchema,(0,e._)`${te}${re}`],[s.default.data,N]),B&&P.push([u.propertyName,B])}}(Qr);var Bo;function Id(){if(Bo)return cr;Bo=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.boolOrEmptySchema=cr.topBoolOrEmptySchema=void 0;const t=Qr,e=be,a=Ct,s={message:"boolean schema is false"};function r(i){const{gen:l,schema:c,validateName:u}=i;c===!1?o(i,!1):typeof c=="object"&&c.$async===!0?l.return(a.default.data):(l.assign((0,e._)`${u}.errors`,null),l.return(!0))}cr.topBoolOrEmptySchema=r;function n(i,l){const{gen:c,schema:u}=i;u===!1?(c.var(l,!1),o(i)):c.var(l,!0)}cr.boolOrEmptySchema=n;function o(i,l){const{gen:c,data:u}=i,f={gen:c,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:i};(0,t.reportError)(f,s,void 0,l)}return cr}var We={},ur={};Object.defineProperty(ur,"__esModule",{value:!0}),ur.getRules=ur.isJSONType=void 0;const Nd=["string","number","integer","boolean","null","object","array"],Ad=new Set(Nd);function jd(t){return typeof t=="string"&&Ad.has(t)}ur.isJSONType=jd;function Dd(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ur.getRules=Dd;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.shouldUseRule=Ft.shouldUseGroup=Ft.schemaHasRulesForType=void 0;function xd({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&Jo(t,s)}Ft.schemaHasRulesForType=xd;function Jo(t,e){return e.rules.some(a=>Qo(t,a))}Ft.shouldUseGroup=Jo;function Qo(t,e){var a;return t[e.keyword]!==void 0||((a=e.definition.implements)===null||a===void 0?void 0:a.some(s=>t[s]!==void 0))}Ft.shouldUseRule=Qo,Object.defineProperty(We,"__esModule",{value:!0}),We.reportTypeError=We.checkDataTypes=We.checkDataType=We.coerceAndCheckDataType=We.getJSONTypes=We.getSchemaTypes=We.DataType=void 0;const Md=ur,Ld=Ft,Fd=Qr,ye=be,Go=ee;var kr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(kr||(We.DataType=kr={}));function qd(t){const e=Wo(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}We.getSchemaTypes=qd;function Wo(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Md.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}We.getJSONTypes=Wo;function Ud(t,e){const{gen:a,data:s,opts:r}=t,n=Vd(e,r.coerceTypes),o=e.length>0&&!(n.length===0&&e.length===1&&(0,Ld.schemaHasRulesForType)(t,e[0]));if(o){const i=sn(e,s,r.strictNumbers,kr.Wrong);a.if(i,()=>{n.length?zd(t,e,n):nn(t)})}return o}We.coerceAndCheckDataType=Ud;const Xo=new Set(["string","number","integer","boolean","null"]);function Vd(t,e){return e?t.filter(a=>Xo.has(a)||e==="array"&&a==="array"):[]}function zd(t,e,a){const{gen:s,data:r,opts:n}=t,o=s.let("dataType",(0,ye._)`typeof ${r}`),i=s.let("coerced",(0,ye._)`undefined`);n.coerceTypes==="array"&&s.if((0,ye._)`${o} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>s.assign(r,(0,ye._)`${r}[0]`).assign(o,(0,ye._)`typeof ${r}`).if(sn(e,r,n.strictNumbers),()=>s.assign(i,r))),s.if((0,ye._)`${i} !== undefined`);for(const c of a)(Xo.has(c)||c==="array"&&n.coerceTypes==="array")&&l(c);s.else(),nn(t),s.endIf(),s.if((0,ye._)`${i} !== undefined`,()=>{s.assign(r,i),Hd(t,i)});function l(c){switch(c){case"string":s.elseIf((0,ye._)`${o} == "number" || ${o} == "boolean"`).assign(i,(0,ye._)`"" + ${r}`).elseIf((0,ye._)`${r} === null`).assign(i,(0,ye._)`""`);return;case"number":s.elseIf((0,ye._)`${o} == "boolean" || ${r} === null
|
|
3
3
|
|| (${o} == "string" && ${r} && ${r} == +${r})`).assign(i,(0,ye._)`+${r}`);return;case"integer":s.elseIf((0,ye._)`${o} === "boolean" || ${r} === null
|
|
4
4
|
|| (${o} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(i,(0,ye._)`+${r}`);return;case"boolean":s.elseIf((0,ye._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(i,!1).elseIf((0,ye._)`${r} === "true" || ${r} === 1`).assign(i,!0);return;case"null":s.elseIf((0,ye._)`${r} === "" || ${r} === 0 || ${r} === false`),s.assign(i,null);return;case"array":s.elseIf((0,ye._)`${o} === "string" || ${o} === "number"
|
|
5
|
-
|| ${o} === "boolean" || ${r} === null`).assign(i,(0,ye._)`[${r}]`)}}}function Ud({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,ye._)`${e} !== undefined`,()=>t.assign((0,ye._)`${e}[${a}]`,s))}function rn(t,e,a,s=Rr.Correct){const r=s===Rr.Correct?ye.operators.EQ:ye.operators.NEQ;let n;switch(t){case"null":return(0,ye._)`${e} ${r} null`;case"array":n=(0,ye._)`Array.isArray(${e})`;break;case"object":n=(0,ye._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":n=o((0,ye._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":n=o();break;default:return(0,ye._)`typeof ${e} ${r} ${t}`}return s===Rr.Correct?n:(0,ye.not)(n);function o(i=ye.nil){return(0,ye.and)((0,ye._)`typeof ${e} == "number"`,i,a?(0,ye._)`isFinite(${e})`:ye.nil)}}Ge.checkDataType=rn;function an(t,e,a,s){if(t.length===1)return rn(t[0],e,a,s);let r;const n=(0,Bo.toHash)(t);if(n.array&&n.object){const o=(0,ye._)`typeof ${e} != "object"`;r=n.null?o:(0,ye._)`!${e} || ${o}`,delete n.null,delete n.array,delete n.object}else r=ye.nil;n.number&&delete n.integer;for(const o in n)r=(0,ye.and)(r,rn(o,e,a,s));return r}Ge.checkDataTypes=an;const Vd={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ye._)`{type: ${t}}`:(0,ye._)`{type: ${e}}`};function sn(t){const e=zd(t);(0,xd.reportError)(e,Vd)}Ge.reportTypeError=sn;function zd(t){const{gen:e,data:a,schema:s}=t,r=(0,Bo.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var Gr={},Go;function Hd(){if(Go)return Gr;Go=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.assignDefaults=void 0;const t=be,e=re;function a(r,n){const{properties:o,items:i}=r.schema;if(n==="object"&&o)for(const l in o)s(r,l,o[l].default);else n==="array"&&Array.isArray(i)&&i.forEach((l,c)=>s(r,c,l.default))}Gr.assignDefaults=a;function s(r,n,o){const{gen:i,compositeRule:l,data:c,opts:u}=r;if(o===void 0)return;const f=(0,t._)`${c}${(0,t.getProperty)(n)}`;if(l){(0,e.checkStrictMode)(r,`default is ignored for: ${f}`);return}let g=(0,t._)`${f} === undefined`;u.useDefaults==="empty"&&(g=(0,t._)`${g} || ${f} === null || ${f} === ""`),i.if(g,(0,t._)`${f} = ${(0,t.stringify)(o)}`)}return Gr}var $t={},Ie={},Wo;function wt(){if(Wo)return Ie;Wo=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.validateUnion=Ie.validateArray=Ie.usePattern=Ie.callValidateCode=Ie.schemaProperties=Ie.allSchemaProperties=Ie.noPropertyInData=Ie.propertyInData=Ie.isOwnProperty=Ie.hasPropFunc=Ie.reportMissingProp=Ie.checkMissingProp=Ie.checkReportMissingProp=void 0;const t=be,e=re,a=Ct,s=re;function r($,w){const{gen:E,data:k,it:D}=$;E.if(u(E,k,w,D.opts.ownProperties),()=>{$.setParams({missingProperty:(0,t._)`${w}`},!0),$.error()})}Ie.checkReportMissingProp=r;function n({gen:$,data:w,it:{opts:E}},k,D){return(0,t.or)(...k.map(H=>(0,t.and)(u($,w,H,E.ownProperties),(0,t._)`${D} = ${H}`)))}Ie.checkMissingProp=n;function o($,w){$.setParams({missingProperty:w},!0),$.error()}Ie.reportMissingProp=o;function i($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}Ie.hasPropFunc=i;function l($,w,E){return(0,t._)`${i($)}.call(${w}, ${E})`}Ie.isOwnProperty=l;function c($,w,E,k){const D=(0,t._)`${w}${(0,t.getProperty)(E)} !== undefined`;return k?(0,t._)`${D} && ${l($,w,E)}`:D}Ie.propertyInData=c;function u($,w,E,k){const D=(0,t._)`${w}${(0,t.getProperty)(E)} === undefined`;return k?(0,t.or)(D,(0,t.not)(l($,w,E))):D}Ie.noPropertyInData=u;function f($){return $?Object.keys($).filter(w=>w!=="__proto__"):[]}Ie.allSchemaProperties=f;function g($,w){return f(w).filter(E=>!(0,e.alwaysValidSchema)($,w[E]))}Ie.schemaProperties=g;function d({schemaCode:$,data:w,it:{gen:E,topSchemaRef:k,schemaPath:D,errorPath:H},it:z},Z,X,Y){const Q=Y?(0,t._)`${$}, ${w}, ${k}${D}`:w,U=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,H)],[a.default.parentData,z.parentData],[a.default.parentDataProperty,z.parentDataProperty],[a.default.rootData,a.default.rootData]];z.opts.dynamicRef&&U.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);const F=(0,t._)`${Q}, ${E.object(...U)}`;return X!==t.nil?(0,t._)`${Z}.call(${X}, ${F})`:(0,t._)`${Z}(${F})`}Ie.callValidateCode=d;const m=(0,t._)`new RegExp`;function p({gen:$,it:{opts:w}},E){const k=w.unicodeRegExp?"u":"",{regExp:D}=w.code,H=D(E,k);return $.scopeValue("pattern",{key:H.toString(),ref:H,code:(0,t._)`${D.code==="new RegExp"?m:(0,s.useFunc)($,D)}(${E}, ${k})`})}Ie.usePattern=p;function h($){const{gen:w,data:E,keyword:k,it:D}=$,H=w.name("valid");if(D.allErrors){const Z=w.let("valid",!0);return z(()=>w.assign(Z,!1)),Z}return w.var(H,!0),z(()=>w.break()),H;function z(Z){const X=w.const("len",(0,t._)`${E}.length`);w.forRange("i",0,X,Y=>{$.subschema({keyword:k,dataProp:Y,dataPropType:e.Type.Num},H),w.if((0,t.not)(H),Z)})}}Ie.validateArray=h;function v($){const{gen:w,schema:E,keyword:k,it:D}=$;if(!Array.isArray(E))throw new Error("ajv implementation error");if(E.some(X=>(0,e.alwaysValidSchema)(D,X))&&!D.opts.unevaluated)return;const z=w.let("valid",!1),Z=w.name("_valid");w.block(()=>E.forEach((X,Y)=>{const Q=$.subschema({keyword:k,schemaProp:Y,compositeRule:!0},Z);w.assign(z,(0,t._)`${z} || ${Z}`),$.mergeValidEvaluated(Q,Z)||w.if((0,t.not)(z))})),$.result(z,()=>$.reset(),()=>$.error(!0))}return Ie.validateUnion=v,Ie}var Xo;function Zd(){if(Xo)return $t;Xo=1,Object.defineProperty($t,"__esModule",{value:!0}),$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;const t=be,e=Ct,a=wt(),s=Jr;function r(g,d){const{gen:m,keyword:p,schema:h,parentSchema:v,it:$}=g,w=d.macro.call($.self,h,v,$),E=c(m,p,w);$.opts.validateSchema!==!1&&$.self.validateSchema(w,!0);const k=m.name("valid");g.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${$.errSchemaPath}/${p}`,topSchemaRef:E,compositeRule:!0},k),g.pass(k,()=>g.error(!0))}$t.macroKeywordCode=r;function n(g,d){var m;const{gen:p,keyword:h,schema:v,parentSchema:$,$data:w,it:E}=g;l(E,d);const k=!w&&d.compile?d.compile.call(E.self,v,$,E):d.validate,D=c(p,h,k),H=p.let("valid");g.block$data(H,z),g.ok((m=d.valid)!==null&&m!==void 0?m:H);function z(){if(d.errors===!1)Y(),d.modifying&&o(g),Q(()=>g.error());else{const U=d.async?Z():X();d.modifying&&o(g),Q(()=>i(g,U))}}function Z(){const U=p.let("ruleErrs",null);return p.try(()=>Y((0,t._)`await `),F=>p.assign(H,!1).if((0,t._)`${F} instanceof ${E.ValidationError}`,()=>p.assign(U,(0,t._)`${F}.errors`),()=>p.throw(F))),U}function X(){const U=(0,t._)`${D}.errors`;return p.assign(U,null),Y(t.nil),U}function Y(U=d.async?(0,t._)`await `:t.nil){const F=E.opts.passContext?e.default.this:e.default.self,ne=!("compile"in d&&!w||d.schema===!1);p.assign(H,(0,t._)`${U}${(0,a.callValidateCode)(g,D,F,ne)}`,d.modifying)}function Q(U){var F;p.if((0,t.not)((F=d.valid)!==null&&F!==void 0?F:H),U)}}$t.funcKeywordCode=n;function o(g){const{gen:d,data:m,it:p}=g;d.if(p.parentData,()=>d.assign(m,(0,t._)`${p.parentData}[${p.parentDataProperty}]`))}function i(g,d){const{gen:m}=g;m.if((0,t._)`Array.isArray(${d})`,()=>{m.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${d} : ${e.default.vErrors}.concat(${d})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,s.extendErrors)(g)},()=>g.error())}function l({schemaEnv:g},d){if(d.async&&!g.$async)throw new Error("async keyword in sync schema")}function c(g,d,m){if(m===void 0)throw new Error(`keyword "${d}" failed to compile`);return g.scopeValue("keyword",typeof m=="function"?{ref:m}:{ref:m,code:(0,t.stringify)(m)})}function u(g,d,m=!1){return!d.length||d.some(p=>p==="array"?Array.isArray(g):p==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==p||m&&typeof g>"u")}$t.validSchemaType=u;function f({schema:g,opts:d,self:m,errSchemaPath:p},h,v){if(Array.isArray(h.keyword)?!h.keyword.includes(v):h.keyword!==v)throw new Error("ajv implementation error");const $=h.dependencies;if($!=null&&$.some(w=>!Object.prototype.hasOwnProperty.call(g,w)))throw new Error(`parent schema must have dependencies of ${v}: ${$.join(",")}`);if(h.validateSchema&&!h.validateSchema(g[v])){const E=`keyword "${v}" value is invalid at path "${p}": `+m.errorsText(h.validateSchema.errors);if(d.validateSchema==="log")m.logger.error(E);else throw new Error(E)}}return $t.validateKeywordUsage=f,$t}var qt={},Yo;function Kd(){if(Yo)return qt;Yo=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.extendSubschemaMode=qt.extendSubschemaData=qt.getSubschema=void 0;const t=be,e=re;function a(n,{keyword:o,schemaProp:i,schema:l,schemaPath:c,errSchemaPath:u,topSchemaRef:f}){if(o!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(o!==void 0){const g=n.schema[o];return i===void 0?{schema:g,schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(o)}`,errSchemaPath:`${n.errSchemaPath}/${o}`}:{schema:g[i],schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(o)}${(0,t.getProperty)(i)}`,errSchemaPath:`${n.errSchemaPath}/${o}/${(0,e.escapeFragment)(i)}`}}if(l!==void 0){if(c===void 0||u===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:f,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}qt.getSubschema=a;function s(n,o,{dataProp:i,dataPropType:l,data:c,dataTypes:u,propertyName:f}){if(c!==void 0&&i!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=o;if(i!==void 0){const{errorPath:m,dataPathArr:p,opts:h}=o,v=g.let("data",(0,t._)`${o.data}${(0,t.getProperty)(i)}`,!0);d(v),n.errorPath=(0,t.str)`${m}${(0,e.getErrorPath)(i,l,h.jsPropertySyntax)}`,n.parentDataProperty=(0,t._)`${i}`,n.dataPathArr=[...p,n.parentDataProperty]}if(c!==void 0){const m=c instanceof t.Name?c:g.let("data",c,!0);d(m),f!==void 0&&(n.propertyName=f)}u&&(n.dataTypes=u);function d(m){n.data=m,n.dataLevel=o.dataLevel+1,n.dataTypes=[],o.definedProperties=new Set,n.parentData=o.data,n.dataNames=[...o.dataNames,m]}}qt.extendSubschemaData=s;function r(n,{jtdDiscriminator:o,jtdMetadata:i,compositeRule:l,createErrors:c,allErrors:u}){l!==void 0&&(n.compositeRule=l),c!==void 0&&(n.createErrors=c),u!==void 0&&(n.allErrors=u),n.jtdDiscriminator=o,n.jtdMetadata=i}return qt.extendSubschemaMode=r,qt}var rt={},Wr=function t(e,a){if(e===a)return!0;if(e&&a&&typeof e=="object"&&typeof a=="object"){if(e.constructor!==a.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=a.length)return!1;for(r=s;r--!==0;)if(!t(e[r],a[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===a.source&&e.flags===a.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===a.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===a.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(a).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(a,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!t(e[o],a[o]))return!1}return!0}return e!==e&&a!==a},el={exports:{}},Wt=el.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};Ra(e,s,r,t,"",t)};Wt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Wt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Wt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Wt.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};function Ra(t,e,a,s,r,n,o,i,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,l,c);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in Wt.arrayKeywords)for(var g=0;g<f.length;g++)Ra(t,e,a,f[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in Wt.propsKeywords){if(f&&typeof f=="object")for(var d in f)Ra(t,e,a,f[d],r+"/"+u+"/"+Bd(d),n,r,u,s,d)}else(u in Wt.keywords||t.allKeys&&!(u in Wt.skipKeywords))&&Ra(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,o,i,l,c)}}function Bd(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var Jd=el.exports;Object.defineProperty(rt,"__esModule",{value:!0}),rt.getSchemaRefs=rt.resolveUrl=rt.normalizeId=rt._getFullPath=rt.getFullPath=rt.inlineRef=void 0;const Qd=re,Gd=Wr,Wd=Jd,Xd=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Yd(t,e=!0){return typeof t=="boolean"?!0:e===!0?!nn(t):e?tl(t)<=e:!1}rt.inlineRef=Yd;const ef=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function nn(t){for(const e in t){if(ef.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(nn)||typeof a=="object"&&nn(a))return!0}return!1}function tl(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!Xd.has(a)&&(typeof t[a]=="object"&&(0,Qd.eachItem)(t[a],s=>e+=tl(s)),e===1/0))return 1/0}return e}function rl(t,e="",a){a!==!1&&(e=kr(e));const s=t.parse(e);return al(t,s)}rt.getFullPath=rl;function al(t,e){return t.serialize(e).split("#")[0]+"#"}rt._getFullPath=al;const tf=/#\/?$/;function kr(t){return t?t.replace(tf,""):""}rt.normalizeId=kr;function rf(t,e,a){return a=kr(a),t.resolve(e,a)}rt.resolveUrl=rf;const af=/^[a-z_][-a-z0-9._]*$/i;function sf(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=kr(t[a]||e),n={"":r},o=rl(s,r,!1),i={},l=new Set;return Wd(t,{allKeys:!0},(f,g,d,m)=>{if(m===void 0)return;const p=o+g;let h=n[m];typeof f[a]=="string"&&(h=v.call(this,f[a])),$.call(this,f.$anchor),$.call(this,f.$dynamicAnchor),n[g]=h;function v(w){const E=this.opts.uriResolver.resolve;if(w=kr(h?E(h,w):w),l.has(w))throw u(w);l.add(w);let k=this.refs[w];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?c(f,k.schema,w):w!==kr(p)&&(w[0]==="#"?(c(f,i[w],w),i[w]=f):this.refs[w]=p),w}function $(w){if(typeof w=="string"){if(!af.test(w))throw new Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),i;function c(f,g,d){if(g!==void 0&&!Gd(f,g))throw u(d)}function u(f){return new Error(`reference "${f}" resolves to more than one schema`)}}rt.getSchemaRefs=sf;var sl;function ka(){if(sl)return Lt;sl=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.getData=Lt.KeywordCxt=Lt.validateFunctionCode=void 0;const t=Td(),e=Ge,a=Ft,s=Ge,r=Hd(),n=Zd(),o=Kd(),i=be,l=Ct,c=rt,u=re,f=Jr;function g(R){if(k(R)&&(H(R),E(R))){h(R);return}d(R,()=>(0,t.topBoolOrEmptySchema)(R))}Lt.validateFunctionCode=g;function d({gen:R,validateName:N,schema:L,schemaEnv:V,opts:se},ue){se.code.es5?R.func(N,(0,i._)`${l.default.data}, ${l.default.valCxt}`,V.$async,()=>{R.code((0,i._)`"use strict"; ${$(L,se)}`),p(R,se),R.code(ue)}):R.func(N,(0,i._)`${l.default.data}, ${m(se)}`,V.$async,()=>R.code($(L,se)).code(ue))}function m(R){return(0,i._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${R.dynamicRef?(0,i._)`, ${l.default.dynamicAnchors}={}`:i.nil}}={}`}function p(R,N){R.if(l.default.valCxt,()=>{R.var(l.default.instancePath,(0,i._)`${l.default.valCxt}.${l.default.instancePath}`),R.var(l.default.parentData,(0,i._)`${l.default.valCxt}.${l.default.parentData}`),R.var(l.default.parentDataProperty,(0,i._)`${l.default.valCxt}.${l.default.parentDataProperty}`),R.var(l.default.rootData,(0,i._)`${l.default.valCxt}.${l.default.rootData}`),N.dynamicRef&&R.var(l.default.dynamicAnchors,(0,i._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{R.var(l.default.instancePath,(0,i._)`""`),R.var(l.default.parentData,(0,i._)`undefined`),R.var(l.default.parentDataProperty,(0,i._)`undefined`),R.var(l.default.rootData,l.default.data),N.dynamicRef&&R.var(l.default.dynamicAnchors,(0,i._)`{}`)})}function h(R){const{schema:N,opts:L,gen:V}=R;d(R,()=>{L.$comment&&N.$comment&&U(R),X(R),V.let(l.default.vErrors,null),V.let(l.default.errors,0),L.unevaluated&&v(R),z(R),F(R)})}function v(R){const{gen:N,validateName:L}=R;R.evaluated=N.const("evaluated",(0,i._)`${L}.evaluated`),N.if((0,i._)`${R.evaluated}.dynamicProps`,()=>N.assign((0,i._)`${R.evaluated}.props`,(0,i._)`undefined`)),N.if((0,i._)`${R.evaluated}.dynamicItems`,()=>N.assign((0,i._)`${R.evaluated}.items`,(0,i._)`undefined`))}function $(R,N){const L=typeof R=="object"&&R[N.schemaId];return L&&(N.code.source||N.code.process)?(0,i._)`/*# sourceURL=${L} */`:i.nil}function w(R,N){if(k(R)&&(H(R),E(R))){D(R,N);return}(0,t.boolOrEmptySchema)(R,N)}function E({schema:R,self:N}){if(typeof R=="boolean")return!R;for(const L in R)if(N.RULES.all[L])return!0;return!1}function k(R){return typeof R.schema!="boolean"}function D(R,N){const{schema:L,gen:V,opts:se}=R;se.$comment&&L.$comment&&U(R),Y(R),Q(R);const ue=V.const("_errs",l.default.errors);z(R,ue),V.var(N,(0,i._)`${ue} === ${l.default.errors}`)}function H(R){(0,u.checkUnknownRules)(R),Z(R)}function z(R,N){if(R.opts.jtd)return $e(R,[],!1,N);const L=(0,e.getSchemaTypes)(R.schema),V=(0,e.coerceAndCheckDataType)(R,L);$e(R,L,!V,N)}function Z(R){const{schema:N,errSchemaPath:L,opts:V,self:se}=R;N.$ref&&V.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(N,se.RULES)&&se.logger.warn(`$ref: keywords ignored in schema at path "${L}"`)}function X(R){const{schema:N,opts:L}=R;N.default!==void 0&&L.useDefaults&&L.strictSchema&&(0,u.checkStrictMode)(R,"default is ignored in the schema root")}function Y(R){const N=R.schema[R.opts.schemaId];N&&(R.baseId=(0,c.resolveUrl)(R.opts.uriResolver,R.baseId,N))}function Q(R){if(R.schema.$async&&!R.schemaEnv.$async)throw new Error("async schema in sync schema")}function U({gen:R,schemaEnv:N,schema:L,errSchemaPath:V,opts:se}){const ue=L.$comment;if(se.$comment===!0)R.code((0,i._)`${l.default.self}.logger.log(${ue})`);else if(typeof se.$comment=="function"){const Fe=(0,i.str)`${V}/$comment`,Ye=R.scopeValue("root",{ref:N.root});R.code((0,i._)`${l.default.self}.opts.$comment(${ue}, ${Fe}, ${Ye}.schema)`)}}function F(R){const{gen:N,schemaEnv:L,validateName:V,ValidationError:se,opts:ue}=R;L.$async?N.if((0,i._)`${l.default.errors} === 0`,()=>N.return(l.default.data),()=>N.throw((0,i._)`new ${se}(${l.default.vErrors})`)):(N.assign((0,i._)`${V}.errors`,l.default.vErrors),ue.unevaluated&&ne(R),N.return((0,i._)`${l.default.errors} === 0`))}function ne({gen:R,evaluated:N,props:L,items:V}){L instanceof i.Name&&R.assign((0,i._)`${N}.props`,L),V instanceof i.Name&&R.assign((0,i._)`${N}.items`,V)}function $e(R,N,L,V){const{gen:se,schema:ue,data:Fe,allErrors:Ye,opts:Te,self:Ve}=R,{RULES:ze}=Ve;if(ue.$ref&&(Te.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ue,ze))){se.block(()=>G(R,"$ref",ze.all.$ref.definition));return}Te.jtd||we(R,N),se.block(()=>{for(const Oe of ze.rules)De(Oe);De(ze.post)});function De(Oe){(0,a.shouldUseGroup)(ue,Oe)&&(Oe.type?(se.if((0,s.checkDataType)(Oe.type,Fe,Te.strictNumbers)),he(R,Oe),N.length===1&&N[0]===Oe.type&&L&&(se.else(),(0,s.reportTypeError)(R)),se.endIf()):he(R,Oe),Ye||se.if((0,i._)`${l.default.errors} === ${V||0}`))}}function he(R,N){const{gen:L,schema:V,opts:{useDefaults:se}}=R;se&&(0,r.assignDefaults)(R,N.type),L.block(()=>{for(const ue of N.rules)(0,a.shouldUseRule)(V,ue)&&G(R,ue.keyword,ue.definition,N.type)})}function we(R,N){R.schemaEnv.meta||!R.opts.strictTypes||(pe(R,N),R.opts.allowUnionTypes||M(R,N),T(R,R.dataTypes))}function pe(R,N){if(N.length){if(!R.dataTypes.length){R.dataTypes=N;return}N.forEach(L=>{I(R.dataTypes,L)||b(R,`type "${L}" not allowed by context "${R.dataTypes.join(",")}"`)}),y(R,N)}}function M(R,N){N.length>1&&!(N.length===2&&N.includes("null"))&&b(R,"use allowUnionTypes to allow union type keyword")}function T(R,N){const L=R.self.RULES.all;for(const V in L){const se=L[V];if(typeof se=="object"&&(0,a.shouldUseRule)(R.schema,se)){const{type:ue}=se.definition;ue.length&&!ue.some(Fe=>q(N,Fe))&&b(R,`missing type "${ue.join(",")}" for keyword "${V}"`)}}}function q(R,N){return R.includes(N)||N==="number"&&R.includes("integer")}function I(R,N){return R.includes(N)||N==="integer"&&R.includes("number")}function y(R,N){const L=[];for(const V of R.dataTypes)I(N,V)?L.push(V):N.includes("integer")&&V==="number"&&L.push("integer");R.dataTypes=L}function b(R,N){const L=R.schemaEnv.baseId+R.errSchemaPath;N+=` at "${L}" (strictTypes)`,(0,u.checkStrictMode)(R,N,R.opts.strictTypes)}class x{constructor(N,L,V){if((0,n.validateKeywordUsage)(N,L,V),this.gen=N.gen,this.allErrors=N.allErrors,this.keyword=V,this.data=N.data,this.schema=N.schema[V],this.$data=L.$data&&N.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(N,this.schema,V,this.$data),this.schemaType=L.schemaType,this.parentSchema=N.schema,this.params={},this.it=N,this.def=L,this.$data)this.schemaCode=N.gen.const("vSchema",ce(this.$data,N));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,L.schemaType,L.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(L.schemaType)}`);("code"in L?L.trackErrors:L.errors!==!1)&&(this.errsCount=N.gen.const("_errs",l.default.errors))}result(N,L,V){this.failResult((0,i.not)(N),L,V)}failResult(N,L,V){this.gen.if(N),V?V():this.error(),L?(this.gen.else(),L(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(N,L){this.failResult((0,i.not)(N),void 0,L)}fail(N){if(N===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(N),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(N){if(!this.$data)return this.fail(N);const{schemaCode:L}=this;this.fail((0,i._)`${L} !== undefined && (${(0,i.or)(this.invalid$data(),N)})`)}error(N,L,V){if(L){this.setParams(L),this._error(N,V),this.setParams({});return}this._error(N,V)}_error(N,L){(N?f.reportExtraError:f.reportError)(this,this.def.error,L)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(N){this.allErrors||this.gen.if(N)}setParams(N,L){L?Object.assign(this.params,N):this.params=N}block$data(N,L,V=i.nil){this.gen.block(()=>{this.check$data(N,V),L()})}check$data(N=i.nil,L=i.nil){if(!this.$data)return;const{gen:V,schemaCode:se,schemaType:ue,def:Fe}=this;V.if((0,i.or)((0,i._)`${se} === undefined`,L)),N!==i.nil&&V.assign(N,!0),(ue.length||Fe.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),N!==i.nil&&V.assign(N,!1)),V.else()}invalid$data(){const{gen:N,schemaCode:L,schemaType:V,def:se,it:ue}=this;return(0,i.or)(Fe(),Ye());function Fe(){if(V.length){if(!(L instanceof i.Name))throw new Error("ajv implementation error");const Te=Array.isArray(V)?V:[V];return(0,i._)`${(0,s.checkDataTypes)(Te,L,ue.opts.strictNumbers,s.DataType.Wrong)}`}return i.nil}function Ye(){if(se.validateSchema){const Te=N.scopeValue("validate$data",{ref:se.validateSchema});return(0,i._)`!${Te}(${L})`}return i.nil}}subschema(N,L){const V=(0,o.getSubschema)(this.it,N);(0,o.extendSubschemaData)(V,this.it,N),(0,o.extendSubschemaMode)(V,N);const se={...this.it,...V,items:void 0,props:void 0};return w(se,L),se}mergeEvaluated(N,L){const{it:V,gen:se}=this;V.opts.unevaluated&&(V.props!==!0&&N.props!==void 0&&(V.props=u.mergeEvaluated.props(se,N.props,V.props,L)),V.items!==!0&&N.items!==void 0&&(V.items=u.mergeEvaluated.items(se,N.items,V.items,L)))}mergeValidEvaluated(N,L){const{it:V,gen:se}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return se.if(L,()=>this.mergeEvaluated(N,i.Name)),!0}}Lt.KeywordCxt=x;function G(R,N,L,V){const se=new x(R,L,N);"code"in L?L.code(se,V):se.$data&&L.validate?(0,n.funcKeywordCode)(se,L):"macro"in L?(0,n.macroKeywordCode)(se,L):(L.compile||L.validate)&&(0,n.funcKeywordCode)(se,L)}const te=/^\/(?:[^~]|~0|~1)*$/,me=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ce(R,{dataLevel:N,dataNames:L,dataPathArr:V}){let se,ue;if(R==="")return l.default.rootData;if(R[0]==="/"){if(!te.test(R))throw new Error(`Invalid JSON-pointer: ${R}`);se=R,ue=l.default.rootData}else{const Ve=me.exec(R);if(!Ve)throw new Error(`Invalid JSON-pointer: ${R}`);const ze=+Ve[1];if(se=Ve[2],se==="#"){if(ze>=N)throw new Error(Te("property/index",ze));return V[N-ze]}if(ze>N)throw new Error(Te("data",ze));if(ue=L[N-ze],!se)return ue}let Fe=ue;const Ye=se.split("/");for(const Ve of Ye)Ve&&(ue=(0,i._)`${ue}${(0,i.getProperty)((0,u.unescapeJsonPointer)(Ve))}`,Fe=(0,i._)`${Fe} && ${ue}`);return Fe;function Te(Ve,ze){return`Cannot access ${Ve} ${ze} levels up, current level is ${N}`}}return Lt.getData=ce,Lt}var Ta={},nl;function on(){if(nl)return Ta;nl=1,Object.defineProperty(Ta,"__esModule",{value:!0});class t extends Error{constructor(a){super("validation failed"),this.errors=a,this.ajv=this.validation=!0}}return Ta.default=t,Ta}var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});const ln=rt;let nf=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,ln.resolveUrl)(e,a,s),this.missingSchema=(0,ln.normalizeId)((0,ln.getFullPath)(e,this.missingRef))}};Tr.default=nf;var ut={};Object.defineProperty(ut,"__esModule",{value:!0}),ut.resolveSchema=ut.getCompilingSchema=ut.resolveRef=ut.compileSchema=ut.SchemaEnv=void 0;const bt=be,of=on(),ur=Ct,Pt=rt,il=re,lf=ka();class Oa{constructor(e){var a;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(a=e.baseId)!==null&&a!==void 0?a:(0,Pt.normalizeId)(s==null?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s==null?void 0:s.$async,this.refs={}}}ut.SchemaEnv=Oa;function cn(t){const e=ol.call(this,t);if(e)return e;const a=(0,Pt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:r}=this.opts.code,{ownProperties:n}=this.opts,o=new bt.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let i;t.$async&&(i=o.scopeValue("Error",{ref:of.default,code:(0,bt._)`require("ajv/dist/runtime/validation_error").default`}));const l=o.scopeName("validate");t.validateName=l;const c={gen:o,allErrors:this.opts.allErrors,data:ur.default.data,parentData:ur.default.parentData,parentDataProperty:ur.default.parentDataProperty,dataNames:[ur.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,bt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:bt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,bt._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,lf.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);const f=o.toString();u=`${o.scopeRefs(ur.default.scope)}return ${f}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const d=new Function(`${ur.default.self}`,`${ur.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:d}),d.errors=null,d.schema=t.schema,d.schemaEnv=t,t.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:l,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){const{props:m,items:p}=c;d.evaluated={props:m instanceof bt.Name?void 0:m,items:p instanceof bt.Name?void 0:p,dynamicProps:m instanceof bt.Name,dynamicItems:p instanceof bt.Name},d.source&&(d.source.evaluated=(0,bt.stringify)(d.evaluated))}return t.validate=d,t}catch(f){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),f}finally{this._compilations.delete(t)}}ut.compileSchema=cn;function cf(t,e,a){var s;a=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a);const r=t.refs[a];if(r)return r;let n=ff.call(this,t,a);if(n===void 0){const o=(s=t.localRefs)===null||s===void 0?void 0:s[a],{schemaId:i}=this.opts;o&&(n=new Oa({schema:o,schemaId:i,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=uf.call(this,n)}ut.resolveRef=cf;function uf(t){return(0,Pt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:cn.call(this,t)}function ol(t){for(const e of this._compilations)if(df(e,t))return e}ut.getCompilingSchema=ol;function df(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function ff(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||Ca.call(this,t,e)}function Ca(t,e){const a=this.opts.uriResolver.parse(e),s=(0,Pt._getFullPath)(this.opts.uriResolver,a);let r=(0,Pt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===r)return un.call(this,a,t);const n=(0,Pt.normalizeId)(s),o=this.refs[n]||this.schemas[n];if(typeof o=="string"){const i=Ca.call(this,t,o);return typeof(i==null?void 0:i.schema)!="object"?void 0:un.call(this,a,i)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||cn.call(this,o),n===(0,Pt.normalizeId)(e)){const{schema:i}=o,{schemaId:l}=this.opts,c=i[l];return c&&(r=(0,Pt.resolveUrl)(this.opts.uriResolver,r,c)),new Oa({schema:i,schemaId:l,root:t,baseId:r})}return un.call(this,a,o)}}ut.resolveSchema=Ca;const hf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function un(t,{baseId:e,schema:a,root:s}){var r;if(((r=t.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(const i of t.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const l=a[(0,il.unescapeFragment)(i)];if(l===void 0)return;a=l;const c=typeof a=="object"&&a[this.opts.schemaId];!hf.has(i)&&c&&(e=(0,Pt.resolveUrl)(this.opts.uriResolver,e,c))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,il.schemaHasRulesButRef)(a,this.RULES)){const i=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=Ca.call(this,s,i)}const{schemaId:o}=this.opts;if(n=n||new Oa({schema:a,schemaId:o,root:s,baseId:e}),n.schema!==n.root.schema)return n}const pf={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var dn={},Ia={exports:{}},mf={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}};const{HEX:vf}=mf,gf=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function ll(t){if(dl(t,".")<3)return{host:t,isIPV4:!1};const e=t.match(gf)||[],[a]=e;return a?{host:_f(a,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function cl(t,e=!1){let a="",s=!0;for(const r of t){if(vf[r]===void 0)return;r!=="0"&&s===!0&&(s=!1),s||(a+=r)}return e&&a.length===0&&(a="0"),a}function yf(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,o=!1,i=!1;function l(){if(r.length){if(n===!1){const c=cl(r);if(c!==void 0)s.push(c);else return a.error=!0,!1}r.length=0}return!0}for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(i=!0),!l())break;if(e++,s.push(":"),e>7){a.error=!0;break}c-1>=0&&t[c-1]===":"&&(o=!0);continue}else if(u==="%"){if(!l())break;n=!0}else{r.push(u);continue}}return r.length&&(n?a.zone=r.join(""):i?s.push(r.join("")):s.push(cl(r))),a.address=s.join(""),a}function ul(t){if(dl(t,":")<2)return{host:t,isIPV6:!1};const e=yf(t);if(e.error)return{host:t,isIPV6:!1};{let a=e.address,s=e.address;return e.zone&&(a+="%"+e.zone,s+="%25"+e.zone),{host:a,escapedHost:s,isIPV6:!0}}}function _f(t,e){let a="",s=!0;const r=t.length;for(let n=0;n<r;n++){const o=t[n];o==="0"&&s?(n+1<=r&&t[n+1]===e||n+1===r)&&(a+=o,s=!1):(o===e?s=!0:s=!1,a+=o)}return a}function dl(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}const fl=/^\.\.?\//u,hl=/^\/\.(?:\/|$)/u,pl=/^\/\.\.(?:\/|$)/u,$f=/^\/?(?:.|\n)*?(?=\/|$)/u;function wf(t){const e=[];for(;t.length;)if(t.match(fl))t=t.replace(fl,"");else if(t.match(hl))t=t.replace(hl,"/");else if(t.match(pl))t=t.replace(pl,"/"),e.pop();else if(t==="."||t==="..")t="";else{const a=t.match($f);if(a){const s=a[0];t=t.slice(s.length),e.push(s)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function bf(t,e){const a=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=a(t.scheme)),t.userinfo!==void 0&&(t.userinfo=a(t.userinfo)),t.host!==void 0&&(t.host=a(t.host)),t.path!==void 0&&(t.path=a(t.path)),t.query!==void 0&&(t.query=a(t.query)),t.fragment!==void 0&&(t.fragment=a(t.fragment)),t}function Pf(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let a=unescape(t.host);const s=ll(a);if(s.isIPV4)a=s.host;else{const r=ul(s.host);r.isIPV6===!0?a=`[${r.escapedHost}]`:a=t.host}e.push(a)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}var Ef={recomposeAuthority:Pf,normalizeComponentEncoding:bf,removeDotSegments:wf,normalizeIPv4:ll,normalizeIPv6:ul};const Sf=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,Rf=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function ml(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function vl(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function gl(t){const e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function kf(t){return t.secure=ml(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Tf(t){if((t.port===(ml(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){const[e,a]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}function Of(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(Rf);if(a){const s=e.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];const r=`${s}:${e.nid||t.nid}`,n=fn[r];t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Cf(t,e){const a=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),r=`${a}:${e.nid||s}`,n=fn[r];n&&(t=n.serialize(t,e));const o=t,i=t.nss;return o.path=`${s||e.nid}:${i}`,e.skipEscape=!0,o}function If(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!Sf.test(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function Nf(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const yl={scheme:"http",domainHost:!0,parse:vl,serialize:gl},Af={scheme:"https",domainHost:yl.domainHost,parse:vl,serialize:gl},Na={scheme:"ws",domainHost:!0,parse:kf,serialize:Tf},jf={scheme:"wss",domainHost:Na.domainHost,parse:Na.parse,serialize:Na.serialize},fn={http:yl,https:Af,ws:Na,wss:jf,urn:{scheme:"urn",parse:Of,serialize:Cf,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:If,serialize:Nf,skipNormalize:!0}};var Df=fn;const{normalizeIPv6:xf,normalizeIPv4:Mf,removeDotSegments:Xr,recomposeAuthority:Lf,normalizeComponentEncoding:Aa}=Ef,hn=Df;function Ff(t,e){return typeof t=="string"?t=It(Ut(t,e),e):typeof t=="object"&&(t=Ut(It(t,e),e)),t}function qf(t,e,a){const s=Object.assign({scheme:"null"},a),r=_l(Ut(t,s),Ut(e,s),s,!0);return It(r,{...s,skipEscape:!0})}function _l(t,e,a,s){const r={};return s||(t=Ut(It(t,a),a),e=Ut(It(e,a),a)),a=a||{},!a.tolerant&&e.scheme?(r.scheme=e.scheme,r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=Xr(e.path||""),r.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=Xr(e.path||""),r.query=e.query):(e.path?(e.path.charAt(0)==="/"?r.path=Xr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?r.path="/"+e.path:t.path?r.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:r.path=e.path,r.path=Xr(r.path)),r.query=e.query):(r.path=t.path,e.query!==void 0?r.query=e.query:r.query=t.query),r.userinfo=t.userinfo,r.host=t.host,r.port=t.port),r.scheme=t.scheme),r.fragment=e.fragment,r}function Uf(t,e,a){return typeof t=="string"?(t=unescape(t),t=It(Aa(Ut(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=It(Aa(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=It(Aa(Ut(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=It(Aa(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function It(t,e){const a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},s=Object.assign({},e),r=[],n=hn[(s.scheme||a.scheme||"").toLowerCase()];n&&n.serialize&&n.serialize(a,s),a.path!==void 0&&(s.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),a.scheme!==void 0&&(a.path=a.path.split("%3A").join(":")))),s.reference!=="suffix"&&a.scheme&&r.push(a.scheme,":");const o=Lf(a);if(o!==void 0&&(s.reference!=="suffix"&&r.push("//"),r.push(o),a.path&&a.path.charAt(0)!=="/"&&r.push("/")),a.path!==void 0){let i=a.path;!s.absolutePath&&(!n||!n.absolutePath)&&(i=Xr(i)),o===void 0&&(i=i.replace(/^\/\//u,"/%2F")),r.push(i)}return a.query!==void 0&&r.push("?",a.query),a.fragment!==void 0&&r.push("#",a.fragment),r.join("")}const Vf=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function zf(t){let e=0;for(let a=0,s=t.length;a<s;++a)if(e=t.charCodeAt(a),e>126||Vf[e])return!0;return!1}const Hf=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ut(t,e){const a=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},r=t.indexOf("%")!==-1;let n=!1;a.reference==="suffix"&&(t=(a.scheme?a.scheme+":":"")+"//"+t);const o=t.match(Hf);if(o){if(s.scheme=o[1],s.userinfo=o[3],s.host=o[4],s.port=parseInt(o[5],10),s.path=o[6]||"",s.query=o[7],s.fragment=o[8],isNaN(s.port)&&(s.port=o[5]),s.host){const l=Mf(s.host);if(l.isIPV4===!1){const c=xf(l.host);s.host=c.host.toLowerCase(),n=c.isIPV6}else s.host=l.host,n=!0}s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",a.reference&&a.reference!=="suffix"&&a.reference!==s.reference&&(s.error=s.error||"URI is not a "+a.reference+" reference.");const i=hn[(a.scheme||s.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!i||!i.unicodeSupport)&&s.host&&(a.domainHost||i&&i.domainHost)&&n===!1&&zf(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(l){s.error=s.error||"Host's domain name can not be converted to ASCII: "+l}(!i||i&&!i.skipNormalize)&&(r&&s.scheme!==void 0&&(s.scheme=unescape(s.scheme)),r&&s.host!==void 0&&(s.host=unescape(s.host)),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),i&&i.parse&&i.parse(s,a)}else s.error=s.error||"URI can not be parsed.";return s}const pn={SCHEMES:hn,normalize:Ff,resolve:qf,resolveComponents:_l,equal:Uf,serialize:It,parse:Ut};Ia.exports=pn,Ia.exports.default=pn,Ia.exports.fastUri=pn;var Zf=Ia.exports;Object.defineProperty(dn,"__esModule",{value:!0});const $l=Zf;$l.code='require("ajv/dist/runtime/uri").default',dn.default=$l,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=ka();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var a=be;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});const s=on(),r=Tr,n=cr,o=ut,i=be,l=rt,c=Ge,u=re,f=pf,g=dn,d=(M,T)=>new RegExp(M,T);d.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$=200;function w(M){var T,q,I,y,b,x,G,te,me,ce,R,N,L,V,se,ue,Fe,Ye,Te,Ve,ze,De,Oe,tt,ir;const Qt=M.strict,br=(T=M.code)===null||T===void 0?void 0:T.optimize,Bs=br===!0||br===void 0?1:br||0,yt=(I=(q=M.code)===null||q===void 0?void 0:q.regExp)!==null&&I!==void 0?I:d,Pr=(y=M.uriResolver)!==null&&y!==void 0?y:g.default;return{strictSchema:(x=(b=M.strictSchema)!==null&&b!==void 0?b:Qt)!==null&&x!==void 0?x:!0,strictNumbers:(te=(G=M.strictNumbers)!==null&&G!==void 0?G:Qt)!==null&&te!==void 0?te:!0,strictTypes:(ce=(me=M.strictTypes)!==null&&me!==void 0?me:Qt)!==null&&ce!==void 0?ce:"log",strictTuples:(N=(R=M.strictTuples)!==null&&R!==void 0?R:Qt)!==null&&N!==void 0?N:"log",strictRequired:(V=(L=M.strictRequired)!==null&&L!==void 0?L:Qt)!==null&&V!==void 0?V:!1,code:M.code?{...M.code,optimize:Bs,regExp:yt}:{optimize:Bs,regExp:yt},loopRequired:(se=M.loopRequired)!==null&&se!==void 0?se:$,loopEnum:(ue=M.loopEnum)!==null&&ue!==void 0?ue:$,meta:(Fe=M.meta)!==null&&Fe!==void 0?Fe:!0,messages:(Ye=M.messages)!==null&&Ye!==void 0?Ye:!0,inlineRefs:(Te=M.inlineRefs)!==null&&Te!==void 0?Te:!0,schemaId:(Ve=M.schemaId)!==null&&Ve!==void 0?Ve:"$id",addUsedSchema:(ze=M.addUsedSchema)!==null&&ze!==void 0?ze:!0,validateSchema:(De=M.validateSchema)!==null&&De!==void 0?De:!0,validateFormats:(Oe=M.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(tt=M.unicodeRegExp)!==null&&tt!==void 0?tt:!0,int32range:(ir=M.int32range)!==null&&ir!==void 0?ir:!0,uriResolver:Pr}}class E{constructor(T={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,T=this.opts={...T,...w(T)};const{es5:q,lines:I}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:p,es5:q,lines:I}),this.logger=Q(T.logger);const y=T.validateFormats;T.validateFormats=!1,this.RULES=(0,n.getRules)(),k.call(this,h,T,"NOT SUPPORTED"),k.call(this,v,T,"DEPRECATED","warn"),this._metaOpts=X.call(this),T.formats&&z.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),T.keywords&&Z.call(this,T.keywords),typeof T.meta=="object"&&this.addMetaSchema(T.meta),H.call(this),T.validateFormats=y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:T,meta:q,schemaId:I}=this.opts;let y=f;I==="id"&&(y={...f},y.id=y.$id,delete y.$id),q&&T&&this.addMetaSchema(y,y[I],!1)}defaultMeta(){const{meta:T,schemaId:q}=this.opts;return this.opts.defaultMeta=typeof T=="object"?T[q]||T:void 0}validate(T,q){let I;if(typeof T=="string"){if(I=this.getSchema(T),!I)throw new Error(`no schema with key or ref "${T}"`)}else I=this.compile(T);const y=I(q);return"$async"in I||(this.errors=I.errors),y}compile(T,q){const I=this._addSchema(T,q);return I.validate||this._compileSchemaEnv(I)}compileAsync(T,q){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:I}=this.opts;return y.call(this,T,q);async function y(ce,R){await b.call(this,ce.$schema);const N=this._addSchema(ce,R);return N.validate||x.call(this,N)}async function b(ce){ce&&!this.getSchema(ce)&&await y.call(this,{$ref:ce},!0)}async function x(ce){try{return this._compileSchemaEnv(ce)}catch(R){if(!(R instanceof r.default))throw R;return G.call(this,R),await te.call(this,R.missingSchema),x.call(this,ce)}}function G({missingSchema:ce,missingRef:R}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${R} cannot be resolved`)}async function te(ce){const R=await me.call(this,ce);this.refs[ce]||await b.call(this,R.$schema),this.refs[ce]||this.addSchema(R,ce,q)}async function me(ce){const R=this._loading[ce];if(R)return R;try{return await(this._loading[ce]=I(ce))}finally{delete this._loading[ce]}}}addSchema(T,q,I,y=this.opts.validateSchema){if(Array.isArray(T)){for(const x of T)this.addSchema(x,void 0,I,y);return this}let b;if(typeof T=="object"){const{schemaId:x}=this.opts;if(b=T[x],b!==void 0&&typeof b!="string")throw new Error(`schema ${x} must be string`)}return q=(0,l.normalizeId)(q||b),this._checkUnique(q),this.schemas[q]=this._addSchema(T,I,q,y,!0),this}addMetaSchema(T,q,I=this.opts.validateSchema){return this.addSchema(T,q,!0,I),this}validateSchema(T,q){if(typeof T=="boolean")return!0;let I;if(I=T.$schema,I!==void 0&&typeof I!="string")throw new Error("$schema must be a string");if(I=I||this.opts.defaultMeta||this.defaultMeta(),!I)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const y=this.validate(I,T);if(!y&&q){const b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw new Error(b)}return y}getSchema(T){let q;for(;typeof(q=D.call(this,T))=="string";)T=q;if(q===void 0){const{schemaId:I}=this.opts,y=new o.SchemaEnv({schema:{},schemaId:I});if(q=o.resolveSchema.call(this,y,T),!q)return;this.refs[T]=q}return q.validate||this._compileSchemaEnv(q)}removeSchema(T){if(T instanceof RegExp)return this._removeAllSchemas(this.schemas,T),this._removeAllSchemas(this.refs,T),this;switch(typeof T){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const q=D.call(this,T);return typeof q=="object"&&this._cache.delete(q.schema),delete this.schemas[T],delete this.refs[T],this}case"object":{const q=T;this._cache.delete(q);let I=T[this.opts.schemaId];return I&&(I=(0,l.normalizeId)(I),delete this.schemas[I],delete this.refs[I]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(T){for(const q of T)this.addKeyword(q);return this}addKeyword(T,q){let I;if(typeof T=="string")I=T,typeof q=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),q.keyword=I);else if(typeof T=="object"&&q===void 0){if(q=T,I=q.keyword,Array.isArray(I)&&!I.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(F.call(this,I,q),!q)return(0,u.eachItem)(I,b=>ne.call(this,b)),this;he.call(this,q);const y={...q,type:(0,c.getJSONTypes)(q.type),schemaType:(0,c.getJSONTypes)(q.schemaType)};return(0,u.eachItem)(I,y.type.length===0?b=>ne.call(this,b,y):b=>y.type.forEach(x=>ne.call(this,b,y,x))),this}getKeyword(T){const q=this.RULES.all[T];return typeof q=="object"?q.definition:!!q}removeKeyword(T){const{RULES:q}=this;delete q.keywords[T],delete q.all[T];for(const I of q.rules){const y=I.rules.findIndex(b=>b.keyword===T);y>=0&&I.rules.splice(y,1)}return this}addFormat(T,q){return typeof q=="string"&&(q=new RegExp(q)),this.formats[T]=q,this}errorsText(T=this.errors,{separator:q=", ",dataVar:I="data"}={}){return!T||T.length===0?"No errors":T.map(y=>`${I}${y.instancePath} ${y.message}`).reduce((y,b)=>y+q+b)}$dataMetaSchema(T,q){const I=this.RULES.all;T=JSON.parse(JSON.stringify(T));for(const y of q){const b=y.split("/").slice(1);let x=T;for(const G of b)x=x[G];for(const G in I){const te=I[G];if(typeof te!="object")continue;const{$data:me}=te.definition,ce=x[G];me&&ce&&(x[G]=pe(ce))}}return T}_removeAllSchemas(T,q){for(const I in T){const y=T[I];(!q||q.test(I))&&(typeof y=="string"?delete T[I]:y&&!y.meta&&(this._cache.delete(y.schema),delete T[I]))}}_addSchema(T,q,I,y=this.opts.validateSchema,b=this.opts.addUsedSchema){let x;const{schemaId:G}=this.opts;if(typeof T=="object")x=T[G];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof T!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(T);if(te!==void 0)return te;I=(0,l.normalizeId)(x||I);const me=l.getSchemaRefs.call(this,T,I);return te=new o.SchemaEnv({schema:T,schemaId:G,meta:q,baseId:I,localRefs:me}),this._cache.set(te.schema,te),b&&!I.startsWith("#")&&(I&&this._checkUnique(I),this.refs[I]=te),y&&this.validateSchema(T,!0),te}_checkUnique(T){if(this.schemas[T]||this.refs[T])throw new Error(`schema with key or id "${T}" already exists`)}_compileSchemaEnv(T){if(T.meta?this._compileMetaSchema(T):o.compileSchema.call(this,T),!T.validate)throw new Error("ajv implementation error");return T.validate}_compileMetaSchema(T){const q=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,T)}finally{this.opts=q}}}E.ValidationError=s.default,E.MissingRefError=r.default,t.default=E;function k(M,T,q,I="error"){for(const y in M){const b=y;b in T&&this.logger[I](`${q}: option ${y}. ${M[b]}`)}}function D(M){return M=(0,l.normalizeId)(M),this.schemas[M]||this.refs[M]}function H(){const M=this.opts.schemas;if(M)if(Array.isArray(M))this.addSchema(M);else for(const T in M)this.addSchema(M[T],T)}function z(){for(const M in this.opts.formats){const T=this.opts.formats[M];T&&this.addFormat(M,T)}}function Z(M){if(Array.isArray(M)){this.addVocabulary(M);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const T in M){const q=M[T];q.keyword||(q.keyword=T),this.addKeyword(q)}}function X(){const M={...this.opts};for(const T of m)delete M[T];return M}const Y={log(){},warn(){},error(){}};function Q(M){if(M===!1)return Y;if(M===void 0)return console;if(M.log&&M.warn&&M.error)return M;throw new Error("logger must implement log, warn and error methods")}const U=/^[a-z_$][a-z0-9_$:-]*$/i;function F(M,T){const{RULES:q}=this;if((0,u.eachItem)(M,I=>{if(q.keywords[I])throw new Error(`Keyword ${I} is already defined`);if(!U.test(I))throw new Error(`Keyword ${I} has invalid name`)}),!!T&&T.$data&&!("code"in T||"validate"in T))throw new Error('$data keyword must have "code" or "validate" function')}function ne(M,T,q){var I;const y=T==null?void 0:T.post;if(q&&y)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:b}=this;let x=y?b.post:b.rules.find(({type:te})=>te===q);if(x||(x={type:q,rules:[]},b.rules.push(x)),b.keywords[M]=!0,!T)return;const G={keyword:M,definition:{...T,type:(0,c.getJSONTypes)(T.type),schemaType:(0,c.getJSONTypes)(T.schemaType)}};T.before?$e.call(this,x,G,T.before):x.rules.push(G),b.all[M]=G,(I=T.implements)===null||I===void 0||I.forEach(te=>this.addKeyword(te))}function $e(M,T,q){const I=M.rules.findIndex(y=>y.keyword===q);I>=0?M.rules.splice(I,0,T):(M.rules.push(T),this.logger.warn(`rule ${q} is not defined`))}function he(M){let{metaSchema:T}=M;T!==void 0&&(M.$data&&this.opts.$data&&(T=pe(T)),M.validateSchema=this.compile(T,!0))}const we={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function pe(M){return{anyOf:[M,we]}}}(xo);var mn={},vn={},gn={};Object.defineProperty(gn,"__esModule",{value:!0});const Kf={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};gn.default=Kf;var dr={};Object.defineProperty(dr,"__esModule",{value:!0}),dr.callRef=dr.getValidate=void 0;const Bf=Tr,wl=wt(),dt=be,Or=Ct,bl=ut,ja=re,Jf={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:o,opts:i,self:l}=s,{root:c}=n;if((a==="#"||a==="#/")&&r===c.baseId)return f();const u=bl.resolveRef.call(l,c,r,a);if(u===void 0)throw new Bf.default(s.opts.uriResolver,r,a);if(u instanceof bl.SchemaEnv)return g(u);return d(u);function f(){if(n===c)return Da(t,o,n,n.$async);const m=e.scopeValue("root",{ref:c});return Da(t,(0,dt._)`${m}.validate`,c,c.$async)}function g(m){const p=Pl(t,m);Da(t,p,m,m.$async)}function d(m){const p=e.scopeValue("schema",i.code.source===!0?{ref:m,code:(0,dt.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:dt.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(v),t.ok(h)}}};function Pl(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,dt._)`${a.scopeValue("wrapper",{ref:e})}.validate`}dr.getValidate=Pl;function Da(t,e,a,s){const{gen:r,it:n}=t,{allErrors:o,schemaEnv:i,opts:l}=n,c=l.passContext?Or.default.this:dt.nil;s?u():f();function u(){if(!i.$async)throw new Error("async schema referenced by sync schema");const m=r.let("valid");r.try(()=>{r.code((0,dt._)`await ${(0,wl.callValidateCode)(t,e,c)}`),d(e),o||r.assign(m,!0)},p=>{r.if((0,dt._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),g(p),o||r.assign(m,!1)}),t.ok(m)}function f(){t.result((0,wl.callValidateCode)(t,e,c),()=>d(e),()=>g(e))}function g(m){const p=(0,dt._)`${m}.errors`;r.assign(Or.default.vErrors,(0,dt._)`${Or.default.vErrors} === null ? ${p} : ${Or.default.vErrors}.concat(${p})`),r.assign(Or.default.errors,(0,dt._)`${Or.default.vErrors}.length`)}function d(m){var p;if(!n.opts.unevaluated)return;const h=(p=a==null?void 0:a.validate)===null||p===void 0?void 0:p.evaluated;if(n.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(n.props=ja.mergeEvaluated.props(r,h.props,n.props));else{const v=r.var("props",(0,dt._)`${m}.evaluated.props`);n.props=ja.mergeEvaluated.props(r,v,n.props,dt.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=ja.mergeEvaluated.items(r,h.items,n.items));else{const v=r.var("items",(0,dt._)`${m}.evaluated.items`);n.items=ja.mergeEvaluated.items(r,v,n.items,dt.Name)}}}dr.callRef=Da,dr.default=Jf,Object.defineProperty(vn,"__esModule",{value:!0});const Qf=gn,Gf=dr,Wf=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Qf.default,Gf.default];vn.default=Wf;var yn={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});const xa=be,Xt=xa.operators,Ma={maximum:{okStr:"<=",ok:Xt.LTE,fail:Xt.GT},minimum:{okStr:">=",ok:Xt.GTE,fail:Xt.LT},exclusiveMaximum:{okStr:"<",ok:Xt.LT,fail:Xt.GTE},exclusiveMinimum:{okStr:">",ok:Xt.GT,fail:Xt.LTE}},Xf={message:({keyword:t,schemaCode:e})=>(0,xa.str)`must be ${Ma[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,xa._)`{comparison: ${Ma[t].okStr}, limit: ${e}}`},Yf={keyword:Object.keys(Ma),type:"number",schemaType:"number",$data:!0,error:Xf,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,xa._)`${a} ${Ma[e].fail} ${s} || isNaN(${a})`)}};_n.default=Yf;var $n={};Object.defineProperty($n,"__esModule",{value:!0});const Yr=be,eh={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,Yr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Yr._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:a,schemaCode:s,it:r}=t,n=r.opts.multipleOfPrecision,o=e.let("res"),i=n?(0,Yr._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,Yr._)`${o} !== parseInt(${o})`;t.fail$data((0,Yr._)`(${s} === 0 || (${o} = ${a}/${s}, ${i}))`)}};$n.default=eh;var wn={},bn={};Object.defineProperty(bn,"__esModule",{value:!0});function El(t){const e=t.length;let a=0,s=0,r;for(;s<e;)a++,r=t.charCodeAt(s++),r>=55296&&r<=56319&&s<e&&(r=t.charCodeAt(s),(r&64512)===56320&&s++);return a}bn.default=El,El.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(wn,"__esModule",{value:!0});const fr=be,th=re,rh=bn,ah={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,fr.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,fr._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?fr.operators.GT:fr.operators.LT,o=r.opts.unicode===!1?(0,fr._)`${a}.length`:(0,fr._)`${(0,th.useFunc)(t.gen,rh.default)}(${a})`;t.fail$data((0,fr._)`${o} ${n} ${s}`)}};wn.default=ah;var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});const sh=wt(),La=be,nh={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,La.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,La._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,o=n.opts.unicodeRegExp?"u":"",i=a?(0,La._)`(new RegExp(${r}, ${o}))`:(0,sh.usePattern)(t,s);t.fail$data((0,La._)`!${i}.test(${e})`)}};Pn.default=nh;var En={};Object.defineProperty(En,"__esModule",{value:!0});const ea=be,ih={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,ea.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,ea._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?ea.operators.GT:ea.operators.LT;t.fail$data((0,ea._)`Object.keys(${a}).length ${r} ${s}`)}};En.default=ih;var Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});const ta=wt(),ra=be,oh=re,lh={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,ra.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ra._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:a,schemaCode:s,data:r,$data:n,it:o}=t,{opts:i}=o;if(!n&&a.length===0)return;const l=a.length>=i.loopRequired;if(o.allErrors?c():u(),i.strictRequired){const d=t.parentSchema.properties,{definedProperties:m}=t.it;for(const p of a)if((d==null?void 0:d[p])===void 0&&!m.has(p)){const h=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,oh.checkStrictMode)(o,v,o.opts.strictRequired)}}function c(){if(l||n)t.block$data(ra.nil,f);else for(const d of a)(0,ta.checkReportMissingProp)(t,d)}function u(){const d=e.let("missing");if(l||n){const m=e.let("valid",!0);t.block$data(m,()=>g(d,m)),t.ok(m)}else e.if((0,ta.checkMissingProp)(t,a,d)),(0,ta.reportMissingProp)(t,d),e.else()}function f(){e.forOf("prop",s,d=>{t.setParams({missingProperty:d}),e.if((0,ta.noPropertyInData)(e,r,d,i.ownProperties),()=>t.error())})}function g(d,m){t.setParams({missingProperty:d}),e.forOf(d,s,()=>{e.assign(m,(0,ta.propertyInData)(e,r,d,i.ownProperties)),e.if((0,ra.not)(m),()=>{t.error(),e.break()})},ra.nil)}}};Sn.default=lh;var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});const aa=be,ch={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,aa.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,aa._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?aa.operators.GT:aa.operators.LT;t.fail$data((0,aa._)`${a}.length ${r} ${s}`)}};Rn.default=ch;var kn={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});const Sl=Wr;Sl.code='require("ajv/dist/runtime/equal").default',sa.default=Sl,Object.defineProperty(kn,"__esModule",{value:!0});const Tn=Ge,at=be,uh=re,dh=sa,fh={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,at.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,at._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:o,it:i}=t;if(!s&&!r)return;const l=e.let("valid"),c=n.items?(0,Tn.getSchemaTypes)(n.items):[];t.block$data(l,u,(0,at._)`${o} === false`),t.ok(l);function u(){const m=e.let("i",(0,at._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(l,!0),e.if((0,at._)`${m} > 1`,()=>(f()?g:d)(m,p))}function f(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function g(m,p){const h=e.name("item"),v=(0,Tn.checkDataTypes)(c,h,i.opts.strictNumbers,Tn.DataType.Wrong),$=e.const("indices",(0,at._)`{}`);e.for((0,at._)`;${m}--;`,()=>{e.let(h,(0,at._)`${a}[${m}]`),e.if(v,(0,at._)`continue`),c.length>1&&e.if((0,at._)`typeof ${h} == "string"`,(0,at._)`${h} += "_"`),e.if((0,at._)`typeof ${$}[${h}] == "number"`,()=>{e.assign(p,(0,at._)`${$}[${h}]`),t.error(),e.assign(l,!1).break()}).code((0,at._)`${$}[${h}] = ${m}`)})}function d(m,p){const h=(0,uh.useFunc)(e,dh.default),v=e.name("outer");e.label(v).for((0,at._)`;${m}--;`,()=>e.for((0,at._)`${p} = ${m}; ${p}--;`,()=>e.if((0,at._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(l,!1).break(v)})))}}};kn.default=fh;var On={};Object.defineProperty(On,"__esModule",{value:!0});const Cn=be,hh=re,ph=sa,mh={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,Cn._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:a,$data:s,schemaCode:r,schema:n}=t;s||n&&typeof n=="object"?t.fail$data((0,Cn._)`!${(0,hh.useFunc)(e,ph.default)}(${a}, ${r})`):t.fail((0,Cn._)`${n} !== ${a}`)}};On.default=mh;var In={};Object.defineProperty(In,"__esModule",{value:!0});const na=be,vh=re,gh=sa,yh={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,na._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:a,$data:s,schema:r,schemaCode:n,it:o}=t;if(!s&&r.length===0)throw new Error("enum must have non-empty array");const i=r.length>=o.opts.loopEnum;let l;const c=()=>l??(l=(0,vh.useFunc)(e,gh.default));let u;if(i||s)u=e.let("valid"),t.block$data(u,f);else{if(!Array.isArray(r))throw new Error("ajv implementation error");const d=e.const("vSchema",n);u=(0,na.or)(...r.map((m,p)=>g(d,p)))}t.pass(u);function f(){e.assign(u,!1),e.forOf("v",n,d=>e.if((0,na._)`${c()}(${a}, ${d})`,()=>e.assign(u,!0).break()))}function g(d,m){const p=r[m];return typeof p=="object"&&p!==null?(0,na._)`${c()}(${a}, ${d}[${m}])`:(0,na._)`${a} === ${p}`}}};In.default=yh,Object.defineProperty(yn,"__esModule",{value:!0});const _h=_n,$h=$n,wh=wn,bh=Pn,Ph=En,Eh=Sn,Sh=Rn,Rh=kn,kh=On,Th=In,Oh=[_h.default,$h.default,wh.default,bh.default,Ph.default,Eh.default,Sh.default,Rh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},kh.default,Th.default];yn.default=Oh;var Nn={},Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.validateAdditionalItems=void 0;const hr=be,An=re,Ch={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,hr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,hr._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,An.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}Rl(t,s)}};function Rl(t,e){const{gen:a,schema:s,data:r,keyword:n,it:o}=t;o.items=!0;const i=a.const("len",(0,hr._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,hr._)`${i} <= ${e.length}`);else if(typeof s=="object"&&!(0,An.alwaysValidSchema)(o,s)){const c=a.var("valid",(0,hr._)`${i} <= ${e.length}`);a.if((0,hr.not)(c),()=>l(c)),t.ok(c)}function l(c){a.forRange("i",e.length,i,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:An.Type.Num},c),o.allErrors||a.if((0,hr.not)(c),()=>a.break())})}}Cr.validateAdditionalItems=Rl,Cr.default=Ch;var jn={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.validateTuple=void 0;const kl=be,Fa=re,Ih=wt(),Nh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return Tl(t,"additionalItems",e);a.items=!0,!(0,Fa.alwaysValidSchema)(a,e)&&t.ok((0,Ih.validateArray)(t))}};function Tl(t,e,a=t.schema){const{gen:s,parentSchema:r,data:n,keyword:o,it:i}=t;u(r),i.opts.unevaluated&&a.length&&i.items!==!0&&(i.items=Fa.mergeEvaluated.items(s,a.length,i.items));const l=s.name("valid"),c=s.const("len",(0,kl._)`${n}.length`);a.forEach((f,g)=>{(0,Fa.alwaysValidSchema)(i,f)||(s.if((0,kl._)`${c} > ${g}`,()=>t.subschema({keyword:o,schemaProp:g,dataProp:g},l)),t.ok(l))});function u(f){const{opts:g,errSchemaPath:d}=i,m=a.length,p=m===f.minItems&&(m===f.maxItems||f[e]===!1);if(g.strictTuples&&!p){const h=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${d}"`;(0,Fa.checkStrictMode)(i,h,g.strictTuples)}}}Ir.validateTuple=Tl,Ir.default=Nh,Object.defineProperty(jn,"__esModule",{value:!0});const Ah=Ir,jh={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Ah.validateTuple)(t,"items")};jn.default=jh;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const Ol=be,Dh=re,xh=wt(),Mh=Cr,Lh={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Ol.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ol._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,Dh.alwaysValidSchema)(s,e)&&(r?(0,Mh.validateAdditionalItems)(t,r):t.ok((0,xh.validateArray)(t)))}};Dn.default=Lh;var xn={};Object.defineProperty(xn,"__esModule",{value:!0});const mt=be,qa=re,Fh={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,mt.str)`must contain at least ${t} valid item(s)`:(0,mt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,mt._)`{minContains: ${t}}`:(0,mt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let o,i;const{minContains:l,maxContains:c}=s;n.opts.next?(o=l===void 0?1:l,i=c):o=1;const u=e.const("len",(0,mt._)`${r}.length`);if(t.setParams({min:o,max:i}),i===void 0&&o===0){(0,qa.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&o>i){(0,qa.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,qa.alwaysValidSchema)(n,a)){let p=(0,mt._)`${u} >= ${o}`;i!==void 0&&(p=(0,mt._)`${p} && ${u} <= ${i}`),t.pass(p);return}n.items=!0;const f=e.name("valid");i===void 0&&o===1?d(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),i!==void 0&&e.if((0,mt._)`${r}.length > 0`,g)):(e.let(f,!1),g()),t.result(f,()=>t.reset());function g(){const p=e.name("_valid"),h=e.let("count",0);d(p,()=>e.if(p,()=>m(h)))}function d(p,h){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:qa.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,mt._)`${p}++`),i===void 0?e.if((0,mt._)`${p} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,mt._)`${p} > ${i}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,mt._)`${p} >= ${o}`,()=>e.assign(f,!0)))}}};xn.default=Fh;var Cl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=be,a=re,s=wt();t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const f=c===1?"property":"properties";return(0,e.str)`must have ${f} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:f}})=>(0,e._)`{property: ${l},
|
|
5
|
+
|| ${o} === "boolean" || ${r} === null`).assign(i,(0,ye._)`[${r}]`)}}}function Hd({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,ye._)`${e} !== undefined`,()=>t.assign((0,ye._)`${e}[${a}]`,s))}function an(t,e,a,s=kr.Correct){const r=s===kr.Correct?ye.operators.EQ:ye.operators.NEQ;let n;switch(t){case"null":return(0,ye._)`${e} ${r} null`;case"array":n=(0,ye._)`Array.isArray(${e})`;break;case"object":n=(0,ye._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":n=o((0,ye._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":n=o();break;default:return(0,ye._)`typeof ${e} ${r} ${t}`}return s===kr.Correct?n:(0,ye.not)(n);function o(i=ye.nil){return(0,ye.and)((0,ye._)`typeof ${e} == "number"`,i,a?(0,ye._)`isFinite(${e})`:ye.nil)}}We.checkDataType=an;function sn(t,e,a,s){if(t.length===1)return an(t[0],e,a,s);let r;const n=(0,Go.toHash)(t);if(n.array&&n.object){const o=(0,ye._)`typeof ${e} != "object"`;r=n.null?o:(0,ye._)`!${e} || ${o}`,delete n.null,delete n.array,delete n.object}else r=ye.nil;n.number&&delete n.integer;for(const o in n)r=(0,ye.and)(r,an(o,e,a,s));return r}We.checkDataTypes=sn;const Zd={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ye._)`{type: ${t}}`:(0,ye._)`{type: ${e}}`};function nn(t){const e=Kd(t);(0,Fd.reportError)(e,Zd)}We.reportTypeError=nn;function Kd(t){const{gen:e,data:a,schema:s}=t,r=(0,Go.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var Wr={},Yo;function Bd(){if(Yo)return Wr;Yo=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.assignDefaults=void 0;const t=be,e=ee;function a(r,n){const{properties:o,items:i}=r.schema;if(n==="object"&&o)for(const l in o)s(r,l,o[l].default);else n==="array"&&Array.isArray(i)&&i.forEach((l,c)=>s(r,c,l.default))}Wr.assignDefaults=a;function s(r,n,o){const{gen:i,compositeRule:l,data:c,opts:u}=r;if(o===void 0)return;const f=(0,t._)`${c}${(0,t.getProperty)(n)}`;if(l){(0,e.checkStrictMode)(r,`default is ignored for: ${f}`);return}let g=(0,t._)`${f} === undefined`;u.useDefaults==="empty"&&(g=(0,t._)`${g} || ${f} === null || ${f} === ""`),i.if(g,(0,t._)`${f} = ${(0,t.stringify)(o)}`)}return Wr}var wt={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.validateUnion=Pe.validateArray=Pe.usePattern=Pe.callValidateCode=Pe.schemaProperties=Pe.allSchemaProperties=Pe.noPropertyInData=Pe.propertyInData=Pe.isOwnProperty=Pe.hasPropFunc=Pe.reportMissingProp=Pe.checkMissingProp=Pe.checkReportMissingProp=void 0;const Me=be,on=ee,Wt=Ct,Jd=ee;function Qd(t,e){const{gen:a,data:s,it:r}=t;a.if(cn(a,s,e,r.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Me._)`${e}`},!0),t.error()})}Pe.checkReportMissingProp=Qd;function Gd({gen:t,data:e,it:{opts:a}},s,r){return(0,Me.or)(...s.map(n=>(0,Me.and)(cn(t,e,n,a.ownProperties),(0,Me._)`${r} = ${n}`)))}Pe.checkMissingProp=Gd;function Wd(t,e){t.setParams({missingProperty:e},!0),t.error()}Pe.reportMissingProp=Wd;function el(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Me._)`Object.prototype.hasOwnProperty`})}Pe.hasPropFunc=el;function ln(t,e,a){return(0,Me._)`${el(t)}.call(${e}, ${a})`}Pe.isOwnProperty=ln;function Xd(t,e,a,s){const r=(0,Me._)`${e}${(0,Me.getProperty)(a)} !== undefined`;return s?(0,Me._)`${r} && ${ln(t,e,a)}`:r}Pe.propertyInData=Xd;function cn(t,e,a,s){const r=(0,Me._)`${e}${(0,Me.getProperty)(a)} === undefined`;return s?(0,Me.or)(r,(0,Me.not)(ln(t,e,a))):r}Pe.noPropertyInData=cn;function tl(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Pe.allSchemaProperties=tl;function Yd(t,e){return tl(e).filter(a=>!(0,on.alwaysValidSchema)(t,e[a]))}Pe.schemaProperties=Yd;function ef({schemaCode:t,data:e,it:{gen:a,topSchemaRef:s,schemaPath:r,errorPath:n},it:o},i,l,c){const u=c?(0,Me._)`${t}, ${e}, ${s}${r}`:e,f=[[Wt.default.instancePath,(0,Me.strConcat)(Wt.default.instancePath,n)],[Wt.default.parentData,o.parentData],[Wt.default.parentDataProperty,o.parentDataProperty],[Wt.default.rootData,Wt.default.rootData]];o.opts.dynamicRef&&f.push([Wt.default.dynamicAnchors,Wt.default.dynamicAnchors]);const g=(0,Me._)`${u}, ${a.object(...f)}`;return l!==Me.nil?(0,Me._)`${i}.call(${l}, ${g})`:(0,Me._)`${i}(${g})`}Pe.callValidateCode=ef;const tf=(0,Me._)`new RegExp`;function rf({gen:t,it:{opts:e}},a){const s=e.unicodeRegExp?"u":"",{regExp:r}=e.code,n=r(a,s);return t.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,Me._)`${r.code==="new RegExp"?tf:(0,Jd.useFunc)(t,r)}(${a}, ${s})`})}Pe.usePattern=rf;function af(t){const{gen:e,data:a,keyword:s,it:r}=t,n=e.name("valid");if(r.allErrors){const i=e.let("valid",!0);return o(()=>e.assign(i,!1)),i}return e.var(n,!0),o(()=>e.break()),n;function o(i){const l=e.const("len",(0,Me._)`${a}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:on.Type.Num},n),e.if((0,Me.not)(n),i)})}}Pe.validateArray=af;function sf(t){const{gen:e,schema:a,keyword:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(l=>(0,on.alwaysValidSchema)(r,l))&&!r.opts.unevaluated)return;const o=e.let("valid",!1),i=e.name("_valid");e.block(()=>a.forEach((l,c)=>{const u=t.subschema({keyword:s,schemaProp:c,compositeRule:!0},i);e.assign(o,(0,Me._)`${o} || ${i}`),t.mergeValidEvaluated(u,i)||e.if((0,Me.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Pe.validateUnion=sf;var rl;function nf(){if(rl)return wt;rl=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.validateKeywordUsage=wt.validSchemaType=wt.funcKeywordCode=wt.macroKeywordCode=void 0;const t=be,e=Ct,a=Pe,s=Qr;function r(g,d){const{gen:m,keyword:p,schema:h,parentSchema:v,it:$}=g,P=d.macro.call($.self,h,v,$),R=c(m,p,P);$.opts.validateSchema!==!1&&$.self.validateSchema(P,!0);const N=m.name("valid");g.subschema({schema:P,schemaPath:t.nil,errSchemaPath:`${$.errSchemaPath}/${p}`,topSchemaRef:R,compositeRule:!0},N),g.pass(N,()=>g.error(!0))}wt.macroKeywordCode=r;function n(g,d){var m;const{gen:p,keyword:h,schema:v,parentSchema:$,$data:P,it:R}=g;l(R,d);const N=!P&&d.compile?d.compile.call(R.self,v,$,R):d.validate,q=c(p,h,N),J=p.let("valid");g.block$data(J,K),g.ok((m=d.valid)!==null&&m!==void 0?m:J);function K(){if(d.errors===!1)re(),d.modifying&&o(g),Q(()=>g.error());else{const U=d.async?B():te();d.modifying&&o(g),Q(()=>i(g,U))}}function B(){const U=p.let("ruleErrs",null);return p.try(()=>re((0,t._)`await `),L=>p.assign(J,!1).if((0,t._)`${L} instanceof ${R.ValidationError}`,()=>p.assign(U,(0,t._)`${L}.errors`),()=>p.throw(L))),U}function te(){const U=(0,t._)`${q}.errors`;return p.assign(U,null),re(t.nil),U}function re(U=d.async?(0,t._)`await `:t.nil){const L=R.opts.passContext?e.default.this:e.default.self,ne=!("compile"in d&&!P||d.schema===!1);p.assign(J,(0,t._)`${U}${(0,a.callValidateCode)(g,q,L,ne)}`,d.modifying)}function Q(U){var L;p.if((0,t.not)((L=d.valid)!==null&&L!==void 0?L:J),U)}}wt.funcKeywordCode=n;function o(g){const{gen:d,data:m,it:p}=g;d.if(p.parentData,()=>d.assign(m,(0,t._)`${p.parentData}[${p.parentDataProperty}]`))}function i(g,d){const{gen:m}=g;m.if((0,t._)`Array.isArray(${d})`,()=>{m.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${d} : ${e.default.vErrors}.concat(${d})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,s.extendErrors)(g)},()=>g.error())}function l({schemaEnv:g},d){if(d.async&&!g.$async)throw new Error("async keyword in sync schema")}function c(g,d,m){if(m===void 0)throw new Error(`keyword "${d}" failed to compile`);return g.scopeValue("keyword",typeof m=="function"?{ref:m}:{ref:m,code:(0,t.stringify)(m)})}function u(g,d,m=!1){return!d.length||d.some(p=>p==="array"?Array.isArray(g):p==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==p||m&&typeof g>"u")}wt.validSchemaType=u;function f({schema:g,opts:d,self:m,errSchemaPath:p},h,v){if(Array.isArray(h.keyword)?!h.keyword.includes(v):h.keyword!==v)throw new Error("ajv implementation error");const $=h.dependencies;if($!=null&&$.some(P=>!Object.prototype.hasOwnProperty.call(g,P)))throw new Error(`parent schema must have dependencies of ${v}: ${$.join(",")}`);if(h.validateSchema&&!h.validateSchema(g[v])){const R=`keyword "${v}" value is invalid at path "${p}": `+m.errorsText(h.validateSchema.errors);if(d.validateSchema==="log")m.logger.error(R);else throw new Error(R)}}return wt.validateKeywordUsage=f,wt}var qt={},al;function of(){if(al)return qt;al=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.extendSubschemaMode=qt.extendSubschemaData=qt.getSubschema=void 0;const t=be,e=ee;function a(n,{keyword:o,schemaProp:i,schema:l,schemaPath:c,errSchemaPath:u,topSchemaRef:f}){if(o!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(o!==void 0){const g=n.schema[o];return i===void 0?{schema:g,schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(o)}`,errSchemaPath:`${n.errSchemaPath}/${o}`}:{schema:g[i],schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(o)}${(0,t.getProperty)(i)}`,errSchemaPath:`${n.errSchemaPath}/${o}/${(0,e.escapeFragment)(i)}`}}if(l!==void 0){if(c===void 0||u===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:f,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}qt.getSubschema=a;function s(n,o,{dataProp:i,dataPropType:l,data:c,dataTypes:u,propertyName:f}){if(c!==void 0&&i!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=o;if(i!==void 0){const{errorPath:m,dataPathArr:p,opts:h}=o,v=g.let("data",(0,t._)`${o.data}${(0,t.getProperty)(i)}`,!0);d(v),n.errorPath=(0,t.str)`${m}${(0,e.getErrorPath)(i,l,h.jsPropertySyntax)}`,n.parentDataProperty=(0,t._)`${i}`,n.dataPathArr=[...p,n.parentDataProperty]}if(c!==void 0){const m=c instanceof t.Name?c:g.let("data",c,!0);d(m),f!==void 0&&(n.propertyName=f)}u&&(n.dataTypes=u);function d(m){n.data=m,n.dataLevel=o.dataLevel+1,n.dataTypes=[],o.definedProperties=new Set,n.parentData=o.data,n.dataNames=[...o.dataNames,m]}}qt.extendSubschemaData=s;function r(n,{jtdDiscriminator:o,jtdMetadata:i,compositeRule:l,createErrors:c,allErrors:u}){l!==void 0&&(n.compositeRule=l),c!==void 0&&(n.createErrors=c),u!==void 0&&(n.allErrors=u),n.jtdDiscriminator=o,n.jtdMetadata=i}return qt.extendSubschemaMode=r,qt}var at={},Xr=function t(e,a){if(e===a)return!0;if(e&&a&&typeof e=="object"&&typeof a=="object"){if(e.constructor!==a.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=a.length)return!1;for(r=s;r--!==0;)if(!t(e[r],a[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===a.source&&e.flags===a.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===a.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===a.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(a).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(a,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!t(e[o],a[o]))return!1}return!0}return e!==e&&a!==a},sl={exports:{}},Xt=sl.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};Ta(e,s,r,t,"",t)};Xt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Xt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Xt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Xt.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};function Ta(t,e,a,s,r,n,o,i,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,l,c);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in Xt.arrayKeywords)for(var g=0;g<f.length;g++)Ta(t,e,a,f[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in Xt.propsKeywords){if(f&&typeof f=="object")for(var d in f)Ta(t,e,a,f[d],r+"/"+u+"/"+lf(d),n,r,u,s,d)}else(u in Xt.keywords||t.allKeys&&!(u in Xt.skipKeywords))&&Ta(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,o,i,l,c)}}function lf(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var cf=sl.exports;Object.defineProperty(at,"__esModule",{value:!0}),at.getSchemaRefs=at.resolveUrl=at.normalizeId=at._getFullPath=at.getFullPath=at.inlineRef=void 0;const uf=ee,df=Xr,ff=cf,hf=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function pf(t,e=!0){return typeof t=="boolean"?!0:e===!0?!un(t):e?nl(t)<=e:!1}at.inlineRef=pf;const mf=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function un(t){for(const e in t){if(mf.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(un)||typeof a=="object"&&un(a))return!0}return!1}function nl(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!hf.has(a)&&(typeof t[a]=="object"&&(0,uf.eachItem)(t[a],s=>e+=nl(s)),e===1/0))return 1/0}return e}function il(t,e="",a){a!==!1&&(e=Tr(e));const s=t.parse(e);return ol(t,s)}at.getFullPath=il;function ol(t,e){return t.serialize(e).split("#")[0]+"#"}at._getFullPath=ol;const vf=/#\/?$/;function Tr(t){return t?t.replace(vf,""):""}at.normalizeId=Tr;function gf(t,e,a){return a=Tr(a),t.resolve(e,a)}at.resolveUrl=gf;const yf=/^[a-z_][-a-z0-9._]*$/i;function _f(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=Tr(t[a]||e),n={"":r},o=il(s,r,!1),i={},l=new Set;return ff(t,{allKeys:!0},(f,g,d,m)=>{if(m===void 0)return;const p=o+g;let h=n[m];typeof f[a]=="string"&&(h=v.call(this,f[a])),$.call(this,f.$anchor),$.call(this,f.$dynamicAnchor),n[g]=h;function v(P){const R=this.opts.uriResolver.resolve;if(P=Tr(h?R(h,P):P),l.has(P))throw u(P);l.add(P);let N=this.refs[P];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?c(f,N.schema,P):P!==Tr(p)&&(P[0]==="#"?(c(f,i[P],P),i[P]=f):this.refs[P]=p),P}function $(P){if(typeof P=="string"){if(!yf.test(P))throw new Error(`invalid anchor "${P}"`);v.call(this,`#${P}`)}}}),i;function c(f,g,d){if(g!==void 0&&!df(f,g))throw u(d)}function u(f){return new Error(`reference "${f}" resolves to more than one schema`)}}at.getSchemaRefs=_f;var ll;function Oa(){if(ll)return Lt;ll=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.getData=Lt.KeywordCxt=Lt.validateFunctionCode=void 0;const t=Id(),e=We,a=Ft,s=We,r=Bd(),n=nf(),o=of(),i=be,l=Ct,c=at,u=ee,f=Qr;function g(S){if(N(S)&&(J(S),R(S))){h(S);return}d(S,()=>(0,t.topBoolOrEmptySchema)(S))}Lt.validateFunctionCode=g;function d({gen:S,validateName:I,schema:M,schemaEnv:V,opts:se},ue){se.code.es5?S.func(I,(0,i._)`${l.default.data}, ${l.default.valCxt}`,V.$async,()=>{S.code((0,i._)`"use strict"; ${$(M,se)}`),p(S,se),S.code(ue)}):S.func(I,(0,i._)`${l.default.data}, ${m(se)}`,V.$async,()=>S.code($(M,se)).code(ue))}function m(S){return(0,i._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${S.dynamicRef?(0,i._)`, ${l.default.dynamicAnchors}={}`:i.nil}}={}`}function p(S,I){S.if(l.default.valCxt,()=>{S.var(l.default.instancePath,(0,i._)`${l.default.valCxt}.${l.default.instancePath}`),S.var(l.default.parentData,(0,i._)`${l.default.valCxt}.${l.default.parentData}`),S.var(l.default.parentDataProperty,(0,i._)`${l.default.valCxt}.${l.default.parentDataProperty}`),S.var(l.default.rootData,(0,i._)`${l.default.valCxt}.${l.default.rootData}`),I.dynamicRef&&S.var(l.default.dynamicAnchors,(0,i._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{S.var(l.default.instancePath,(0,i._)`""`),S.var(l.default.parentData,(0,i._)`undefined`),S.var(l.default.parentDataProperty,(0,i._)`undefined`),S.var(l.default.rootData,l.default.data),I.dynamicRef&&S.var(l.default.dynamicAnchors,(0,i._)`{}`)})}function h(S){const{schema:I,opts:M,gen:V}=S;d(S,()=>{M.$comment&&I.$comment&&U(S),te(S),V.let(l.default.vErrors,null),V.let(l.default.errors,0),M.unevaluated&&v(S),K(S),L(S)})}function v(S){const{gen:I,validateName:M}=S;S.evaluated=I.const("evaluated",(0,i._)`${M}.evaluated`),I.if((0,i._)`${S.evaluated}.dynamicProps`,()=>I.assign((0,i._)`${S.evaluated}.props`,(0,i._)`undefined`)),I.if((0,i._)`${S.evaluated}.dynamicItems`,()=>I.assign((0,i._)`${S.evaluated}.items`,(0,i._)`undefined`))}function $(S,I){const M=typeof S=="object"&&S[I.schemaId];return M&&(I.code.source||I.code.process)?(0,i._)`/*# sourceURL=${M} */`:i.nil}function P(S,I){if(N(S)&&(J(S),R(S))){q(S,I);return}(0,t.boolOrEmptySchema)(S,I)}function R({schema:S,self:I}){if(typeof S=="boolean")return!S;for(const M in S)if(I.RULES.all[M])return!0;return!1}function N(S){return typeof S.schema!="boolean"}function q(S,I){const{schema:M,gen:V,opts:se}=S;se.$comment&&M.$comment&&U(S),re(S),Q(S);const ue=V.const("_errs",l.default.errors);K(S,ue),V.var(I,(0,i._)`${ue} === ${l.default.errors}`)}function J(S){(0,u.checkUnknownRules)(S),B(S)}function K(S,I){if(S.opts.jtd)return $e(S,[],!1,I);const M=(0,e.getSchemaTypes)(S.schema),V=(0,e.coerceAndCheckDataType)(S,M);$e(S,M,!V,I)}function B(S){const{schema:I,errSchemaPath:M,opts:V,self:se}=S;I.$ref&&V.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(I,se.RULES)&&se.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function te(S){const{schema:I,opts:M}=S;I.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,u.checkStrictMode)(S,"default is ignored in the schema root")}function re(S){const I=S.schema[S.opts.schemaId];I&&(S.baseId=(0,c.resolveUrl)(S.opts.uriResolver,S.baseId,I))}function Q(S){if(S.schema.$async&&!S.schemaEnv.$async)throw new Error("async schema in sync schema")}function U({gen:S,schemaEnv:I,schema:M,errSchemaPath:V,opts:se}){const ue=M.$comment;if(se.$comment===!0)S.code((0,i._)`${l.default.self}.logger.log(${ue})`);else if(typeof se.$comment=="function"){const qe=(0,i.str)`${V}/$comment`,et=S.scopeValue("root",{ref:I.root});S.code((0,i._)`${l.default.self}.opts.$comment(${ue}, ${qe}, ${et}.schema)`)}}function L(S){const{gen:I,schemaEnv:M,validateName:V,ValidationError:se,opts:ue}=S;M.$async?I.if((0,i._)`${l.default.errors} === 0`,()=>I.return(l.default.data),()=>I.throw((0,i._)`new ${se}(${l.default.vErrors})`)):(I.assign((0,i._)`${V}.errors`,l.default.vErrors),ue.unevaluated&&ne(S),I.return((0,i._)`${l.default.errors} === 0`))}function ne({gen:S,evaluated:I,props:M,items:V}){M instanceof i.Name&&S.assign((0,i._)`${I}.props`,M),V instanceof i.Name&&S.assign((0,i._)`${I}.items`,V)}function $e(S,I,M,V){const{gen:se,schema:ue,data:qe,allErrors:et,opts:Oe,self:ze}=S,{RULES:He}=ze;if(ue.$ref&&(Oe.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ue,He))){se.block(()=>G(S,"$ref",He.all.$ref.definition));return}Oe.jtd||we(S,I),se.block(()=>{for(const Ce of He.rules)De(Ce);De(He.post)});function De(Ce){(0,a.shouldUseGroup)(ue,Ce)&&(Ce.type?(se.if((0,s.checkDataType)(Ce.type,qe,Oe.strictNumbers)),he(S,Ce),I.length===1&&I[0]===Ce.type&&M&&(se.else(),(0,s.reportTypeError)(S)),se.endIf()):he(S,Ce),et||se.if((0,i._)`${l.default.errors} === ${V||0}`))}}function he(S,I){const{gen:M,schema:V,opts:{useDefaults:se}}=S;se&&(0,r.assignDefaults)(S,I.type),M.block(()=>{for(const ue of I.rules)(0,a.shouldUseRule)(V,ue)&&G(S,ue.keyword,ue.definition,I.type)})}function we(S,I){S.schemaEnv.meta||!S.opts.strictTypes||(pe(S,I),S.opts.allowUnionTypes||x(S,I),k(S,S.dataTypes))}function pe(S,I){if(I.length){if(!S.dataTypes.length){S.dataTypes=I;return}I.forEach(M=>{C(S.dataTypes,M)||w(S,`type "${M}" not allowed by context "${S.dataTypes.join(",")}"`)}),y(S,I)}}function x(S,I){I.length>1&&!(I.length===2&&I.includes("null"))&&w(S,"use allowUnionTypes to allow union type keyword")}function k(S,I){const M=S.self.RULES.all;for(const V in M){const se=M[V];if(typeof se=="object"&&(0,a.shouldUseRule)(S.schema,se)){const{type:ue}=se.definition;ue.length&&!ue.some(qe=>F(I,qe))&&w(S,`missing type "${ue.join(",")}" for keyword "${V}"`)}}}function F(S,I){return S.includes(I)||I==="number"&&S.includes("integer")}function C(S,I){return S.includes(I)||I==="integer"&&S.includes("number")}function y(S,I){const M=[];for(const V of S.dataTypes)C(I,V)?M.push(V):I.includes("integer")&&V==="number"&&M.push("integer");S.dataTypes=M}function w(S,I){const M=S.schemaEnv.baseId+S.errSchemaPath;I+=` at "${M}" (strictTypes)`,(0,u.checkStrictMode)(S,I,S.opts.strictTypes)}class D{constructor(I,M,V){if((0,n.validateKeywordUsage)(I,M,V),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=V,this.data=I.data,this.schema=I.schema[V],this.$data=M.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(I,this.schema,V,this.$data),this.schemaType=M.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=M,this.$data)this.schemaCode=I.gen.const("vSchema",ce(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=I.gen.const("_errs",l.default.errors))}result(I,M,V){this.failResult((0,i.not)(I),M,V)}failResult(I,M,V){this.gen.if(I),V?V():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(I,M){this.failResult((0,i.not)(I),void 0,M)}fail(I){if(I===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(I),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);const{schemaCode:M}=this;this.fail((0,i._)`${M} !== undefined && (${(0,i.or)(this.invalid$data(),I)})`)}error(I,M,V){if(M){this.setParams(M),this._error(I,V),this.setParams({});return}this._error(I,V)}_error(I,M){(I?f.reportExtraError:f.reportError)(this,this.def.error,M)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(I){this.allErrors||this.gen.if(I)}setParams(I,M){M?Object.assign(this.params,I):this.params=I}block$data(I,M,V=i.nil){this.gen.block(()=>{this.check$data(I,V),M()})}check$data(I=i.nil,M=i.nil){if(!this.$data)return;const{gen:V,schemaCode:se,schemaType:ue,def:qe}=this;V.if((0,i.or)((0,i._)`${se} === undefined`,M)),I!==i.nil&&V.assign(I,!0),(ue.length||qe.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),I!==i.nil&&V.assign(I,!1)),V.else()}invalid$data(){const{gen:I,schemaCode:M,schemaType:V,def:se,it:ue}=this;return(0,i.or)(qe(),et());function qe(){if(V.length){if(!(M instanceof i.Name))throw new Error("ajv implementation error");const Oe=Array.isArray(V)?V:[V];return(0,i._)`${(0,s.checkDataTypes)(Oe,M,ue.opts.strictNumbers,s.DataType.Wrong)}`}return i.nil}function et(){if(se.validateSchema){const Oe=I.scopeValue("validate$data",{ref:se.validateSchema});return(0,i._)`!${Oe}(${M})`}return i.nil}}subschema(I,M){const V=(0,o.getSubschema)(this.it,I);(0,o.extendSubschemaData)(V,this.it,I),(0,o.extendSubschemaMode)(V,I);const se={...this.it,...V,items:void 0,props:void 0};return P(se,M),se}mergeEvaluated(I,M){const{it:V,gen:se}=this;V.opts.unevaluated&&(V.props!==!0&&I.props!==void 0&&(V.props=u.mergeEvaluated.props(se,I.props,V.props,M)),V.items!==!0&&I.items!==void 0&&(V.items=u.mergeEvaluated.items(se,I.items,V.items,M)))}mergeValidEvaluated(I,M){const{it:V,gen:se}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return se.if(M,()=>this.mergeEvaluated(I,i.Name)),!0}}Lt.KeywordCxt=D;function G(S,I,M,V){const se=new D(S,M,I);"code"in M?M.code(se,V):se.$data&&M.validate?(0,n.funcKeywordCode)(se,M):"macro"in M?(0,n.macroKeywordCode)(se,M):(M.compile||M.validate)&&(0,n.funcKeywordCode)(se,M)}const Y=/^\/(?:[^~]|~0|~1)*$/,me=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ce(S,{dataLevel:I,dataNames:M,dataPathArr:V}){let se,ue;if(S==="")return l.default.rootData;if(S[0]==="/"){if(!Y.test(S))throw new Error(`Invalid JSON-pointer: ${S}`);se=S,ue=l.default.rootData}else{const ze=me.exec(S);if(!ze)throw new Error(`Invalid JSON-pointer: ${S}`);const He=+ze[1];if(se=ze[2],se==="#"){if(He>=I)throw new Error(Oe("property/index",He));return V[I-He]}if(He>I)throw new Error(Oe("data",He));if(ue=M[I-He],!se)return ue}let qe=ue;const et=se.split("/");for(const ze of et)ze&&(ue=(0,i._)`${ue}${(0,i.getProperty)((0,u.unescapeJsonPointer)(ze))}`,qe=(0,i._)`${qe} && ${ue}`);return qe;function Oe(ze,He){return`Cannot access ${ze} ${He} levels up, current level is ${I}`}}return Lt.getData=ce,Lt}var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});let $f=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Yr.default=$f;var Or={};Object.defineProperty(Or,"__esModule",{value:!0});const dn=at;let wf=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,dn.resolveUrl)(e,a,s),this.missingSchema=(0,dn.normalizeId)((0,dn.getFullPath)(e,this.missingRef))}};Or.default=wf;var dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.resolveSchema=dt.getCompilingSchema=dt.resolveRef=dt.compileSchema=dt.SchemaEnv=void 0;const bt=be,bf=Yr,dr=Ct,Pt=at,cl=ee,Pf=Oa();class Ca{constructor(e){var a;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(a=e.baseId)!==null&&a!==void 0?a:(0,Pt.normalizeId)(s==null?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s==null?void 0:s.$async,this.refs={}}}dt.SchemaEnv=Ca;function fn(t){const e=ul.call(this,t);if(e)return e;const a=(0,Pt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:r}=this.opts.code,{ownProperties:n}=this.opts,o=new bt.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let i;t.$async&&(i=o.scopeValue("Error",{ref:bf.default,code:(0,bt._)`require("ajv/dist/runtime/validation_error").default`}));const l=o.scopeName("validate");t.validateName=l;const c={gen:o,allErrors:this.opts.allErrors,data:dr.default.data,parentData:dr.default.parentData,parentDataProperty:dr.default.parentDataProperty,dataNames:[dr.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,bt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:bt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,bt._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,Pf.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);const f=o.toString();u=`${o.scopeRefs(dr.default.scope)}return ${f}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const d=new Function(`${dr.default.self}`,`${dr.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:d}),d.errors=null,d.schema=t.schema,d.schemaEnv=t,t.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:l,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){const{props:m,items:p}=c;d.evaluated={props:m instanceof bt.Name?void 0:m,items:p instanceof bt.Name?void 0:p,dynamicProps:m instanceof bt.Name,dynamicItems:p instanceof bt.Name},d.source&&(d.source.evaluated=(0,bt.stringify)(d.evaluated))}return t.validate=d,t}catch(f){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),f}finally{this._compilations.delete(t)}}dt.compileSchema=fn;function Ef(t,e,a){var s;a=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a);const r=t.refs[a];if(r)return r;let n=kf.call(this,t,a);if(n===void 0){const o=(s=t.localRefs)===null||s===void 0?void 0:s[a],{schemaId:i}=this.opts;o&&(n=new Ca({schema:o,schemaId:i,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=Sf.call(this,n)}dt.resolveRef=Ef;function Sf(t){return(0,Pt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:fn.call(this,t)}function ul(t){for(const e of this._compilations)if(Rf(e,t))return e}dt.getCompilingSchema=ul;function Rf(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function kf(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||Ia.call(this,t,e)}function Ia(t,e){const a=this.opts.uriResolver.parse(e),s=(0,Pt._getFullPath)(this.opts.uriResolver,a);let r=(0,Pt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===r)return hn.call(this,a,t);const n=(0,Pt.normalizeId)(s),o=this.refs[n]||this.schemas[n];if(typeof o=="string"){const i=Ia.call(this,t,o);return typeof(i==null?void 0:i.schema)!="object"?void 0:hn.call(this,a,i)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||fn.call(this,o),n===(0,Pt.normalizeId)(e)){const{schema:i}=o,{schemaId:l}=this.opts,c=i[l];return c&&(r=(0,Pt.resolveUrl)(this.opts.uriResolver,r,c)),new Ca({schema:i,schemaId:l,root:t,baseId:r})}return hn.call(this,a,o)}}dt.resolveSchema=Ia;const Tf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function hn(t,{baseId:e,schema:a,root:s}){var r;if(((r=t.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(const i of t.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const l=a[(0,cl.unescapeFragment)(i)];if(l===void 0)return;a=l;const c=typeof a=="object"&&a[this.opts.schemaId];!Tf.has(i)&&c&&(e=(0,Pt.resolveUrl)(this.opts.uriResolver,e,c))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,cl.schemaHasRulesButRef)(a,this.RULES)){const i=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=Ia.call(this,s,i)}const{schemaId:o}=this.opts;if(n=n||new Ca({schema:a,schemaId:o,root:s,baseId:e}),n.schema!==n.root.schema)return n}const Of={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var pn={},Na={exports:{}},Cf={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}};const{HEX:If}=Cf,Nf=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function dl(t){if(pl(t,".")<3)return{host:t,isIPV4:!1};const e=t.match(Nf)||[],[a]=e;return a?{host:jf(a,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function fl(t,e=!1){let a="",s=!0;for(const r of t){if(If[r]===void 0)return;r!=="0"&&s===!0&&(s=!1),s||(a+=r)}return e&&a.length===0&&(a="0"),a}function Af(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,o=!1,i=!1;function l(){if(r.length){if(n===!1){const c=fl(r);if(c!==void 0)s.push(c);else return a.error=!0,!1}r.length=0}return!0}for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(i=!0),!l())break;if(e++,s.push(":"),e>7){a.error=!0;break}c-1>=0&&t[c-1]===":"&&(o=!0);continue}else if(u==="%"){if(!l())break;n=!0}else{r.push(u);continue}}return r.length&&(n?a.zone=r.join(""):i?s.push(r.join("")):s.push(fl(r))),a.address=s.join(""),a}function hl(t){if(pl(t,":")<2)return{host:t,isIPV6:!1};const e=Af(t);if(e.error)return{host:t,isIPV6:!1};{let a=e.address,s=e.address;return e.zone&&(a+="%"+e.zone,s+="%25"+e.zone),{host:a,escapedHost:s,isIPV6:!0}}}function jf(t,e){let a="",s=!0;const r=t.length;for(let n=0;n<r;n++){const o=t[n];o==="0"&&s?(n+1<=r&&t[n+1]===e||n+1===r)&&(a+=o,s=!1):(o===e?s=!0:s=!1,a+=o)}return a}function pl(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}const ml=/^\.\.?\//u,vl=/^\/\.(?:\/|$)/u,gl=/^\/\.\.(?:\/|$)/u,Df=/^\/?(?:.|\n)*?(?=\/|$)/u;function xf(t){const e=[];for(;t.length;)if(t.match(ml))t=t.replace(ml,"");else if(t.match(vl))t=t.replace(vl,"/");else if(t.match(gl))t=t.replace(gl,"/"),e.pop();else if(t==="."||t==="..")t="";else{const a=t.match(Df);if(a){const s=a[0];t=t.slice(s.length),e.push(s)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function Mf(t,e){const a=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=a(t.scheme)),t.userinfo!==void 0&&(t.userinfo=a(t.userinfo)),t.host!==void 0&&(t.host=a(t.host)),t.path!==void 0&&(t.path=a(t.path)),t.query!==void 0&&(t.query=a(t.query)),t.fragment!==void 0&&(t.fragment=a(t.fragment)),t}function Lf(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let a=unescape(t.host);const s=dl(a);if(s.isIPV4)a=s.host;else{const r=hl(s.host);r.isIPV6===!0?a=`[${r.escapedHost}]`:a=t.host}e.push(a)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}var Ff={recomposeAuthority:Lf,normalizeComponentEncoding:Mf,removeDotSegments:xf,normalizeIPv4:dl,normalizeIPv6:hl};const qf=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,Uf=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function yl(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function _l(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function $l(t){const e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function Vf(t){return t.secure=yl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function zf(t){if((t.port===(yl(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){const[e,a]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=a,t.resourceName=void 0}return t.fragment=void 0,t}function Hf(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(Uf);if(a){const s=e.scheme||t.scheme||"urn";t.nid=a[1].toLowerCase(),t.nss=a[2];const r=`${s}:${e.nid||t.nid}`,n=mn[r];t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Zf(t,e){const a=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),r=`${a}:${e.nid||s}`,n=mn[r];n&&(t=n.serialize(t,e));const o=t,i=t.nss;return o.path=`${s||e.nid}:${i}`,e.skipEscape=!0,o}function Kf(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!qf.test(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function Bf(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const wl={scheme:"http",domainHost:!0,parse:_l,serialize:$l},Jf={scheme:"https",domainHost:wl.domainHost,parse:_l,serialize:$l},Aa={scheme:"ws",domainHost:!0,parse:Vf,serialize:zf},Qf={scheme:"wss",domainHost:Aa.domainHost,parse:Aa.parse,serialize:Aa.serialize},mn={http:wl,https:Jf,ws:Aa,wss:Qf,urn:{scheme:"urn",parse:Hf,serialize:Zf,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:Kf,serialize:Bf,skipNormalize:!0}};var Gf=mn;const{normalizeIPv6:Wf,normalizeIPv4:Xf,removeDotSegments:ea,recomposeAuthority:Yf,normalizeComponentEncoding:ja}=Ff,vn=Gf;function eh(t,e){return typeof t=="string"?t=It(Ut(t,e),e):typeof t=="object"&&(t=Ut(It(t,e),e)),t}function th(t,e,a){const s=Object.assign({scheme:"null"},a),r=bl(Ut(t,s),Ut(e,s),s,!0);return It(r,{...s,skipEscape:!0})}function bl(t,e,a,s){const r={};return s||(t=Ut(It(t,a),a),e=Ut(It(e,a),a)),a=a||{},!a.tolerant&&e.scheme?(r.scheme=e.scheme,r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=ea(e.path||""),r.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(r.userinfo=e.userinfo,r.host=e.host,r.port=e.port,r.path=ea(e.path||""),r.query=e.query):(e.path?(e.path.charAt(0)==="/"?r.path=ea(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?r.path="/"+e.path:t.path?r.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:r.path=e.path,r.path=ea(r.path)),r.query=e.query):(r.path=t.path,e.query!==void 0?r.query=e.query:r.query=t.query),r.userinfo=t.userinfo,r.host=t.host,r.port=t.port),r.scheme=t.scheme),r.fragment=e.fragment,r}function rh(t,e,a){return typeof t=="string"?(t=unescape(t),t=It(ja(Ut(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=It(ja(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=It(ja(Ut(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=It(ja(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function It(t,e){const a={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},s=Object.assign({},e),r=[],n=vn[(s.scheme||a.scheme||"").toLowerCase()];n&&n.serialize&&n.serialize(a,s),a.path!==void 0&&(s.skipEscape?a.path=unescape(a.path):(a.path=escape(a.path),a.scheme!==void 0&&(a.path=a.path.split("%3A").join(":")))),s.reference!=="suffix"&&a.scheme&&r.push(a.scheme,":");const o=Yf(a);if(o!==void 0&&(s.reference!=="suffix"&&r.push("//"),r.push(o),a.path&&a.path.charAt(0)!=="/"&&r.push("/")),a.path!==void 0){let i=a.path;!s.absolutePath&&(!n||!n.absolutePath)&&(i=ea(i)),o===void 0&&(i=i.replace(/^\/\//u,"/%2F")),r.push(i)}return a.query!==void 0&&r.push("?",a.query),a.fragment!==void 0&&r.push("#",a.fragment),r.join("")}const ah=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function sh(t){let e=0;for(let a=0,s=t.length;a<s;++a)if(e=t.charCodeAt(a),e>126||ah[e])return!0;return!1}const nh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ut(t,e){const a=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},r=t.indexOf("%")!==-1;let n=!1;a.reference==="suffix"&&(t=(a.scheme?a.scheme+":":"")+"//"+t);const o=t.match(nh);if(o){if(s.scheme=o[1],s.userinfo=o[3],s.host=o[4],s.port=parseInt(o[5],10),s.path=o[6]||"",s.query=o[7],s.fragment=o[8],isNaN(s.port)&&(s.port=o[5]),s.host){const l=Xf(s.host);if(l.isIPV4===!1){const c=Wf(l.host);s.host=c.host.toLowerCase(),n=c.isIPV6}else s.host=l.host,n=!0}s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",a.reference&&a.reference!=="suffix"&&a.reference!==s.reference&&(s.error=s.error||"URI is not a "+a.reference+" reference.");const i=vn[(a.scheme||s.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!i||!i.unicodeSupport)&&s.host&&(a.domainHost||i&&i.domainHost)&&n===!1&&sh(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(l){s.error=s.error||"Host's domain name can not be converted to ASCII: "+l}(!i||i&&!i.skipNormalize)&&(r&&s.scheme!==void 0&&(s.scheme=unescape(s.scheme)),r&&s.host!==void 0&&(s.host=unescape(s.host)),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),i&&i.parse&&i.parse(s,a)}else s.error=s.error||"URI can not be parsed.";return s}const gn={SCHEMES:vn,normalize:eh,resolve:th,resolveComponents:bl,equal:rh,serialize:It,parse:Ut};Na.exports=gn,Na.exports.default=gn,Na.exports.fastUri=gn;var ih=Na.exports;Object.defineProperty(pn,"__esModule",{value:!0});const Pl=ih;Pl.code='require("ajv/dist/runtime/uri").default',pn.default=Pl,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=Oa();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var a=be;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return a.CodeGen}});const s=Yr,r=Or,n=ur,o=dt,i=be,l=at,c=We,u=ee,f=Of,g=pn,d=(x,k)=>new RegExp(x,k);d.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$=200;function P(x){var k,F,C,y,w,D,G,Y,me,ce,S,I,M,V,se,ue,qe,et,Oe,ze,He,De,Ce,rt,or;const Qt=x.strict,Pr=(k=x.code)===null||k===void 0?void 0:k.optimize,Js=Pr===!0||Pr===void 0?1:Pr||0,_t=(C=(F=x.code)===null||F===void 0?void 0:F.regExp)!==null&&C!==void 0?C:d,Er=(y=x.uriResolver)!==null&&y!==void 0?y:g.default;return{strictSchema:(D=(w=x.strictSchema)!==null&&w!==void 0?w:Qt)!==null&&D!==void 0?D:!0,strictNumbers:(Y=(G=x.strictNumbers)!==null&&G!==void 0?G:Qt)!==null&&Y!==void 0?Y:!0,strictTypes:(ce=(me=x.strictTypes)!==null&&me!==void 0?me:Qt)!==null&&ce!==void 0?ce:"log",strictTuples:(I=(S=x.strictTuples)!==null&&S!==void 0?S:Qt)!==null&&I!==void 0?I:"log",strictRequired:(V=(M=x.strictRequired)!==null&&M!==void 0?M:Qt)!==null&&V!==void 0?V:!1,code:x.code?{...x.code,optimize:Js,regExp:_t}:{optimize:Js,regExp:_t},loopRequired:(se=x.loopRequired)!==null&&se!==void 0?se:$,loopEnum:(ue=x.loopEnum)!==null&&ue!==void 0?ue:$,meta:(qe=x.meta)!==null&&qe!==void 0?qe:!0,messages:(et=x.messages)!==null&&et!==void 0?et:!0,inlineRefs:(Oe=x.inlineRefs)!==null&&Oe!==void 0?Oe:!0,schemaId:(ze=x.schemaId)!==null&&ze!==void 0?ze:"$id",addUsedSchema:(He=x.addUsedSchema)!==null&&He!==void 0?He:!0,validateSchema:(De=x.validateSchema)!==null&&De!==void 0?De:!0,validateFormats:(Ce=x.validateFormats)!==null&&Ce!==void 0?Ce:!0,unicodeRegExp:(rt=x.unicodeRegExp)!==null&&rt!==void 0?rt:!0,int32range:(or=x.int32range)!==null&&or!==void 0?or:!0,uriResolver:Er}}class R{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...P(k)};const{es5:F,lines:C}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:p,es5:F,lines:C}),this.logger=Q(k.logger);const y=k.validateFormats;k.validateFormats=!1,this.RULES=(0,n.getRules)(),N.call(this,h,k,"NOT SUPPORTED"),N.call(this,v,k,"DEPRECATED","warn"),this._metaOpts=te.call(this),k.formats&&K.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&B.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),J.call(this),k.validateFormats=y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:F,schemaId:C}=this.opts;let y=f;C==="id"&&(y={...f},y.id=y.$id,delete y.$id),F&&k&&this.addMetaSchema(y,y[C],!1)}defaultMeta(){const{meta:k,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[F]||k:void 0}validate(k,F){let C;if(typeof k=="string"){if(C=this.getSchema(k),!C)throw new Error(`no schema with key or ref "${k}"`)}else C=this.compile(k);const y=C(F);return"$async"in C||(this.errors=C.errors),y}compile(k,F){const C=this._addSchema(k,F);return C.validate||this._compileSchemaEnv(C)}compileAsync(k,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:C}=this.opts;return y.call(this,k,F);async function y(ce,S){await w.call(this,ce.$schema);const I=this._addSchema(ce,S);return I.validate||D.call(this,I)}async function w(ce){ce&&!this.getSchema(ce)&&await y.call(this,{$ref:ce},!0)}async function D(ce){try{return this._compileSchemaEnv(ce)}catch(S){if(!(S instanceof r.default))throw S;return G.call(this,S),await Y.call(this,S.missingSchema),D.call(this,ce)}}function G({missingSchema:ce,missingRef:S}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${S} cannot be resolved`)}async function Y(ce){const S=await me.call(this,ce);this.refs[ce]||await w.call(this,S.$schema),this.refs[ce]||this.addSchema(S,ce,F)}async function me(ce){const S=this._loading[ce];if(S)return S;try{return await(this._loading[ce]=C(ce))}finally{delete this._loading[ce]}}}addSchema(k,F,C,y=this.opts.validateSchema){if(Array.isArray(k)){for(const D of k)this.addSchema(D,void 0,C,y);return this}let w;if(typeof k=="object"){const{schemaId:D}=this.opts;if(w=k[D],w!==void 0&&typeof w!="string")throw new Error(`schema ${D} must be string`)}return F=(0,l.normalizeId)(F||w),this._checkUnique(F),this.schemas[F]=this._addSchema(k,C,F,y,!0),this}addMetaSchema(k,F,C=this.opts.validateSchema){return this.addSchema(k,F,!0,C),this}validateSchema(k,F){if(typeof k=="boolean")return!0;let C;if(C=k.$schema,C!==void 0&&typeof C!="string")throw new Error("$schema must be a string");if(C=C||this.opts.defaultMeta||this.defaultMeta(),!C)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const y=this.validate(C,k);if(!y&&F){const w="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(w);else throw new Error(w)}return y}getSchema(k){let F;for(;typeof(F=q.call(this,k))=="string";)k=F;if(F===void 0){const{schemaId:C}=this.opts,y=new o.SchemaEnv({schema:{},schemaId:C});if(F=o.resolveSchema.call(this,y,k),!F)return;this.refs[k]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=q.call(this,k);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const F=k;this._cache.delete(F);let C=k[this.opts.schemaId];return C&&(C=(0,l.normalizeId)(C),delete this.schemas[C],delete this.refs[C]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const F of k)this.addKeyword(F);return this}addKeyword(k,F){let C;if(typeof k=="string")C=k,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=C);else if(typeof k=="object"&&F===void 0){if(F=k,C=F.keyword,Array.isArray(C)&&!C.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(L.call(this,C,F),!F)return(0,u.eachItem)(C,w=>ne.call(this,w)),this;he.call(this,F);const y={...F,type:(0,c.getJSONTypes)(F.type),schemaType:(0,c.getJSONTypes)(F.schemaType)};return(0,u.eachItem)(C,y.type.length===0?w=>ne.call(this,w,y):w=>y.type.forEach(D=>ne.call(this,w,y,D))),this}getKeyword(k){const F=this.RULES.all[k];return typeof F=="object"?F.definition:!!F}removeKeyword(k){const{RULES:F}=this;delete F.keywords[k],delete F.all[k];for(const C of F.rules){const y=C.rules.findIndex(w=>w.keyword===k);y>=0&&C.rules.splice(y,1)}return this}addFormat(k,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[k]=F,this}errorsText(k=this.errors,{separator:F=", ",dataVar:C="data"}={}){return!k||k.length===0?"No errors":k.map(y=>`${C}${y.instancePath} ${y.message}`).reduce((y,w)=>y+F+w)}$dataMetaSchema(k,F){const C=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const y of F){const w=y.split("/").slice(1);let D=k;for(const G of w)D=D[G];for(const G in C){const Y=C[G];if(typeof Y!="object")continue;const{$data:me}=Y.definition,ce=D[G];me&&ce&&(D[G]=pe(ce))}}return k}_removeAllSchemas(k,F){for(const C in k){const y=k[C];(!F||F.test(C))&&(typeof y=="string"?delete k[C]:y&&!y.meta&&(this._cache.delete(y.schema),delete k[C]))}}_addSchema(k,F,C,y=this.opts.validateSchema,w=this.opts.addUsedSchema){let D;const{schemaId:G}=this.opts;if(typeof k=="object")D=k[G];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let Y=this._cache.get(k);if(Y!==void 0)return Y;C=(0,l.normalizeId)(D||C);const me=l.getSchemaRefs.call(this,k,C);return Y=new o.SchemaEnv({schema:k,schemaId:G,meta:F,baseId:C,localRefs:me}),this._cache.set(Y.schema,Y),w&&!C.startsWith("#")&&(C&&this._checkUnique(C),this.refs[C]=Y),y&&this.validateSchema(k,!0),Y}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):o.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const F=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,k)}finally{this.opts=F}}}R.ValidationError=s.default,R.MissingRefError=r.default,t.default=R;function N(x,k,F,C="error"){for(const y in x){const w=y;w in k&&this.logger[C](`${F}: option ${y}. ${x[w]}`)}}function q(x){return x=(0,l.normalizeId)(x),this.schemas[x]||this.refs[x]}function J(){const x=this.opts.schemas;if(x)if(Array.isArray(x))this.addSchema(x);else for(const k in x)this.addSchema(x[k],k)}function K(){for(const x in this.opts.formats){const k=this.opts.formats[x];k&&this.addFormat(x,k)}}function B(x){if(Array.isArray(x)){this.addVocabulary(x);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in x){const F=x[k];F.keyword||(F.keyword=k),this.addKeyword(F)}}function te(){const x={...this.opts};for(const k of m)delete x[k];return x}const re={log(){},warn(){},error(){}};function Q(x){if(x===!1)return re;if(x===void 0)return console;if(x.log&&x.warn&&x.error)return x;throw new Error("logger must implement log, warn and error methods")}const U=/^[a-z_$][a-z0-9_$:-]*$/i;function L(x,k){const{RULES:F}=this;if((0,u.eachItem)(x,C=>{if(F.keywords[C])throw new Error(`Keyword ${C} is already defined`);if(!U.test(C))throw new Error(`Keyword ${C} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function ne(x,k,F){var C;const y=k==null?void 0:k.post;if(F&&y)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:w}=this;let D=y?w.post:w.rules.find(({type:Y})=>Y===F);if(D||(D={type:F,rules:[]},w.rules.push(D)),w.keywords[x]=!0,!k)return;const G={keyword:x,definition:{...k,type:(0,c.getJSONTypes)(k.type),schemaType:(0,c.getJSONTypes)(k.schemaType)}};k.before?$e.call(this,D,G,k.before):D.rules.push(G),w.all[x]=G,(C=k.implements)===null||C===void 0||C.forEach(Y=>this.addKeyword(Y))}function $e(x,k,F){const C=x.rules.findIndex(y=>y.keyword===F);C>=0?x.rules.splice(C,0,k):(x.rules.push(k),this.logger.warn(`rule ${F} is not defined`))}function he(x){let{metaSchema:k}=x;k!==void 0&&(x.$data&&this.opts.$data&&(k=pe(k)),x.validateSchema=this.compile(k,!0))}const we={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function pe(x){return{anyOf:[x,we]}}}(Fo);var yn={},_n={},$n={};Object.defineProperty($n,"__esModule",{value:!0});const oh={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$n.default=oh;var fr={};Object.defineProperty(fr,"__esModule",{value:!0}),fr.callRef=fr.getValidate=void 0;const lh=Or,El=Pe,ft=be,Cr=Ct,Sl=dt,Da=ee,ch={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:o,opts:i,self:l}=s,{root:c}=n;if((a==="#"||a==="#/")&&r===c.baseId)return f();const u=Sl.resolveRef.call(l,c,r,a);if(u===void 0)throw new lh.default(s.opts.uriResolver,r,a);if(u instanceof Sl.SchemaEnv)return g(u);return d(u);function f(){if(n===c)return xa(t,o,n,n.$async);const m=e.scopeValue("root",{ref:c});return xa(t,(0,ft._)`${m}.validate`,c,c.$async)}function g(m){const p=Rl(t,m);xa(t,p,m,m.$async)}function d(m){const p=e.scopeValue("schema",i.code.source===!0?{ref:m,code:(0,ft.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:ft.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(v),t.ok(h)}}};function Rl(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,ft._)`${a.scopeValue("wrapper",{ref:e})}.validate`}fr.getValidate=Rl;function xa(t,e,a,s){const{gen:r,it:n}=t,{allErrors:o,schemaEnv:i,opts:l}=n,c=l.passContext?Cr.default.this:ft.nil;s?u():f();function u(){if(!i.$async)throw new Error("async schema referenced by sync schema");const m=r.let("valid");r.try(()=>{r.code((0,ft._)`await ${(0,El.callValidateCode)(t,e,c)}`),d(e),o||r.assign(m,!0)},p=>{r.if((0,ft._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),g(p),o||r.assign(m,!1)}),t.ok(m)}function f(){t.result((0,El.callValidateCode)(t,e,c),()=>d(e),()=>g(e))}function g(m){const p=(0,ft._)`${m}.errors`;r.assign(Cr.default.vErrors,(0,ft._)`${Cr.default.vErrors} === null ? ${p} : ${Cr.default.vErrors}.concat(${p})`),r.assign(Cr.default.errors,(0,ft._)`${Cr.default.vErrors}.length`)}function d(m){var p;if(!n.opts.unevaluated)return;const h=(p=a==null?void 0:a.validate)===null||p===void 0?void 0:p.evaluated;if(n.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(n.props=Da.mergeEvaluated.props(r,h.props,n.props));else{const v=r.var("props",(0,ft._)`${m}.evaluated.props`);n.props=Da.mergeEvaluated.props(r,v,n.props,ft.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=Da.mergeEvaluated.items(r,h.items,n.items));else{const v=r.var("items",(0,ft._)`${m}.evaluated.items`);n.items=Da.mergeEvaluated.items(r,v,n.items,ft.Name)}}}fr.callRef=xa,fr.default=ch,Object.defineProperty(_n,"__esModule",{value:!0});const uh=$n,dh=fr,fh=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",uh.default,dh.default];_n.default=fh;var wn={},bn={};Object.defineProperty(bn,"__esModule",{value:!0});const Ma=be,Yt=Ma.operators,La={maximum:{okStr:"<=",ok:Yt.LTE,fail:Yt.GT},minimum:{okStr:">=",ok:Yt.GTE,fail:Yt.LT},exclusiveMaximum:{okStr:"<",ok:Yt.LT,fail:Yt.GTE},exclusiveMinimum:{okStr:">",ok:Yt.GT,fail:Yt.LTE}},hh={message:({keyword:t,schemaCode:e})=>(0,Ma.str)`must be ${La[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ma._)`{comparison: ${La[t].okStr}, limit: ${e}}`},ph={keyword:Object.keys(La),type:"number",schemaType:"number",$data:!0,error:hh,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,Ma._)`${a} ${La[e].fail} ${s} || isNaN(${a})`)}};bn.default=ph;var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});const ta=be,mh={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,ta.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ta._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:a,schemaCode:s,it:r}=t,n=r.opts.multipleOfPrecision,o=e.let("res"),i=n?(0,ta._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,ta._)`${o} !== parseInt(${o})`;t.fail$data((0,ta._)`(${s} === 0 || (${o} = ${a}/${s}, ${i}))`)}};Pn.default=mh;var En={},Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});function kl(t){const e=t.length;let a=0,s=0,r;for(;s<e;)a++,r=t.charCodeAt(s++),r>=55296&&r<=56319&&s<e&&(r=t.charCodeAt(s),(r&64512)===56320&&s++);return a}Sn.default=kl,kl.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(En,"__esModule",{value:!0});const hr=be,vh=ee,gh=Sn,yh={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,hr.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,hr._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?hr.operators.GT:hr.operators.LT,o=r.opts.unicode===!1?(0,hr._)`${a}.length`:(0,hr._)`${(0,vh.useFunc)(t.gen,gh.default)}(${a})`;t.fail$data((0,hr._)`${o} ${n} ${s}`)}};En.default=yh;var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});const _h=Pe,Fa=be,$h={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Fa.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Fa._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,o=n.opts.unicodeRegExp?"u":"",i=a?(0,Fa._)`(new RegExp(${r}, ${o}))`:(0,_h.usePattern)(t,s);t.fail$data((0,Fa._)`!${i}.test(${e})`)}};Rn.default=$h;var kn={};Object.defineProperty(kn,"__esModule",{value:!0});const ra=be,wh={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,ra.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,ra._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?ra.operators.GT:ra.operators.LT;t.fail$data((0,ra._)`Object.keys(${a}).length ${r} ${s}`)}};kn.default=wh;var Tn={};Object.defineProperty(Tn,"__esModule",{value:!0});const aa=Pe,sa=be,bh=ee,Ph={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,sa.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,sa._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:a,schemaCode:s,data:r,$data:n,it:o}=t,{opts:i}=o;if(!n&&a.length===0)return;const l=a.length>=i.loopRequired;if(o.allErrors?c():u(),i.strictRequired){const d=t.parentSchema.properties,{definedProperties:m}=t.it;for(const p of a)if((d==null?void 0:d[p])===void 0&&!m.has(p)){const h=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,bh.checkStrictMode)(o,v,o.opts.strictRequired)}}function c(){if(l||n)t.block$data(sa.nil,f);else for(const d of a)(0,aa.checkReportMissingProp)(t,d)}function u(){const d=e.let("missing");if(l||n){const m=e.let("valid",!0);t.block$data(m,()=>g(d,m)),t.ok(m)}else e.if((0,aa.checkMissingProp)(t,a,d)),(0,aa.reportMissingProp)(t,d),e.else()}function f(){e.forOf("prop",s,d=>{t.setParams({missingProperty:d}),e.if((0,aa.noPropertyInData)(e,r,d,i.ownProperties),()=>t.error())})}function g(d,m){t.setParams({missingProperty:d}),e.forOf(d,s,()=>{e.assign(m,(0,aa.propertyInData)(e,r,d,i.ownProperties)),e.if((0,sa.not)(m),()=>{t.error(),e.break()})},sa.nil)}}};Tn.default=Ph;var On={};Object.defineProperty(On,"__esModule",{value:!0});const na=be,Eh={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,na.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,na._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?na.operators.GT:na.operators.LT;t.fail$data((0,na._)`${a}.length ${r} ${s}`)}};On.default=Eh;var Cn={},ia={};Object.defineProperty(ia,"__esModule",{value:!0});const Tl=Xr;Tl.code='require("ajv/dist/runtime/equal").default',ia.default=Tl,Object.defineProperty(Cn,"__esModule",{value:!0});const In=We,st=be,Sh=ee,Rh=ia,kh={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,st.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,st._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:o,it:i}=t;if(!s&&!r)return;const l=e.let("valid"),c=n.items?(0,In.getSchemaTypes)(n.items):[];t.block$data(l,u,(0,st._)`${o} === false`),t.ok(l);function u(){const m=e.let("i",(0,st._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(l,!0),e.if((0,st._)`${m} > 1`,()=>(f()?g:d)(m,p))}function f(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function g(m,p){const h=e.name("item"),v=(0,In.checkDataTypes)(c,h,i.opts.strictNumbers,In.DataType.Wrong),$=e.const("indices",(0,st._)`{}`);e.for((0,st._)`;${m}--;`,()=>{e.let(h,(0,st._)`${a}[${m}]`),e.if(v,(0,st._)`continue`),c.length>1&&e.if((0,st._)`typeof ${h} == "string"`,(0,st._)`${h} += "_"`),e.if((0,st._)`typeof ${$}[${h}] == "number"`,()=>{e.assign(p,(0,st._)`${$}[${h}]`),t.error(),e.assign(l,!1).break()}).code((0,st._)`${$}[${h}] = ${m}`)})}function d(m,p){const h=(0,Sh.useFunc)(e,Rh.default),v=e.name("outer");e.label(v).for((0,st._)`;${m}--;`,()=>e.for((0,st._)`${p} = ${m}; ${p}--;`,()=>e.if((0,st._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(l,!1).break(v)})))}}};Cn.default=kh;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const An=be,Th=ee,Oh=ia,Ch={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,An._)`{allowedValue: ${t}}`},code(t){const{gen:e,data:a,$data:s,schemaCode:r,schema:n}=t;s||n&&typeof n=="object"?t.fail$data((0,An._)`!${(0,Th.useFunc)(e,Oh.default)}(${a}, ${r})`):t.fail((0,An._)`${n} !== ${a}`)}};Nn.default=Ch;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});const oa=be,Ih=ee,Nh=ia,Ah={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,oa._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:a,$data:s,schema:r,schemaCode:n,it:o}=t;if(!s&&r.length===0)throw new Error("enum must have non-empty array");const i=r.length>=o.opts.loopEnum;let l;const c=()=>l??(l=(0,Ih.useFunc)(e,Nh.default));let u;if(i||s)u=e.let("valid"),t.block$data(u,f);else{if(!Array.isArray(r))throw new Error("ajv implementation error");const d=e.const("vSchema",n);u=(0,oa.or)(...r.map((m,p)=>g(d,p)))}t.pass(u);function f(){e.assign(u,!1),e.forOf("v",n,d=>e.if((0,oa._)`${c()}(${a}, ${d})`,()=>e.assign(u,!0).break()))}function g(d,m){const p=r[m];return typeof p=="object"&&p!==null?(0,oa._)`${c()}(${a}, ${d}[${m}])`:(0,oa._)`${a} === ${p}`}}};jn.default=Ah,Object.defineProperty(wn,"__esModule",{value:!0});const jh=bn,Dh=Pn,xh=En,Mh=Rn,Lh=kn,Fh=Tn,qh=On,Uh=Cn,Vh=Nn,zh=jn,Hh=[jh.default,Dh.default,xh.default,Mh.default,Lh.default,Fh.default,qh.default,Uh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Vh.default,zh.default];wn.default=Hh;var Dn={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.validateAdditionalItems=void 0;const pr=be,xn=ee,Zh={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,pr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,pr._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,xn.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ol(t,s)}};function Ol(t,e){const{gen:a,schema:s,data:r,keyword:n,it:o}=t;o.items=!0;const i=a.const("len",(0,pr._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,pr._)`${i} <= ${e.length}`);else if(typeof s=="object"&&!(0,xn.alwaysValidSchema)(o,s)){const c=a.var("valid",(0,pr._)`${i} <= ${e.length}`);a.if((0,pr.not)(c),()=>l(c)),t.ok(c)}function l(c){a.forRange("i",e.length,i,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:xn.Type.Num},c),o.allErrors||a.if((0,pr.not)(c),()=>a.break())})}}Ir.validateAdditionalItems=Ol,Ir.default=Zh;var Mn={},Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.validateTuple=void 0;const Cl=be,qa=ee,Kh=Pe,Bh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return Il(t,"additionalItems",e);a.items=!0,!(0,qa.alwaysValidSchema)(a,e)&&t.ok((0,Kh.validateArray)(t))}};function Il(t,e,a=t.schema){const{gen:s,parentSchema:r,data:n,keyword:o,it:i}=t;u(r),i.opts.unevaluated&&a.length&&i.items!==!0&&(i.items=qa.mergeEvaluated.items(s,a.length,i.items));const l=s.name("valid"),c=s.const("len",(0,Cl._)`${n}.length`);a.forEach((f,g)=>{(0,qa.alwaysValidSchema)(i,f)||(s.if((0,Cl._)`${c} > ${g}`,()=>t.subschema({keyword:o,schemaProp:g,dataProp:g},l)),t.ok(l))});function u(f){const{opts:g,errSchemaPath:d}=i,m=a.length,p=m===f.minItems&&(m===f.maxItems||f[e]===!1);if(g.strictTuples&&!p){const h=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${d}"`;(0,qa.checkStrictMode)(i,h,g.strictTuples)}}}Nr.validateTuple=Il,Nr.default=Bh,Object.defineProperty(Mn,"__esModule",{value:!0});const Jh=Nr,Qh={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Jh.validateTuple)(t,"items")};Mn.default=Qh;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const Nl=be,Gh=ee,Wh=Pe,Xh=Ir,Yh={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Nl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nl._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,Gh.alwaysValidSchema)(s,e)&&(r?(0,Xh.validateAdditionalItems)(t,r):t.ok((0,Wh.validateArray)(t)))}};Ln.default=Yh;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const vt=be,Ua=ee,ep={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,vt.str)`must contain at least ${t} valid item(s)`:(0,vt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,vt._)`{minContains: ${t}}`:(0,vt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let o,i;const{minContains:l,maxContains:c}=s;n.opts.next?(o=l===void 0?1:l,i=c):o=1;const u=e.const("len",(0,vt._)`${r}.length`);if(t.setParams({min:o,max:i}),i===void 0&&o===0){(0,Ua.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&o>i){(0,Ua.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ua.alwaysValidSchema)(n,a)){let p=(0,vt._)`${u} >= ${o}`;i!==void 0&&(p=(0,vt._)`${p} && ${u} <= ${i}`),t.pass(p);return}n.items=!0;const f=e.name("valid");i===void 0&&o===1?d(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),i!==void 0&&e.if((0,vt._)`${r}.length > 0`,g)):(e.let(f,!1),g()),t.result(f,()=>t.reset());function g(){const p=e.name("_valid"),h=e.let("count",0);d(p,()=>e.if(p,()=>m(h)))}function d(p,h){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Ua.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,vt._)`${p}++`),i===void 0?e.if((0,vt._)`${p} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,vt._)`${p} > ${i}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,vt._)`${p} >= ${o}`,()=>e.assign(f,!0)))}}};Fn.default=ep;var Al={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=be,a=ee,s=Pe;t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const f=c===1?"property":"properties";return(0,e.str)`must have ${f} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:f}})=>(0,e._)`{property: ${l},
|
|
6
6
|
missingProperty: ${f},
|
|
7
7
|
depsCount: ${c},
|
|
8
|
-
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=n(l);o(l,c),i(l,u)}};function n({schema:l}){const c={},u={};for(const f in l){if(f==="__proto__")continue;const g=Array.isArray(l[f])?c:u;g[f]=l[f]}return[c,u]}function o(l,c=l.schema){const{gen:u,data:f,it:g}=l;if(Object.keys(c).length===0)return;const d=u.let("missing");for(const m in c){const p=c[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,f,m,g.opts.ownProperties);l.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),g.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(l,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(l,p,d)})`),(0,s.reportMissingProp)(l,d),u.else())}}t.validatePropertyDeps=o;function i(l,c=l.schema){const{gen:u,data:f,keyword:g,it:d}=l,m=u.name("valid");for(const p in c)(0,a.alwaysValidSchema)(d,c[p])||(u.if((0,s.propertyInData)(u,f,p,d.opts.ownProperties),()=>{const h=l.subschema({keyword:g,schemaProp:p},m);l.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),l.ok(m))}t.validateSchemaDeps=i,t.default=r})(Cl);var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Il=be,qh=re,Uh={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,Il._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,qh.alwaysValidSchema)(r,a))return;const n=e.name("valid");e.forIn("key",s,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},n),e.if((0,Il.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};Mn.default=Uh;var Ua={};Object.defineProperty(Ua,"__esModule",{value:!0});const Va=wt(),Et=be,Vh=Ct,za=re,zh={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,Et._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,errsCount:n,it:o}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:i,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,za.alwaysValidSchema)(o,a))return;const c=(0,Va.allSchemaProperties)(s.properties),u=(0,Va.allSchemaProperties)(s.patternProperties);f(),t.ok((0,Et._)`${n} === ${Vh.default.errors}`);function f(){e.forIn("key",r,h=>{!c.length&&!u.length?m(h):e.if(g(h),()=>m(h))})}function g(h){let v;if(c.length>8){const $=(0,za.schemaRefOrVal)(o,s.properties,"properties");v=(0,Va.isOwnProperty)(e,$,h)}else c.length?v=(0,Et.or)(...c.map($=>(0,Et._)`${h} === ${$}`)):v=Et.nil;return u.length&&(v=(0,Et.or)(v,...u.map($=>(0,Et._)`${(0,Va.usePattern)(t,$)}.test(${h})`))),(0,Et.not)(v)}function d(h){e.code((0,Et._)`delete ${r}[${h}]`)}function m(h){if(l.removeAdditional==="all"||l.removeAdditional&&a===!1){d(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),i||e.break();return}if(typeof a=="object"&&!(0,za.alwaysValidSchema)(o,a)){const v=e.name("valid");l.removeAdditional==="failing"?(p(h,v,!1),e.if((0,Et.not)(v),()=>{t.reset(),d(h)})):(p(h,v),i||e.if((0,Et.not)(v),()=>e.break()))}}function p(h,v,$){const w={keyword:"additionalProperties",dataProp:h,dataPropType:za.Type.Str};$===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,v)}}};Ua.default=zh;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const Hh=ka(),Nl=wt(),Fn=re,Al=Ua,Zh={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;n.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&Al.default.code(new Hh.KeywordCxt(n,Al.default,"additionalProperties"));const o=(0,Nl.allSchemaProperties)(a);for(const f of o)n.definedProperties.add(f);n.opts.unevaluated&&o.length&&n.props!==!0&&(n.props=Fn.mergeEvaluated.props(e,(0,Fn.toHash)(o),n.props));const i=o.filter(f=>!(0,Fn.alwaysValidSchema)(n,a[f]));if(i.length===0)return;const l=e.name("valid");for(const f of i)c(f)?u(f):(e.if((0,Nl.propertyInData)(e,r,f,n.opts.ownProperties)),u(f),n.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(l);function c(f){return n.opts.useDefaults&&!n.compositeRule&&a[f].default!==void 0}function u(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},l)}}};Ln.default=Zh;var qn={};Object.defineProperty(qn,"__esModule",{value:!0});const jl=wt(),Ha=be,Dl=re,xl=re,Kh={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,data:s,parentSchema:r,it:n}=t,{opts:o}=n,i=(0,jl.allSchemaProperties)(a),l=i.filter(p=>(0,Dl.alwaysValidSchema)(n,a[p]));if(i.length===0||l.length===i.length&&(!n.opts.unevaluated||n.props===!0))return;const c=o.strictSchema&&!o.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof Ha.Name)&&(n.props=(0,xl.evaluatedPropsToName)(e,n.props));const{props:f}=n;g();function g(){for(const p of i)c&&d(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function d(p){for(const h in c)new RegExp(p).test(h)&&(0,Dl.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,Ha._)`${(0,jl.usePattern)(t,p)}.test(${h})`,()=>{const v=l.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:xl.Type.Str},u),n.opts.unevaluated&&f!==!0?e.assign((0,Ha._)`${f}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,Ha.not)(u),()=>e.break())})})}}};qn.default=Kh;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const Bh=re,Jh={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,Bh.alwaysValidSchema)(s,a)){t.fail();return}const r=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),t.failResult(r,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Un.default=Jh;var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});const Qh={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:wt().validateUnion,error:{message:"must match a schema in anyOf"}};Vn.default=Qh;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});const Za=be,Gh=re,Wh={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Za._)`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:a,parentSchema:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(r.opts.discriminator&&s.discriminator)return;const n=a,o=e.let("valid",!1),i=e.let("passing",null),l=e.name("_valid");t.setParams({passing:i}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){n.forEach((u,f)=>{let g;(0,Gh.alwaysValidSchema)(r,u)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},l),f>0&&e.if((0,Za._)`${l} && ${o}`).assign(o,!1).assign(i,(0,Za._)`[${i}, ${f}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(i,f),g&&t.mergeEvaluated(g,Za.Name)})})}}};zn.default=Wh;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const Xh=re,Yh={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:a,it:s}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");const r=e.name("valid");a.forEach((n,o)=>{if((0,Xh.alwaysValidSchema)(s,n))return;const i=t.subschema({keyword:"allOf",schemaProp:o},r);t.ok(r),t.mergeEvaluated(i)})}};Hn.default=Yh;var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});const Ka=be,Ml=re,ep={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,Ka.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ka._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,Ml.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=Ll(s,"then"),n=Ll(s,"else");if(!r&&!n)return;const o=e.let("valid",!0),i=e.name("_valid");if(l(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(i,c("then",u),c("else",u))}else r?e.if(i,c("then")):e.if((0,Ka.not)(i),c("else"));t.pass(o,()=>t.error(!0));function l(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);t.mergeEvaluated(u)}function c(u,f){return()=>{const g=t.subschema({keyword:u},i);e.assign(o,i),t.mergeValidEvaluated(g,o),f?e.assign(f,(0,Ka._)`${u}`):t.setParams({ifClause:u})}}}};function Ll(t,e){const a=t.schema[e];return a!==void 0&&!(0,Ml.alwaysValidSchema)(t,a)}Zn.default=ep;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});const tp=re,rp={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,tp.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};Kn.default=rp,Object.defineProperty(Nn,"__esModule",{value:!0});const ap=Cr,sp=jn,np=Ir,ip=Dn,op=xn,lp=Cl,cp=Mn,up=Ua,dp=Ln,fp=qn,hp=Un,pp=Vn,mp=zn,vp=Hn,gp=Zn,yp=Kn;function _p(t=!1){const e=[hp.default,pp.default,mp.default,vp.default,gp.default,yp.default,cp.default,up.default,lp.default,dp.default,fp.default];return t?e.push(sp.default,ip.default):e.push(ap.default,np.default),e.push(op.default),e}Nn.default=_p;var Bn={},Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});const Ze=be,$p={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ze.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ze._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:o,it:i}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:f}=i;if(!l.validateFormats)return;r?g():d();function g(){const m=a.scopeValue("formats",{ref:f.formats,code:l.code.formats}),p=a.const("fDef",(0,Ze._)`${m}[${o}]`),h=a.let("fType"),v=a.let("format");a.if((0,Ze._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,Ze._)`${p}.type || "string"`).assign(v,(0,Ze._)`${p}.validate`),()=>a.assign(h,(0,Ze._)`"string"`).assign(v,p)),t.fail$data((0,Ze.or)($(),w()));function $(){return l.strictSchema===!1?Ze.nil:(0,Ze._)`${o} && !${v}`}function w(){const E=u.$async?(0,Ze._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,Ze._)`${v}(${s})`,k=(0,Ze._)`(typeof ${v} == "function" ? ${E} : ${v}.test(${s}))`;return(0,Ze._)`${v} && ${v} !== true && ${h} === ${e} && !${k}`}}function d(){const m=f.formats[n];if(!m){$();return}if(m===!0)return;const[p,h,v]=w(m);p===e&&t.pass(E());function $(){if(l.strictSchema===!1){f.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${n}" ignored in schema at path "${c}"`}}function w(k){const D=k instanceof RegExp?(0,Ze.regexpCode)(k):l.code.formats?(0,Ze._)`${l.code.formats}${(0,Ze.getProperty)(n)}`:void 0,H=a.scopeValue("formats",{key:n,ref:k,code:D});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,Ze._)`${H}.validate`]:["string",k,H]}function E(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ze._)`await ${v}(${s})`}return typeof h=="function"?(0,Ze._)`${v}(${s})`:(0,Ze._)`${v}.test(${s})`}}}};Jn.default=$p,Object.defineProperty(Bn,"__esModule",{value:!0});const wp=[Jn.default];Bn.default=wp;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.contentVocabulary=Nr.metadataVocabulary=void 0,Nr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Nr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(mn,"__esModule",{value:!0});const bp=vn,Pp=yn,Ep=Nn,Sp=Bn,Fl=Nr,Rp=[bp.default,Pp.default,(0,Ep.default)(),Sp.default,Fl.metadataVocabulary,Fl.contentVocabulary];mn.default=Rp;var Qn={},Ba={};Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.DiscrError=void 0;var ql;(function(t){t.Tag="tag",t.Mapping="mapping"})(ql||(Ba.DiscrError=ql={})),Object.defineProperty(Qn,"__esModule",{value:!0});const Ar=be,Gn=Ba,Ul=ut,kp=Tr,Tp=re,Op={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Gn.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,Ar._)`{error: ${t}, tag: ${a}, tagValue: ${e}}`},code(t){const{gen:e,data:a,schema:s,parentSchema:r,it:n}=t,{oneOf:o}=r;if(!n.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=s.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const l=e.let("valid",!1),c=e.const("tag",(0,Ar._)`${a}${(0,Ar.getProperty)(i)}`);e.if((0,Ar._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:Gn.DiscrError.Tag,tag:c,tagName:i})),t.ok(l);function u(){const d=g();e.if(!1);for(const m in d)e.elseIf((0,Ar._)`${c} === ${m}`),e.assign(l,f(d[m]));e.else(),t.error(!1,{discrError:Gn.DiscrError.Mapping,tag:c,tagName:i}),e.endIf()}function f(d){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:d},m);return t.mergeEvaluated(p,Ar.Name),m}function g(){var d;const m={},p=v(r);let h=!0;for(let E=0;E<o.length;E++){let k=o[E];if(k!=null&&k.$ref&&!(0,Tp.schemaHasRulesButRef)(k,n.self.RULES)){const H=k.$ref;if(k=Ul.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,H),k instanceof Ul.SchemaEnv&&(k=k.schema),k===void 0)throw new kp.default(n.opts.uriResolver,n.baseId,H)}const D=(d=k==null?void 0:k.properties)===null||d===void 0?void 0:d[i];if(typeof D!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);h=h&&(p||v(k)),$(D,E)}if(!h)throw new Error(`discriminator: "${i}" must be required`);return m;function v({required:E}){return Array.isArray(E)&&E.includes(i)}function $(E,k){if(E.const)w(E.const,k);else if(E.enum)for(const D of E.enum)w(D,k);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function w(E,k){if(typeof E!="string"||E in m)throw new Error(`discriminator: "${i}" values must be unique strings`);m[E]=k}}}};Qn.default=Op;const Cp={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const a=xo,s=mn,r=Qn,n=Cp,o=["/properties"],i="http://json-schema.org/draft-07/schema";class l extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const m=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(m,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=ka();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=be;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=on();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var g=Tr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(Ws,Ws.exports);var Ip=Ws.exports;const Np=Do(Ip);var ke;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const o of r)n[o]=o;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(const i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(const o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(ke||(ke={}));var Vl;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Vl||(Vl={}));const ae=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=t=>{switch(typeof t){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(t)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(t)?ae.array:t===null?ae.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ae.promise:typeof Map<"u"&&t instanceof Map?ae.map:typeof Set<"u"&&t instanceof Set?ae.set:typeof Date<"u"&&t instanceof Date?ae.date:ae.object;default:return ae.unknown}},B=ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Vt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(a(o));else{let i=s,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(a(o))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof Vt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Vt.create=t=>new Vt(t);const Wn=(t,e)=>{let a;switch(t.code){case B.invalid_type:t.received===ae.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case B.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,ke.jsonStringifyReplacer)}`;break;case B.unrecognized_keys:a=`Unrecognized key(s) in object: ${ke.joinValues(t.keys,", ")}`;break;case B.invalid_union:a="Invalid input";break;case B.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ke.joinValues(t.options)}`;break;case B.invalid_enum_value:a=`Invalid enum value. Expected ${ke.joinValues(t.options)}, received '${t.received}'`;break;case B.invalid_arguments:a="Invalid function arguments";break;case B.invalid_return_type:a="Invalid function return type";break;case B.invalid_date:a="Invalid date";break;case B.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:ke.assertNever(t.validation):t.validation!=="regex"?a=`Invalid ${t.validation}`:a="Invalid";break;case B.too_small:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:a="Invalid input";break;case B.too_big:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?a=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:a="Invalid input";break;case B.custom:a="Invalid input";break;case B.invalid_intersection_types:a="Intersection results could not be merged";break;case B.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case B.not_finite:a="Number must be finite";break;default:a=e.defaultError,ke.assertNever(t)}return{message:a}};let Ap=Wn;function jp(){return Ap}const Dp=t=>{const{data:e,path:a,errorMaps:s,issueData:r}=t,n=[...a,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let i="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)i=c(o,{data:e,defaultError:i}).message;return{...r,path:n,message:i}};function ee(t,e){const a=jp(),s=Dp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===Wn?void 0:Wn].filter(r=>!!r)});t.common.issues.push(s)}class it{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const s=[];for(const r of a){if(r.status==="aborted")return fe;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,a){const s=[];for(const r of a){const n=await r.key,o=await r.value;s.push({key:n,value:o})}return it.mergeObjectSync(e,s)}static mergeObjectSync(e,a){const s={};for(const r of a){const{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return fe;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}}const fe=Object.freeze({status:"aborted"}),ia=t=>({status:"dirty",value:t}),vt=t=>({status:"valid",value:t}),zl=t=>t.status==="aborted",Hl=t=>t.status==="dirty",jr=t=>t.status==="valid",Ja=t=>typeof Promise<"u"&&t instanceof Promise;var oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(oe||(oe={}));class Nt{constructor(e,a,s,r){this._cachedPath=[],this.parent=e,this.data=a,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Zl=(t,e)=>{if(jr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Vt(t.common.issues);return this._error=a,this._error}}};function _e(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:l??a??i.defaultError}},description:r}}class Pe{get description(){return this._def.description}_getType(e){return Yt(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:Yt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:Yt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Ja(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const s=this.safeParse(e,a);if(s.success)return s.data;throw s.error}safeParse(e,a){const s={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Zl(s,r)}"~validate"(e){var s,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return jr(n)?{value:n.value}:{issues:a.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(n=>jr(n)?{value:n.value}:{issues:a.common.issues})}async parseAsync(e,a){const s=await this.safeParseAsync(e,a);if(s.success)return s.data;throw s.error}async safeParseAsync(e,a){const s={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(Ja(r)?r:Promise.resolve(r));return Zl(s,n)}refine(e,a){const s=r=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(r):a;return this._refinement((r,n)=>{const o=e(r),i=()=>n.addIssue({code:B.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,a){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof a=="function"?a(s,r):a),!1))}_refinement(e){return new vr({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Zt.create(this,this._def)}nullable(){return gr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return At.create(this)}promise(){return es.create(this,this._def)}or(e){return Ga.create([this,e],this._def)}and(e){return Wa.create(this,e,this._def)}transform(e){return new vr({..._e(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ts({..._e(this._def),innerType:this,defaultValue:a,typeName:J.ZodDefault})}brand(){return new Yl({typeName:J.ZodBranded,type:this,..._e(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new rs({..._e(this._def),innerType:this,catchValue:a,typeName:J.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return li.create(this,e)}readonly(){return as.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xp=/^c[^\s-]{8,}$/i,Mp=/^[0-9a-z]+$/,Lp=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fp=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qp=/^[a-z0-9_-]{21}$/i,Up=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vp=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zp=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xn;const Zp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Bp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Jp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kl="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wp=new RegExp(`^${Kl}$`);function Bl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function Xp(t){return new RegExp(`^${Bl(t)}$`)}function Yp(t){let e=`${Kl}T${Bl(t)}`;const a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function em(t,e){return!!((e==="v4"||!e)&&Zp.test(t)||(e==="v6"||!e)&&Bp.test(t))}function tm(t,e){if(!Up.test(t))return!1;try{const[a]=t.split(".");if(!a)return!1;const s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function rm(t,e){return!!((e==="v4"||!e)&&Kp.test(t)||(e==="v6"||!e)&&Jp.test(t))}class zt extends Pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ae.string){const n=this._getOrReturnCtx(e);return ee(n,{code:B.invalid_type,expected:ae.string,received:n.parsedType}),fe}const s=new it;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),ee(r,{code:B.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),ee(r,{code:B.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?ee(r,{code:B.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&ee(r,{code:B.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")zp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"email",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Xn||(Xn=new RegExp(Hp,"u")),Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"emoji",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Fp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"uuid",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")qp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"nanoid",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")xp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"cuid",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Mp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"cuid2",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Lp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"ulid",code:B.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),ee(r,{validation:"url",code:B.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"regex",code:B.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Yp(n).test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Wp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Xp(n).test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:B.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Vp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"duration",code:B.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?em(e.data,n.version)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"ip",code:B.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?tm(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"jwt",code:B.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?rm(e.data,n.version)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"cidr",code:B.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Qp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"base64",code:B.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Gp.test(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{validation:"base64url",code:B.invalid_string,message:n.message}),s.dirty()):ke.assertNever(n);return{status:s.value,value:e.data}}_regex(e,a,s){return this.refinement(r=>e.test(r),{validation:a,code:B.invalid_string,...oe.errToObj(s)})}_addCheck(e){return new zt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...oe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...oe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...oe.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...oe.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...oe.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...oe.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...oe.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...oe.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...oe.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...oe.errToObj(a)})}nonempty(e){return this.min(1,oe.errToObj(e))}trim(){return new zt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}zt.create=t=>new zt({checks:[],typeName:J.ZodString,coerce:(t==null?void 0:t.coerce)??!1,..._e(t)});function am(t,e){const a=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=a>s?a:s,n=Number.parseInt(t.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}class Dr extends Pe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ae.number){const n=this._getOrReturnCtx(e);return ee(n,{code:B.invalid_type,expected:ae.number,received:n.parsedType}),fe}let s;const r=new it;for(const n of this._def.checks)n.kind==="int"?ke.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),ee(s,{code:B.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?am(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),ee(s,{code:B.not_finite,message:n.message}),r.dirty()):ke.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,oe.toString(a))}gt(e,a){return this.setLimit("min",e,!1,oe.toString(a))}lte(e,a){return this.setLimit("max",e,!0,oe.toString(a))}lt(e,a){return this.setLimit("max",e,!1,oe.toString(a))}setLimit(e,a,s,r){return new Dr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:oe.toString(r)}]})}_addCheck(e){return new Dr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oe.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:oe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oe.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ke.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(a===null||s.value>a)&&(a=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(a)&&Number.isFinite(e)}}Dr.create=t=>new Dr({checks:[],typeName:J.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,..._e(t)});class oa extends Pe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ae.bigint)return this._getInvalidInput(e);let s;const r=new it;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),ee(s,{code:B.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ke.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return ee(a,{code:B.invalid_type,expected:ae.bigint,received:a.parsedType}),fe}gte(e,a){return this.setLimit("min",e,!0,oe.toString(a))}gt(e,a){return this.setLimit("min",e,!1,oe.toString(a))}lte(e,a){return this.setLimit("max",e,!0,oe.toString(a))}lt(e,a){return this.setLimit("max",e,!1,oe.toString(a))}setLimit(e,a,s,r){return new oa({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:oe.toString(r)}]})}_addCheck(e){return new oa({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}oa.create=t=>new oa({checks:[],typeName:J.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,..._e(t)});class Yn extends Pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ae.boolean){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.boolean,received:s.parsedType}),fe}return vt(e.data)}}Yn.create=t=>new Yn({typeName:J.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,..._e(t)});class Qa extends Pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ae.date){const n=this._getOrReturnCtx(e);return ee(n,{code:B.invalid_type,expected:ae.date,received:n.parsedType}),fe}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return ee(n,{code:B.invalid_date}),fe}const s=new it;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),ee(r,{code:B.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),ee(r,{code:B.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):ke.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qa({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:oe.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:oe.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Qa.create=t=>new Qa({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:J.ZodDate,..._e(t)});class Jl extends Pe{_parse(e){if(this._getType(e)!==ae.symbol){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.symbol,received:s.parsedType}),fe}return vt(e.data)}}Jl.create=t=>new Jl({typeName:J.ZodSymbol,..._e(t)});class ei extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.undefined,received:s.parsedType}),fe}return vt(e.data)}}ei.create=t=>new ei({typeName:J.ZodUndefined,..._e(t)});class ti extends Pe{_parse(e){if(this._getType(e)!==ae.null){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.null,received:s.parsedType}),fe}return vt(e.data)}}ti.create=t=>new ti({typeName:J.ZodNull,..._e(t)});class ri extends Pe{constructor(){super(...arguments),this._any=!0}_parse(e){return vt(e.data)}}ri.create=t=>new ri({typeName:J.ZodAny,..._e(t)});class ai extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return vt(e.data)}}ai.create=t=>new ai({typeName:J.ZodUnknown,..._e(t)});class er extends Pe{_parse(e){const a=this._getOrReturnCtx(e);return ee(a,{code:B.invalid_type,expected:ae.never,received:a.parsedType}),fe}}er.create=t=>new er({typeName:J.ZodNever,..._e(t)});class Ql extends Pe{_parse(e){if(this._getType(e)!==ae.undefined){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.void,received:s.parsedType}),fe}return vt(e.data)}}Ql.create=t=>new Ql({typeName:J.ZodVoid,..._e(t)});class At extends Pe{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==ae.array)return ee(a,{code:B.invalid_type,expected:ae.array,received:a.parsedType}),fe;if(r.exactLength!==null){const o=a.data.length>r.exactLength.value,i=a.data.length<r.exactLength.value;(o||i)&&(ee(a,{code:o?B.too_big:B.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&a.data.length<r.minLength.value&&(ee(a,{code:B.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&a.data.length>r.maxLength.value&&(ee(a,{code:B.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>r.type._parseAsync(new Nt(a,o,a.path,i)))).then(o=>it.mergeArray(s,o));const n=[...a.data].map((o,i)=>r.type._parseSync(new Nt(a,o,a.path,i)));return it.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new At({...this._def,minLength:{value:e,message:oe.toString(a)}})}max(e,a){return new At({...this._def,maxLength:{value:e,message:oe.toString(a)}})}length(e,a){return new At({...this._def,exactLength:{value:e,message:oe.toString(a)}})}nonempty(e){return this.min(1,e)}}At.create=(t,e)=>new At({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,..._e(e)});function xr(t){if(t instanceof Je){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Zt.create(xr(s))}return new Je({...t._def,shape:()=>e})}else return t instanceof At?new At({...t._def,type:xr(t.element)}):t instanceof Zt?Zt.create(xr(t.unwrap())):t instanceof gr?gr.create(xr(t.unwrap())):t instanceof pr?pr.create(t.items.map(e=>xr(e))):t}class Je extends Pe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ke.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==ae.object){const c=this._getOrReturnCtx(e);return ee(c,{code:B.invalid_type,expected:ae.object,received:c.parsedType}),fe}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof er&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||i.push(c);const l=[];for(const c of o){const u=n[c],f=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Nt(r,f,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof er){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")i.length>0&&(ee(r,{code:B.unrecognized_keys,keys:i}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of i){const f=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Nt(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,g=await u.value;c.push({key:f,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>it.mergeObjectSync(s,c)):it.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return oe.errToObj,new Je({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,s)=>{var n,o;const r=((o=(n=this._def).errorMap)==null?void 0:o.call(n,a,s).message)??s.defaultError;return a.code==="unrecognized_keys"?{message:oe.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Je({...this._def,unknownKeys:"strip"})}passthrough(){return new Je({...this._def,unknownKeys:"passthrough"})}extend(e){return new Je({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Je({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Je({...this._def,catchall:e})}pick(e){const a={};for(const s of ke.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Je({...this._def,shape:()=>a})}omit(e){const a={};for(const s of ke.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Je({...this._def,shape:()=>a})}deepPartial(){return xr(this)}partial(e){const a={};for(const s of ke.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Je({...this._def,shape:()=>a})}required(e){const a={};for(const s of ke.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Zt;)n=n._def.innerType;a[s]=n}return new Je({...this._def,shape:()=>a})}keyof(){return Wl(ke.objectKeys(this.shape))}}Je.create=(t,e)=>new Je({shape:()=>t,unknownKeys:"strip",catchall:er.create(),typeName:J.ZodObject,..._e(e)}),Je.strictCreate=(t,e)=>new Je({shape:()=>t,unknownKeys:"strict",catchall:er.create(),typeName:J.ZodObject,..._e(e)}),Je.lazycreate=(t,e)=>new Je({shape:t,unknownKeys:"strip",catchall:er.create(),typeName:J.ZodObject,..._e(e)});class Ga extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e),s=this._def.options;function r(n){for(const i of n)if(i.result.status==="valid")return i.result;for(const i of n)if(i.result.status==="dirty")return a.common.issues.push(...i.ctx.common.issues),i.result;const o=n.map(i=>new Vt(i.ctx.common.issues));return ee(a,{code:B.invalid_union,unionErrors:o}),fe}if(a.common.async)return Promise.all(s.map(async n=>{const o={...a,common:{...a.common,issues:[]},parent:null};return{result:await n._parseAsync({data:a.data,path:a.path,parent:o}),ctx:o}})).then(r);{let n;const o=[];for(const l of s){const c={...a,common:{...a.common,issues:[]},parent:null},u=l._parseSync({data:a.data,path:a.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const i=o.map(l=>new Vt(l));return ee(a,{code:B.invalid_union,unionErrors:i}),fe}}get options(){return this._def.options}}Ga.create=(t,e)=>new Ga({options:t,typeName:J.ZodUnion,..._e(e)});const Ht=t=>t instanceof ii?Ht(t.schema):t instanceof vr?Ht(t.innerType()):t instanceof Ya?[t.value]:t instanceof mr?t.options:t instanceof oi?ke.objectValues(t.enum):t instanceof ts?Ht(t._def.innerType):t instanceof ei?[void 0]:t instanceof ti?[null]:t instanceof Zt?[void 0,...Ht(t.unwrap())]:t instanceof gr?[null,...Ht(t.unwrap())]:t instanceof Yl||t instanceof as?Ht(t.unwrap()):t instanceof rs?Ht(t._def.innerType):[];class si extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==ae.object)return ee(a,{code:B.invalid_type,expected:ae.object,received:a.parsedType}),fe;const s=this.discriminator,r=a.data[s],n=this.optionsMap.get(r);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(ee(a,{code:B.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,s){const r=new Map;for(const n of a){const o=Ht(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new si({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,..._e(s)})}}function ni(t,e){const a=Yt(t),s=Yt(e);if(t===e)return{valid:!0,data:t};if(a===ae.object&&s===ae.object){const r=ke.objectKeys(e),n=ke.objectKeys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(const i of n){const l=ni(t[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(a===ae.array&&s===ae.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let n=0;n<t.length;n++){const o=t[n],i=e[n],l=ni(o,i);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return a===ae.date&&s===ae.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Wa extends Pe{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(zl(n)||zl(o))return fe;const i=ni(n.value,o.value);return i.valid?((Hl(n)||Hl(o))&&a.dirty(),{status:a.value,value:i.data}):(ee(s,{code:B.invalid_intersection_types}),fe)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Wa.create=(t,e,a)=>new Wa({left:t,right:e,typeName:J.ZodIntersection,..._e(a)});class pr extends Pe{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.array)return ee(s,{code:B.invalid_type,expected:ae.array,received:s.parsedType}),fe;if(s.data.length<this._def.items.length)return ee(s,{code:B.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),fe;!this._def.rest&&s.data.length>this._def.items.length&&(ee(s,{code:B.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const n=[...s.data].map((o,i)=>{const l=this._def.items[i]||this._def.rest;return l?l._parse(new Nt(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>it.mergeArray(a,o)):it.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new pr({...this._def,rest:e})}}pr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pr({items:t,typeName:J.ZodTuple,rest:null,..._e(e)})};class Xa extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.object)return ee(s,{code:B.invalid_type,expected:ae.object,received:s.parsedType}),fe;const r=[],n=this._def.keyType,o=this._def.valueType;for(const i in s.data)r.push({key:n._parse(new Nt(s,i,s.path,i)),value:o._parse(new Nt(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?it.mergeObjectAsync(a,r):it.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof Pe?new Xa({keyType:e,valueType:a,typeName:J.ZodRecord,..._e(s)}):new Xa({keyType:zt.create(),valueType:e,typeName:J.ZodRecord,..._e(a)})}}class Gl extends Pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.map)return ee(s,{code:B.invalid_type,expected:ae.map,received:s.parsedType}),fe;const r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,l],c)=>({key:r._parse(new Nt(s,i,s.path,[c,"key"])),value:n._parse(new Nt(s,l,s.path,[c,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return fe;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),i.set(c.value,u.value)}return{status:a.value,value:i}})}else{const i=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return fe;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),i.set(c.value,u.value)}return{status:a.value,value:i}}}}Gl.create=(t,e,a)=>new Gl({valueType:e,keyType:t,typeName:J.ZodMap,..._e(a)});class la extends Pe{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.set)return ee(s,{code:B.invalid_type,expected:ae.set,received:s.parsedType}),fe;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(ee(s,{code:B.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),a.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(ee(s,{code:B.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),a.dirty());const n=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return fe;u.status==="dirty"&&a.dirty(),c.add(u.value)}return{status:a.value,value:c}}const i=[...s.data.values()].map((l,c)=>n._parse(new Nt(s,l,s.path,c)));return s.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,a){return new la({...this._def,minSize:{value:e,message:oe.toString(a)}})}max(e,a){return new la({...this._def,maxSize:{value:e,message:oe.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}la.create=(t,e)=>new la({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,..._e(e)});class ii extends Pe{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ii.create=(t,e)=>new ii({getter:t,typeName:J.ZodLazy,..._e(e)});class Ya extends Pe{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return ee(a,{received:a.data,code:B.invalid_literal,expected:this._def.value}),fe}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ya.create=(t,e)=>new Ya({value:t,typeName:J.ZodLiteral,..._e(e)});function Wl(t,e){return new mr({values:t,typeName:J.ZodEnum,..._e(e)})}class mr extends Pe{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return ee(a,{expected:ke.joinValues(s),received:a.parsedType,code:B.invalid_type}),fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const a=this._getOrReturnCtx(e),s=this._def.values;return ee(a,{received:a.data,code:B.invalid_enum_value,options:s}),fe}return vt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return mr.create(e,{...this._def,...a})}exclude(e,a=this._def){return mr.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}mr.create=Wl;class oi extends Pe{_parse(e){const a=ke.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ae.string&&s.parsedType!==ae.number){const r=ke.objectValues(a);return ee(s,{expected:ke.joinValues(r),received:s.parsedType,code:B.invalid_type}),fe}if(this._cache||(this._cache=new Set(ke.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=ke.objectValues(a);return ee(s,{received:s.data,code:B.invalid_enum_value,options:r}),fe}return vt(e.data)}get enum(){return this._def.values}}oi.create=(t,e)=>new oi({values:t,typeName:J.ZodNativeEnum,..._e(e)});class es extends Pe{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==ae.promise&&a.common.async===!1)return ee(a,{code:B.invalid_type,expected:ae.promise,received:a.parsedType}),fe;const s=a.parsedType===ae.promise?a.data:Promise.resolve(a.data);return vt(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}es.create=(t,e)=>new es({type:t,typeName:J.ZodPromise,..._e(e)});class vr extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{ee(s,o),o.fatal?a.abort():a.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){const o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(a.value==="aborted")return fe;const l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?fe:l.status==="dirty"||a.value==="dirty"?ia(l.value):l});{if(a.value==="aborted")return fe;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?fe:i.status==="dirty"||a.value==="dirty"?ia(i.value):i}}if(r.type==="refinement"){const o=i=>{const l=r.refinement(i,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?fe:(i.status==="dirty"&&a.dirty(),o(i.value),{status:a.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?fe:(i.status==="dirty"&&a.dirty(),o(i.value).then(()=>({status:a.value,value:i.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!jr(o))return fe;const i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>jr(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:a.value,value:i})):fe);ke.assertNever(r)}}vr.create=(t,e,a)=>new vr({schema:t,typeName:J.ZodEffects,effect:e,..._e(a)}),vr.createWithPreprocess=(t,e,a)=>new vr({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,..._e(a)});class Zt extends Pe{_parse(e){return this._getType(e)===ae.undefined?vt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zt.create=(t,e)=>new Zt({innerType:t,typeName:J.ZodOptional,..._e(e)});class gr extends Pe{_parse(e){return this._getType(e)===ae.null?vt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gr.create=(t,e)=>new gr({innerType:t,typeName:J.ZodNullable,..._e(e)});class ts extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===ae.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ts.create=(t,e)=>new ts({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});class rs extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e),s={...a,common:{...a.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ja(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Vt(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Vt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}rs.create=(t,e)=>new rs({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});class Xl extends Pe{_parse(e){if(this._getType(e)!==ae.nan){const s=this._getOrReturnCtx(e);return ee(s,{code:B.invalid_type,expected:ae.nan,received:s.parsedType}),fe}return{status:"valid",value:e.data}}}Xl.create=t=>new Xl({typeName:J.ZodNaN,..._e(t)});class Yl extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}class li extends Pe{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?fe:n.status==="dirty"?(a.dirty(),ia(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?fe:r.status==="dirty"?(a.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,a){return new li({in:e,out:a,typeName:J.ZodPipeline})}}class as extends Pe{_parse(e){const a=this._def.innerType._parse(e),s=r=>(jr(r)&&(r.value=Object.freeze(r.value)),r);return Ja(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}as.create=(t,e)=>new as({innerType:t,typeName:J.ZodReadonly,..._e(e)});var J;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(J||(J={}));const C=zt.create,et=Dr.create,We=Yn.create,sm=ri.create,ca=ai.create;er.create;const ie=At.create,W=Je.create,ot=Ga.create,nm=si.create;Wa.create,pr.create;const ua=Xa.create,ge=Ya.create,Kt=mr.create;es.create;const K=Zt.create;gr.create;const yr="2025-06-18",im="2025-03-26",ci=[yr,"2025-03-26","2024-11-05","2024-10-07"],da="2.0",ui=ot([C(),et().int()]),di=C(),om=W({progressToken:K(ui)}).passthrough(),gt=W({_meta:K(om)}).passthrough(),lt=W({method:C(),params:K(gt)}),fa=W({_meta:K(W({}).passthrough())}).passthrough(),St=W({method:C(),params:K(fa)}),pt=W({_meta:K(W({}).passthrough())}).passthrough(),ha=ot([C(),et().int()]),fi=W({jsonrpc:ge(da),id:ha}).merge(lt).strict(),hi=t=>fi.safeParse(t).success,pi=W({jsonrpc:ge(da)}).merge(St).strict(),ec=t=>pi.safeParse(t).success,mi=W({jsonrpc:ge(da),id:ha,result:pt}).strict(),ss=t=>mi.safeParse(t).success;O.ErrorCode=void 0,function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"}(O.ErrorCode||(O.ErrorCode={}));const vi=W({jsonrpc:ge(da),id:ha,error:W({code:et().int(),message:C(),data:K(ca())})}).strict(),tc=t=>vi.safeParse(t).success,pa=ot([fi,pi,mi,vi]),tr=pt.strict(),ns=St.extend({method:ge("notifications/cancelled"),params:fa.extend({requestId:ha,reason:C().optional()})}),Mr=W({name:C(),title:K(C())}).passthrough(),gi=Mr.extend({version:C()}),rc=W({experimental:K(W({}).passthrough()),sampling:K(W({}).passthrough()),elicitation:K(W({}).passthrough()),roots:K(W({listChanged:K(We())}).passthrough())}).passthrough(),is=lt.extend({method:ge("initialize"),params:gt.extend({protocolVersion:C(),capabilities:rc,clientInfo:gi})}),lm=t=>is.safeParse(t).success,ac=W({experimental:K(W({}).passthrough()),logging:K(W({}).passthrough()),completions:K(W({}).passthrough()),prompts:K(W({listChanged:K(We())}).passthrough()),resources:K(W({subscribe:K(We()),listChanged:K(We())}).passthrough()),tools:K(W({listChanged:K(We())}).passthrough())}).passthrough(),yi=pt.extend({protocolVersion:C(),capabilities:ac,serverInfo:gi,instructions:K(C())}),os=St.extend({method:ge("notifications/initialized")}),sc=t=>os.safeParse(t).success,ls=lt.extend({method:ge("ping")}),nc=W({progress:et(),total:K(et()),message:K(C())}).passthrough(),cs=St.extend({method:ge("notifications/progress"),params:fa.merge(nc).extend({progressToken:ui})}),ma=lt.extend({params:gt.extend({cursor:K(di)}).optional()}),va=pt.extend({nextCursor:K(di)}),_i=W({uri:C(),mimeType:K(C()),_meta:K(W({}).passthrough())}).passthrough(),$i=_i.extend({text:C()}),wi=C().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),bi=_i.extend({blob:wi}),Pi=Mr.extend({uri:C(),description:K(C()),mimeType:K(C()),_meta:K(W({}).passthrough())}),ic=Mr.extend({uriTemplate:C(),description:K(C()),mimeType:K(C()),_meta:K(W({}).passthrough())}),us=ma.extend({method:ge("resources/list")}),Ei=va.extend({resources:ie(Pi)}),ds=ma.extend({method:ge("resources/templates/list")}),Si=va.extend({resourceTemplates:ie(ic)}),fs=lt.extend({method:ge("resources/read"),params:gt.extend({uri:C()})}),Ri=pt.extend({contents:ie(ot([$i,bi]))}),oc=St.extend({method:ge("notifications/resources/list_changed")}),lc=lt.extend({method:ge("resources/subscribe"),params:gt.extend({uri:C()})}),cc=lt.extend({method:ge("resources/unsubscribe"),params:gt.extend({uri:C()})}),uc=St.extend({method:ge("notifications/resources/updated"),params:fa.extend({uri:C()})}),dc=W({name:C(),description:K(C()),required:K(We())}).passthrough(),fc=Mr.extend({description:K(C()),arguments:K(ie(dc)),_meta:K(W({}).passthrough())}),hs=ma.extend({method:ge("prompts/list")}),ki=va.extend({prompts:ie(fc)}),ps=lt.extend({method:ge("prompts/get"),params:gt.extend({name:C(),arguments:K(ua(C()))})}),ms=W({type:ge("text"),text:C(),_meta:K(W({}).passthrough())}).passthrough(),vs=W({type:ge("image"),data:wi,mimeType:C(),_meta:K(W({}).passthrough())}).passthrough(),gs=W({type:ge("audio"),data:wi,mimeType:C(),_meta:K(W({}).passthrough())}).passthrough(),hc=W({type:ge("resource"),resource:ot([$i,bi]),_meta:K(W({}).passthrough())}).passthrough(),pc=Pi.extend({type:ge("resource_link")}),Ti=ot([ms,vs,gs,pc,hc]),mc=W({role:Kt(["user","assistant"]),content:Ti}).passthrough(),Oi=pt.extend({description:K(C()),messages:ie(mc)}),vc=St.extend({method:ge("notifications/prompts/list_changed")}),gc=W({title:K(C()),readOnlyHint:K(We()),destructiveHint:K(We()),idempotentHint:K(We()),openWorldHint:K(We())}).passthrough(),yc=Mr.extend({description:K(C()),inputSchema:W({type:ge("object"),properties:K(W({}).passthrough()),required:K(ie(C()))}).passthrough(),outputSchema:K(W({type:ge("object"),properties:K(W({}).passthrough()),required:K(ie(C()))}).passthrough()),annotations:K(gc),_meta:K(W({}).passthrough())}),ys=ma.extend({method:ge("tools/list")}),Ci=va.extend({tools:ie(yc)}),_s=pt.extend({content:ie(Ti).default([]),structuredContent:W({}).passthrough().optional(),isError:K(We())}),cm=_s.or(pt.extend({toolResult:ca()})),$s=lt.extend({method:ge("tools/call"),params:gt.extend({name:C(),arguments:K(ua(ca()))})}),_c=St.extend({method:ge("notifications/tools/list_changed")}),Ii=Kt(["debug","info","notice","warning","error","critical","alert","emergency"]),$c=lt.extend({method:ge("logging/setLevel"),params:gt.extend({level:Ii})}),wc=St.extend({method:ge("notifications/message"),params:fa.extend({level:Ii,logger:K(C()),data:ca()})}),bc=W({name:C().optional()}).passthrough(),Pc=W({hints:K(ie(bc)),costPriority:K(et().min(0).max(1)),speedPriority:K(et().min(0).max(1)),intelligencePriority:K(et().min(0).max(1))}).passthrough(),Ec=W({role:Kt(["user","assistant"]),content:ot([ms,vs,gs])}).passthrough(),Sc=lt.extend({method:ge("sampling/createMessage"),params:gt.extend({messages:ie(Ec),systemPrompt:K(C()),includeContext:K(Kt(["none","thisServer","allServers"])),temperature:K(et()),maxTokens:et().int(),stopSequences:K(ie(C())),metadata:K(W({}).passthrough()),modelPreferences:K(Pc)})}),Ni=pt.extend({model:C(),stopReason:K(Kt(["endTurn","stopSequence","maxTokens"]).or(C())),role:Kt(["user","assistant"]),content:nm("type",[ms,vs,gs])}),Rc=W({type:ge("boolean"),title:K(C()),description:K(C()),default:K(We())}).passthrough(),kc=W({type:ge("string"),title:K(C()),description:K(C()),minLength:K(et()),maxLength:K(et()),format:K(Kt(["email","uri","date","date-time"]))}).passthrough(),Tc=W({type:Kt(["number","integer"]),title:K(C()),description:K(C()),minimum:K(et()),maximum:K(et())}).passthrough(),Oc=W({type:ge("string"),title:K(C()),description:K(C()),enum:ie(C()),enumNames:K(ie(C()))}).passthrough(),Cc=ot([Rc,kc,Tc,Oc]),Ic=lt.extend({method:ge("elicitation/create"),params:gt.extend({message:C(),requestedSchema:W({type:ge("object"),properties:ua(C(),Cc),required:K(ie(C()))}).passthrough()})}),Ai=pt.extend({action:Kt(["accept","decline","cancel"]),content:K(ua(C(),ca()))}),ji=W({type:ge("ref/resource"),uri:C()}).passthrough(),um=ji,Nc=W({type:ge("ref/prompt"),name:C()}).passthrough(),ws=lt.extend({method:ge("completion/complete"),params:gt.extend({ref:ot([Nc,ji]),argument:W({name:C(),value:C()}).passthrough(),context:K(W({arguments:K(ua(C(),C()))}))})}),Di=pt.extend({completion:W({values:ie(C()).max(100),total:K(et().int()),hasMore:K(We())}).passthrough()}),Ac=W({uri:C().startsWith("file://"),name:K(C()),_meta:K(W({}).passthrough())}).passthrough(),jc=lt.extend({method:ge("roots/list")}),xi=pt.extend({roots:ie(Ac)}),Dc=St.extend({method:ge("notifications/roots/list_changed")}),dm=ot([ls,is,ws,$c,ps,hs,us,ds,fs,lc,cc,$s,ys]),fm=ot([ns,cs,os,Dc]),hm=ot([tr,Ni,Ai,xi]),pm=ot([ls,Sc,Ic,jc]),mm=ot([ns,cs,wc,uc,oc,_c,vc]),vm=ot([tr,yi,Di,Oi,ki,Ei,Si,Ri,_s,Ci]);class je extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const xc=1e6,Mi=1e6,Mc=1e4,gm=1e6;class Bt{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,a,s){if(e.length>a)throw new Error(`${s} exceeds maximum length of ${a} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){Bt.validateLength(e,xc,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const a=[];let s="",r=0,n=0;for(;r<e.length;)if(e[r]==="{"){s&&(a.push(s),s="");const o=e.indexOf("}",r);if(o===-1)throw new Error("Unclosed template expression");if(n++,n>Mc)throw new Error(`Template contains too many expressions (max ${Mc})`);const i=e.slice(r+1,o),l=this.getOperator(i),c=i.includes("*"),u=this.getNames(i),f=u[0];for(const g of u)Bt.validateLength(g,Mi,"Variable name");a.push({name:f,operator:l,names:u,exploded:c}),r=o+1}else s+=e[r],r++;return s&&a.push(s),a}getOperator(e){return["+","#",".","/","?","&"].find(s=>e.startsWith(s))||""}getNames(e){const a=this.getOperator(e);return e.slice(a.length).split(",").map(s=>s.replace("*","").trim()).filter(s=>s.length>0)}encodeValue(e,a){return Bt.validateLength(e,Mi,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const o=e.names.map(l=>{const c=a[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(f=>this.encodeValue(f,e.operator)).join(","):this.encodeValue(c.toString(),e.operator);return`${l}=${u}`}).filter(l=>l.length>0);return o.length===0?"":(e.operator==="?"?"?":"&")+o.join("&")}if(e.names.length>1){const o=e.names.map(i=>a[i]).filter(i=>i!==void 0);return o.length===0?"":o.map(i=>Array.isArray(i)?i[0]:i).join(",")}const s=a[e.name];if(s===void 0)return"";const n=(Array.isArray(s)?s:[s]).map(o=>this.encodeValue(o,e.operator));switch(e.operator){case"":return n.join(",");case"+":return n.join(",");case"#":return"#"+n.join(",");case".":return"."+n.join(".");case"/":return"/"+n.join("/");default:return n.join(",")}}expand(e){let a="",s=!1;for(const r of this.parts){if(typeof r=="string"){a+=r;continue}const n=this.expandPart(r,e);n&&((r.operator==="?"||r.operator==="&")&&s?a+=n.replace("?","&"):a+=n,(r.operator==="?"||r.operator==="&")&&(s=!0))}return a}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const a=[];for(const n of e.names)Bt.validateLength(n,Mi,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let n=0;n<e.names.length;n++){const o=e.names[n],i=n===0?"\\"+e.operator:"&";a.push({pattern:i+this.escapeRegExp(o)+"=([^&]+)",name:o})}return a}let s;const r=e.name;switch(e.operator){case"":s=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":s="(.+)";break;case".":s="\\.([^/,]+)";break;case"/":s="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:s="([^/]+)"}return a.push({pattern:s,name:r}),a}match(e){Bt.validateLength(e,xc,"URI");let a="^";const s=[];for(const i of this.parts)if(typeof i=="string")a+=this.escapeRegExp(i);else{const l=this.partToRegExp(i);for(const{pattern:c,name:u}of l)a+=c,s.push({name:u,exploded:i.exploded})}a+="$",Bt.validateLength(a,gm,"Generated regex pattern");const r=new RegExp(a),n=e.match(r);if(!n)return null;const o={};for(let i=0;i<s.length;i++){const{name:l,exploded:c}=s[i],u=n[i+1],f=l.replace("*","");c&&u.includes(",")?o[f]=u.split(","):o[f]=u}return o}}O.McpZodTypeKind=void 0,function(t){t.Completable="McpCompletable"}(O.McpZodTypeKind||(O.McpZodTypeKind={}));class ga extends Pe{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}ga.create=(t,e)=>new ga({type:t,typeName:O.McpZodTypeKind.Completable,complete:e.complete,..._m(e)});function ym(t,e){return ga.create(t,{...t._def,complete:e})}function _m(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{var l,c;const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??a)!==null&&c!==void 0?c:i.defaultError}},description:r}}function $m(t){var e;if(t.title!==void 0&&t.title!=="")return t.title;if("annotations"in t){const a=t;if(!((e=a.annotations)===null||e===void 0)&&e.title)return a.annotations.title}return t.name}const Lc=6e4;class Li{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(ns,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(cs,a=>{this._onprogress(a)}),this.setRequestHandler(ls,a=>({}))}_setupTimeout(e,a,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,a),startTime:Date.now(),timeout:a,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){const a=this._timeoutInfo.get(e);if(!a)return!1;const s=Date.now()-a.startTime;if(a.maxTotalTimeout&&s>=a.maxTotalTimeout)throw this._timeoutInfo.delete(e),new je(O.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:s});return clearTimeout(a.timeoutId),a.timeoutId=setTimeout(a.onTimeout,a.timeout),!0}_cleanupTimeout(e){const a=this._timeoutInfo.get(e);a&&(clearTimeout(a.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var a,s,r;this._transport=e;const n=(a=this.transport)===null||a===void 0?void 0:a.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=l=>{o==null||o(l),this._onerror(l)};const i=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(l,c)=>{i==null||i(l,c),ss(l)||tc(l)?this._onresponse(l):hi(l)?this._onrequest(l,c):ec(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;const a=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new je(O.ErrorCode.ConnectionClosed,"Connection closed");for(const r of a.values())r(s)}_onerror(e){var a;(a=this.onerror)===null||a===void 0||a.call(this,e)}_onnotification(e){var a;const s=(a=this._notificationHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,a){var s,r,n,o;const i=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler;if(i===void 0){(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",id:e.id,error:{code:O.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const c={signal:l.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,f,g)=>this.request(u,f,{...g,relatedRequestId:e.id}),authInfo:a==null?void 0:a.authInfo,requestId:e.id,requestInfo:a==null?void 0:a.requestInfo};Promise.resolve().then(()=>i(e,c)).then(u=>{var f;if(!l.signal.aborted)return(f=this._transport)===null||f===void 0?void 0:f.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var f,g;if(!l.signal.aborted)return(f=this._transport)===null||f===void 0?void 0:f.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:O.ErrorCode.InternalError,message:(g=u.message)!==null&&g!==void 0?g:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:a,...s}=e.params,r=Number(a),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){o(l);return}n(s)}_onresponse(e){const a=Number(e.id),s=this._responseHandlers.get(a);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),ss(e))s(e);else{const r=new je(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,a,s){const{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}=s??{};return new Promise((i,l)=>{var c,u,f,g,d,m;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=s==null?void 0:s.signal)===null||u===void 0||u.throwIfAborted();const p=this._requestMessageId++,h={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),h.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:p}});const v=E=>{var k;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(E)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`))),l(E)};this._responseHandlers.set(p,E=>{var k;if(!(!((k=s==null?void 0:s.signal)===null||k===void 0)&&k.aborted)){if(E instanceof Error)return l(E);try{const D=a.parse(E.result);i(D)}catch(D){l(D)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var E;v((E=s==null?void 0:s.signal)===null||E===void 0?void 0:E.reason)});const $=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:Lc,w=()=>v(new je(O.ErrorCode.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(p,$,s==null?void 0:s.maxTotalTimeout,w,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(E=>{this._cleanupTimeout(p),l(E)})})}async notification(e,a){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,a).catch(u=>this._onerror(u))});return}const i={...e,jsonrpc:"2.0"};await this._transport.send(i,a)}setRequestHandler(e,a){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(a(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,a){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(a(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function Fi(t,e){return Object.entries(e).reduce((a,[s,r])=>(r&&typeof r=="object"?a[s]=a[s]?{...a[s],...r}:r:a[s]=r,a),{...t})}var qi={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(a,s){s(e)})(Br,function(a){function s(){for(var P=arguments.length,_=Array(P),S=0;S<P;S++)_[S]=arguments[S];if(_.length>1){_[0]=_[0].slice(0,-1);for(var j=_.length-1,A=1;A<j;++A)_[A]=_[A].slice(1,-1);return _[j]=_[j].slice(1),_.join("")}else return _[0]}function r(P){return"(?:"+P+")"}function n(P){return P===void 0?"undefined":P===null?"null":Object.prototype.toString.call(P).split(" ").pop().split("]").shift().toLowerCase()}function o(P){return P.toUpperCase()}function i(P){return P!=null?P instanceof Array?P:typeof P.length!="number"||P.split||P.setInterval||P.call?[P]:Array.prototype.slice.call(P):[]}function l(P,_){var S=P;if(_)for(var j in _)S[j]=_[j];return S}function c(P){var _="[A-Za-z]",S="[0-9]",j=s(S,"[A-Fa-f]"),A=r(r("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+r("%[89A-Fa-f]"+j+"%"+j+j)+"|"+r("%"+j+j)),le="[\\:\\/\\?\\#\\[\\]\\@]",de="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Re=s(le,de),Me=P?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ke=P?"[\\uE000-\\uF8FF]":"[]",Se=s(_,S,"[\\-\\.\\_\\~]",Me);r(_+s(_,S,"[\\+\\-\\.]")+"*"),r(r(A+"|"+s(Se,de,"[\\:]"))+"*");var xe=r(r("25[0-5]")+"|"+r("2[0-4]"+S)+"|"+r("1"+S+S)+"|"+r("0?[1-9]"+S)+"|0?0?"+S),Be=r(xe+"\\."+xe+"\\."+xe+"\\."+xe),ve=r(j+"{1,4}"),qe=r(r(ve+"\\:"+ve)+"|"+Be),Qe=r(r(ve+"\\:")+"{6}"+qe),Ue=r("\\:\\:"+r(ve+"\\:")+"{5}"+qe),or=r(r(ve)+"?\\:\\:"+r(ve+"\\:")+"{4}"+qe),Dt=r(r(r(ve+"\\:")+"{0,1}"+ve)+"?\\:\\:"+r(ve+"\\:")+"{3}"+qe),xt=r(r(r(ve+"\\:")+"{0,2}"+ve)+"?\\:\\:"+r(ve+"\\:")+"{2}"+qe),Kr=r(r(r(ve+"\\:")+"{0,3}"+ve)+"?\\:\\:"+ve+"\\:"+qe),Er=r(r(r(ve+"\\:")+"{0,4}"+ve)+"?\\:\\:"+qe),_t=r(r(r(ve+"\\:")+"{0,5}"+ve)+"?\\:\\:"+ve),Mt=r(r(r(ve+"\\:")+"{0,6}"+ve)+"?\\:\\:"),Sr=r([Qe,Ue,or,Dt,xt,Kr,Er,_t,Mt].join("|")),Gt=r(r(Se+"|"+A)+"+");r("[vV]"+j+"+\\."+s(Se,de,"[\\:]")+"+"),r(r(A+"|"+s(Se,de))+"*");var Ea=r(A+"|"+s(Se,de,"[\\:\\@]"));return r(r(A+"|"+s(Se,de,"[\\@]"))+"+"),r(r(Ea+"|"+s("[\\/\\?]",Ke))+"*"),{NOT_SCHEME:new RegExp(s("[^]",_,S,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",Se,de),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",Se,de),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",Se,de),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",Se,de),"g"),NOT_QUERY:new RegExp(s("[^\\%]",Se,de,"[\\:\\@\\/\\?]",Ke),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",Se,de,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",Se,de),"g"),UNRESERVED:new RegExp(Se,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",Se,Re),"g"),PCT_ENCODED:new RegExp(A,"g"),IPV4ADDRESS:new RegExp("^("+Be+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Sr+")"+r(r("\\%25|\\%(?!"+j+"{2})")+"("+Gt+")")+"?\\]?$")}}var u=c(!1),f=c(!0),g=function(){function P(_,S){var j=[],A=!0,le=!1,de=void 0;try{for(var Re=_[Symbol.iterator](),Me;!(A=(Me=Re.next()).done)&&(j.push(Me.value),!(S&&j.length===S));A=!0);}catch(Ke){le=!0,de=Ke}finally{try{!A&&Re.return&&Re.return()}finally{if(le)throw de}}return j}return function(_,S){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return P(_,S);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(P){if(Array.isArray(P)){for(var _=0,S=Array(P.length);_<P.length;_++)S[_]=P[_];return S}else return Array.from(P)},m=2147483647,p=36,h=1,v=26,$=38,w=700,E=72,k=128,D="-",H=/^xn--/,z=/[^\0-\x7E]/,Z=/[\x2E\u3002\uFF0E\uFF61]/g,X={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Y=p-h,Q=Math.floor,U=String.fromCharCode;function F(P){throw new RangeError(X[P])}function ne(P,_){for(var S=[],j=P.length;j--;)S[j]=_(P[j]);return S}function $e(P,_){var S=P.split("@"),j="";S.length>1&&(j=S[0]+"@",P=S[1]),P=P.replace(Z,".");var A=P.split("."),le=ne(A,_).join(".");return j+le}function he(P){for(var _=[],S=0,j=P.length;S<j;){var A=P.charCodeAt(S++);if(A>=55296&&A<=56319&&S<j){var le=P.charCodeAt(S++);(le&64512)==56320?_.push(((A&1023)<<10)+(le&1023)+65536):(_.push(A),S--)}else _.push(A)}return _}var we=function(_){return String.fromCodePoint.apply(String,d(_))},pe=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:p},M=function(_,S){return _+22+75*(_<26)-((S!=0)<<5)},T=function(_,S,j){var A=0;for(_=j?Q(_/w):_>>1,_+=Q(_/S);_>Y*v>>1;A+=p)_=Q(_/Y);return Q(A+(Y+1)*_/(_+$))},q=function(_){var S=[],j=_.length,A=0,le=k,de=E,Re=_.lastIndexOf(D);Re<0&&(Re=0);for(var Me=0;Me<Re;++Me)_.charCodeAt(Me)>=128&&F("not-basic"),S.push(_.charCodeAt(Me));for(var Ke=Re>0?Re+1:0;Ke<j;){for(var Se=A,xe=1,Be=p;;Be+=p){Ke>=j&&F("invalid-input");var ve=pe(_.charCodeAt(Ke++));(ve>=p||ve>Q((m-A)/xe))&&F("overflow"),A+=ve*xe;var qe=Be<=de?h:Be>=de+v?v:Be-de;if(ve<qe)break;var Qe=p-qe;xe>Q(m/Qe)&&F("overflow"),xe*=Qe}var Ue=S.length+1;de=T(A-Se,Ue,Se==0),Q(A/Ue)>m-le&&F("overflow"),le+=Q(A/Ue),A%=Ue,S.splice(A++,0,le)}return String.fromCodePoint.apply(String,S)},I=function(_){var S=[];_=he(_);var j=_.length,A=k,le=0,de=E,Re=!0,Me=!1,Ke=void 0;try{for(var Se=_[Symbol.iterator](),xe;!(Re=(xe=Se.next()).done);Re=!0){var Be=xe.value;Be<128&&S.push(U(Be))}}catch(Sa){Me=!0,Ke=Sa}finally{try{!Re&&Se.return&&Se.return()}finally{if(Me)throw Ke}}var ve=S.length,qe=ve;for(ve&&S.push(D);qe<j;){var Qe=m,Ue=!0,or=!1,Dt=void 0;try{for(var xt=_[Symbol.iterator](),Kr;!(Ue=(Kr=xt.next()).done);Ue=!0){var Er=Kr.value;Er>=A&&Er<Qe&&(Qe=Er)}}catch(Sa){or=!0,Dt=Sa}finally{try{!Ue&&xt.return&&xt.return()}finally{if(or)throw Dt}}var _t=qe+1;Qe-A>Q((m-le)/_t)&&F("overflow"),le+=(Qe-A)*_t,A=Qe;var Mt=!0,Sr=!1,Gt=void 0;try{for(var Ea=_[Symbol.iterator](),hd;!(Mt=(hd=Ea.next()).done);Mt=!0){var pd=hd.value;if(pd<A&&++le>m&&F("overflow"),pd==A){for(var Js=le,Qs=p;;Qs+=p){var Gs=Qs<=de?h:Qs>=de+v?v:Qs-de;if(Js<Gs)break;var md=Js-Gs,vd=p-Gs;S.push(U(M(Gs+md%vd,0))),Js=Q(md/vd)}S.push(U(M(Js,0))),de=T(le,_t,qe==ve),le=0,++qe}}}catch(Sa){Sr=!0,Gt=Sa}finally{try{!Mt&&Ea.return&&Ea.return()}finally{if(Sr)throw Gt}}++le,++A}return S.join("")},y=function(_){return $e(_,function(S){return H.test(S)?q(S.slice(4).toLowerCase()):S})},b=function(_){return $e(_,function(S){return z.test(S)?"xn--"+I(S):S})},x={version:"2.1.0",ucs2:{decode:he,encode:we},decode:q,encode:I,toASCII:b,toUnicode:y},G={};function te(P){var _=P.charCodeAt(0),S=void 0;return _<16?S="%0"+_.toString(16).toUpperCase():_<128?S="%"+_.toString(16).toUpperCase():_<2048?S="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():S="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),S}function me(P){for(var _="",S=0,j=P.length;S<j;){var A=parseInt(P.substr(S+1,2),16);if(A<128)_+=String.fromCharCode(A),S+=3;else if(A>=194&&A<224){if(j-S>=6){var le=parseInt(P.substr(S+4,2),16);_+=String.fromCharCode((A&31)<<6|le&63)}else _+=P.substr(S,6);S+=6}else if(A>=224){if(j-S>=9){var de=parseInt(P.substr(S+4,2),16),Re=parseInt(P.substr(S+7,2),16);_+=String.fromCharCode((A&15)<<12|(de&63)<<6|Re&63)}else _+=P.substr(S,9);S+=9}else _+=P.substr(S,3),S+=3}return _}function ce(P,_){function S(j){var A=me(j);return A.match(_.UNRESERVED)?A:j}return P.scheme&&(P.scheme=String(P.scheme).replace(_.PCT_ENCODED,S).toLowerCase().replace(_.NOT_SCHEME,"")),P.userinfo!==void 0&&(P.userinfo=String(P.userinfo).replace(_.PCT_ENCODED,S).replace(_.NOT_USERINFO,te).replace(_.PCT_ENCODED,o)),P.host!==void 0&&(P.host=String(P.host).replace(_.PCT_ENCODED,S).toLowerCase().replace(_.NOT_HOST,te).replace(_.PCT_ENCODED,o)),P.path!==void 0&&(P.path=String(P.path).replace(_.PCT_ENCODED,S).replace(P.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,te).replace(_.PCT_ENCODED,o)),P.query!==void 0&&(P.query=String(P.query).replace(_.PCT_ENCODED,S).replace(_.NOT_QUERY,te).replace(_.PCT_ENCODED,o)),P.fragment!==void 0&&(P.fragment=String(P.fragment).replace(_.PCT_ENCODED,S).replace(_.NOT_FRAGMENT,te).replace(_.PCT_ENCODED,o)),P}function R(P){return P.replace(/^0*(.*)/,"$1")||"0"}function N(P,_){var S=P.match(_.IPV4ADDRESS)||[],j=g(S,2),A=j[1];return A?A.split(".").map(R).join("."):P}function L(P,_){var S=P.match(_.IPV6ADDRESS)||[],j=g(S,3),A=j[1],le=j[2];if(A){for(var de=A.toLowerCase().split("::").reverse(),Re=g(de,2),Me=Re[0],Ke=Re[1],Se=Ke?Ke.split(":").map(R):[],xe=Me.split(":").map(R),Be=_.IPV4ADDRESS.test(xe[xe.length-1]),ve=Be?7:8,qe=xe.length-ve,Qe=Array(ve),Ue=0;Ue<ve;++Ue)Qe[Ue]=Se[Ue]||xe[qe+Ue]||"";Be&&(Qe[ve-1]=N(Qe[ve-1],_));var or=Qe.reduce(function(_t,Mt,Sr){if(!Mt||Mt==="0"){var Gt=_t[_t.length-1];Gt&&Gt.index+Gt.length===Sr?Gt.length++:_t.push({index:Sr,length:1})}return _t},[]),Dt=or.sort(function(_t,Mt){return Mt.length-_t.length})[0],xt=void 0;if(Dt&&Dt.length>1){var Kr=Qe.slice(0,Dt.index),Er=Qe.slice(Dt.index+Dt.length);xt=Kr.join(":")+"::"+Er.join(":")}else xt=Qe.join(":");return le&&(xt+="%"+le),xt}else return P}var V=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,se="".match(/(){0}/)[1]===void 0;function ue(P){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S={},j=_.iri!==!1?f:u;_.reference==="suffix"&&(P=(_.scheme?_.scheme+":":"")+"//"+P);var A=P.match(V);if(A){se?(S.scheme=A[1],S.userinfo=A[3],S.host=A[4],S.port=parseInt(A[5],10),S.path=A[6]||"",S.query=A[7],S.fragment=A[8],isNaN(S.port)&&(S.port=A[5])):(S.scheme=A[1]||void 0,S.userinfo=P.indexOf("@")!==-1?A[3]:void 0,S.host=P.indexOf("//")!==-1?A[4]:void 0,S.port=parseInt(A[5],10),S.path=A[6]||"",S.query=P.indexOf("?")!==-1?A[7]:void 0,S.fragment=P.indexOf("#")!==-1?A[8]:void 0,isNaN(S.port)&&(S.port=P.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?A[4]:void 0)),S.host&&(S.host=L(N(S.host,j),j)),S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&!S.path&&S.query===void 0?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==S.reference&&(S.error=S.error||"URI is not a "+_.reference+" reference.");var le=G[(_.scheme||S.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!le||!le.unicodeSupport)){if(S.host&&(_.domainHost||le&&le.domainHost))try{S.host=x.toASCII(S.host.replace(j.PCT_ENCODED,me).toLowerCase())}catch(de){S.error=S.error||"Host's domain name can not be converted to ASCII via punycode: "+de}ce(S,u)}else ce(S,j);le&&le.parse&&le.parse(S,_)}else S.error=S.error||"URI can not be parsed.";return S}function Fe(P,_){var S=_.iri!==!1?f:u,j=[];return P.userinfo!==void 0&&(j.push(P.userinfo),j.push("@")),P.host!==void 0&&j.push(L(N(String(P.host),S),S).replace(S.IPV6ADDRESS,function(A,le,de){return"["+le+(de?"%25"+de:"")+"]"})),(typeof P.port=="number"||typeof P.port=="string")&&(j.push(":"),j.push(String(P.port))),j.length?j.join(""):void 0}var Ye=/^\.\.?\//,Te=/^\/\.(\/|$)/,Ve=/^\/\.\.(\/|$)/,ze=/^\/?(?:.|\n)*?(?=\/|$)/;function De(P){for(var _=[];P.length;)if(P.match(Ye))P=P.replace(Ye,"");else if(P.match(Te))P=P.replace(Te,"/");else if(P.match(Ve))P=P.replace(Ve,"/"),_.pop();else if(P==="."||P==="..")P="";else{var S=P.match(ze);if(S){var j=S[0];P=P.slice(j.length),_.push(j)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function Oe(P){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=_.iri?f:u,j=[],A=G[(_.scheme||P.scheme||"").toLowerCase()];if(A&&A.serialize&&A.serialize(P,_),P.host&&!S.IPV6ADDRESS.test(P.host)){if(_.domainHost||A&&A.domainHost)try{P.host=_.iri?x.toUnicode(P.host):x.toASCII(P.host.replace(S.PCT_ENCODED,me).toLowerCase())}catch(Re){P.error=P.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+Re}}ce(P,S),_.reference!=="suffix"&&P.scheme&&(j.push(P.scheme),j.push(":"));var le=Fe(P,_);if(le!==void 0&&(_.reference!=="suffix"&&j.push("//"),j.push(le),P.path&&P.path.charAt(0)!=="/"&&j.push("/")),P.path!==void 0){var de=P.path;!_.absolutePath&&(!A||!A.absolutePath)&&(de=De(de)),le===void 0&&(de=de.replace(/^\/\//,"/%2F")),j.push(de)}return P.query!==void 0&&(j.push("?"),j.push(P.query)),P.fragment!==void 0&&(j.push("#"),j.push(P.fragment)),j.join("")}function tt(P,_){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments[3],A={};return j||(P=ue(Oe(P,S),S),_=ue(Oe(_,S),S)),S=S||{},!S.tolerant&&_.scheme?(A.scheme=_.scheme,A.userinfo=_.userinfo,A.host=_.host,A.port=_.port,A.path=De(_.path||""),A.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(A.userinfo=_.userinfo,A.host=_.host,A.port=_.port,A.path=De(_.path||""),A.query=_.query):(_.path?(_.path.charAt(0)==="/"?A.path=De(_.path):((P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)&&!P.path?A.path="/"+_.path:P.path?A.path=P.path.slice(0,P.path.lastIndexOf("/")+1)+_.path:A.path=_.path,A.path=De(A.path)),A.query=_.query):(A.path=P.path,_.query!==void 0?A.query=_.query:A.query=P.query),A.userinfo=P.userinfo,A.host=P.host,A.port=P.port),A.scheme=P.scheme),A.fragment=_.fragment,A}function ir(P,_,S){var j=l({scheme:"null"},S);return Oe(tt(ue(P,j),ue(_,j),j,!0),j)}function Qt(P,_){return typeof P=="string"?P=Oe(ue(P,_),_):n(P)==="object"&&(P=ue(Oe(P,_),_)),P}function br(P,_,S){return typeof P=="string"?P=Oe(ue(P,S),S):n(P)==="object"&&(P=Oe(P,S)),typeof _=="string"?_=Oe(ue(_,S),S):n(_)==="object"&&(_=Oe(_,S)),P===_}function Bs(P,_){return P&&P.toString().replace(!_||!_.iri?u.ESCAPE:f.ESCAPE,te)}function yt(P,_){return P&&P.toString().replace(!_||!_.iri?u.PCT_ENCODED:f.PCT_ENCODED,me)}var Pr={scheme:"http",domainHost:!0,parse:function(_,S){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,S){var j=String(_.scheme).toLowerCase()==="https";return(_.port===(j?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},nd={scheme:"https",domainHost:Pr.domainHost,parse:Pr.parse,serialize:Pr.serialize};function id(P){return typeof P.secure=="boolean"?P.secure:String(P.scheme).toLowerCase()==="wss"}var Pa={scheme:"ws",domainHost:!0,parse:function(_,S){var j=_;return j.secure=id(j),j.resourceName=(j.path||"/")+(j.query?"?"+j.query:""),j.path=void 0,j.query=void 0,j},serialize:function(_,S){if((_.port===(id(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var j=_.resourceName.split("?"),A=g(j,2),le=A[0],de=A[1];_.path=le&&le!=="/"?le:void 0,_.query=de,_.resourceName=void 0}return _.fragment=void 0,_}},od={scheme:"wss",domainHost:Pa.domainHost,parse:Pa.parse,serialize:Pa.serialize},Jy={},ld="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",jt="[0-9A-Fa-f]",Qy=r(r("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+r("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+r("%"+jt+jt)),Gy="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Wy="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Xy=s(Wy,'[\\"\\\\]'),Yy="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",e_=new RegExp(ld,"g"),Zr=new RegExp(Qy,"g"),t_=new RegExp(s("[^]",Gy,"[\\.]",'[\\"]',Xy),"g"),cd=new RegExp(s("[^]",ld,Yy),"g"),r_=cd;function jo(P){var _=me(P);return _.match(e_)?_:P}var ud={scheme:"mailto",parse:function(_,S){var j=_,A=j.to=j.path?j.path.split(","):[];if(j.path=void 0,j.query){for(var le=!1,de={},Re=j.query.split("&"),Me=0,Ke=Re.length;Me<Ke;++Me){var Se=Re[Me].split("=");switch(Se[0]){case"to":for(var xe=Se[1].split(","),Be=0,ve=xe.length;Be<ve;++Be)A.push(xe[Be]);break;case"subject":j.subject=yt(Se[1],S);break;case"body":j.body=yt(Se[1],S);break;default:le=!0,de[yt(Se[0],S)]=yt(Se[1],S);break}}le&&(j.headers=de)}j.query=void 0;for(var qe=0,Qe=A.length;qe<Qe;++qe){var Ue=A[qe].split("@");if(Ue[0]=yt(Ue[0]),S.unicodeSupport)Ue[1]=yt(Ue[1],S).toLowerCase();else try{Ue[1]=x.toASCII(yt(Ue[1],S).toLowerCase())}catch(or){j.error=j.error||"Email address's domain name can not be converted to ASCII via punycode: "+or}A[qe]=Ue.join("@")}return j},serialize:function(_,S){var j=_,A=i(_.to);if(A){for(var le=0,de=A.length;le<de;++le){var Re=String(A[le]),Me=Re.lastIndexOf("@"),Ke=Re.slice(0,Me).replace(Zr,jo).replace(Zr,o).replace(t_,te),Se=Re.slice(Me+1);try{Se=S.iri?x.toUnicode(Se):x.toASCII(yt(Se,S).toLowerCase())}catch(qe){j.error=j.error||"Email address's domain name can not be converted to "+(S.iri?"Unicode":"ASCII")+" via punycode: "+qe}A[le]=Ke+"@"+Se}j.path=A.join(",")}var xe=_.headers=_.headers||{};_.subject&&(xe.subject=_.subject),_.body&&(xe.body=_.body);var Be=[];for(var ve in xe)xe[ve]!==Jy[ve]&&Be.push(ve.replace(Zr,jo).replace(Zr,o).replace(cd,te)+"="+xe[ve].replace(Zr,jo).replace(Zr,o).replace(r_,te));return Be.length&&(j.query=Be.join("&")),j}},a_=/^([^\:]+)\:(.*)/,dd={scheme:"urn",parse:function(_,S){var j=_.path&&_.path.match(a_),A=_;if(j){var le=S.scheme||A.scheme||"urn",de=j[1].toLowerCase(),Re=j[2],Me=le+":"+(S.nid||de),Ke=G[Me];A.nid=de,A.nss=Re,A.path=void 0,Ke&&(A=Ke.parse(A,S))}else A.error=A.error||"URN can not be parsed.";return A},serialize:function(_,S){var j=S.scheme||_.scheme||"urn",A=_.nid,le=j+":"+(S.nid||A),de=G[le];de&&(_=de.serialize(_,S));var Re=_,Me=_.nss;return Re.path=(A||S.nid)+":"+Me,Re}},s_=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,fd={scheme:"urn:uuid",parse:function(_,S){var j=_;return j.uuid=j.nss,j.nss=void 0,!S.tolerant&&(!j.uuid||!j.uuid.match(s_))&&(j.error=j.error||"UUID is not valid."),j},serialize:function(_,S){var j=_;return j.nss=(_.uuid||"").toLowerCase(),j}};G[Pr.scheme]=Pr,G[nd.scheme]=nd,G[Pa.scheme]=Pa,G[od.scheme]=od,G[ud.scheme]=ud,G[dd.scheme]=dd,G[fd.scheme]=fd,a.SCHEMES=G,a.pctEncChar=te,a.pctDecChars=me,a.parse=ue,a.removeDotSegments=De,a.serialize=Oe,a.resolveComponents=tt,a.resolve=ir,a.normalize=Qt,a.equal=br,a.escapeComponent=Bs,a.unescapeComponent=yt,Object.defineProperty(a,"__esModule",{value:!0})})})(qi,qi.exports);var wm=qi.exports,bm=function(e){for(var a=0,s=e.length,r=0,n;r<s;)a++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return a},Lr={copy:Pm,checkDataType:Ui,checkDataTypes:Em,coerceToTypes:Sm,toHash:Vi,getProperty:zi,escapeQuotes:Hi,equal:Wr,ucs2length:bm,varOccurences:Tm,varReplace:Om,schemaHasRules:Cm,schemaHasRulesExcept:Im,schemaUnknownRules:Nm,toQuotedString:Zi,getPathExpr:Am,getPath:jm,getData:Mm,unescapeFragment:Lm,unescapeJsonPointer:Bi,escapeFragment:Fm,escapeJsonPointer:Ki};function Pm(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function Ui(t,e,a,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(t){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+i+"("+e+" % 1)"+n+e+r+e+(a?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+t+'"'+(a?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+t+'"'}}function Em(t,e,a){switch(t.length){case 1:return Ui(t[0],e,a,!0);default:var s="",r=Vi(t);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Ui(n,e,a,!0);return s}}var Fc=Vi(["string","number","integer","boolean","null"]);function Sm(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(Fc[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(Fc[e])return[e];if(t==="array"&&e==="array")return["array"]}}function Vi(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var Rm=/^[a-z$_][a-z$_0-9]*$/i,km=/'|\\/g;function zi(t){return typeof t=="number"?"["+t+"]":Rm.test(t)?"."+t:"['"+Hi(t)+"']"}function Hi(t){return t.replace(km,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Tm(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function Om(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function Cm(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function Im(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function Nm(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function Zi(t){return"'"+Hi(t)+"'"}function Am(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return qc(t,r)}function jm(t,e,a){var s=Zi(a?"/"+Ki(e):zi(e));return qc(t,s)}var Dm=/^\/(?:[^~]|~0|~1)*$/,xm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Mm(t,e,a){var s,r,n,o;if(t==="")return"rootData";if(t[0]=="/"){if(!Dm.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(o=t.match(xm),!o)throw new Error("Invalid JSON-pointer: "+t);if(s=+o[1],r=o[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return a[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var i=n,l=r.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(n+=zi(Bi(u)),i+=" && "+n)}return i}function qc(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Lm(t){return Bi(decodeURIComponent(t))}function Fm(t){return encodeURIComponent(Ki(t))}function Ki(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Bi(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var qm=Lr,Uc=Um;function Um(t){qm.copy(t,this)}var Vc={exports:{}},rr=Vc.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};bs(e,s,r,t,"",t)};rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},rr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},rr.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};function bs(t,e,a,s,r,n,o,i,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,l,c);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in rr.arrayKeywords)for(var g=0;g<f.length;g++)bs(t,e,a,f[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in rr.propsKeywords){if(f&&typeof f=="object")for(var d in f)bs(t,e,a,f[d],r+"/"+u+"/"+Vm(d),n,r,u,s,d)}else(u in rr.keywords||t.allKeys&&!(u in rr.skipKeywords))&&bs(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,o,i,l,c)}}function Vm(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var zm=Vc.exports,ya=wm,zc=Wr,Ps=Lr,Es=Uc,Hm=zm,Ji=ar;ar.normalizeId=sr,ar.fullPath=Rs,ar.url=ks,ar.ids=Qm,ar.inlineRef=Qi,ar.schema=Ss;function ar(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return ar.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof Es)return Qi(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ss.call(this,e,a),n,o,i;return r&&(n=r.schema,e=r.root,i=r.baseId),n instanceof Es?o=n.validate||t.call(this,n.schema,e,void 0,i):n!==void 0&&(o=Qi(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,i)),o}function Ss(t,e){var a=ya.parse(e),s=Zc(a),r=Rs(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=sr(s),o=this._refs[n];if(typeof o=="string")return Zm.call(this,t,o,a);if(o instanceof Es)o.validate||this._compile(o),t=o;else if(o=this._schemas[n],o instanceof Es){if(o.validate||this._compile(o),n==sr(e))return{schema:o,root:t,baseId:r};t=o}else return;if(!t.schema)return;r=Rs(this._getId(t.schema))}return Hc.call(this,a,r,t.schema,t)}function Zm(t,e,a){var s=Ss.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var o=this._getId(r);return o&&(n=ks(n,o)),Hc.call(this,a,n,r,t)}}var Km=Ps.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Hc(t,e,a,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var r=t.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Ps.unescapeFragment(o),a=a[o],a===void 0)break;var i;if(!Km[o]&&(i=this._getId(a),i&&(e=ks(e,i)),a.$ref)){var l=ks(e,a.$ref),c=Ss.call(this,s,l);c&&(a=c.schema,s=c.root,e=c.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var Bm=Ps.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Qi(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return Gi(t);if(e)return Wi(t)<=e}function Gi(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!Gi(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!Gi(e)))return!1;return!0}function Wi(t){var e=0,a;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(a=t[s],typeof a=="object"&&(e+=Wi(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(Bm[r])e++;else if(a=t[r],typeof a=="object"&&(e+=Wi(a)+1),e==1/0)return 1/0}return e}function Rs(t,e){e!==!1&&(t=sr(t));var a=ya.parse(t);return Zc(a)}function Zc(t){return ya.serialize(t).split("#")[0]+"#"}var Jm=/#\/?$/;function sr(t){return t?t.replace(Jm,""):""}function ks(t,e){return e=sr(e),ya.resolve(t,e)}function Qm(t){var e=sr(this._getId(t)),a={"":e},s={"":Rs(e,!1)},r={},n=this;return Hm(t,{allKeys:!0},function(o,i,l,c,u,f,g){if(i!==""){var d=n._getId(o),m=a[c],p=s[c]+"/"+u;if(g!==void 0&&(p+="/"+(typeof g=="number"?g:Ps.escapeFragment(g))),typeof d=="string"){d=m=sr(m?ya.resolve(m,d):d);var h=n._refs[d];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!zc(o,h.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=sr(p))if(d[0]=="#"){if(r[d]&&!zc(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=p}a[i]=m,s[i]=p}}),r}var Xi=Ji,Yi={Validation:Kc(Gm),MissingRef:Kc(eo)};function Gm(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}eo.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function eo(t,e,a){this.message=a||eo.message(t,e),this.missingRef=Xi.url(t,e),this.missingSchema=Xi.normalizeId(Xi.fullPath(this.missingRef))}function Kc(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Bc=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var a=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(o){return function(i,l){var c={key:i,value:o[i]},u={key:l,value:o[l]};return n(c,u)}}}(e.cmp),r=[];return function n(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,l;if(Array.isArray(o)){for(l="[",i=0;i<o.length;i++)i&&(l+=","),l+=n(o[i])||"null";return l+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,u=Object.keys(o).sort(s&&s(o));for(l="",i=0;i<u.length;i++){var f=u[i],g=n(o[f]);g&&(l&&(l+=","),l+=JSON.stringify(f)+":"+g)}return r.splice(c,1),"{"+l+"}"}}(t)},Jc=function(e,a,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var a="false schema",u=e.level,f=e.dataLevel,g=e.schema[a],d=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,k=!e.opts.allErrors,z,p="data"+(f||""),E="valid"+u;if(e.schema===!1){e.isTop?k=!0:r+=" var "+E+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&k?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+E+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,u=e.level=0,f=e.dataLevel=0,p="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var w="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,f=e.dataLevel,p="data"+(f||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+u+" = errors;"}var E="valid"+u,k=!e.opts.allErrors,D="",H="",z,Z=e.schema.type,X=Array.isArray(Z);if(Z&&e.opts.nullable&&e.schema.nullable===!0&&(X?Z.indexOf("null")==-1&&(Z=Z.concat("null")):Z!="null"&&(Z=[Z,"null"],X=!0)),X&&Z.length==1&&(Z=Z[0],X=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),Z){if(e.opts.coerceTypes)var Y=e.util.coerceToTypes(e.opts.coerceTypes,Z);var Q=e.RULES.types[Z];if(Y||X||Q===!0||Q&&!Te(Q)){var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",d=e.schemaPath+".type",m=e.errSchemaPath+"/type",U=X?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[U](Z,p,e.opts.strictNumbers,!0)+") { ",Y){var F="dataType"+u,ne="coerced"+u;r+=" var "+F+" = typeof "+p+"; var "+ne+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+F+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+F+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+ne+" = "+p+"; } "),r+=" if ("+ne+" !== undefined) ; ";var $e=Y;if($e)for(var he,we=-1,pe=$e.length-1;we<pe;)he=$e[we+=1],he=="string"?r+=" else if ("+F+" == 'number' || "+F+" == 'boolean') "+ne+" = '' + "+p+"; else if ("+p+" === null) "+ne+" = ''; ":he=="number"||he=="integer"?(r+=" else if ("+F+" == 'boolean' || "+p+" === null || ("+F+" == 'string' && "+p+" && "+p+" == +"+p+" ",he=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+ne+" = +"+p+"; "):he=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+ne+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+ne+" = true; ":he=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+ne+" = null; ":e.opts.coerceTypes=="array"&&he=="array"&&(r+=" else if ("+F+" == 'string' || "+F+" == 'number' || "+F+" == 'boolean' || "+p+" == null) "+ne+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",X?r+=""+Z.join(","):r+=""+Z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",X?r+=""+Z.join(","):r+=""+Z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&k?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+ne+" !== undefined) { ";var M=f?"data"+(f-1||""):"parentData",T=f?e.dataPathArr[f]:"parentDataProperty";r+=" "+p+" = "+ne+"; ",f||(r+="if ("+M+" !== undefined)"),r+=" "+M+"["+T+"] = "+ne+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",X?r+=""+Z.join(","):r+=""+Z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",X?r+=""+Z.join(","):r+=""+Z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&k?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",k&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",H+="}");else{var q=e.RULES;if(q){for(var Q,I=-1,y=q.length-1;I<y;)if(Q=q[I+=1],Te(Q)){if(Q.type&&(r+=" if ("+e.util.checkDataType(Q.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(Q.type=="object"&&e.schema.properties){var g=e.schema.properties,b=Object.keys(g),x=b;if(x)for(var G,te=-1,me=x.length-1;te<me;){G=x[te+=1];var ce=g[G];if(ce.default!==void 0){var R=p+e.util.getProperty(G);if(e.compositeRule){if(e.opts.strictDefaults){var w="default is ignored for: "+R;if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}}else r+=" if ("+R+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ce.default)+" ":r+=" "+JSON.stringify(ce.default)+" ",r+="; "}}}else if(Q.type=="array"&&Array.isArray(e.schema.items)){var N=e.schema.items;if(N){for(var ce,we=-1,L=N.length-1;we<L;)if(ce=N[we+=1],ce.default!==void 0){var R=p+"["+we+"]";if(e.compositeRule){if(e.opts.strictDefaults){var w="default is ignored for: "+R;if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}}else r+=" if ("+R+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ce.default)+" ":r+=" "+JSON.stringify(ce.default)+" ",r+="; "}}}}var V=Q.rules;if(V){for(var se,ue=-1,Fe=V.length-1;ue<Fe;)if(se=V[ue+=1],Ve(se)){var Ye=se.code(e,se.keyword,Q.type);Ye&&(r+=" "+Ye+" ",k&&(D+="}"))}}if(k&&(r+=" "+D+" ",D=""),Q.type&&(r+=" } ",Z&&Z===Q.type&&!Y)){r+=" else { ";var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(z||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",X?r+=""+Z.join(","):r+=""+Z,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",X?r+=""+Z.join(","):r+=""+Z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&k?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}k&&(r+=" if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",H+="}")}}}k&&(r+=" "+H+" "),$?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+E+" = errors === errs_"+u+";";function Te(De){for(var Oe=De.rules,tt=0;tt<Oe.length;tt++)if(Ve(Oe[tt]))return!0}function Ve(De){return e.schema[De.keyword]!==void 0||De.implements&&ze(De)}function ze(De){for(var Oe=De.implements,tt=0;tt<Oe.length;tt++)if(e.schema[Oe[tt]]!==void 0)return!0}return r},Ts=Ji,Os=Lr,Qc=Yi,Wm=Bc,Gc=Jc,Xm=Os.ucs2length,Ym=Wr,ev=Qc.Validation,tv=to;function to(t,e,a,s){var r=this,n=this._opts,o=[void 0],i={},l=[],c={},u=[],f={},g=[];e=e||{schema:t,refVal:o,refs:i};var d=rv.call(this,t,e,s),m=this._compilations[d.index];if(d.compiling)return m.callValidate=w;var p=this._formats,h=this.RULES;try{var v=E(t,e,a,s);m.validate=v;var $=m.callValidate;return $&&($.schema=v.schema,$.errors=null,$.refs=v.refs,$.refVal=v.refVal,$.root=v.root,$.$async=v.$async,n.sourceCode&&($.source=v.source)),v}finally{av.call(this,t,e,s)}function w(){var U=m.validate,F=U.apply(this,arguments);return w.errors=U.errors,F}function E(U,F,ne,$e){var he=!F||F&&F.schema==U;if(F.schema!=e.schema)return to.call(r,U,F,ne,$e);var we=U.$async===!0,pe=Gc({isTop:!0,schema:U,isRoot:he,baseId:$e,root:F,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Qc.MissingRef,RULES:h,validate:Gc,util:Os,resolve:Ts,resolveRef:k,usePattern:X,useDefault:Y,useCustomRule:Q,opts:n,formats:p,logger:r.logger,self:r});pe=Cs(o,iv)+Cs(l,sv)+Cs(u,nv)+Cs(g,ov)+pe,n.processCode&&(pe=n.processCode(pe,U));var M;try{var T=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",pe);M=T(r,h,p,e,o,u,g,Ym,Xm,ev),o[0]=M}catch(q){throw r.logger.error("Error compiling schema, function code:",pe),q}return M.schema=U,M.errors=null,M.refs=i,M.refVal=o,M.root=he?M:F,we&&(M.$async=!0),n.sourceCode===!0&&(M.source={code:pe,patterns:l,defaults:u}),M}function k(U,F,ne){F=Ts.url(U,F);var $e=i[F],he,we;if($e!==void 0)return he=o[$e],we="refVal["+$e+"]",Z(he,we);if(!ne&&e.refs){var pe=e.refs[F];if(pe!==void 0)return he=e.refVal[pe],we=D(F,he),Z(he,we)}we=D(F);var M=Ts.call(r,E,e,F);if(M===void 0){var T=a&&a[F];T&&(M=Ts.inlineRef(T,n.inlineRefs)?T:to.call(r,T,e,a,U))}if(M===void 0)H(F);else return z(F,M),Z(M,we)}function D(U,F){var ne=o.length;return o[ne]=F,i[U]=ne,"refVal"+ne}function H(U){delete i[U]}function z(U,F){var ne=i[U];o[ne]=F}function Z(U,F){return typeof U=="object"||typeof U=="boolean"?{code:F,schema:U,inline:!0}:{code:F,$async:U&&!!U.$async}}function X(U){var F=c[U];return F===void 0&&(F=c[U]=l.length,l[F]=U),"pattern"+F}function Y(U){switch(typeof U){case"boolean":case"number":return""+U;case"string":return Os.toQuotedString(U);case"object":if(U===null)return"null";var F=Wm(U),ne=f[F];return ne===void 0&&(ne=f[F]=u.length,u[ne]=U),"default"+ne}}function Q(U,F,ne,$e){if(r._opts.validateSchema!==!1){var he=U.definition.dependencies;if(he&&!he.every(function(x){return Object.prototype.hasOwnProperty.call(ne,x)}))throw new Error("parent schema must have all required keywords: "+he.join(","));var we=U.definition.validateSchema;if(we){var pe=we(F);if(!pe){var M="keyword schema is invalid: "+r.errorsText(we.errors);if(r._opts.validateSchema=="log")r.logger.error(M);else throw new Error(M)}}}var T=U.definition.compile,q=U.definition.inline,I=U.definition.macro,y;if(T)y=T.call(r,F,ne,$e);else if(I)y=I.call(r,F,ne,$e),n.validateSchema!==!1&&r.validateSchema(y,!0);else if(q)y=q.call(r,$e,U.keyword,F,ne);else if(y=U.definition.validate,!y)return;if(y===void 0)throw new Error('custom keyword "'+U.keyword+'"failed to compile');var b=g.length;return g[b]=y,{code:"customRule"+b,validate:y}}}function rv(t,e,a){var s=Wc.call(this,t,e,a);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:a},{index:s,compiling:!1})}function av(t,e,a){var s=Wc.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function Wc(t,e,a){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==t&&r.root==e&&r.baseId==a)return s}return-1}function sv(t,e){return"var pattern"+t+" = new RegExp("+Os.toQuotedString(e[t])+");"}function nv(t){return"var default"+t+" = defaults["+t+"];"}function iv(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function ov(t){return"var customRule"+t+" = customRules["+t+"];"}function Cs(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var Xc={exports:{}},Is=Xc.exports=function(){this._cache={}};Is.prototype.put=function(e,a){this._cache[e]=a},Is.prototype.get=function(e){return this._cache[e]},Is.prototype.del=function(e){delete this._cache[e]},Is.prototype.clear=function(){this._cache={}};var lv=Xc.exports,cv=Lr,uv=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dv=[0,31,28,31,30,31,30,31,31,30,31,30,31],fv=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Yc=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,hv=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,pv=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,eu=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,tu=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,ru=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,au=/^(?:\/(?:[^~/]|~0|~1)*)*$/,su=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,nu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,mv=Ns;function Ns(t){return t=t=="full"?"full":"fast",cv.copy(Ns[t])}Ns.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":eu,url:tu,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Yc,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:lu,uuid:ru,"json-pointer":au,"json-pointer-uri-fragment":su,"relative-json-pointer":nu},Ns.full={date:iu,time:ou,"date-time":yv,uri:$v,"uri-reference":pv,"uri-template":eu,url:tu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Yc,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:lu,uuid:ru,"json-pointer":au,"json-pointer-uri-fragment":su,"relative-json-pointer":nu};function vv(t){return t%4===0&&(t%100!==0||t%400===0)}function iu(t){var e=t.match(uv);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&vv(a)?29:dv[s])}function ou(t,e){var a=t.match(fv);if(!a)return!1;var s=a[1],r=a[2],n=a[3],o=a[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var gv=/t|\s/i;function yv(t){var e=t.split(gv);return e.length==2&&iu(e[0])&&ou(e[1],!0)}var _v=/\/|:/;function $v(t){return _v.test(t)&&hv.test(t)}var wv=/[^\\]\\Z/;function lu(t){if(wv.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var bv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,u="data"+(o||""),f="valid"+n,g,d;if(i=="#"||i=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var m=e.resolveRef(e.baseId,i,e.isRoot);if(m===void 0){var p=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(p);var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,p)}else if(m.inline){var $=e.util.copy(e);$.level++;var w="valid"+$.level;$.schema=m.schema,$.schemaPath="",$.errSchemaPath=i;var E=e.validate($).replace(/validate\.schema/g,m.code);r+=" "+E+" ",c&&(r+=" if ("+w+") { ")}else g=m.$async===!0||e.async&&m.$async!==!1,d=m.code}if(d){var h=h||[];h.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var k=o?"data"+(o-1||""):"parentData",D=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+k+" , "+D+", rootData) ";var H=r;if(r=h.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+f+"; "),r+=" try { await "+H+"; ",c&&(r+=" "+f+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+f+" = false; "),r+=" } ",c&&(r+=" if ("+f+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r},Pv=function(e,a,s){var r=" ",n=e.schema[a],o=e.schemaPath+e.util.getProperty(a),i=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var f="valid"+c.level,g=c.baseId,d=!0,m=n;if(m)for(var p,h=-1,v=m.length-1;h<v;)p=m[h+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(d=!1,c.schema=p,c.schemaPath=o+"["+h+"]",c.errSchemaPath=i+"/"+h,r+=" "+e.validate(c)+" ",c.baseId=g,l&&(r+=" if ("+f+") { ",u+="}"));return l&&(d?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},Ev=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=i.every(function(z){return e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)});if(v){var $=m.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var w=e.compositeRule;e.compositeRule=m.compositeRule=!0;var E=i;if(E)for(var k,D=-1,H=E.length-1;D<H;)k=E[D+=1],m.schema=k,m.schemaPath=l+"["+D+"]",m.errSchemaPath=c+"/"+D,r+=" "+e.validate(m)+" ",m.baseId=$,r+=" "+g+" = "+g+" || "+h+"; if (!"+g+") { ",p+="}";e.compositeRule=m.compositeRule=w,r+=" "+p+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else u&&(r+=" if (true) { ");return r},Sv=function(e,a,s){var r=" ",n=e.schema[a],o=e.errSchemaPath+"/"+a;e.opts.allErrors;var i=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+i+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+i+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r},Rv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),d||(r+=" var schema"+n+" = validate.schema"+l+";"),r+="var "+g+" = equal("+f+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},kv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,w="data"+$,E=e.baseId,k=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",k){var D=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+h+" = false; for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var H=f+"["+v+"]";m.dataPathArr[$]=v;var z=e.validate(m);m.baseId=E,e.util.varOccurences(z,w)<2?r+=" "+e.util.varReplace(z,w,H)+" ":r+=" var "+w+" = "+H+"; "+z+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=D,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+f+".length == 0) {";var Z=Z||[];Z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var X=r;return r=Z.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+X+"]); ":r+=" validate.errors = ["+X+"]; return false; ":r+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",k&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},Tv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h={},v={},$=e.opts.ownProperties;for(D in i)if(D!="__proto__"){var w=i[D],E=Array.isArray(w)?v:h;E[D]=w}r+="var "+g+" = errors;";var k=e.errorPath;r+="var missing"+n+";";for(var D in v)if(E=v[D],E.length){if(r+=" if ( "+f+e.util.getProperty(D)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(D)+"') "),u){r+=" && ( ";var H=E;if(H)for(var z,Z=-1,X=H.length-1;Z<X;){z=H[Z+=1],Z&&(r+=" || ");var Y=e.util.getProperty(z),Q=f+Y;r+=" ( ( "+Q+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(z)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?z:Y)+") ) "}r+=")) { ";var U="missing"+n,F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,U,!0):k+" + "+U);var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(D)+"', missingProperty: '"+F+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",E.length==1?r+="property "+e.util.escapeQuotes(E[0]):r+="properties "+e.util.escapeQuotes(E.join(", ")),r+=" when property "+e.util.escapeQuotes(D)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var $e=r;r=ne.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+$e+"]); ":r+=" validate.errors = ["+$e+"]; return false; ":r+=" var err = "+$e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var he=E;if(he)for(var z,we=-1,pe=he.length-1;we<pe;){z=he[we+=1];var Y=e.util.getProperty(z),F=e.util.escapeQuotes(z),Q=f+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,z,e.opts.jsonPointers)),r+=" if ( "+Q+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(z)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(D)+"', missingProperty: '"+F+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",E.length==1?r+="property "+e.util.escapeQuotes(E[0]):r+="properties "+e.util.escapeQuotes(E.join(", ")),r+=" when property "+e.util.escapeQuotes(D)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",u&&(m+="}",r+=" else { ")}e.errorPath=k;var M=d.baseId;for(var D in h){var w=h[D];(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all))&&(r+=" "+p+" = true; if ( "+f+e.util.getProperty(D)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(D)+"') "),r+=") { ",d.schema=w,d.schemaPath=l+e.util.getProperty(D),d.errSchemaPath=c+"/"+e.util.escapeFragment(D),r+=" "+e.validate(d)+" ",d.baseId=M,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},Ov=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var m="i"+n,p="schema"+n;d||(r+=" var "+p+" = validate.schema"+l+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+f+", "+p+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},Cv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=e.opts.unknownFormats,p=Array.isArray(m);if(g){var h="format"+n,v="isObject"+n,$="formatType"+n;r+=" var "+h+" = formats["+d+"]; var "+v+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+$+" = "+v+" && "+h+".type || 'string'; if ("+v+") { ",e.async&&(r+=" var async"+n+" = "+h+".async; "),r+=" "+h+" = "+h+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+d+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+h+" && "+$+" == '"+s+"' && !(typeof "+h+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+h+"("+f+") : "+h+"("+f+")) ":r+=" "+h+"("+f+") ",r+=" : "+h+".test("+f+"))))) {"}else{var h=e.formats[i];if(!h){if(m=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(r+=" if (true) { "),r;if(p&&m.indexOf(i)>=0)return u&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof h=="object"&&!(h instanceof RegExp)&&h.validate,$=v&&h.type||"string";if(v){var w=h.async===!0;h=h.validate}if($!=s)return u&&(r+=" if (true) { "),r;if(w){if(!e.async)throw new Error("async format in sync schema");var E="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+E+"("+f+"))) { "}else{r+=" if (! ";var E="formats"+e.util.getProperty(i);v&&(E+=".validate"),typeof h=="function"?r+=" "+E+"("+f+") ":r+=" "+E+".test("+f+") ",r+=") { "}}var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var D=r;return r=k.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},Iv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e);m.level++;var p="valid"+m.level,h=e.schema.then,v=e.schema.else,$=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),w=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),E=m.baseId;if($||w){var k;m.createErrors=!1,m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var D=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=E,m.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=D,$?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=E,r+=" "+g+" = "+p+"; ",$&&w?(k="ifClause"+n,r+=" var "+k+" = 'then'; "):k="'then'",r+=" } ",w&&(r+=" else { ")):r+=" if (!"+p+") { ",w&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=E,r+=" "+g+" = "+p+"; ",$&&w?(k="ifClause"+n,r+=" var "+k+" = 'else'; "):k="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+k+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+k+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},Nv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,w="data"+$,E=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(i)){var k=e.schema.additionalItems;if(k===!1){r+=" "+g+" = "+f+".length <= "+i.length+"; ";var D=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var z=r;r=H.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=D,u&&(p+="}",r+=" else { ")}var Z=i;if(Z){for(var X,Y=-1,Q=Z.length-1;Y<Q;)if(X=Z[Y+=1],e.opts.strictKeywords?typeof X=="object"&&Object.keys(X).length>0||X===!1:e.util.schemaHasRules(X,e.RULES.all)){r+=" "+h+" = true; if ("+f+".length > "+Y+") { ";var U=f+"["+Y+"]";m.schema=X,m.schemaPath=l+"["+Y+"]",m.errSchemaPath=c+"/"+Y,m.errorPath=e.util.getPathExpr(e.errorPath,Y,e.opts.jsonPointers,!0),m.dataPathArr[$]=Y;var F=e.validate(m);m.baseId=E,e.util.varOccurences(F,w)<2?r+=" "+e.util.varReplace(F,w,U)+" ":r+=" var "+w+" = "+U+"; "+F+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof k=="object"&&(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))){m.schema=k,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+h+" = true; if ("+f+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var U=f+"["+v+"]";m.dataPathArr[$]=v;var F=e.validate(m);m.baseId=E,e.util.varOccurences(F,w)<2?r+=" "+e.util.varReplace(F,w,U)+" ":r+=" var "+w+" = "+U+"; "+F+" ",u&&(r+=" if (!"+h+") break; "),r+=" } } ",u&&(r+=" if ("+h+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var U=f+"["+v+"]";m.dataPathArr[$]=v;var F=e.validate(m);m.baseId=E,e.util.varOccurences(F,w)<2?r+=" "+e.util.varReplace(F,w,U)+" ":r+=" var "+w+" = "+U+"; "+F+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+d+" == errors) {"),r},cu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,E,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=a=="maximum",p=m?"exclusiveMaximum":"exclusiveMinimum",h=e.schema[p],v=e.opts.$data&&h&&h.$data,$=m?"<":">",w=m?">":"<",E=void 0;if(!(g||typeof i=="number"||i===void 0))throw new Error(a+" must be number");if(!(v||h===void 0||typeof h=="number"||typeof h=="boolean"))throw new Error(p+" must be number or boolean");if(v){var k=e.util.getData(h.$data,o,e.dataPathArr),D="exclusive"+n,H="exclType"+n,z="exclIsNumber"+n,Z="op"+n,X="' + "+Z+" + '";r+=" var schemaExcl"+n+" = "+k+"; ",k="schemaExcl"+n,r+=" var "+D+"; var "+H+" = typeof "+k+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var E=p,Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+D+" = "+d+" === undefined || "+k+" "+$+"= "+d+") ? "+f+" "+w+"= "+k+" : "+f+" "+w+" "+d+" ) : ( ("+D+" = "+k+" === true) ? "+f+" "+w+"= "+d+" : "+f+" "+w+" "+d+" ) || "+f+" !== "+f+") { var op"+n+" = "+D+" ? '"+$+"' : '"+$+"='; ",i===void 0&&(E=p,c=e.errSchemaPath+"/"+p,d=k,g=v)}else{var z=typeof h=="number",X=$;if(z&&g){var Z="'"+X+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+h+" "+$+"= "+d+" ? "+f+" "+w+"= "+h+" : "+f+" "+w+" "+d+" ) || "+f+" !== "+f+") { "}else{z&&i===void 0?(D=!0,E=p,c=e.errSchemaPath+"/"+p,d=h,w+="="):(z&&(d=Math[m?"min":"max"](h,i)),h===(z?d:!0)?(D=!0,E=p,c=e.errSchemaPath+"/"+p,w+="="):(D=!1,X+="="));var Z="'"+X+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+" "+w+" "+d+" || "+f+" !== "+f+") { "}}E=E||a;var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+Z+", limit: "+d+", exclusive: "+D+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+X+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;return r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},uu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+".length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},du=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+f+".length ":r+=" ucs2length("+f+") ",r+=" "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},fu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+f+").length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Av=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+f+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},jv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var m="valid"+d.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=l,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var h;d.opts.allErrors&&(h=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,h&&(d.opts.allErrors=h),e.compositeRule=d.compositeRule=p,r+=" if ("+m+") { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var $=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},Dv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,$="prevValid"+n,w="passingSchemas"+n;r+="var "+d+" = errors , "+$+" = false , "+g+" = false , "+w+" = null; ";var E=e.compositeRule;e.compositeRule=m.compositeRule=!0;var k=i;if(k)for(var D,H=-1,z=k.length-1;H<z;)D=k[H+=1],(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))?(m.schema=D,m.schemaPath=l+"["+H+"]",m.errSchemaPath=c+"/"+H,r+=" "+e.validate(m)+" ",m.baseId=v):r+=" var "+h+" = true; ",H&&(r+=" if ("+h+" && "+$+") { "+g+" = false; "+w+" = ["+w+", "+H+"]; } else { ",p+="}"),r+=" if ("+h+") { "+g+" = "+$+" = true; "+w+" = "+H+"; }";return e.compositeRule=m.compositeRule=E,r+=""+p+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+w+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r},xv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=g?"(new RegExp("+d+"))":e.usePattern(i);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+m+".test("+f+") ) { ";var p=p||[];p.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var h=r;return r=p.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+h+"]); ":r+=" validate.errors = ["+h+"]; return false; ":r+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Mv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h="key"+n,v="idx"+n,$=d.dataLevel=e.dataLevel+1,w="data"+$,E="dataProperties"+n,k=Object.keys(i||{}).filter(we),D=e.schema.patternProperties||{},H=Object.keys(D).filter(we),z=e.schema.additionalProperties,Z=k.length||H.length,X=z===!1,Y=typeof z=="object"&&Object.keys(z).length,Q=e.opts.removeAdditional,U=X||Y||Q,F=e.opts.ownProperties,ne=e.baseId,$e=e.schema.required;if($e&&!(e.opts.$data&&$e.$data)&&$e.length<e.opts.loopRequired)var he=e.util.toHash($e);function we(br){return br!=="__proto__"}if(r+="var "+g+" = errors;var "+p+" = true;",F&&(r+=" var "+E+" = undefined;"),U){if(F?r+=" "+E+" = "+E+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+E+".length; "+v+"++) { var "+h+" = "+E+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",Z){if(r+=" var isAdditional"+n+" = !(false ",k.length)if(k.length>8)r+=" || validate.schema"+l+".hasOwnProperty("+h+") ";else{var pe=k;if(pe)for(var M,T=-1,q=pe.length-1;T<q;)M=pe[T+=1],r+=" || "+h+" == "+e.util.toQuotedString(M)+" "}if(H.length){var I=H;if(I)for(var y,b=-1,x=I.length-1;b<x;)y=I[b+=1],r+=" || "+e.usePattern(y)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(Q=="all")r+=" delete "+f+"["+h+"]; ";else{var G=e.errorPath,te="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),X)if(Q)r+=" delete "+f+"["+h+"]; ";else{r+=" "+p+" = false; ";var me=c;c=e.errSchemaPath+"/additionalProperties";var ce=ce||[];ce.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var R=r;r=ce.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=me,u&&(r+=" break; ")}else if(Y)if(Q=="failing"){r+=" var "+g+" = errors; ";var N=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var L=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,w)<2?r+=" "+e.util.varReplace(V,w,L)+" ":r+=" var "+w+" = "+L+"; "+V+" ",r+=" if (!"+p+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+h+"]; } ",e.compositeRule=d.compositeRule=N}else{d.schema=z,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var L=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,w)<2?r+=" "+e.util.varReplace(V,w,L)+" ":r+=" var "+w+" = "+L+"; "+V+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=G}Z&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var se=e.opts.useDefaults&&!e.compositeRule;if(k.length){var ue=k;if(ue)for(var M,Fe=-1,Ye=ue.length-1;Fe<Ye;){M=ue[Fe+=1];var Te=i[M];if(e.opts.strictKeywords?typeof Te=="object"&&Object.keys(Te).length>0||Te===!1:e.util.schemaHasRules(Te,e.RULES.all)){var Ve=e.util.getProperty(M),L=f+Ve,ze=se&&Te.default!==void 0;d.schema=Te,d.schemaPath=l+Ve,d.errSchemaPath=c+"/"+e.util.escapeFragment(M),d.errorPath=e.util.getPath(e.errorPath,M,e.opts.jsonPointers),d.dataPathArr[$]=e.util.toQuotedString(M);var V=e.validate(d);if(d.baseId=ne,e.util.varOccurences(V,w)<2){V=e.util.varReplace(V,w,L);var De=L}else{var De=w;r+=" var "+w+" = "+L+"; "}if(ze)r+=" "+V+" ";else{if(he&&he[M]){r+=" if ( "+De+" === undefined ",F&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") { "+p+" = false; ";var G=e.errorPath,me=c,Oe=e.util.escapeQuotes(M);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(G,M,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var ce=ce||[];ce.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Oe+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Oe+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var R=r;r=ce.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=me,e.errorPath=G,r+=" } else { "}else u?(r+=" if ( "+De+" === undefined ",F&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+De+" !== undefined ",F&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=" ) { ");r+=" "+V+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(H.length){var tt=H;if(tt)for(var y,ir=-1,Qt=tt.length-1;ir<Qt;){y=tt[ir+=1];var Te=D[y];if(e.opts.strictKeywords?typeof Te=="object"&&Object.keys(Te).length>0||Te===!1:e.util.schemaHasRules(Te,e.RULES.all)){d.schema=Te,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(y),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(y),F?r+=" "+E+" = "+E+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+E+".length; "+v+"++) { var "+h+" = "+E+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" if ("+e.usePattern(y)+".test("+h+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var L=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,w)<2?r+=" "+e.util.varReplace(V,w,L)+" ":r+=" var "+w+" = "+L+"; "+V+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},Lv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=l,d.errSchemaPath=c;var h="key"+n,v="idx"+n,$="i"+n,w="' + "+h+" + '",E=d.dataLevel=e.dataLevel+1,k="data"+E,D="dataProperties"+n,H=e.opts.ownProperties,z=e.baseId;H&&(r+=" var "+D+" = undefined; "),H?r+=" "+D+" = "+D+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+D+".length; "+v+"++) { var "+h+" = "+D+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" var startErrs"+n+" = errors; ";var Z=h,X=e.compositeRule;e.compositeRule=d.compositeRule=!0;var Y=e.validate(d);d.baseId=z,e.util.varOccurences(Y,k)<2?r+=" "+e.util.varReplace(Y,k,Z)+" ":r+=" var "+k+" = "+Z+"; "+Y+" ",e.compositeRule=d.compositeRule=X,r+=" if (!"+p+") { for (var "+$+"=startErrs"+n+"; "+$+"<errors; "+$+"++) { vErrors["+$+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+w+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+w+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),u&&(r+=" break; "),r+=" } }"}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},Fv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var m="schema"+n;if(!d)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],h=i;if(h)for(var v,$=-1,w=h.length-1;$<w;){v=h[$+=1];var E=e.schema.properties[v];E&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))||(p[p.length]=v)}}else var p=i;if(d||p.length){var k=e.errorPath,D=d||p.length>=e.opts.loopRequired,H=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",D){d||(r+=" var "+m+" = validate.schema"+l+"; ");var z="i"+n,Z="schema"+n+"["+z+"]",X="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,Z,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+z+" = 0; "+z+" < "+m+".length; "+z+"++) { "+g+" = "+f+"["+m+"["+z+"]] !== undefined ",H&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", "+m+"["+z+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+X+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+X+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var U=p;if(U)for(var F,z=-1,ne=U.length-1;z<ne;){F=U[z+=1],z&&(r+=" || ");var $e=e.util.getProperty(F),he=f+$e;r+=" ( ( "+he+" === undefined ",H&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(F)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:$e)+") ) "}r+=") { ";var Z="missing"+n,X="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,Z,!0):k+" + "+Z);var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+X+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+X+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(D){d||(r+=" var "+m+" = validate.schema"+l+"; ");var z="i"+n,Z="schema"+n+"["+z+"]",X="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,Z,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+X+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+X+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+z+" = 0; "+z+" < "+m+".length; "+z+"++) { if ("+f+"["+m+"["+z+"]] === undefined ",H&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+m+"["+z+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+X+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+X+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var we=p;if(we)for(var F,pe=-1,M=we.length-1;pe<M;){F=we[pe+=1];var $e=e.util.getProperty(F),X=e.util.escapeQuotes(F),he=f+$e;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,F,e.opts.jsonPointers)),r+=" if ( "+he+" === undefined ",H&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(F)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+X+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+X+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=k}else u&&(r+=" if (true) {");return r},qv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,m;if(d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",m="schema"+n):m=i,(i||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+m+" === false || "+m+" === undefined) "+g+" = true; else if (typeof "+m+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+f+".length , "+g+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,h=Array.isArray(p);if(!p||p=="object"||p=="array"||h&&(p.indexOf("object")>=0||p.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var v="checkDataType"+(h?"s":"");r+=" if ("+e.util[v](p,"item",e.opts.strictNumbers,!0)+") continue; ",h&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var w=r;r=$.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},Uv={$ref:bv,allOf:Pv,anyOf:Ev,$comment:Sv,const:Rv,contains:kv,dependencies:Tv,enum:Ov,format:Cv,if:Iv,items:Nv,maximum:cu,minimum:cu,maxItems:uu,minItems:uu,maxLength:du,minLength:du,maxProperties:fu,minProperties:fu,multipleOf:Av,not:jv,oneOf:Dv,pattern:xv,properties:Mv,propertyNames:Lv,required:Fv,uniqueItems:qv,validate:Jc},hu=Uv,ro=Lr.toHash,Vv=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],a=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=ro(a),e.types=ro(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var i;if(typeof o=="object"){var l=Object.keys(o)[0];i=o[l],o=l,i.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(o);var c=e.all[o]={keyword:o,code:hu[o],implements:i};return c}),e.all.$comment={keyword:"$comment",code:hu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ro(a.concat(s)),e.custom={},e},pu=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],zv=function(t,e){for(var a=0;a<e.length;a++){t=JSON.parse(JSON.stringify(t));var s=e[a].split("/"),r=t,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<pu.length;n++){var o=pu[n],i=r[o];i&&(r[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},Hv=Yi.MissingRef,Zv=mu;function mu(t,e,a){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(a=e,e=void 0);var r=n(t).then(function(){var i=s._addSchema(t,void 0,e);return i.validate||o(i)});return a&&r.then(function(i){a(null,i)},a),r;function n(i){var l=i.$schema;return l&&!s.getSchema(l)?mu.call(s,{$ref:l},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(c){if(c instanceof Hv)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var f=s._loadingSchemas[u];return f||(f=s._loadingSchemas[u]=s._opts.loadSchema(u),f.then(g,g)),f.then(function(m){if(!d(u))return n(m).then(function(){d(u)||s.addSchema(m,u,void 0,e)})}).then(function(){return o(i)});function g(){delete s._loadingSchemas[u]}function d(m){return s._refs[m]||s._schemas[m]}}}}var Kv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f,g="data"+(o||""),d="valid"+n,m="errs__"+n,p=e.opts.$data&&i&&i.$data,h;p?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+n):h=i;var v=this,$="definition"+n,w=v.definition,E="",k,D,H,z,Z;if(p&&w.$data){Z="keywordValidate"+n;var X=w.validateSchema;r+=" var "+$+" = RULES.custom['"+a+"'].definition; var "+Z+" = "+$+".validate;"}else{if(z=e.useCustomRule(v,i,e.schema,e),!z)return;h="validate.schema"+l,Z=z.code,k=w.compile,D=w.inline,H=w.macro}var Y=Z+".errors",Q="i"+n,U="ruleErr"+n,F=w.async;if(F&&!e.async)throw new Error("async keyword in sync schema");if(D||H||(r+=""+Y+" = null;"),r+="var "+m+" = errors;var "+d+";",p&&w.$data&&(E+="}",r+=" if ("+h+" === undefined) { "+d+" = true; } else { ",X&&(E+="}",r+=" "+d+" = "+$+".validateSchema("+h+"); if ("+d+") { ")),D)w.statements?r+=" "+z.validate+" ":r+=" "+d+" = "+z.validate+"; ";else if(H){var ne=e.util.copy(e),E="";ne.level++;var $e="valid"+ne.level;ne.schema=z.validate,ne.schemaPath="";var he=e.compositeRule;e.compositeRule=ne.compositeRule=!0;var we=e.validate(ne).replace(/validate\.schema/g,Z);e.compositeRule=ne.compositeRule=he,r+=" "+we}else{var pe=pe||[];pe.push(r),r="",r+=" "+Z+".call( ",e.opts.passContext?r+="this":r+="self",k||w.schema===!1?r+=" , "+g+" ":r+=" , "+h+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var M=o?"data"+(o-1||""):"parentData",T=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+M+" , "+T+" , rootData ) ";var q=r;r=pe.pop(),w.errors===!1?(r+=" "+d+" = ",F&&(r+="await "),r+=""+q+"; "):F?(Y="customErrors"+n,r+=" var "+Y+" = null; try { "+d+" = await "+q+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+Y+" = e.errors; else throw e; } "):r+=" "+Y+" = null; "+d+" = "+q+"; "}if(w.modifying&&(r+=" if ("+M+") "+g+" = "+M+"["+T+"];"),r+=""+E,w.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",w.valid===void 0?(r+=" !",H?r+=""+$e:r+=""+d):r+=" "+!w.valid+" ",r+=") { ",f=v.keyword;var pe=pe||[];pe.push(r),r="";var pe=pe||[];pe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var I=r;r=pe.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var y=r;r=pe.pop(),D?w.errors?w.errors!="full"&&(r+=" for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } "):w.errors===!1?r+=" "+y+" ":(r+=" if ("+m+" == errors) { "+y+" } else { for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):w.errors===!1?r+=" "+y+" ":(r+=" if (Array.isArray("+Y+")) { if (vErrors === null) vErrors = "+Y+"; else vErrors = vErrors.concat("+Y+"); errors = vErrors.length; for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; "+U+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } } else { "+y+" } "),r+=" } ",u&&(r+=" else { ")}return r};const vu={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var gu=vu,Bv={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:gu.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:gu.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},Jv=/^[a-z_$][a-z0-9_$-]*$/i,Qv=Kv,Gv=Bv,Wv={add:Xv,get:Yv,remove:eg,validate:ao};function Xv(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!Jv.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(t,s[r],e);else o(t,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}a.keywords[t]=a.all[t]=!0;function o(i,l,c){for(var u,f=0;f<a.length;f++){var g=a[f];if(g.type==l){u=g;break}}u||(u={type:l,rules:[]},a.push(u));var d={keyword:i,definition:c,custom:!0,code:Qv,implements:c.implements};u.rules.push(d),a.custom[i]=d}return this}function Yv(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function eg(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var a=0;a<e.length;a++)for(var s=e[a].rules,r=0;r<s.length;r++)if(s[r].keyword==t){s.splice(r,1);break}return this}function ao(t,e){ao.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(Gv,!0);if(a(t))return!0;if(ao.errors=a.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}const tg={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var yu=tv,_r=Ji,rg=lv,_u=Uc,ag=Bc,sg=mv,ng=Vv,$u=zv,wu=Lr,ig=He;He.prototype.validate=lg,He.prototype.compile=cg,He.prototype.addSchema=ug,He.prototype.addMetaSchema=dg,He.prototype.validateSchema=fg,He.prototype.getSchema=pg,He.prototype.removeSchema=vg,He.prototype.addFormat=Eg,He.prototype.errorsText=Pg,He.prototype._addSchema=gg,He.prototype._compile=yg,He.prototype.compileAsync=Zv;var As=Wv;He.prototype.addKeyword=As.add,He.prototype.getKeyword=As.get,He.prototype.removeKeyword=As.remove,He.prototype.validateKeyword=As.validate;var bu=Yi;He.ValidationError=bu.Validation,He.MissingRefError=bu.MissingRef,He.$dataMetaSchema=$u;var js="http://json-schema.org/draft-07/schema",Pu=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],og=["/properties"];function He(t){if(!(this instanceof He))return new He(t);t=this._opts=wu.copy(t)||{},Cg(this),this._schemas={},this._refs={},this._fragments={},this._formats=sg(t.format),this._cache=t.cache||new rg,this._loadingSchemas={},this._compilations=[],this.RULES=ng(),this._getId=_g(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=ag),this._metaOpts=Og(this),t.formats&&kg(this),t.keywords&&Tg(this),Sg(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Rg(this)}function lg(t,e){var a;if(typeof t=="string"){if(a=this.getSchema(t),!a)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);a=s.validate||this._compile(s)}var r=a(e);return a.$async!==!0&&(this.errors=a.errors),r}function cg(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function ug(t,e,a,s){if(Array.isArray(t)){for(var r=0;r<t.length;r++)this.addSchema(t[r],void 0,a,s);return this}var n=this._getId(t);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=_r.normalizeId(e||n),Su(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function dg(t,e,a){return this.addSchema(t,e,a,!0),this}function fg(t,e){var a=t.$schema;if(a!==void 0&&typeof a!="string")throw new Error("$schema must be a string");if(a=a||this._opts.defaultMeta||hg(this),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(a,t);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function hg(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(js)?js:void 0,t._opts.defaultMeta}function pg(t){var e=Eu(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return mg(this,t)}}function mg(t,e){var a=_r.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,o=yu.call(t,s,r,void 0,n);return t._fragments[e]=new _u({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function Eu(t,e){return e=_r.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function vg(t){if(t instanceof RegExp)return Ds(this,this._schemas,t),Ds(this,this._refs,t),this;switch(typeof t){case"undefined":return Ds(this,this._schemas),Ds(this,this._refs),this._cache.clear(),this;case"string":var e=Eu(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var a=this._opts.serialize,s=a?a(t):t;this._cache.del(s);var r=this._getId(t);r&&(r=_r.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ds(t,e,a){for(var s in e){var r=e[s];!r.meta&&(!a||a.test(s))&&(t._cache.del(r.cacheKey),delete e[s])}}function gg(t,e,a,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(t):t,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=_r.normalizeId(this._getId(t));i&&s&&Su(this,i);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=i&&i==_r.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=_r.ids.call(this,t),f=new _u({id:i,schema:t,localRefs:u,cacheKey:n,meta:a});return i[0]!="#"&&s&&(this._refs[i]=f),this._cache.put(n,f),l&&c&&this.validateSchema(t,!0),f}function yg(t,e){if(t.compiling)return t.validate=r,r.schema=t.schema,r.errors=null,r.root=e||r,t.schema.$async===!0&&(r.$async=!0),r;t.compiling=!0;var a;t.meta&&(a=this._opts,this._opts=this._metaOpts);var s;try{s=yu.call(this,t.schema,e,t.localRefs)}catch(n){throw delete t.validate,n}finally{t.compiling=!1,t.meta&&(this._opts=a)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function r(){var n=t.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function _g(t){switch(t.schemaId){case"auto":return bg;case"id":return $g;default:return wg}}function $g(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function wg(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function bg(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function Pg(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var a=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<t.length;n++){var o=t[n];o&&(r+=s+o.dataPath+" "+o.message+a)}return r.slice(0,-a.length)}function Eg(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Sg(t){var e;if(t._opts.$data&&(e=tg,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=vu;t._opts.$data&&(a=$u(a,og)),t.addMetaSchema(a,js,!0),t._refs["http://json-schema.org/schema"]=js}}function Rg(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var a in e)t.addSchema(e[a],a)}function kg(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function Tg(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function Su(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Og(t){for(var e=wu.copy(t._opts),a=0;a<Pu.length;a++)delete e[Pu[a]];return e}function Cg(t){var e=t._opts.logger;if(e===!1)t.logger={log:so,warn:so,error:so};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function so(){}const Ru=Do(ig);class Ig extends Li{constructor(e,a){var s;super(a),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._ajv=new Ru}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Fi(this._capabilities,e)}assertCapability(e,a){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${a})`)}async connect(e,a){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:yr,capabilities:this._capabilities,clientInfo:this._clientInfo}},yi,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!ci.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var a,s,r,n,o;switch(e){case"logging/setLevel":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var a;switch(e){case"notifications/roots/list_changed":if(!(!((a=this._capabilities.roots)===null||a===void 0)&&a.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},tr,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},Di,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},tr,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},Oi,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},ki,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},Ei,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},Si,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},Ri,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},tr,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},tr,a)}async callTool(e,a=_s,s){const r=await this.request({method:"tools/call",params:e},a,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new je(O.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new je(O.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof je?o:new je(O.ErrorCode.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const a of e)if(a.outputSchema)try{const s=this._ajv.compile(a.outputSchema);this._cachedToolOutputValidators.set(a.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,a){const s=await this.request({method:"tools/list",params:e},Ci,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let no;no=globalThis.crypto;async function Ng(t){return(await no).getRandomValues(new Uint8Array(t))}async function Ag(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await Ng(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function jg(t){return await Ag(t)}async function Dg(t){const e=await(await no).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xg(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await jg(t),a=await Dg(e);return{code_verifier:e,code_challenge:a}}const Mg=W({resource:C().url(),authorization_servers:ie(C().url()).optional(),jwks_uri:C().url().optional(),scopes_supported:ie(C()).optional(),bearer_methods_supported:ie(C()).optional(),resource_signing_alg_values_supported:ie(C()).optional(),resource_name:C().optional(),resource_documentation:C().optional(),resource_policy_uri:C().url().optional(),resource_tos_uri:C().url().optional(),tls_client_certificate_bound_access_tokens:We().optional(),authorization_details_types_supported:ie(C()).optional(),dpop_signing_alg_values_supported:ie(C()).optional(),dpop_bound_access_tokens_required:We().optional()}).passthrough(),io=W({issuer:C(),authorization_endpoint:C(),token_endpoint:C(),registration_endpoint:C().optional(),scopes_supported:ie(C()).optional(),response_types_supported:ie(C()),response_modes_supported:ie(C()).optional(),grant_types_supported:ie(C()).optional(),token_endpoint_auth_methods_supported:ie(C()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(C()).optional(),service_documentation:C().optional(),revocation_endpoint:C().optional(),revocation_endpoint_auth_methods_supported:ie(C()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ie(C()).optional(),introspection_endpoint:C().optional(),introspection_endpoint_auth_methods_supported:ie(C()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ie(C()).optional(),code_challenge_methods_supported:ie(C()).optional()}).passthrough(),Lg=W({issuer:C(),authorization_endpoint:C(),token_endpoint:C(),userinfo_endpoint:C().optional(),jwks_uri:C(),registration_endpoint:C().optional(),scopes_supported:ie(C()).optional(),response_types_supported:ie(C()),response_modes_supported:ie(C()).optional(),grant_types_supported:ie(C()).optional(),acr_values_supported:ie(C()).optional(),subject_types_supported:ie(C()),id_token_signing_alg_values_supported:ie(C()),id_token_encryption_alg_values_supported:ie(C()).optional(),id_token_encryption_enc_values_supported:ie(C()).optional(),userinfo_signing_alg_values_supported:ie(C()).optional(),userinfo_encryption_alg_values_supported:ie(C()).optional(),userinfo_encryption_enc_values_supported:ie(C()).optional(),request_object_signing_alg_values_supported:ie(C()).optional(),request_object_encryption_alg_values_supported:ie(C()).optional(),request_object_encryption_enc_values_supported:ie(C()).optional(),token_endpoint_auth_methods_supported:ie(C()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(C()).optional(),display_values_supported:ie(C()).optional(),claim_types_supported:ie(C()).optional(),claims_supported:ie(C()).optional(),service_documentation:C().optional(),claims_locales_supported:ie(C()).optional(),ui_locales_supported:ie(C()).optional(),claims_parameter_supported:We().optional(),request_parameter_supported:We().optional(),request_uri_parameter_supported:We().optional(),require_request_uri_registration:We().optional(),op_policy_uri:C().optional(),op_tos_uri:C().optional()}).passthrough().merge(io.pick({code_challenge_methods_supported:!0})),ku=W({access_token:C(),id_token:C().optional(),token_type:C(),expires_in:et().optional(),scope:C().optional(),refresh_token:C().optional()}).strip(),Fg=W({error:C(),error_description:C().optional(),error_uri:C().optional()}),qg=W({redirect_uris:ie(C()).refine(t=>t.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:C().optional(),grant_types:ie(C()).optional(),response_types:ie(C()).optional(),client_name:C().optional(),client_uri:C().optional(),logo_uri:C().optional(),scope:C().optional(),contacts:ie(C()).optional(),tos_uri:C().optional(),policy_uri:C().optional(),jwks_uri:C().optional(),jwks:sm().optional(),software_id:C().optional(),software_version:C().optional(),software_statement:C().optional()}).strip(),Ug=W({client_id:C(),client_secret:C().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),Vg=qg.merge(Ug);W({error:C(),error_description:C().optional()}).strip(),W({token:C(),token_type_hint:C().optional()}).strip();function zg(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Hg({requestedResource:t,configuredResource:e}){const a=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const r=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}class st extends Error{constructor(e,a){super(e),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class oo extends st{}oo.errorCode="invalid_request";class xs extends st{}xs.errorCode="invalid_client";class Ms extends st{}Ms.errorCode="invalid_grant";class Ls extends st{}Ls.errorCode="unauthorized_client";class lo extends st{}lo.errorCode="unsupported_grant_type";class co extends st{}co.errorCode="invalid_scope";class uo extends st{}uo.errorCode="access_denied";class Fr extends st{}Fr.errorCode="server_error";class fo extends st{}fo.errorCode="temporarily_unavailable";class ho extends st{}ho.errorCode="unsupported_response_type";class po extends st{}po.errorCode="unsupported_token_type";class mo extends st{}mo.errorCode="invalid_token";class vo extends st{}vo.errorCode="method_not_allowed";class go extends st{}go.errorCode="too_many_requests";class yo extends st{}yo.errorCode="invalid_client_metadata";class _o extends st{}_o.errorCode="insufficient_scope";const Zg={[oo.errorCode]:oo,[xs.errorCode]:xs,[Ms.errorCode]:Ms,[Ls.errorCode]:Ls,[lo.errorCode]:lo,[co.errorCode]:co,[uo.errorCode]:uo,[Fr.errorCode]:Fr,[fo.errorCode]:fo,[ho.errorCode]:ho,[po.errorCode]:po,[mo.errorCode]:mo,[vo.errorCode]:vo,[go.errorCode]:go,[yo.errorCode]:yo,[_o.errorCode]:_o};class Rt extends Error{constructor(e){super(e??"Unauthorized")}}function Tu(t,e){const a=t.client_secret!==void 0;return e.length===0?a?"client_secret_post":"none":a&&e.includes("client_secret_basic")?"client_secret_basic":a&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":a?"client_secret_post":"none"}function Ou(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":Kg(r,n,a);return;case"client_secret_post":Bg(r,n,s);return;case"none":Jg(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Kg(t,e,a){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);a.set("Authorization",`Basic ${s}`)}function Bg(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function Jg(t,e){e.set("client_id",t)}async function Fs(t){const e=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{const s=Fg.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:o}=s,i=Zg[r]||Fr;return new i(n||"",o)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new Fr(r)}}async function $r(t,e){var a,s;try{return await $o(t,e)}catch(r){if(r instanceof xs||r instanceof Ls)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await $o(t,e);if(r instanceof Ms)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await $o(t,e);throw r}}async function $o(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,i;try{o=await Iu(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const l=await Cu(e,t,o),c=await Du(i,{fetchFn:n});let u=await Promise.resolve(t.clientInformation());if(!u){if(a!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const p=await Fu(i,{metadata:c,clientMetadata:t.clientMetadata});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await Mu(i,{metadata:c,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const f=await t.tokens();if(f!=null&&f.refresh_token)try{const p=await Lu(i,{metadata:c,clientInformation:u,refreshToken:f.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof st)||p instanceof Fr))throw p}const g=t.state?await t.state():void 0,{authorizationUrl:d,codeVerifier:m}=await xu(i,{metadata:c,clientInformation:u,state:g,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(d),"REDIRECT"}async function Cu(t,e,a){const s=zg(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!Hg({requestedResource:s,configuredResource:a.resource}))throw new Error(`Protected resource ${a.resource} does not match expected ${s} (or origin)`);return new URL(a.resource)}}function qs(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[a,s]=e.split(" ");if(a.toLowerCase()!=="bearer"||!s)return;const n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function Iu(t,e,a=fetch){const s=await Au(t,"oauth-protected-resource",a,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Mg.parse(await s.json())}async function wo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?wo(t,void 0,a):void 0;throw s}}function Qg(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Nu(t,e,a=fetch){return await wo(t,{"MCP-Protocol-Version":e},a)}function Gg(t,e){return!t||t.status===404&&e!=="/"}async function Au(t,e,a,s){var r,n;const o=new URL(t),i=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:yr;let l;if(s!=null&&s.metadataUrl)l=new URL(s.metadataUrl);else{const u=Qg(e,o.pathname);l=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),l.search=o.search}let c=await Nu(l,i,a);if(!(s!=null&&s.metadataUrl)&&Gg(c,o.pathname)){const u=new URL(`/.well-known/${e}`,o);c=await Nu(u,i,a)}return c}async function Wg(t,{authorizationServerUrl:e,protocolVersion:a}={},s=fetch){typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),a??(a=yr);const r=await Au(e,"oauth-authorization-server",s,{protocolVersion:a,metadataServerUrl:e});if(!(!r||r.status===404)){if(!r.ok)throw new Error(`HTTP ${r.status} trying to load well-known OAuth metadata`);return io.parse(await r.json())}}function ju(t){const e=typeof t=="string"?new URL(t):t,a=e.pathname!=="/",s=[];if(!a)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function Du(t,{fetchFn:e=fetch,protocolVersion:a=yr}={}){var s;const r={"MCP-Protocol-Version":a},n=ju(t);for(const{url:o,type:i}of n){const l=await wo(o,r,e);if(!l)throw new Error(`CORS error trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`);if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return io.parse(await l.json());{const c=Lg.parse(await l.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return c}}}async function xu(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:o}){const i="code",l="S256";let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(l))throw new Error(`Incompatible auth server: does not support code challenge method ${l}`)}else c=new URL("/authorize",t);const u=await xg(),f=u.code_verifier,g=u.code_challenge;return c.searchParams.set("response_type",i),c.searchParams.set("client_id",a.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",l),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:f}}async function Mu(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:i,fetchFn:l}){var c;const u="authorization_code",f=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:u,code:s,code_verifier:r,redirect_uri:String(n)});if(i)i(g,d,t,e);else{const p=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=Tu(a,p);Ou(h,a,g,d)}o&&d.set("resource",o.href);const m=await(l??fetch)(f,{method:"POST",headers:g,body:d});if(!m.ok)throw await Fs(m);return ku.parse(await m.json())}async function Lu(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var i;const l="refresh_token";let c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else c=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:l,refresh_token:s});if(n)n(u,f,t,e);else{const d=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],m=Tu(a,d);Ou(m,a,u,f)}r&&f.set("resource",r.href);const g=await(o??fetch)(c,{method:"POST",headers:u,body:f});if(!g.ok)throw await Fs(g);return ku.parse({refresh_token:s,...await g.json()})}async function Fu(t,{metadata:e,clientMetadata:a,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",t);const n=await(s??fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok)throw await Fs(n);return Vg.parse(await n.json())}class qu extends Error{constructor(e,a){super(e),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}}function bo(t){}function Uu(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=bo,onError:a=bo,onRetry:s=bo,onComment:r}=t;let n="",o=!0,i,l="",c="";function u(p){const h=o?p.replace(/^\xEF\xBB\xBF/,""):p,[v,$]=Xg(`${n}${h}`);for(const w of v)f(w);n=$,o=!1}function f(p){if(p===""){d();return}if(p.startsWith(":")){r&&r(p.slice(p.startsWith(": ")?2:1));return}const h=p.indexOf(":");if(h!==-1){const v=p.slice(0,h),$=p[h+1]===" "?2:1,w=p.slice(h+$);g(v,w,p);return}g(p,"",p)}function g(p,h,v){switch(p){case"event":c=h;break;case"data":l=`${l}${h}
|
|
9
|
-
`;break;case"id":i=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new
|
|
10
|
-
`)?l.slice(0,-1):l}),i=void 0,l="",c=""}function m(p={}){n&&p.consume&&f(n),o=!0,i=void 0,l="",c="",n=""}return{feed:u,reset:m}}function
|
|
8
|
+
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=n(l);o(l,c),i(l,u)}};function n({schema:l}){const c={},u={};for(const f in l){if(f==="__proto__")continue;const g=Array.isArray(l[f])?c:u;g[f]=l[f]}return[c,u]}function o(l,c=l.schema){const{gen:u,data:f,it:g}=l;if(Object.keys(c).length===0)return;const d=u.let("missing");for(const m in c){const p=c[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,f,m,g.opts.ownProperties);l.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),g.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(l,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(l,p,d)})`),(0,s.reportMissingProp)(l,d),u.else())}}t.validatePropertyDeps=o;function i(l,c=l.schema){const{gen:u,data:f,keyword:g,it:d}=l,m=u.name("valid");for(const p in c)(0,a.alwaysValidSchema)(d,c[p])||(u.if((0,s.propertyInData)(u,f,p,d.opts.ownProperties),()=>{const h=l.subschema({keyword:g,schemaProp:p},m);l.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),l.ok(m))}t.validateSchemaDeps=i,t.default=r})(Al);var qn={};Object.defineProperty(qn,"__esModule",{value:!0});const jl=be,tp=ee,rp={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,jl._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,tp.alwaysValidSchema)(r,a))return;const n=e.name("valid");e.forIn("key",s,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},n),e.if((0,jl.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};qn.default=rp;var Va={};Object.defineProperty(Va,"__esModule",{value:!0});const za=Pe,Et=be,ap=Ct,Ha=ee,sp={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,Et._)`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,errsCount:n,it:o}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:i,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,Ha.alwaysValidSchema)(o,a))return;const c=(0,za.allSchemaProperties)(s.properties),u=(0,za.allSchemaProperties)(s.patternProperties);f(),t.ok((0,Et._)`${n} === ${ap.default.errors}`);function f(){e.forIn("key",r,h=>{!c.length&&!u.length?m(h):e.if(g(h),()=>m(h))})}function g(h){let v;if(c.length>8){const $=(0,Ha.schemaRefOrVal)(o,s.properties,"properties");v=(0,za.isOwnProperty)(e,$,h)}else c.length?v=(0,Et.or)(...c.map($=>(0,Et._)`${h} === ${$}`)):v=Et.nil;return u.length&&(v=(0,Et.or)(v,...u.map($=>(0,Et._)`${(0,za.usePattern)(t,$)}.test(${h})`))),(0,Et.not)(v)}function d(h){e.code((0,Et._)`delete ${r}[${h}]`)}function m(h){if(l.removeAdditional==="all"||l.removeAdditional&&a===!1){d(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),i||e.break();return}if(typeof a=="object"&&!(0,Ha.alwaysValidSchema)(o,a)){const v=e.name("valid");l.removeAdditional==="failing"?(p(h,v,!1),e.if((0,Et.not)(v),()=>{t.reset(),d(h)})):(p(h,v),i||e.if((0,Et.not)(v),()=>e.break()))}}function p(h,v,$){const P={keyword:"additionalProperties",dataProp:h,dataPropType:Ha.Type.Str};$===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,v)}}};Va.default=sp;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const np=Oa(),Dl=Pe,Vn=ee,xl=Va,ip={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;n.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&xl.default.code(new np.KeywordCxt(n,xl.default,"additionalProperties"));const o=(0,Dl.allSchemaProperties)(a);for(const f of o)n.definedProperties.add(f);n.opts.unevaluated&&o.length&&n.props!==!0&&(n.props=Vn.mergeEvaluated.props(e,(0,Vn.toHash)(o),n.props));const i=o.filter(f=>!(0,Vn.alwaysValidSchema)(n,a[f]));if(i.length===0)return;const l=e.name("valid");for(const f of i)c(f)?u(f):(e.if((0,Dl.propertyInData)(e,r,f,n.opts.ownProperties)),u(f),n.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(l);function c(f){return n.opts.useDefaults&&!n.compositeRule&&a[f].default!==void 0}function u(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},l)}}};Un.default=ip;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});const Ml=Pe,Za=be,Ll=ee,Fl=ee,op={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,data:s,parentSchema:r,it:n}=t,{opts:o}=n,i=(0,Ml.allSchemaProperties)(a),l=i.filter(p=>(0,Ll.alwaysValidSchema)(n,a[p]));if(i.length===0||l.length===i.length&&(!n.opts.unevaluated||n.props===!0))return;const c=o.strictSchema&&!o.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof Za.Name)&&(n.props=(0,Fl.evaluatedPropsToName)(e,n.props));const{props:f}=n;g();function g(){for(const p of i)c&&d(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function d(p){for(const h in c)new RegExp(p).test(h)&&(0,Ll.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,Za._)`${(0,Ml.usePattern)(t,p)}.test(${h})`,()=>{const v=l.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:Fl.Type.Str},u),n.opts.unevaluated&&f!==!0?e.assign((0,Za._)`${f}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,Za.not)(u),()=>e.break())})})}}};zn.default=op;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const lp=ee,cp={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,lp.alwaysValidSchema)(s,a)){t.fail();return}const r=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),t.failResult(r,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Hn.default=cp;var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});const up={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pe.validateUnion,error:{message:"must match a schema in anyOf"}};Zn.default=up;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});const Ka=be,dp=ee,fp={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ka._)`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:a,parentSchema:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(r.opts.discriminator&&s.discriminator)return;const n=a,o=e.let("valid",!1),i=e.let("passing",null),l=e.name("_valid");t.setParams({passing:i}),e.block(c),t.result(o,()=>t.reset(),()=>t.error(!0));function c(){n.forEach((u,f)=>{let g;(0,dp.alwaysValidSchema)(r,u)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},l),f>0&&e.if((0,Ka._)`${l} && ${o}`).assign(o,!1).assign(i,(0,Ka._)`[${i}, ${f}]`).else(),e.if(l,()=>{e.assign(o,!0),e.assign(i,f),g&&t.mergeEvaluated(g,Ka.Name)})})}}};Kn.default=fp;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});const hp=ee,pp={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:a,it:s}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");const r=e.name("valid");a.forEach((n,o)=>{if((0,hp.alwaysValidSchema)(s,n))return;const i=t.subschema({keyword:"allOf",schemaProp:o},r);t.ok(r),t.mergeEvaluated(i)})}};Bn.default=pp;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});const Ba=be,ql=ee,mp={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,Ba.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ba._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,ql.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=Ul(s,"then"),n=Ul(s,"else");if(!r&&!n)return;const o=e.let("valid",!0),i=e.name("_valid");if(l(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(i,c("then",u),c("else",u))}else r?e.if(i,c("then")):e.if((0,Ba.not)(i),c("else"));t.pass(o,()=>t.error(!0));function l(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);t.mergeEvaluated(u)}function c(u,f){return()=>{const g=t.subschema({keyword:u},i);e.assign(o,i),t.mergeValidEvaluated(g,o),f?e.assign(f,(0,Ba._)`${u}`):t.setParams({ifClause:u})}}}};function Ul(t,e){const a=t.schema[e];return a!==void 0&&!(0,ql.alwaysValidSchema)(t,a)}Jn.default=mp;var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});const vp=ee,gp={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,vp.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};Qn.default=gp,Object.defineProperty(Dn,"__esModule",{value:!0});const yp=Ir,_p=Mn,$p=Nr,wp=Ln,bp=Fn,Pp=Al,Ep=qn,Sp=Va,Rp=Un,kp=zn,Tp=Hn,Op=Zn,Cp=Kn,Ip=Bn,Np=Jn,Ap=Qn;function jp(t=!1){const e=[Tp.default,Op.default,Cp.default,Ip.default,Np.default,Ap.default,Ep.default,Sp.default,Pp.default,Rp.default,kp.default];return t?e.push(_p.default,wp.default):e.push(yp.default,$p.default),e.push(bp.default),e}Dn.default=jp;var Gn={},Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});const Ke=be,Dp={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ke.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ke._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:o,it:i}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:f}=i;if(!l.validateFormats)return;r?g():d();function g(){const m=a.scopeValue("formats",{ref:f.formats,code:l.code.formats}),p=a.const("fDef",(0,Ke._)`${m}[${o}]`),h=a.let("fType"),v=a.let("format");a.if((0,Ke._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,Ke._)`${p}.type || "string"`).assign(v,(0,Ke._)`${p}.validate`),()=>a.assign(h,(0,Ke._)`"string"`).assign(v,p)),t.fail$data((0,Ke.or)($(),P()));function $(){return l.strictSchema===!1?Ke.nil:(0,Ke._)`${o} && !${v}`}function P(){const R=u.$async?(0,Ke._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,Ke._)`${v}(${s})`,N=(0,Ke._)`(typeof ${v} == "function" ? ${R} : ${v}.test(${s}))`;return(0,Ke._)`${v} && ${v} !== true && ${h} === ${e} && !${N}`}}function d(){const m=f.formats[n];if(!m){$();return}if(m===!0)return;const[p,h,v]=P(m);p===e&&t.pass(R());function $(){if(l.strictSchema===!1){f.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${n}" ignored in schema at path "${c}"`}}function P(N){const q=N instanceof RegExp?(0,Ke.regexpCode)(N):l.code.formats?(0,Ke._)`${l.code.formats}${(0,Ke.getProperty)(n)}`:void 0,J=a.scopeValue("formats",{key:n,ref:N,code:q});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,Ke._)`${J}.validate`]:["string",N,J]}function R(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ke._)`await ${v}(${s})`}return typeof h=="function"?(0,Ke._)`${v}(${s})`:(0,Ke._)`${v}.test(${s})`}}}};Wn.default=Dp,Object.defineProperty(Gn,"__esModule",{value:!0});const xp=[Wn.default];Gn.default=xp;var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.contentVocabulary=Ar.metadataVocabulary=void 0,Ar.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Ar.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(yn,"__esModule",{value:!0});const Mp=_n,Lp=wn,Fp=Dn,qp=Gn,Vl=Ar,Up=[Mp.default,Lp.default,(0,Fp.default)(),qp.default,Vl.metadataVocabulary,Vl.contentVocabulary];yn.default=Up;var Xn={},Ja={};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.DiscrError=void 0;var zl;(function(t){t.Tag="tag",t.Mapping="mapping"})(zl||(Ja.DiscrError=zl={})),Object.defineProperty(Xn,"__esModule",{value:!0});const jr=be,Yn=Ja,Hl=dt,Vp=Or,zp=ee,Hp={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Yn.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,jr._)`{error: ${t}, tag: ${a}, tagValue: ${e}}`},code(t){const{gen:e,data:a,schema:s,parentSchema:r,it:n}=t,{oneOf:o}=r;if(!n.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=s.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const l=e.let("valid",!1),c=e.const("tag",(0,jr._)`${a}${(0,jr.getProperty)(i)}`);e.if((0,jr._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:Yn.DiscrError.Tag,tag:c,tagName:i})),t.ok(l);function u(){const d=g();e.if(!1);for(const m in d)e.elseIf((0,jr._)`${c} === ${m}`),e.assign(l,f(d[m]));e.else(),t.error(!1,{discrError:Yn.DiscrError.Mapping,tag:c,tagName:i}),e.endIf()}function f(d){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:d},m);return t.mergeEvaluated(p,jr.Name),m}function g(){var d;const m={},p=v(r);let h=!0;for(let R=0;R<o.length;R++){let N=o[R];if(N!=null&&N.$ref&&!(0,zp.schemaHasRulesButRef)(N,n.self.RULES)){const J=N.$ref;if(N=Hl.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,J),N instanceof Hl.SchemaEnv&&(N=N.schema),N===void 0)throw new Vp.default(n.opts.uriResolver,n.baseId,J)}const q=(d=N==null?void 0:N.properties)===null||d===void 0?void 0:d[i];if(typeof q!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);h=h&&(p||v(N)),$(q,R)}if(!h)throw new Error(`discriminator: "${i}" must be required`);return m;function v({required:R}){return Array.isArray(R)&&R.includes(i)}function $(R,N){if(R.const)P(R.const,N);else if(R.enum)for(const q of R.enum)P(q,N);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function P(R,N){if(typeof R!="string"||R in m)throw new Error(`discriminator: "${i}" values must be unique strings`);m[R]=N}}}};Xn.default=Hp;const Zp={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const a=Fo,s=yn,r=Xn,n=Zp,o=["/properties"],i="http://json-schema.org/draft-07/schema";class l extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const m=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(m,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=Oa();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=be;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=Yr;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var g=Or;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(Xs,Xs.exports);var Kp=Xs.exports;const Bp=Lo(Kp);var Te;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const o of r)n[o]=o;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(const i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(const o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Te||(Te={}));var Zl;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Zl||(Zl={}));const ae=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),er=t=>{switch(typeof t){case"undefined":return ae.undefined;case"string":return ae.string;case"number":return Number.isNaN(t)?ae.nan:ae.number;case"boolean":return ae.boolean;case"function":return ae.function;case"bigint":return ae.bigint;case"symbol":return ae.symbol;case"object":return Array.isArray(t)?ae.array:t===null?ae.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ae.promise:typeof Map<"u"&&t instanceof Map?ae.map:typeof Set<"u"&&t instanceof Set?ae.set:typeof Date<"u"&&t instanceof Date?ae.date:ae.object;default:return ae.unknown}},H=Te.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Vt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(a(o));else{let i=s,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(a(o))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof Vt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Vt.create=t=>new Vt(t);const ei=(t,e)=>{let a;switch(t.code){case H.invalid_type:t.received===ae.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case H.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,Te.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:a=`Unrecognized key(s) in object: ${Te.joinValues(t.keys,", ")}`;break;case H.invalid_union:a="Invalid input";break;case H.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Te.joinValues(t.options)}`;break;case H.invalid_enum_value:a=`Invalid enum value. Expected ${Te.joinValues(t.options)}, received '${t.received}'`;break;case H.invalid_arguments:a="Invalid function arguments";break;case H.invalid_return_type:a="Invalid function return type";break;case H.invalid_date:a="Invalid date";break;case H.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:Te.assertNever(t.validation):t.validation!=="regex"?a=`Invalid ${t.validation}`:a="Invalid";break;case H.too_small:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?a=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:a="Invalid input";break;case H.too_big:t.type==="array"?a=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?a=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?a=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?a=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?a=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:a="Invalid input";break;case H.custom:a="Invalid input";break;case H.invalid_intersection_types:a="Intersection results could not be merged";break;case H.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case H.not_finite:a="Number must be finite";break;default:a=e.defaultError,Te.assertNever(t)}return{message:a}};let Jp=ei;function Qp(){return Jp}const Gp=t=>{const{data:e,path:a,errorMaps:s,issueData:r}=t,n=[...a,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let i="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)i=c(o,{data:e,defaultError:i}).message;return{...r,path:n,message:i}};function X(t,e){const a=Qp(),s=Gp({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===ei?void 0:ei].filter(r=>!!r)});t.common.issues.push(s)}class ot{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const s=[];for(const r of a){if(r.status==="aborted")return fe;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,a){const s=[];for(const r of a){const n=await r.key,o=await r.value;s.push({key:n,value:o})}return ot.mergeObjectSync(e,s)}static mergeObjectSync(e,a){const s={};for(const r of a){const{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return fe;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}}const fe=Object.freeze({status:"aborted"}),la=t=>({status:"dirty",value:t}),gt=t=>({status:"valid",value:t}),Kl=t=>t.status==="aborted",Bl=t=>t.status==="dirty",Dr=t=>t.status==="valid",Qa=t=>typeof Promise<"u"&&t instanceof Promise;var oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(oe||(oe={}));class Nt{constructor(e,a,s,r){this._cachedPath=[],this.parent=e,this.data=a,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Jl=(t,e)=>{if(Dr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Vt(t.common.issues);return this._error=a,this._error}}};function _e(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:l??a??i.defaultError}},description:r}}class Ee{get description(){return this._def.description}_getType(e){return er(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ot,ctx:{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Qa(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const s=this.safeParse(e,a);if(s.success)return s.data;throw s.error}safeParse(e,a){const s={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Jl(s,r)}"~validate"(e){var s,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return Dr(n)?{value:n.value}:{issues:a.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(n=>Dr(n)?{value:n.value}:{issues:a.common.issues})}async parseAsync(e,a){const s=await this.safeParseAsync(e,a);if(s.success)return s.data;throw s.error}async safeParseAsync(e,a){const s={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(Qa(r)?r:Promise.resolve(r));return Jl(s,n)}refine(e,a){const s=r=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(r):a;return this._refinement((r,n)=>{const o=e(r),i=()=>n.addIssue({code:H.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,a){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof a=="function"?a(s,r):a),!1))}_refinement(e){return new gr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Zt.create(this,this._def)}nullable(){return yr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return At.create(this)}promise(){return ts.create(this,this._def)}or(e){return Wa.create([this,e],this._def)}and(e){return Xa.create(this,e,this._def)}transform(e){return new gr({..._e(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new rs({..._e(this._def),innerType:this,defaultValue:a,typeName:Z.ZodDefault})}brand(){return new rc({typeName:Z.ZodBranded,type:this,..._e(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new as({..._e(this._def),innerType:this,catchValue:a,typeName:Z.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return di.create(this,e)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Wp=/^c[^\s-]{8,}$/i,Xp=/^[0-9a-z]+$/,Yp=/^[0-9A-HJKMNP-TV-Z]{26}$/i,em=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tm=/^[a-z0-9_-]{21}$/i,rm=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,am=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sm=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ti;const im=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,om=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,lm=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cm=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,um=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dm=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ql="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fm=new RegExp(`^${Ql}$`);function Gl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function hm(t){return new RegExp(`^${Gl(t)}$`)}function pm(t){let e=`${Ql}T${Gl(t)}`;const a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function mm(t,e){return!!((e==="v4"||!e)&&im.test(t)||(e==="v6"||!e)&&lm.test(t))}function vm(t,e){if(!rm.test(t))return!1;try{const[a]=t.split(".");if(!a)return!1;const s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function gm(t,e){return!!((e==="v4"||!e)&&om.test(t)||(e==="v6"||!e)&&cm.test(t))}class zt extends Ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ae.string){const n=this._getOrReturnCtx(e);return X(n,{code:H.invalid_type,expected:ae.string,received:n.parsedType}),fe}const s=new ot;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),X(r,{code:H.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),X(r,{code:H.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?X(r,{code:H.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&X(r,{code:H.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")sm.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"email",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")ti||(ti=new RegExp(nm,"u")),ti.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"emoji",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")em.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"uuid",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")tm.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"nanoid",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Wp.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"cuid",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Xp.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"cuid2",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Yp.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"ulid",code:H.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),X(r,{validation:"url",code:H.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"regex",code:H.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?pm(n).test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?fm.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?hm(n).test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{code:H.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?am.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"duration",code:H.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?mm(e.data,n.version)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"ip",code:H.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?vm(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"jwt",code:H.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?gm(e.data,n.version)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"cidr",code:H.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?um.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"base64",code:H.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?dm.test(e.data)||(r=this._getOrReturnCtx(e,r),X(r,{validation:"base64url",code:H.invalid_string,message:n.message}),s.dirty()):Te.assertNever(n);return{status:s.value,value:e.data}}_regex(e,a,s){return this.refinement(r=>e.test(r),{validation:a,code:H.invalid_string,...oe.errToObj(s)})}_addCheck(e){return new zt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...oe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...oe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...oe.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...oe.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...oe.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...oe.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...oe.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...oe.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...oe.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...oe.errToObj(a)})}nonempty(e){return this.min(1,oe.errToObj(e))}trim(){return new zt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}zt.create=t=>new zt({checks:[],typeName:Z.ZodString,coerce:(t==null?void 0:t.coerce)??!1,..._e(t)});function ym(t,e){const a=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=a>s?a:s,n=Number.parseInt(t.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}class xr extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ae.number){const n=this._getOrReturnCtx(e);return X(n,{code:H.invalid_type,expected:ae.number,received:n.parsedType}),fe}let s;const r=new ot;for(const n of this._def.checks)n.kind==="int"?Te.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{code:H.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ym(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),X(s,{code:H.not_finite,message:n.message}),r.dirty()):Te.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,oe.toString(a))}gt(e,a){return this.setLimit("min",e,!1,oe.toString(a))}lte(e,a){return this.setLimit("max",e,!0,oe.toString(a))}lt(e,a){return this.setLimit("max",e,!1,oe.toString(a))}setLimit(e,a,s,r){return new xr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:oe.toString(r)}]})}_addCheck(e){return new xr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oe.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:oe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oe.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Te.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(a===null||s.value>a)&&(a=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(a)&&Number.isFinite(e)}}xr.create=t=>new xr({checks:[],typeName:Z.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,..._e(t)});class ca extends Ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ae.bigint)return this._getInvalidInput(e);let s;const r=new ot;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),X(s,{code:H.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Te.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return X(a,{code:H.invalid_type,expected:ae.bigint,received:a.parsedType}),fe}gte(e,a){return this.setLimit("min",e,!0,oe.toString(a))}gt(e,a){return this.setLimit("min",e,!1,oe.toString(a))}lte(e,a){return this.setLimit("max",e,!0,oe.toString(a))}lt(e,a){return this.setLimit("max",e,!1,oe.toString(a))}setLimit(e,a,s,r){return new ca({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:oe.toString(r)}]})}_addCheck(e){return new ca({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ca.create=t=>new ca({checks:[],typeName:Z.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,..._e(t)});class ri extends Ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ae.boolean){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.boolean,received:s.parsedType}),fe}return gt(e.data)}}ri.create=t=>new ri({typeName:Z.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,..._e(t)});class Ga extends Ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ae.date){const n=this._getOrReturnCtx(e);return X(n,{code:H.invalid_type,expected:ae.date,received:n.parsedType}),fe}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return X(n,{code:H.invalid_date}),fe}const s=new ot;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),X(r,{code:H.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),X(r,{code:H.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Te.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ga({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:oe.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:oe.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Ga.create=t=>new Ga({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Z.ZodDate,..._e(t)});class Wl extends Ee{_parse(e){if(this._getType(e)!==ae.symbol){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.symbol,received:s.parsedType}),fe}return gt(e.data)}}Wl.create=t=>new Wl({typeName:Z.ZodSymbol,..._e(t)});class ai extends Ee{_parse(e){if(this._getType(e)!==ae.undefined){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.undefined,received:s.parsedType}),fe}return gt(e.data)}}ai.create=t=>new ai({typeName:Z.ZodUndefined,..._e(t)});class si extends Ee{_parse(e){if(this._getType(e)!==ae.null){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.null,received:s.parsedType}),fe}return gt(e.data)}}si.create=t=>new si({typeName:Z.ZodNull,..._e(t)});class ni extends Ee{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}}ni.create=t=>new ni({typeName:Z.ZodAny,..._e(t)});class ii extends Ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}}ii.create=t=>new ii({typeName:Z.ZodUnknown,..._e(t)});class tr extends Ee{_parse(e){const a=this._getOrReturnCtx(e);return X(a,{code:H.invalid_type,expected:ae.never,received:a.parsedType}),fe}}tr.create=t=>new tr({typeName:Z.ZodNever,..._e(t)});class Xl extends Ee{_parse(e){if(this._getType(e)!==ae.undefined){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.void,received:s.parsedType}),fe}return gt(e.data)}}Xl.create=t=>new Xl({typeName:Z.ZodVoid,..._e(t)});class At extends Ee{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==ae.array)return X(a,{code:H.invalid_type,expected:ae.array,received:a.parsedType}),fe;if(r.exactLength!==null){const o=a.data.length>r.exactLength.value,i=a.data.length<r.exactLength.value;(o||i)&&(X(a,{code:o?H.too_big:H.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&a.data.length<r.minLength.value&&(X(a,{code:H.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&a.data.length>r.maxLength.value&&(X(a,{code:H.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>r.type._parseAsync(new Nt(a,o,a.path,i)))).then(o=>ot.mergeArray(s,o));const n=[...a.data].map((o,i)=>r.type._parseSync(new Nt(a,o,a.path,i)));return ot.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new At({...this._def,minLength:{value:e,message:oe.toString(a)}})}max(e,a){return new At({...this._def,maxLength:{value:e,message:oe.toString(a)}})}length(e,a){return new At({...this._def,exactLength:{value:e,message:oe.toString(a)}})}nonempty(e){return this.min(1,e)}}At.create=(t,e)=>new At({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,..._e(e)});function Mr(t){if(t instanceof Qe){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Zt.create(Mr(s))}return new Qe({...t._def,shape:()=>e})}else return t instanceof At?new At({...t._def,type:Mr(t.element)}):t instanceof Zt?Zt.create(Mr(t.unwrap())):t instanceof yr?yr.create(Mr(t.unwrap())):t instanceof mr?mr.create(t.items.map(e=>Mr(e))):t}class Qe extends Ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=Te.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==ae.object){const c=this._getOrReturnCtx(e);return X(c,{code:H.invalid_type,expected:ae.object,received:c.parsedType}),fe}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof tr&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||i.push(c);const l=[];for(const c of o){const u=n[c],f=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Nt(r,f,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof tr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")i.length>0&&(X(r,{code:H.unrecognized_keys,keys:i}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of i){const f=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Nt(r,f,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,g=await u.value;c.push({key:f,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>ot.mergeObjectSync(s,c)):ot.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return oe.errToObj,new Qe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,s)=>{var n,o;const r=((o=(n=this._def).errorMap)==null?void 0:o.call(n,a,s).message)??s.defaultError;return a.code==="unrecognized_keys"?{message:oe.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Qe({...this._def,unknownKeys:"strip"})}passthrough(){return new Qe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Qe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Qe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Qe({...this._def,catchall:e})}pick(e){const a={};for(const s of Te.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Qe({...this._def,shape:()=>a})}omit(e){const a={};for(const s of Te.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Qe({...this._def,shape:()=>a})}deepPartial(){return Mr(this)}partial(e){const a={};for(const s of Te.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Qe({...this._def,shape:()=>a})}required(e){const a={};for(const s of Te.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Zt;)n=n._def.innerType;a[s]=n}return new Qe({...this._def,shape:()=>a})}keyof(){return ec(Te.objectKeys(this.shape))}}Qe.create=(t,e)=>new Qe({shape:()=>t,unknownKeys:"strip",catchall:tr.create(),typeName:Z.ZodObject,..._e(e)}),Qe.strictCreate=(t,e)=>new Qe({shape:()=>t,unknownKeys:"strict",catchall:tr.create(),typeName:Z.ZodObject,..._e(e)}),Qe.lazycreate=(t,e)=>new Qe({shape:t,unknownKeys:"strip",catchall:tr.create(),typeName:Z.ZodObject,..._e(e)});class Wa extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e),s=this._def.options;function r(n){for(const i of n)if(i.result.status==="valid")return i.result;for(const i of n)if(i.result.status==="dirty")return a.common.issues.push(...i.ctx.common.issues),i.result;const o=n.map(i=>new Vt(i.ctx.common.issues));return X(a,{code:H.invalid_union,unionErrors:o}),fe}if(a.common.async)return Promise.all(s.map(async n=>{const o={...a,common:{...a.common,issues:[]},parent:null};return{result:await n._parseAsync({data:a.data,path:a.path,parent:o}),ctx:o}})).then(r);{let n;const o=[];for(const l of s){const c={...a,common:{...a.common,issues:[]},parent:null},u=l._parseSync({data:a.data,path:a.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const i=o.map(l=>new Vt(l));return X(a,{code:H.invalid_union,unionErrors:i}),fe}}get options(){return this._def.options}}Wa.create=(t,e)=>new Wa({options:t,typeName:Z.ZodUnion,..._e(e)});const Ht=t=>t instanceof ci?Ht(t.schema):t instanceof gr?Ht(t.innerType()):t instanceof es?[t.value]:t instanceof vr?t.options:t instanceof ui?Te.objectValues(t.enum):t instanceof rs?Ht(t._def.innerType):t instanceof ai?[void 0]:t instanceof si?[null]:t instanceof Zt?[void 0,...Ht(t.unwrap())]:t instanceof yr?[null,...Ht(t.unwrap())]:t instanceof rc||t instanceof ss?Ht(t.unwrap()):t instanceof as?Ht(t._def.innerType):[];class oi extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==ae.object)return X(a,{code:H.invalid_type,expected:ae.object,received:a.parsedType}),fe;const s=this.discriminator,r=a.data[s],n=this.optionsMap.get(r);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(X(a,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,s){const r=new Map;for(const n of a){const o=Ht(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new oi({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,..._e(s)})}}function li(t,e){const a=er(t),s=er(e);if(t===e)return{valid:!0,data:t};if(a===ae.object&&s===ae.object){const r=Te.objectKeys(e),n=Te.objectKeys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(const i of n){const l=li(t[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(a===ae.array&&s===ae.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let n=0;n<t.length;n++){const o=t[n],i=e[n],l=li(o,i);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return a===ae.date&&s===ae.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Xa extends Ee{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(Kl(n)||Kl(o))return fe;const i=li(n.value,o.value);return i.valid?((Bl(n)||Bl(o))&&a.dirty(),{status:a.value,value:i.data}):(X(s,{code:H.invalid_intersection_types}),fe)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Xa.create=(t,e,a)=>new Xa({left:t,right:e,typeName:Z.ZodIntersection,..._e(a)});class mr extends Ee{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.array)return X(s,{code:H.invalid_type,expected:ae.array,received:s.parsedType}),fe;if(s.data.length<this._def.items.length)return X(s,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),fe;!this._def.rest&&s.data.length>this._def.items.length&&(X(s,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const n=[...s.data].map((o,i)=>{const l=this._def.items[i]||this._def.rest;return l?l._parse(new Nt(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>ot.mergeArray(a,o)):ot.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new mr({...this._def,rest:e})}}mr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mr({items:t,typeName:Z.ZodTuple,rest:null,..._e(e)})};class Ya extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.object)return X(s,{code:H.invalid_type,expected:ae.object,received:s.parsedType}),fe;const r=[],n=this._def.keyType,o=this._def.valueType;for(const i in s.data)r.push({key:n._parse(new Nt(s,i,s.path,i)),value:o._parse(new Nt(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?ot.mergeObjectAsync(a,r):ot.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof Ee?new Ya({keyType:e,valueType:a,typeName:Z.ZodRecord,..._e(s)}):new Ya({keyType:zt.create(),valueType:e,typeName:Z.ZodRecord,..._e(a)})}}class Yl extends Ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.map)return X(s,{code:H.invalid_type,expected:ae.map,received:s.parsedType}),fe;const r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,l],c)=>({key:r._parse(new Nt(s,i,s.path,[c,"key"])),value:n._parse(new Nt(s,l,s.path,[c,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return fe;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),i.set(c.value,u.value)}return{status:a.value,value:i}})}else{const i=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return fe;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),i.set(c.value,u.value)}return{status:a.value,value:i}}}}Yl.create=(t,e,a)=>new Yl({valueType:e,keyType:t,typeName:Z.ZodMap,..._e(a)});class ua extends Ee{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==ae.set)return X(s,{code:H.invalid_type,expected:ae.set,received:s.parsedType}),fe;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(X(s,{code:H.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),a.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(X(s,{code:H.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),a.dirty());const n=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return fe;u.status==="dirty"&&a.dirty(),c.add(u.value)}return{status:a.value,value:c}}const i=[...s.data.values()].map((l,c)=>n._parse(new Nt(s,l,s.path,c)));return s.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,a){return new ua({...this._def,minSize:{value:e,message:oe.toString(a)}})}max(e,a){return new ua({...this._def,maxSize:{value:e,message:oe.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}ua.create=(t,e)=>new ua({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,..._e(e)});class ci extends Ee{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ci.create=(t,e)=>new ci({getter:t,typeName:Z.ZodLazy,..._e(e)});class es extends Ee{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return X(a,{received:a.data,code:H.invalid_literal,expected:this._def.value}),fe}return{status:"valid",value:e.data}}get value(){return this._def.value}}es.create=(t,e)=>new es({value:t,typeName:Z.ZodLiteral,..._e(e)});function ec(t,e){return new vr({values:t,typeName:Z.ZodEnum,..._e(e)})}class vr extends Ee{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return X(a,{expected:Te.joinValues(s),received:a.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const a=this._getOrReturnCtx(e),s=this._def.values;return X(a,{received:a.data,code:H.invalid_enum_value,options:s}),fe}return gt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return vr.create(e,{...this._def,...a})}exclude(e,a=this._def){return vr.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}vr.create=ec;class ui extends Ee{_parse(e){const a=Te.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ae.string&&s.parsedType!==ae.number){const r=Te.objectValues(a);return X(s,{expected:Te.joinValues(r),received:s.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(Te.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Te.objectValues(a);return X(s,{received:s.data,code:H.invalid_enum_value,options:r}),fe}return gt(e.data)}get enum(){return this._def.values}}ui.create=(t,e)=>new ui({values:t,typeName:Z.ZodNativeEnum,..._e(e)});class ts extends Ee{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==ae.promise&&a.common.async===!1)return X(a,{code:H.invalid_type,expected:ae.promise,received:a.parsedType}),fe;const s=a.parsedType===ae.promise?a.data:Promise.resolve(a.data);return gt(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}ts.create=(t,e)=>new ts({type:t,typeName:Z.ZodPromise,..._e(e)});class gr extends Ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{X(s,o),o.fatal?a.abort():a.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){const o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(a.value==="aborted")return fe;const l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?fe:l.status==="dirty"||a.value==="dirty"?la(l.value):l});{if(a.value==="aborted")return fe;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?fe:i.status==="dirty"||a.value==="dirty"?la(i.value):i}}if(r.type==="refinement"){const o=i=>{const l=r.refinement(i,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?fe:(i.status==="dirty"&&a.dirty(),o(i.value),{status:a.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?fe:(i.status==="dirty"&&a.dirty(),o(i.value).then(()=>({status:a.value,value:i.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Dr(o))return fe;const i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Dr(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:a.value,value:i})):fe);Te.assertNever(r)}}gr.create=(t,e,a)=>new gr({schema:t,typeName:Z.ZodEffects,effect:e,..._e(a)}),gr.createWithPreprocess=(t,e,a)=>new gr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,..._e(a)});class Zt extends Ee{_parse(e){return this._getType(e)===ae.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zt.create=(t,e)=>new Zt({innerType:t,typeName:Z.ZodOptional,..._e(e)});class yr extends Ee{_parse(e){return this._getType(e)===ae.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yr.create=(t,e)=>new yr({innerType:t,typeName:Z.ZodNullable,..._e(e)});class rs extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===ae.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}rs.create=(t,e)=>new rs({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});class as extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e),s={...a,common:{...a.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Qa(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Vt(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Vt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}as.create=(t,e)=>new as({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});class tc extends Ee{_parse(e){if(this._getType(e)!==ae.nan){const s=this._getOrReturnCtx(e);return X(s,{code:H.invalid_type,expected:ae.nan,received:s.parsedType}),fe}return{status:"valid",value:e.data}}}tc.create=t=>new tc({typeName:Z.ZodNaN,..._e(t)});class rc extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}class di extends Ee{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?fe:n.status==="dirty"?(a.dirty(),la(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?fe:r.status==="dirty"?(a.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,a){return new di({in:e,out:a,typeName:Z.ZodPipeline})}}class ss extends Ee{_parse(e){const a=this._def.innerType._parse(e),s=r=>(Dr(r)&&(r.value=Object.freeze(r.value)),r);return Qa(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}ss.create=(t,e)=>new ss({innerType:t,typeName:Z.ZodReadonly,..._e(e)});var Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));const O=zt.create,tt=xr.create,Xe=ri.create,_m=ni.create,da=ii.create;tr.create;const ie=At.create,W=Qe.create,lt=Wa.create,$m=oi.create;Xa.create,mr.create;const fa=Ya.create,ge=es.create,Kt=vr.create;ts.create;const z=Zt.create;yr.create;const _r="2025-06-18",wm="2025-03-26",fi=[_r,"2025-03-26","2024-11-05","2024-10-07"],ha="2.0",hi=lt([O(),tt().int()]),pi=O(),bm=W({progressToken:z(hi)}).passthrough(),yt=W({_meta:z(bm)}).passthrough(),ct=W({method:O(),params:z(yt)}),pa=W({_meta:z(W({}).passthrough())}).passthrough(),St=W({method:O(),params:z(pa)}),mt=W({_meta:z(W({}).passthrough())}).passthrough(),ma=lt([O(),tt().int()]),mi=W({jsonrpc:ge(ha),id:ma}).merge(ct).strict(),vi=t=>mi.safeParse(t).success,gi=W({jsonrpc:ge(ha)}).merge(St).strict(),ac=t=>gi.safeParse(t).success,yi=W({jsonrpc:ge(ha),id:ma,result:mt}).strict(),ns=t=>yi.safeParse(t).success;T.ErrorCode=void 0,function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"}(T.ErrorCode||(T.ErrorCode={}));const _i=W({jsonrpc:ge(ha),id:ma,error:W({code:tt().int(),message:O(),data:z(da())})}).strict(),sc=t=>_i.safeParse(t).success,va=lt([mi,gi,yi,_i]),rr=mt.strict(),is=St.extend({method:ge("notifications/cancelled"),params:pa.extend({requestId:ma,reason:O().optional()})}),Lr=W({name:O(),title:z(O())}).passthrough(),$i=Lr.extend({version:O()}),nc=W({experimental:z(W({}).passthrough()),sampling:z(W({}).passthrough()),elicitation:z(W({}).passthrough()),roots:z(W({listChanged:z(Xe())}).passthrough())}).passthrough(),os=ct.extend({method:ge("initialize"),params:yt.extend({protocolVersion:O(),capabilities:nc,clientInfo:$i})}),Pm=t=>os.safeParse(t).success,ic=W({experimental:z(W({}).passthrough()),logging:z(W({}).passthrough()),completions:z(W({}).passthrough()),prompts:z(W({listChanged:z(Xe())}).passthrough()),resources:z(W({subscribe:z(Xe()),listChanged:z(Xe())}).passthrough()),tools:z(W({listChanged:z(Xe())}).passthrough())}).passthrough(),wi=mt.extend({protocolVersion:O(),capabilities:ic,serverInfo:$i,instructions:z(O())}),ls=St.extend({method:ge("notifications/initialized")}),oc=t=>ls.safeParse(t).success,cs=ct.extend({method:ge("ping")}),lc=W({progress:tt(),total:z(tt()),message:z(O())}).passthrough(),us=St.extend({method:ge("notifications/progress"),params:pa.merge(lc).extend({progressToken:hi})}),ga=ct.extend({params:yt.extend({cursor:z(pi)}).optional()}),ya=mt.extend({nextCursor:z(pi)}),bi=W({uri:O(),mimeType:z(O()),_meta:z(W({}).passthrough())}).passthrough(),Pi=bi.extend({text:O()}),Ei=O().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Si=bi.extend({blob:Ei}),Ri=Lr.extend({uri:O(),description:z(O()),mimeType:z(O()),_meta:z(W({}).passthrough())}),cc=Lr.extend({uriTemplate:O(),description:z(O()),mimeType:z(O()),_meta:z(W({}).passthrough())}),ds=ga.extend({method:ge("resources/list")}),ki=ya.extend({resources:ie(Ri)}),fs=ga.extend({method:ge("resources/templates/list")}),Ti=ya.extend({resourceTemplates:ie(cc)}),hs=ct.extend({method:ge("resources/read"),params:yt.extend({uri:O()})}),Oi=mt.extend({contents:ie(lt([Pi,Si]))}),uc=St.extend({method:ge("notifications/resources/list_changed")}),dc=ct.extend({method:ge("resources/subscribe"),params:yt.extend({uri:O()})}),fc=ct.extend({method:ge("resources/unsubscribe"),params:yt.extend({uri:O()})}),hc=St.extend({method:ge("notifications/resources/updated"),params:pa.extend({uri:O()})}),pc=W({name:O(),description:z(O()),required:z(Xe())}).passthrough(),mc=Lr.extend({description:z(O()),arguments:z(ie(pc)),_meta:z(W({}).passthrough())}),ps=ga.extend({method:ge("prompts/list")}),Ci=ya.extend({prompts:ie(mc)}),ms=ct.extend({method:ge("prompts/get"),params:yt.extend({name:O(),arguments:z(fa(O()))})}),vs=W({type:ge("text"),text:O(),_meta:z(W({}).passthrough())}).passthrough(),gs=W({type:ge("image"),data:Ei,mimeType:O(),_meta:z(W({}).passthrough())}).passthrough(),ys=W({type:ge("audio"),data:Ei,mimeType:O(),_meta:z(W({}).passthrough())}).passthrough(),vc=W({type:ge("resource"),resource:lt([Pi,Si]),_meta:z(W({}).passthrough())}).passthrough(),gc=Ri.extend({type:ge("resource_link")}),Ii=lt([vs,gs,ys,gc,vc]),yc=W({role:Kt(["user","assistant"]),content:Ii}).passthrough(),Ni=mt.extend({description:z(O()),messages:ie(yc)}),_c=St.extend({method:ge("notifications/prompts/list_changed")}),$c=W({title:z(O()),readOnlyHint:z(Xe()),destructiveHint:z(Xe()),idempotentHint:z(Xe()),openWorldHint:z(Xe())}).passthrough(),wc=Lr.extend({description:z(O()),inputSchema:W({type:ge("object"),properties:z(W({}).passthrough()),required:z(ie(O()))}).passthrough(),outputSchema:z(W({type:ge("object"),properties:z(W({}).passthrough()),required:z(ie(O()))}).passthrough()),annotations:z($c),_meta:z(W({}).passthrough())}),_s=ga.extend({method:ge("tools/list")}),Ai=ya.extend({tools:ie(wc)}),$s=mt.extend({content:ie(Ii).default([]),structuredContent:W({}).passthrough().optional(),isError:z(Xe())}),Em=$s.or(mt.extend({toolResult:da()})),ws=ct.extend({method:ge("tools/call"),params:yt.extend({name:O(),arguments:z(fa(da()))})}),bc=St.extend({method:ge("notifications/tools/list_changed")}),ji=Kt(["debug","info","notice","warning","error","critical","alert","emergency"]),Pc=ct.extend({method:ge("logging/setLevel"),params:yt.extend({level:ji})}),Ec=St.extend({method:ge("notifications/message"),params:pa.extend({level:ji,logger:z(O()),data:da()})}),Sc=W({name:O().optional()}).passthrough(),Rc=W({hints:z(ie(Sc)),costPriority:z(tt().min(0).max(1)),speedPriority:z(tt().min(0).max(1)),intelligencePriority:z(tt().min(0).max(1))}).passthrough(),kc=W({role:Kt(["user","assistant"]),content:lt([vs,gs,ys])}).passthrough(),Tc=ct.extend({method:ge("sampling/createMessage"),params:yt.extend({messages:ie(kc),systemPrompt:z(O()),includeContext:z(Kt(["none","thisServer","allServers"])),temperature:z(tt()),maxTokens:tt().int(),stopSequences:z(ie(O())),metadata:z(W({}).passthrough()),modelPreferences:z(Rc)})}),Di=mt.extend({model:O(),stopReason:z(Kt(["endTurn","stopSequence","maxTokens"]).or(O())),role:Kt(["user","assistant"]),content:$m("type",[vs,gs,ys])}),Oc=W({type:ge("boolean"),title:z(O()),description:z(O()),default:z(Xe())}).passthrough(),Cc=W({type:ge("string"),title:z(O()),description:z(O()),minLength:z(tt()),maxLength:z(tt()),format:z(Kt(["email","uri","date","date-time"]))}).passthrough(),Ic=W({type:Kt(["number","integer"]),title:z(O()),description:z(O()),minimum:z(tt()),maximum:z(tt())}).passthrough(),Nc=W({type:ge("string"),title:z(O()),description:z(O()),enum:ie(O()),enumNames:z(ie(O()))}).passthrough(),Ac=lt([Oc,Cc,Ic,Nc]),jc=ct.extend({method:ge("elicitation/create"),params:yt.extend({message:O(),requestedSchema:W({type:ge("object"),properties:fa(O(),Ac),required:z(ie(O()))}).passthrough()})}),xi=mt.extend({action:Kt(["accept","decline","cancel"]),content:z(fa(O(),da()))}),Mi=W({type:ge("ref/resource"),uri:O()}).passthrough(),Sm=Mi,Dc=W({type:ge("ref/prompt"),name:O()}).passthrough(),bs=ct.extend({method:ge("completion/complete"),params:yt.extend({ref:lt([Dc,Mi]),argument:W({name:O(),value:O()}).passthrough(),context:z(W({arguments:z(fa(O(),O()))}))})}),Li=mt.extend({completion:W({values:ie(O()).max(100),total:z(tt().int()),hasMore:z(Xe())}).passthrough()}),xc=W({uri:O().startsWith("file://"),name:z(O()),_meta:z(W({}).passthrough())}).passthrough(),Mc=ct.extend({method:ge("roots/list")}),Fi=mt.extend({roots:ie(xc)}),Lc=St.extend({method:ge("notifications/roots/list_changed")}),Rm=lt([cs,os,bs,Pc,ms,ps,ds,fs,hs,dc,fc,ws,_s]),km=lt([is,us,ls,Lc]),Tm=lt([rr,Di,xi,Fi]),Om=lt([cs,Tc,jc,Mc]),Cm=lt([is,us,Ec,hc,uc,bc,_c]),Im=lt([rr,wi,Li,Ni,Ci,ki,Ti,Oi,$s,Ai]);class je extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const Fc=1e6,qi=1e6,qc=1e4,Nm=1e6;class Bt{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,a,s){if(e.length>a)throw new Error(`${s} exceeds maximum length of ${a} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){Bt.validateLength(e,Fc,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const a=[];let s="",r=0,n=0;for(;r<e.length;)if(e[r]==="{"){s&&(a.push(s),s="");const o=e.indexOf("}",r);if(o===-1)throw new Error("Unclosed template expression");if(n++,n>qc)throw new Error(`Template contains too many expressions (max ${qc})`);const i=e.slice(r+1,o),l=this.getOperator(i),c=i.includes("*"),u=this.getNames(i),f=u[0];for(const g of u)Bt.validateLength(g,qi,"Variable name");a.push({name:f,operator:l,names:u,exploded:c}),r=o+1}else s+=e[r],r++;return s&&a.push(s),a}getOperator(e){return["+","#",".","/","?","&"].find(s=>e.startsWith(s))||""}getNames(e){const a=this.getOperator(e);return e.slice(a.length).split(",").map(s=>s.replace("*","").trim()).filter(s=>s.length>0)}encodeValue(e,a){return Bt.validateLength(e,qi,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const o=e.names.map(l=>{const c=a[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(f=>this.encodeValue(f,e.operator)).join(","):this.encodeValue(c.toString(),e.operator);return`${l}=${u}`}).filter(l=>l.length>0);return o.length===0?"":(e.operator==="?"?"?":"&")+o.join("&")}if(e.names.length>1){const o=e.names.map(i=>a[i]).filter(i=>i!==void 0);return o.length===0?"":o.map(i=>Array.isArray(i)?i[0]:i).join(",")}const s=a[e.name];if(s===void 0)return"";const n=(Array.isArray(s)?s:[s]).map(o=>this.encodeValue(o,e.operator));switch(e.operator){case"":return n.join(",");case"+":return n.join(",");case"#":return"#"+n.join(",");case".":return"."+n.join(".");case"/":return"/"+n.join("/");default:return n.join(",")}}expand(e){let a="",s=!1;for(const r of this.parts){if(typeof r=="string"){a+=r;continue}const n=this.expandPart(r,e);n&&((r.operator==="?"||r.operator==="&")&&s?a+=n.replace("?","&"):a+=n,(r.operator==="?"||r.operator==="&")&&(s=!0))}return a}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const a=[];for(const n of e.names)Bt.validateLength(n,qi,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let n=0;n<e.names.length;n++){const o=e.names[n],i=n===0?"\\"+e.operator:"&";a.push({pattern:i+this.escapeRegExp(o)+"=([^&]+)",name:o})}return a}let s;const r=e.name;switch(e.operator){case"":s=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":s="(.+)";break;case".":s="\\.([^/,]+)";break;case"/":s="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:s="([^/]+)"}return a.push({pattern:s,name:r}),a}match(e){Bt.validateLength(e,Fc,"URI");let a="^";const s=[];for(const i of this.parts)if(typeof i=="string")a+=this.escapeRegExp(i);else{const l=this.partToRegExp(i);for(const{pattern:c,name:u}of l)a+=c,s.push({name:u,exploded:i.exploded})}a+="$",Bt.validateLength(a,Nm,"Generated regex pattern");const r=new RegExp(a),n=e.match(r);if(!n)return null;const o={};for(let i=0;i<s.length;i++){const{name:l,exploded:c}=s[i],u=n[i+1],f=l.replace("*","");c&&u.includes(",")?o[f]=u.split(","):o[f]=u}return o}}T.McpZodTypeKind=void 0,function(t){t.Completable="McpCompletable"}(T.McpZodTypeKind||(T.McpZodTypeKind={}));class _a extends Ee{_parse(e){const{ctx:a}=this._processInputParams(e),s=a.data;return this._def.type._parse({data:s,path:a.path,parent:a})}unwrap(){return this._def.type}}_a.create=(t,e)=>new _a({type:t,typeName:T.McpZodTypeKind.Completable,complete:e.complete,...jm(e)});function Am(t,e){return _a.create(t,{...t._def,complete:e})}function jm(t){if(!t)return{};const{errorMap:e,invalid_type_error:a,required_error:s,description:r}=t;if(e&&(a||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{var l,c;const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??a)!==null&&c!==void 0?c:i.defaultError}},description:r}}function Dm(t){var e;if(t.title!==void 0&&t.title!=="")return t.title;if("annotations"in t){const a=t;if(!((e=a.annotations)===null||e===void 0)&&e.title)return a.annotations.title}return t.name}const Uc=6e4;class Ui{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(is,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(us,a=>{this._onprogress(a)}),this.setRequestHandler(cs,a=>({}))}_setupTimeout(e,a,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,a),startTime:Date.now(),timeout:a,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){const a=this._timeoutInfo.get(e);if(!a)return!1;const s=Date.now()-a.startTime;if(a.maxTotalTimeout&&s>=a.maxTotalTimeout)throw this._timeoutInfo.delete(e),new je(T.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:s});return clearTimeout(a.timeoutId),a.timeoutId=setTimeout(a.onTimeout,a.timeout),!0}_cleanupTimeout(e){const a=this._timeoutInfo.get(e);a&&(clearTimeout(a.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var a,s,r;this._transport=e;const n=(a=this.transport)===null||a===void 0?void 0:a.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=l=>{o==null||o(l),this._onerror(l)};const i=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(l,c)=>{i==null||i(l,c),ns(l)||sc(l)?this._onresponse(l):vi(l)?this._onrequest(l,c):ac(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;const a=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new je(T.ErrorCode.ConnectionClosed,"Connection closed");for(const r of a.values())r(s)}_onerror(e){var a;(a=this.onerror)===null||a===void 0||a.call(this,e)}_onnotification(e){var a;const s=(a=this._notificationHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,a){var s,r,n,o;const i=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler;if(i===void 0){(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",id:e.id,error:{code:T.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const c={signal:l.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,f,g)=>this.request(u,f,{...g,relatedRequestId:e.id}),authInfo:a==null?void 0:a.authInfo,requestId:e.id,requestInfo:a==null?void 0:a.requestInfo};Promise.resolve().then(()=>i(e,c)).then(u=>{var f;if(!l.signal.aborted)return(f=this._transport)===null||f===void 0?void 0:f.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var f,g;if(!l.signal.aborted)return(f=this._transport)===null||f===void 0?void 0:f.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:T.ErrorCode.InternalError,message:(g=u.message)!==null&&g!==void 0?g:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:a,...s}=e.params,r=Number(a),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){o(l);return}n(s)}_onresponse(e){const a=Number(e.id),s=this._responseHandlers.get(a);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),ns(e))s(e);else{const r=new je(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,a,s){const{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}=s??{};return new Promise((i,l)=>{var c,u,f,g,d,m;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=s==null?void 0:s.signal)===null||u===void 0||u.throwIfAborted();const p=this._requestMessageId++,h={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),h.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:p}});const v=R=>{var N;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(N=this._transport)===null||N===void 0||N.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(R)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(q=>this._onerror(new Error(`Failed to send cancellation: ${q}`))),l(R)};this._responseHandlers.set(p,R=>{var N;if(!(!((N=s==null?void 0:s.signal)===null||N===void 0)&&N.aborted)){if(R instanceof Error)return l(R);try{const q=a.parse(R.result);i(q)}catch(q){l(q)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var R;v((R=s==null?void 0:s.signal)===null||R===void 0?void 0:R.reason)});const $=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:Uc,P=()=>v(new je(T.ErrorCode.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(p,$,s==null?void 0:s.maxTotalTimeout,P,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(R=>{this._cleanupTimeout(p),l(R)})})}async notification(e,a){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,a).catch(u=>this._onerror(u))});return}const i={...e,jsonrpc:"2.0"};await this._transport.send(i,a)}setRequestHandler(e,a){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(a(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,a){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(a(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function Vi(t,e){return Object.entries(e).reduce((a,[s,r])=>(r&&typeof r=="object"?a[s]=a[s]?{...a[s],...r}:r:a[s]=r,a),{...t})}var zi={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(t,e){(function(a,s){s(e)})(Jr,function(a){function s(){for(var b=arguments.length,_=Array(b),E=0;E<b;E++)_[E]=arguments[E];if(_.length>1){_[0]=_[0].slice(0,-1);for(var j=_.length-1,A=1;A<j;++A)_[A]=_[A].slice(1,-1);return _[j]=_[j].slice(1),_.join("")}else return _[0]}function r(b){return"(?:"+b+")"}function n(b){return b===void 0?"undefined":b===null?"null":Object.prototype.toString.call(b).split(" ").pop().split("]").shift().toLowerCase()}function o(b){return b.toUpperCase()}function i(b){return b!=null?b instanceof Array?b:typeof b.length!="number"||b.split||b.setInterval||b.call?[b]:Array.prototype.slice.call(b):[]}function l(b,_){var E=b;if(_)for(var j in _)E[j]=_[j];return E}function c(b){var _="[A-Za-z]",E="[0-9]",j=s(E,"[A-Fa-f]"),A=r(r("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+r("%[89A-Fa-f]"+j+"%"+j+j)+"|"+r("%"+j+j)),le="[\\:\\/\\?\\#\\[\\]\\@]",de="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ke=s(le,de),Le=b?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Be=b?"[\\uE000-\\uF8FF]":"[]",Re=s(_,E,"[\\-\\.\\_\\~]",Le);r(_+s(_,E,"[\\+\\-\\.]")+"*"),r(r(A+"|"+s(Re,de,"[\\:]"))+"*");var xe=r(r("25[0-5]")+"|"+r("2[0-4]"+E)+"|"+r("1"+E+E)+"|"+r("0?[1-9]"+E)+"|0?0?"+E),Je=r(xe+"\\."+xe+"\\."+xe+"\\."+xe),ve=r(j+"{1,4}"),Ue=r(r(ve+"\\:"+ve)+"|"+Je),Ge=r(r(ve+"\\:")+"{6}"+Ue),Ve=r("\\:\\:"+r(ve+"\\:")+"{5}"+Ue),lr=r(r(ve)+"?\\:\\:"+r(ve+"\\:")+"{4}"+Ue),Dt=r(r(r(ve+"\\:")+"{0,1}"+ve)+"?\\:\\:"+r(ve+"\\:")+"{3}"+Ue),xt=r(r(r(ve+"\\:")+"{0,2}"+ve)+"?\\:\\:"+r(ve+"\\:")+"{2}"+Ue),Br=r(r(r(ve+"\\:")+"{0,3}"+ve)+"?\\:\\:"+ve+"\\:"+Ue),Sr=r(r(r(ve+"\\:")+"{0,4}"+ve)+"?\\:\\:"+Ue),$t=r(r(r(ve+"\\:")+"{0,5}"+ve)+"?\\:\\:"+ve),Mt=r(r(r(ve+"\\:")+"{0,6}"+ve)+"?\\:\\:"),Rr=r([Ge,Ve,lr,Dt,xt,Br,Sr,$t,Mt].join("|")),Gt=r(r(Re+"|"+A)+"+");r("[vV]"+j+"+\\."+s(Re,de,"[\\:]")+"+"),r(r(A+"|"+s(Re,de))+"*");var Ra=r(A+"|"+s(Re,de,"[\\:\\@]"));return r(r(A+"|"+s(Re,de,"[\\@]"))+"+"),r(r(Ra+"|"+s("[\\/\\?]",Be))+"*"),{NOT_SCHEME:new RegExp(s("[^]",_,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",Re,de),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",Re,de),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",Re,de),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",Re,de),"g"),NOT_QUERY:new RegExp(s("[^\\%]",Re,de,"[\\:\\@\\/\\?]",Be),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",Re,de,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",Re,de),"g"),UNRESERVED:new RegExp(Re,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",Re,ke),"g"),PCT_ENCODED:new RegExp(A,"g"),IPV4ADDRESS:new RegExp("^("+Je+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Rr+")"+r(r("\\%25|\\%(?!"+j+"{2})")+"("+Gt+")")+"?\\]?$")}}var u=c(!1),f=c(!0),g=function(){function b(_,E){var j=[],A=!0,le=!1,de=void 0;try{for(var ke=_[Symbol.iterator](),Le;!(A=(Le=ke.next()).done)&&(j.push(Le.value),!(E&&j.length===E));A=!0);}catch(Be){le=!0,de=Be}finally{try{!A&&ke.return&&ke.return()}finally{if(le)throw de}}return j}return function(_,E){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return b(_,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(b){if(Array.isArray(b)){for(var _=0,E=Array(b.length);_<b.length;_++)E[_]=b[_];return E}else return Array.from(b)},m=2147483647,p=36,h=1,v=26,$=38,P=700,R=72,N=128,q="-",J=/^xn--/,K=/[^\0-\x7E]/,B=/[\x2E\u3002\uFF0E\uFF61]/g,te={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=p-h,Q=Math.floor,U=String.fromCharCode;function L(b){throw new RangeError(te[b])}function ne(b,_){for(var E=[],j=b.length;j--;)E[j]=_(b[j]);return E}function $e(b,_){var E=b.split("@"),j="";E.length>1&&(j=E[0]+"@",b=E[1]),b=b.replace(B,".");var A=b.split("."),le=ne(A,_).join(".");return j+le}function he(b){for(var _=[],E=0,j=b.length;E<j;){var A=b.charCodeAt(E++);if(A>=55296&&A<=56319&&E<j){var le=b.charCodeAt(E++);(le&64512)==56320?_.push(((A&1023)<<10)+(le&1023)+65536):(_.push(A),E--)}else _.push(A)}return _}var we=function(_){return String.fromCodePoint.apply(String,d(_))},pe=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:p},x=function(_,E){return _+22+75*(_<26)-((E!=0)<<5)},k=function(_,E,j){var A=0;for(_=j?Q(_/P):_>>1,_+=Q(_/E);_>re*v>>1;A+=p)_=Q(_/re);return Q(A+(re+1)*_/(_+$))},F=function(_){var E=[],j=_.length,A=0,le=N,de=R,ke=_.lastIndexOf(q);ke<0&&(ke=0);for(var Le=0;Le<ke;++Le)_.charCodeAt(Le)>=128&&L("not-basic"),E.push(_.charCodeAt(Le));for(var Be=ke>0?ke+1:0;Be<j;){for(var Re=A,xe=1,Je=p;;Je+=p){Be>=j&&L("invalid-input");var ve=pe(_.charCodeAt(Be++));(ve>=p||ve>Q((m-A)/xe))&&L("overflow"),A+=ve*xe;var Ue=Je<=de?h:Je>=de+v?v:Je-de;if(ve<Ue)break;var Ge=p-Ue;xe>Q(m/Ge)&&L("overflow"),xe*=Ge}var Ve=E.length+1;de=k(A-Re,Ve,Re==0),Q(A/Ve)>m-le&&L("overflow"),le+=Q(A/Ve),A%=Ve,E.splice(A++,0,le)}return String.fromCodePoint.apply(String,E)},C=function(_){var E=[];_=he(_);var j=_.length,A=N,le=0,de=R,ke=!0,Le=!1,Be=void 0;try{for(var Re=_[Symbol.iterator](),xe;!(ke=(xe=Re.next()).done);ke=!0){var Je=xe.value;Je<128&&E.push(U(Je))}}catch(ka){Le=!0,Be=ka}finally{try{!ke&&Re.return&&Re.return()}finally{if(Le)throw Be}}var ve=E.length,Ue=ve;for(ve&&E.push(q);Ue<j;){var Ge=m,Ve=!0,lr=!1,Dt=void 0;try{for(var xt=_[Symbol.iterator](),Br;!(Ve=(Br=xt.next()).done);Ve=!0){var Sr=Br.value;Sr>=A&&Sr<Ge&&(Ge=Sr)}}catch(ka){lr=!0,Dt=ka}finally{try{!Ve&&xt.return&&xt.return()}finally{if(lr)throw Dt}}var $t=Ue+1;Ge-A>Q((m-le)/$t)&&L("overflow"),le+=(Ge-A)*$t,A=Ge;var Mt=!0,Rr=!1,Gt=void 0;try{for(var Ra=_[Symbol.iterator](),vd;!(Mt=(vd=Ra.next()).done);Mt=!0){var gd=vd.value;if(gd<A&&++le>m&&L("overflow"),gd==A){for(var Qs=le,Gs=p;;Gs+=p){var Ws=Gs<=de?h:Gs>=de+v?v:Gs-de;if(Qs<Ws)break;var yd=Qs-Ws,_d=p-Ws;E.push(U(x(Ws+yd%_d,0))),Qs=Q(yd/_d)}E.push(U(x(Qs,0))),de=k(le,$t,Ue==ve),le=0,++Ue}}}catch(ka){Rr=!0,Gt=ka}finally{try{!Mt&&Ra.return&&Ra.return()}finally{if(Rr)throw Gt}}++le,++A}return E.join("")},y=function(_){return $e(_,function(E){return J.test(E)?F(E.slice(4).toLowerCase()):E})},w=function(_){return $e(_,function(E){return K.test(E)?"xn--"+C(E):E})},D={version:"2.1.0",ucs2:{decode:he,encode:we},decode:F,encode:C,toASCII:w,toUnicode:y},G={};function Y(b){var _=b.charCodeAt(0),E=void 0;return _<16?E="%0"+_.toString(16).toUpperCase():_<128?E="%"+_.toString(16).toUpperCase():_<2048?E="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():E="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),E}function me(b){for(var _="",E=0,j=b.length;E<j;){var A=parseInt(b.substr(E+1,2),16);if(A<128)_+=String.fromCharCode(A),E+=3;else if(A>=194&&A<224){if(j-E>=6){var le=parseInt(b.substr(E+4,2),16);_+=String.fromCharCode((A&31)<<6|le&63)}else _+=b.substr(E,6);E+=6}else if(A>=224){if(j-E>=9){var de=parseInt(b.substr(E+4,2),16),ke=parseInt(b.substr(E+7,2),16);_+=String.fromCharCode((A&15)<<12|(de&63)<<6|ke&63)}else _+=b.substr(E,9);E+=9}else _+=b.substr(E,3),E+=3}return _}function ce(b,_){function E(j){var A=me(j);return A.match(_.UNRESERVED)?A:j}return b.scheme&&(b.scheme=String(b.scheme).replace(_.PCT_ENCODED,E).toLowerCase().replace(_.NOT_SCHEME,"")),b.userinfo!==void 0&&(b.userinfo=String(b.userinfo).replace(_.PCT_ENCODED,E).replace(_.NOT_USERINFO,Y).replace(_.PCT_ENCODED,o)),b.host!==void 0&&(b.host=String(b.host).replace(_.PCT_ENCODED,E).toLowerCase().replace(_.NOT_HOST,Y).replace(_.PCT_ENCODED,o)),b.path!==void 0&&(b.path=String(b.path).replace(_.PCT_ENCODED,E).replace(b.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,Y).replace(_.PCT_ENCODED,o)),b.query!==void 0&&(b.query=String(b.query).replace(_.PCT_ENCODED,E).replace(_.NOT_QUERY,Y).replace(_.PCT_ENCODED,o)),b.fragment!==void 0&&(b.fragment=String(b.fragment).replace(_.PCT_ENCODED,E).replace(_.NOT_FRAGMENT,Y).replace(_.PCT_ENCODED,o)),b}function S(b){return b.replace(/^0*(.*)/,"$1")||"0"}function I(b,_){var E=b.match(_.IPV4ADDRESS)||[],j=g(E,2),A=j[1];return A?A.split(".").map(S).join("."):b}function M(b,_){var E=b.match(_.IPV6ADDRESS)||[],j=g(E,3),A=j[1],le=j[2];if(A){for(var de=A.toLowerCase().split("::").reverse(),ke=g(de,2),Le=ke[0],Be=ke[1],Re=Be?Be.split(":").map(S):[],xe=Le.split(":").map(S),Je=_.IPV4ADDRESS.test(xe[xe.length-1]),ve=Je?7:8,Ue=xe.length-ve,Ge=Array(ve),Ve=0;Ve<ve;++Ve)Ge[Ve]=Re[Ve]||xe[Ue+Ve]||"";Je&&(Ge[ve-1]=I(Ge[ve-1],_));var lr=Ge.reduce(function($t,Mt,Rr){if(!Mt||Mt==="0"){var Gt=$t[$t.length-1];Gt&&Gt.index+Gt.length===Rr?Gt.length++:$t.push({index:Rr,length:1})}return $t},[]),Dt=lr.sort(function($t,Mt){return Mt.length-$t.length})[0],xt=void 0;if(Dt&&Dt.length>1){var Br=Ge.slice(0,Dt.index),Sr=Ge.slice(Dt.index+Dt.length);xt=Br.join(":")+"::"+Sr.join(":")}else xt=Ge.join(":");return le&&(xt+="%"+le),xt}else return b}var V=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,se="".match(/(){0}/)[1]===void 0;function ue(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},j=_.iri!==!1?f:u;_.reference==="suffix"&&(b=(_.scheme?_.scheme+":":"")+"//"+b);var A=b.match(V);if(A){se?(E.scheme=A[1],E.userinfo=A[3],E.host=A[4],E.port=parseInt(A[5],10),E.path=A[6]||"",E.query=A[7],E.fragment=A[8],isNaN(E.port)&&(E.port=A[5])):(E.scheme=A[1]||void 0,E.userinfo=b.indexOf("@")!==-1?A[3]:void 0,E.host=b.indexOf("//")!==-1?A[4]:void 0,E.port=parseInt(A[5],10),E.path=A[6]||"",E.query=b.indexOf("?")!==-1?A[7]:void 0,E.fragment=b.indexOf("#")!==-1?A[8]:void 0,isNaN(E.port)&&(E.port=b.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?A[4]:void 0)),E.host&&(E.host=M(I(E.host,j),j)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==E.reference&&(E.error=E.error||"URI is not a "+_.reference+" reference.");var le=G[(_.scheme||E.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!le||!le.unicodeSupport)){if(E.host&&(_.domainHost||le&&le.domainHost))try{E.host=D.toASCII(E.host.replace(j.PCT_ENCODED,me).toLowerCase())}catch(de){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+de}ce(E,u)}else ce(E,j);le&&le.parse&&le.parse(E,_)}else E.error=E.error||"URI can not be parsed.";return E}function qe(b,_){var E=_.iri!==!1?f:u,j=[];return b.userinfo!==void 0&&(j.push(b.userinfo),j.push("@")),b.host!==void 0&&j.push(M(I(String(b.host),E),E).replace(E.IPV6ADDRESS,function(A,le,de){return"["+le+(de?"%25"+de:"")+"]"})),(typeof b.port=="number"||typeof b.port=="string")&&(j.push(":"),j.push(String(b.port))),j.length?j.join(""):void 0}var et=/^\.\.?\//,Oe=/^\/\.(\/|$)/,ze=/^\/\.\.(\/|$)/,He=/^\/?(?:.|\n)*?(?=\/|$)/;function De(b){for(var _=[];b.length;)if(b.match(et))b=b.replace(et,"");else if(b.match(Oe))b=b.replace(Oe,"/");else if(b.match(ze))b=b.replace(ze,"/"),_.pop();else if(b==="."||b==="..")b="";else{var E=b.match(He);if(E){var j=E[0];b=b.slice(j.length),_.push(j)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function Ce(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=_.iri?f:u,j=[],A=G[(_.scheme||b.scheme||"").toLowerCase()];if(A&&A.serialize&&A.serialize(b,_),b.host&&!E.IPV6ADDRESS.test(b.host)){if(_.domainHost||A&&A.domainHost)try{b.host=_.iri?D.toUnicode(b.host):D.toASCII(b.host.replace(E.PCT_ENCODED,me).toLowerCase())}catch(ke){b.error=b.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+ke}}ce(b,E),_.reference!=="suffix"&&b.scheme&&(j.push(b.scheme),j.push(":"));var le=qe(b,_);if(le!==void 0&&(_.reference!=="suffix"&&j.push("//"),j.push(le),b.path&&b.path.charAt(0)!=="/"&&j.push("/")),b.path!==void 0){var de=b.path;!_.absolutePath&&(!A||!A.absolutePath)&&(de=De(de)),le===void 0&&(de=de.replace(/^\/\//,"/%2F")),j.push(de)}return b.query!==void 0&&(j.push("?"),j.push(b.query)),b.fragment!==void 0&&(j.push("#"),j.push(b.fragment)),j.join("")}function rt(b,_){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments[3],A={};return j||(b=ue(Ce(b,E),E),_=ue(Ce(_,E),E)),E=E||{},!E.tolerant&&_.scheme?(A.scheme=_.scheme,A.userinfo=_.userinfo,A.host=_.host,A.port=_.port,A.path=De(_.path||""),A.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(A.userinfo=_.userinfo,A.host=_.host,A.port=_.port,A.path=De(_.path||""),A.query=_.query):(_.path?(_.path.charAt(0)==="/"?A.path=De(_.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?A.path="/"+_.path:b.path?A.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+_.path:A.path=_.path,A.path=De(A.path)),A.query=_.query):(A.path=b.path,_.query!==void 0?A.query=_.query:A.query=b.query),A.userinfo=b.userinfo,A.host=b.host,A.port=b.port),A.scheme=b.scheme),A.fragment=_.fragment,A}function or(b,_,E){var j=l({scheme:"null"},E);return Ce(rt(ue(b,j),ue(_,j),j,!0),j)}function Qt(b,_){return typeof b=="string"?b=Ce(ue(b,_),_):n(b)==="object"&&(b=ue(Ce(b,_),_)),b}function Pr(b,_,E){return typeof b=="string"?b=Ce(ue(b,E),E):n(b)==="object"&&(b=Ce(b,E)),typeof _=="string"?_=Ce(ue(_,E),E):n(_)==="object"&&(_=Ce(_,E)),b===_}function Js(b,_){return b&&b.toString().replace(!_||!_.iri?u.ESCAPE:f.ESCAPE,Y)}function _t(b,_){return b&&b.toString().replace(!_||!_.iri?u.PCT_ENCODED:f.PCT_ENCODED,me)}var Er={scheme:"http",domainHost:!0,parse:function(_,E){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,E){var j=String(_.scheme).toLowerCase()==="https";return(_.port===(j?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},ld={scheme:"https",domainHost:Er.domainHost,parse:Er.parse,serialize:Er.serialize};function cd(b){return typeof b.secure=="boolean"?b.secure:String(b.scheme).toLowerCase()==="wss"}var Sa={scheme:"ws",domainHost:!0,parse:function(_,E){var j=_;return j.secure=cd(j),j.resourceName=(j.path||"/")+(j.query?"?"+j.query:""),j.path=void 0,j.query=void 0,j},serialize:function(_,E){if((_.port===(cd(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var j=_.resourceName.split("?"),A=g(j,2),le=A[0],de=A[1];_.path=le&&le!=="/"?le:void 0,_.query=de,_.resourceName=void 0}return _.fragment=void 0,_}},ud={scheme:"wss",domainHost:Sa.domainHost,parse:Sa.parse,serialize:Sa.serialize},c_={},dd="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",jt="[0-9A-Fa-f]",u_=r(r("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+r("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+r("%"+jt+jt)),d_="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",f_="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",h_=s(f_,'[\\"\\\\]'),p_="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",m_=new RegExp(dd,"g"),Kr=new RegExp(u_,"g"),v_=new RegExp(s("[^]",d_,"[\\.]",'[\\"]',h_),"g"),fd=new RegExp(s("[^]",dd,p_),"g"),g_=fd;function Mo(b){var _=me(b);return _.match(m_)?_:b}var hd={scheme:"mailto",parse:function(_,E){var j=_,A=j.to=j.path?j.path.split(","):[];if(j.path=void 0,j.query){for(var le=!1,de={},ke=j.query.split("&"),Le=0,Be=ke.length;Le<Be;++Le){var Re=ke[Le].split("=");switch(Re[0]){case"to":for(var xe=Re[1].split(","),Je=0,ve=xe.length;Je<ve;++Je)A.push(xe[Je]);break;case"subject":j.subject=_t(Re[1],E);break;case"body":j.body=_t(Re[1],E);break;default:le=!0,de[_t(Re[0],E)]=_t(Re[1],E);break}}le&&(j.headers=de)}j.query=void 0;for(var Ue=0,Ge=A.length;Ue<Ge;++Ue){var Ve=A[Ue].split("@");if(Ve[0]=_t(Ve[0]),E.unicodeSupport)Ve[1]=_t(Ve[1],E).toLowerCase();else try{Ve[1]=D.toASCII(_t(Ve[1],E).toLowerCase())}catch(lr){j.error=j.error||"Email address's domain name can not be converted to ASCII via punycode: "+lr}A[Ue]=Ve.join("@")}return j},serialize:function(_,E){var j=_,A=i(_.to);if(A){for(var le=0,de=A.length;le<de;++le){var ke=String(A[le]),Le=ke.lastIndexOf("@"),Be=ke.slice(0,Le).replace(Kr,Mo).replace(Kr,o).replace(v_,Y),Re=ke.slice(Le+1);try{Re=E.iri?D.toUnicode(Re):D.toASCII(_t(Re,E).toLowerCase())}catch(Ue){j.error=j.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Ue}A[le]=Be+"@"+Re}j.path=A.join(",")}var xe=_.headers=_.headers||{};_.subject&&(xe.subject=_.subject),_.body&&(xe.body=_.body);var Je=[];for(var ve in xe)xe[ve]!==c_[ve]&&Je.push(ve.replace(Kr,Mo).replace(Kr,o).replace(fd,Y)+"="+xe[ve].replace(Kr,Mo).replace(Kr,o).replace(g_,Y));return Je.length&&(j.query=Je.join("&")),j}},y_=/^([^\:]+)\:(.*)/,pd={scheme:"urn",parse:function(_,E){var j=_.path&&_.path.match(y_),A=_;if(j){var le=E.scheme||A.scheme||"urn",de=j[1].toLowerCase(),ke=j[2],Le=le+":"+(E.nid||de),Be=G[Le];A.nid=de,A.nss=ke,A.path=void 0,Be&&(A=Be.parse(A,E))}else A.error=A.error||"URN can not be parsed.";return A},serialize:function(_,E){var j=E.scheme||_.scheme||"urn",A=_.nid,le=j+":"+(E.nid||A),de=G[le];de&&(_=de.serialize(_,E));var ke=_,Le=_.nss;return ke.path=(A||E.nid)+":"+Le,ke}},__=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,md={scheme:"urn:uuid",parse:function(_,E){var j=_;return j.uuid=j.nss,j.nss=void 0,!E.tolerant&&(!j.uuid||!j.uuid.match(__))&&(j.error=j.error||"UUID is not valid."),j},serialize:function(_,E){var j=_;return j.nss=(_.uuid||"").toLowerCase(),j}};G[Er.scheme]=Er,G[ld.scheme]=ld,G[Sa.scheme]=Sa,G[ud.scheme]=ud,G[hd.scheme]=hd,G[pd.scheme]=pd,G[md.scheme]=md,a.SCHEMES=G,a.pctEncChar=Y,a.pctDecChars=me,a.parse=ue,a.removeDotSegments=De,a.serialize=Ce,a.resolveComponents=rt,a.resolve=or,a.normalize=Qt,a.equal=Pr,a.escapeComponent=Js,a.unescapeComponent=_t,Object.defineProperty(a,"__esModule",{value:!0})})})(zi,zi.exports);var xm=zi.exports,Mm=function(e){for(var a=0,s=e.length,r=0,n;r<s;)a++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return a},Fr={copy:Lm,checkDataType:Hi,checkDataTypes:Fm,coerceToTypes:qm,toHash:Zi,getProperty:Ki,escapeQuotes:Bi,equal:Xr,ucs2length:Mm,varOccurences:zm,varReplace:Hm,schemaHasRules:Zm,schemaHasRulesExcept:Km,schemaUnknownRules:Bm,toQuotedString:Ji,getPathExpr:Jm,getPath:Qm,getData:Xm,unescapeFragment:Ym,unescapeJsonPointer:Gi,escapeFragment:ev,escapeJsonPointer:Qi};function Lm(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function Hi(t,e,a,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(t){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+i+"("+e+" % 1)"+n+e+r+e+(a?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+t+'"'+(a?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+t+'"'}}function Fm(t,e,a){switch(t.length){case 1:return Hi(t[0],e,a,!0);default:var s="",r=Zi(t);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Hi(n,e,a,!0);return s}}var Vc=Zi(["string","number","integer","boolean","null"]);function qm(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(Vc[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(Vc[e])return[e];if(t==="array"&&e==="array")return["array"]}}function Zi(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var Um=/^[a-z$_][a-z$_0-9]*$/i,Vm=/'|\\/g;function Ki(t){return typeof t=="number"?"["+t+"]":Um.test(t)?"."+t:"['"+Bi(t)+"']"}function Bi(t){return t.replace(Vm,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function zm(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function Hm(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function Zm(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function Km(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function Bm(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function Ji(t){return"'"+Bi(t)+"'"}function Jm(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return zc(t,r)}function Qm(t,e,a){var s=Ji(a?"/"+Qi(e):Ki(e));return zc(t,s)}var Gm=/^\/(?:[^~]|~0|~1)*$/,Wm=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Xm(t,e,a){var s,r,n,o;if(t==="")return"rootData";if(t[0]=="/"){if(!Gm.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(o=t.match(Wm),!o)throw new Error("Invalid JSON-pointer: "+t);if(s=+o[1],r=o[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return a[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var i=n,l=r.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(n+=Ki(Gi(u)),i+=" && "+n)}return i}function zc(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Ym(t){return Gi(decodeURIComponent(t))}function ev(t){return encodeURIComponent(Qi(t))}function Qi(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Gi(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var tv=Fr,Hc=rv;function rv(t){tv.copy(t,this)}var Zc={exports:{}},ar=Zc.exports=function(t,e,a){typeof e=="function"&&(a=e,e={}),a=e.cb||a;var s=typeof a=="function"?a:a.pre||function(){},r=a.post||function(){};Ps(e,s,r,t,"",t)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},ar.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},ar.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};function Ps(t,e,a,s,r,n,o,i,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,l,c);for(var u in s){var f=s[u];if(Array.isArray(f)){if(u in ar.arrayKeywords)for(var g=0;g<f.length;g++)Ps(t,e,a,f[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in ar.propsKeywords){if(f&&typeof f=="object")for(var d in f)Ps(t,e,a,f[d],r+"/"+u+"/"+av(d),n,r,u,s,d)}else(u in ar.keywords||t.allKeys&&!(u in ar.skipKeywords))&&Ps(t,e,a,f,r+"/"+u,n,r,u,s)}a(s,r,n,o,i,l,c)}}function av(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var sv=Zc.exports,$a=xm,Kc=Xr,Es=Fr,Ss=Hc,nv=sv,Wi=sr;sr.normalizeId=nr,sr.fullPath=ks,sr.url=Ts,sr.ids=uv,sr.inlineRef=Xi,sr.schema=Rs;function sr(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return sr.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof Ss)return Xi(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Rs.call(this,e,a),n,o,i;return r&&(n=r.schema,e=r.root,i=r.baseId),n instanceof Ss?o=n.validate||t.call(this,n.schema,e,void 0,i):n!==void 0&&(o=Xi(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,i)),o}function Rs(t,e){var a=$a.parse(e),s=Jc(a),r=ks(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=nr(s),o=this._refs[n];if(typeof o=="string")return iv.call(this,t,o,a);if(o instanceof Ss)o.validate||this._compile(o),t=o;else if(o=this._schemas[n],o instanceof Ss){if(o.validate||this._compile(o),n==nr(e))return{schema:o,root:t,baseId:r};t=o}else return;if(!t.schema)return;r=ks(this._getId(t.schema))}return Bc.call(this,a,r,t.schema,t)}function iv(t,e,a){var s=Rs.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var o=this._getId(r);return o&&(n=Ts(n,o)),Bc.call(this,a,n,r,t)}}var ov=Es.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Bc(t,e,a,s){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var r=t.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Es.unescapeFragment(o),a=a[o],a===void 0)break;var i;if(!ov[o]&&(i=this._getId(a),i&&(e=Ts(e,i)),a.$ref)){var l=Ts(e,a.$ref),c=Rs.call(this,s,l);c&&(a=c.schema,s=c.root,e=c.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var lv=Es.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Xi(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return Yi(t);if(e)return eo(t)<=e}function Yi(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!Yi(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!Yi(e)))return!1;return!0}function eo(t){var e=0,a;if(Array.isArray(t)){for(var s=0;s<t.length;s++)if(a=t[s],typeof a=="object"&&(e+=eo(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(lv[r])e++;else if(a=t[r],typeof a=="object"&&(e+=eo(a)+1),e==1/0)return 1/0}return e}function ks(t,e){e!==!1&&(t=nr(t));var a=$a.parse(t);return Jc(a)}function Jc(t){return $a.serialize(t).split("#")[0]+"#"}var cv=/#\/?$/;function nr(t){return t?t.replace(cv,""):""}function Ts(t,e){return e=nr(e),$a.resolve(t,e)}function uv(t){var e=nr(this._getId(t)),a={"":e},s={"":ks(e,!1)},r={},n=this;return nv(t,{allKeys:!0},function(o,i,l,c,u,f,g){if(i!==""){var d=n._getId(o),m=a[c],p=s[c]+"/"+u;if(g!==void 0&&(p+="/"+(typeof g=="number"?g:Es.escapeFragment(g))),typeof d=="string"){d=m=nr(m?$a.resolve(m,d):d);var h=n._refs[d];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!Kc(o,h.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=nr(p))if(d[0]=="#"){if(r[d]&&!Kc(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=p}a[i]=m,s[i]=p}}),r}var to=Wi,ro={Validation:Qc(dv),MissingRef:Qc(ao)};function dv(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}ao.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function ao(t,e,a){this.message=a||ao.message(t,e),this.missingRef=to.url(t,e),this.missingSchema=to.normalizeId(to.fullPath(this.missingRef))}function Qc(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Gc=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var a=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(o){return function(i,l){var c={key:i,value:o[i]},u={key:l,value:o[l]};return n(c,u)}}}(e.cmp),r=[];return function n(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,l;if(Array.isArray(o)){for(l="[",i=0;i<o.length;i++)i&&(l+=","),l+=n(o[i])||"null";return l+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,u=Object.keys(o).sort(s&&s(o));for(l="",i=0;i<u.length;i++){var f=u[i],g=n(o[f]);g&&(l&&(l+=","),l+=JSON.stringify(f)+":"+g)}return r.splice(c,1),"{"+l+"}"}}(t)},Wc=function(e,a,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var a="false schema",u=e.level,f=e.dataLevel,g=e.schema[a],d=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,N=!e.opts.allErrors,K,p="data"+(f||""),R="valid"+u;if(e.schema===!1){e.isTop?N=!0:r+=" var "+R+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(K||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&N?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+R+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,u=e.level=0,f=e.dataLevel=0,p="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,f=e.dataLevel,p="data"+(f||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+u+" = errors;"}var R="valid"+u,N=!e.opts.allErrors,q="",J="",K,B=e.schema.type,te=Array.isArray(B);if(B&&e.opts.nullable&&e.schema.nullable===!0&&(te?B.indexOf("null")==-1&&(B=B.concat("null")):B!="null"&&(B=[B,"null"],te=!0)),te&&B.length==1&&(B=B[0],te=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),B){if(e.opts.coerceTypes)var re=e.util.coerceToTypes(e.opts.coerceTypes,B);var Q=e.RULES.types[B];if(re||te||Q===!0||Q&&!Oe(Q)){var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",d=e.schemaPath+".type",m=e.errSchemaPath+"/type",U=te?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[U](B,p,e.opts.strictNumbers,!0)+") { ",re){var L="dataType"+u,ne="coerced"+u;r+=" var "+L+" = typeof "+p+"; var "+ne+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+L+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+L+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+ne+" = "+p+"; } "),r+=" if ("+ne+" !== undefined) ; ";var $e=re;if($e)for(var he,we=-1,pe=$e.length-1;we<pe;)he=$e[we+=1],he=="string"?r+=" else if ("+L+" == 'number' || "+L+" == 'boolean') "+ne+" = '' + "+p+"; else if ("+p+" === null) "+ne+" = ''; ":he=="number"||he=="integer"?(r+=" else if ("+L+" == 'boolean' || "+p+" === null || ("+L+" == 'string' && "+p+" && "+p+" == +"+p+" ",he=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+ne+" = +"+p+"; "):he=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+ne+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+ne+" = true; ":he=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+ne+" = null; ":e.opts.coerceTypes=="array"&&he=="array"&&(r+=" else if ("+L+" == 'string' || "+L+" == 'number' || "+L+" == 'boolean' || "+p+" == null) "+ne+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(K||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",te?r+=""+B.join(","):r+=""+B,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",te?r+=""+B.join(","):r+=""+B,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&N?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+ne+" !== undefined) { ";var x=f?"data"+(f-1||""):"parentData",k=f?e.dataPathArr[f]:"parentDataProperty";r+=" "+p+" = "+ne+"; ",f||(r+="if ("+x+" !== undefined)"),r+=" "+x+"["+k+"] = "+ne+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(K||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",te?r+=""+B.join(","):r+=""+B,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",te?r+=""+B.join(","):r+=""+B,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&N?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",N&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",J+="}");else{var F=e.RULES;if(F){for(var Q,C=-1,y=F.length-1;C<y;)if(Q=F[C+=1],Oe(Q)){if(Q.type&&(r+=" if ("+e.util.checkDataType(Q.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(Q.type=="object"&&e.schema.properties){var g=e.schema.properties,w=Object.keys(g),D=w;if(D)for(var G,Y=-1,me=D.length-1;Y<me;){G=D[Y+=1];var ce=g[G];if(ce.default!==void 0){var S=p+e.util.getProperty(G);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+S;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+S+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+S+" === null || "+S+" === '' "),r+=" ) "+S+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ce.default)+" ":r+=" "+JSON.stringify(ce.default)+" ",r+="; "}}}else if(Q.type=="array"&&Array.isArray(e.schema.items)){var I=e.schema.items;if(I){for(var ce,we=-1,M=I.length-1;we<M;)if(ce=I[we+=1],ce.default!==void 0){var S=p+"["+we+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+S;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+S+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+S+" === null || "+S+" === '' "),r+=" ) "+S+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ce.default)+" ":r+=" "+JSON.stringify(ce.default)+" ",r+="; "}}}}var V=Q.rules;if(V){for(var se,ue=-1,qe=V.length-1;ue<qe;)if(se=V[ue+=1],ze(se)){var et=se.code(e,se.keyword,Q.type);et&&(r+=" "+et+" ",N&&(q+="}"))}}if(N&&(r+=" "+q+" ",q=""),Q.type&&(r+=" } ",B&&B===Q.type&&!re)){r+=" else { ";var d=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(K||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",te?r+=""+B.join(","):r+=""+B,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",te?r+=""+B.join(","):r+=""+B,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&N?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}N&&(r+=" if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",J+="}")}}}N&&(r+=" "+J+" "),$?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+R+" = errors === errs_"+u+";";function Oe(De){for(var Ce=De.rules,rt=0;rt<Ce.length;rt++)if(ze(Ce[rt]))return!0}function ze(De){return e.schema[De.keyword]!==void 0||De.implements&&He(De)}function He(De){for(var Ce=De.implements,rt=0;rt<Ce.length;rt++)if(e.schema[Ce[rt]]!==void 0)return!0}return r},Os=Wi,Cs=Fr,Xc=ro,fv=Gc,Yc=Wc,hv=Cs.ucs2length,pv=Xr,mv=Xc.Validation,vv=so;function so(t,e,a,s){var r=this,n=this._opts,o=[void 0],i={},l=[],c={},u=[],f={},g=[];e=e||{schema:t,refVal:o,refs:i};var d=gv.call(this,t,e,s),m=this._compilations[d.index];if(d.compiling)return m.callValidate=P;var p=this._formats,h=this.RULES;try{var v=R(t,e,a,s);m.validate=v;var $=m.callValidate;return $&&($.schema=v.schema,$.errors=null,$.refs=v.refs,$.refVal=v.refVal,$.root=v.root,$.$async=v.$async,n.sourceCode&&($.source=v.source)),v}finally{yv.call(this,t,e,s)}function P(){var U=m.validate,L=U.apply(this,arguments);return P.errors=U.errors,L}function R(U,L,ne,$e){var he=!L||L&&L.schema==U;if(L.schema!=e.schema)return so.call(r,U,L,ne,$e);var we=U.$async===!0,pe=Yc({isTop:!0,schema:U,isRoot:he,baseId:$e,root:L,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Xc.MissingRef,RULES:h,validate:Yc,util:Cs,resolve:Os,resolveRef:N,usePattern:te,useDefault:re,useCustomRule:Q,opts:n,formats:p,logger:r.logger,self:r});pe=Is(o,wv)+Is(l,_v)+Is(u,$v)+Is(g,bv)+pe,n.processCode&&(pe=n.processCode(pe,U));var x;try{var k=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",pe);x=k(r,h,p,e,o,u,g,pv,hv,mv),o[0]=x}catch(F){throw r.logger.error("Error compiling schema, function code:",pe),F}return x.schema=U,x.errors=null,x.refs=i,x.refVal=o,x.root=he?x:L,we&&(x.$async=!0),n.sourceCode===!0&&(x.source={code:pe,patterns:l,defaults:u}),x}function N(U,L,ne){L=Os.url(U,L);var $e=i[L],he,we;if($e!==void 0)return he=o[$e],we="refVal["+$e+"]",B(he,we);if(!ne&&e.refs){var pe=e.refs[L];if(pe!==void 0)return he=e.refVal[pe],we=q(L,he),B(he,we)}we=q(L);var x=Os.call(r,R,e,L);if(x===void 0){var k=a&&a[L];k&&(x=Os.inlineRef(k,n.inlineRefs)?k:so.call(r,k,e,a,U))}if(x===void 0)J(L);else return K(L,x),B(x,we)}function q(U,L){var ne=o.length;return o[ne]=L,i[U]=ne,"refVal"+ne}function J(U){delete i[U]}function K(U,L){var ne=i[U];o[ne]=L}function B(U,L){return typeof U=="object"||typeof U=="boolean"?{code:L,schema:U,inline:!0}:{code:L,$async:U&&!!U.$async}}function te(U){var L=c[U];return L===void 0&&(L=c[U]=l.length,l[L]=U),"pattern"+L}function re(U){switch(typeof U){case"boolean":case"number":return""+U;case"string":return Cs.toQuotedString(U);case"object":if(U===null)return"null";var L=fv(U),ne=f[L];return ne===void 0&&(ne=f[L]=u.length,u[ne]=U),"default"+ne}}function Q(U,L,ne,$e){if(r._opts.validateSchema!==!1){var he=U.definition.dependencies;if(he&&!he.every(function(D){return Object.prototype.hasOwnProperty.call(ne,D)}))throw new Error("parent schema must have all required keywords: "+he.join(","));var we=U.definition.validateSchema;if(we){var pe=we(L);if(!pe){var x="keyword schema is invalid: "+r.errorsText(we.errors);if(r._opts.validateSchema=="log")r.logger.error(x);else throw new Error(x)}}}var k=U.definition.compile,F=U.definition.inline,C=U.definition.macro,y;if(k)y=k.call(r,L,ne,$e);else if(C)y=C.call(r,L,ne,$e),n.validateSchema!==!1&&r.validateSchema(y,!0);else if(F)y=F.call(r,$e,U.keyword,L,ne);else if(y=U.definition.validate,!y)return;if(y===void 0)throw new Error('custom keyword "'+U.keyword+'"failed to compile');var w=g.length;return g[w]=y,{code:"customRule"+w,validate:y}}}function gv(t,e,a){var s=eu.call(this,t,e,a);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:t,root:e,baseId:a},{index:s,compiling:!1})}function yv(t,e,a){var s=eu.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function eu(t,e,a){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==t&&r.root==e&&r.baseId==a)return s}return-1}function _v(t,e){return"var pattern"+t+" = new RegExp("+Cs.toQuotedString(e[t])+");"}function $v(t){return"var default"+t+" = defaults["+t+"];"}function wv(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function bv(t){return"var customRule"+t+" = customRules["+t+"];"}function Is(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var tu={exports:{}},Ns=tu.exports=function(){this._cache={}};Ns.prototype.put=function(e,a){this._cache[e]=a},Ns.prototype.get=function(e){return this._cache[e]},Ns.prototype.del=function(e){delete this._cache[e]},Ns.prototype.clear=function(){this._cache={}};var Pv=tu.exports,Ev=Fr,Sv=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Rv=[0,31,28,31,30,31,30,31,31,30,31,30,31],kv=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ru=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Tv=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Ov=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,au=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,su=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,nu=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,iu=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ou=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,lu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Cv=As;function As(t){return t=t=="full"?"full":"fast",Ev.copy(As[t])}As.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":au,url:su,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:ru,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:du,uuid:nu,"json-pointer":iu,"json-pointer-uri-fragment":ou,"relative-json-pointer":lu},As.full={date:cu,time:uu,"date-time":Av,uri:Dv,"uri-reference":Ov,"uri-template":au,url:su,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:ru,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:du,uuid:nu,"json-pointer":iu,"json-pointer-uri-fragment":ou,"relative-json-pointer":lu};function Iv(t){return t%4===0&&(t%100!==0||t%400===0)}function cu(t){var e=t.match(Sv);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Iv(a)?29:Rv[s])}function uu(t,e){var a=t.match(kv);if(!a)return!1;var s=a[1],r=a[2],n=a[3],o=a[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var Nv=/t|\s/i;function Av(t){var e=t.split(Nv);return e.length==2&&cu(e[0])&&uu(e[1],!0)}var jv=/\/|:/;function Dv(t){return jv.test(t)&&Tv.test(t)}var xv=/[^\\]\\Z/;function du(t){if(xv.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var Mv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,u="data"+(o||""),f="valid"+n,g,d;if(i=="#"||i=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var m=e.resolveRef(e.baseId,i,e.isRoot);if(m===void 0){var p=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(p);var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,p)}else if(m.inline){var $=e.util.copy(e);$.level++;var P="valid"+$.level;$.schema=m.schema,$.schemaPath="",$.errSchemaPath=i;var R=e.validate($).replace(/validate\.schema/g,m.code);r+=" "+R+" ",c&&(r+=" if ("+P+") { ")}else g=m.$async===!0||e.async&&m.$async!==!1,d=m.code}if(d){var h=h||[];h.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var N=o?"data"+(o-1||""):"parentData",q=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+N+" , "+q+", rootData) ";var J=r;if(r=h.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+f+"; "),r+=" try { await "+J+"; ",c&&(r+=" "+f+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+f+" = false; "),r+=" } ",c&&(r+=" if ("+f+") { ")}else r+=" if (!"+J+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r},Lv=function(e,a,s){var r=" ",n=e.schema[a],o=e.schemaPath+e.util.getProperty(a),i=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var f="valid"+c.level,g=c.baseId,d=!0,m=n;if(m)for(var p,h=-1,v=m.length-1;h<v;)p=m[h+=1],(e.opts.strictKeywords?typeof p=="object"&&Object.keys(p).length>0||p===!1:e.util.schemaHasRules(p,e.RULES.all))&&(d=!1,c.schema=p,c.schemaPath=o+"["+h+"]",c.errSchemaPath=i+"/"+h,r+=" "+e.validate(c)+" ",c.baseId=g,l&&(r+=" if ("+f+") { ",u+="}"));return l&&(d?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},Fv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=i.every(function(K){return e.opts.strictKeywords?typeof K=="object"&&Object.keys(K).length>0||K===!1:e.util.schemaHasRules(K,e.RULES.all)});if(v){var $=m.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=m.compositeRule=!0;var R=i;if(R)for(var N,q=-1,J=R.length-1;q<J;)N=R[q+=1],m.schema=N,m.schemaPath=l+"["+q+"]",m.errSchemaPath=c+"/"+q,r+=" "+e.validate(m)+" ",m.baseId=$,r+=" "+g+" = "+g+" || "+h+"; if (!"+g+") { ",p+="}";e.compositeRule=m.compositeRule=P,r+=" "+p+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else u&&(r+=" if (true) { ");return r},qv=function(e,a,s){var r=" ",n=e.schema[a],o=e.errSchemaPath+"/"+a;e.opts.allErrors;var i=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+i+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+i+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r},Uv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),d||(r+=" var schema"+n+" = validate.schema"+l+";"),r+="var "+g+" = equal("+f+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},Vv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,P="data"+$,R=e.baseId,N=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",N){var q=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+h+" = false; for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var J=f+"["+v+"]";m.dataPathArr[$]=v;var K=e.validate(m);m.baseId=R,e.util.varOccurences(K,P)<2?r+=" "+e.util.varReplace(K,P,J)+" ":r+=" var "+P+" = "+J+"; "+K+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=q,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+f+".length == 0) {";var B=B||[];B.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var te=r;return r=B.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+te+"]); ":r+=" validate.errors = ["+te+"]; return false; ":r+=" var err = "+te+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",N&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},zv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h={},v={},$=e.opts.ownProperties;for(q in i)if(q!="__proto__"){var P=i[q],R=Array.isArray(P)?v:h;R[q]=P}r+="var "+g+" = errors;";var N=e.errorPath;r+="var missing"+n+";";for(var q in v)if(R=v[q],R.length){if(r+=" if ( "+f+e.util.getProperty(q)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),u){r+=" && ( ";var J=R;if(J)for(var K,B=-1,te=J.length-1;B<te;){K=J[B+=1],B&&(r+=" || ");var re=e.util.getProperty(K),Q=f+re;r+=" ( ( "+Q+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(K)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?K:re)+") ) "}r+=")) { ";var U="missing"+n,L="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(N,U,!0):N+" + "+U);var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+L+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",R.length==1?r+="property "+e.util.escapeQuotes(R[0]):r+="properties "+e.util.escapeQuotes(R.join(", ")),r+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var $e=r;r=ne.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+$e+"]); ":r+=" validate.errors = ["+$e+"]; return false; ":r+=" var err = "+$e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var he=R;if(he)for(var K,we=-1,pe=he.length-1;we<pe;){K=he[we+=1];var re=e.util.getProperty(K),L=e.util.escapeQuotes(K),Q=f+re;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,K,e.opts.jsonPointers)),r+=" if ( "+Q+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(K)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(q)+"', missingProperty: '"+L+"', depsCount: "+R.length+", deps: '"+e.util.escapeQuotes(R.length==1?R[0]:R.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",R.length==1?r+="property "+e.util.escapeQuotes(R[0]):r+="properties "+e.util.escapeQuotes(R.join(", ")),r+=" when property "+e.util.escapeQuotes(q)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",u&&(m+="}",r+=" else { ")}e.errorPath=N;var x=d.baseId;for(var q in h){var P=h[q];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+p+" = true; if ( "+f+e.util.getProperty(q)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),r+=") { ",d.schema=P,d.schemaPath=l+e.util.getProperty(q),d.errSchemaPath=c+"/"+e.util.escapeFragment(q),r+=" "+e.validate(d)+" ",d.baseId=x,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},Hv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var m="i"+n,p="schema"+n;d||(r+=" var "+p+" = validate.schema"+l+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+f+", "+p+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},Zv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=e.opts.unknownFormats,p=Array.isArray(m);if(g){var h="format"+n,v="isObject"+n,$="formatType"+n;r+=" var "+h+" = formats["+d+"]; var "+v+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+$+" = "+v+" && "+h+".type || 'string'; if ("+v+") { ",e.async&&(r+=" var async"+n+" = "+h+".async; "),r+=" "+h+" = "+h+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+d+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+h+" && "+$+" == '"+s+"' && !(typeof "+h+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+h+"("+f+") : "+h+"("+f+")) ":r+=" "+h+"("+f+") ",r+=" : "+h+".test("+f+"))))) {"}else{var h=e.formats[i];if(!h){if(m=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(r+=" if (true) { "),r;if(p&&m.indexOf(i)>=0)return u&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof h=="object"&&!(h instanceof RegExp)&&h.validate,$=v&&h.type||"string";if(v){var P=h.async===!0;h=h.validate}if($!=s)return u&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+R+"("+f+"))) { "}else{r+=" if (! ";var R="formats"+e.util.getProperty(i);v&&(R+=".validate"),typeof h=="function"?r+=" "+R+"("+f+") ":r+=" "+R+".test("+f+") ",r+=") { "}}var N=N||[];N.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var q=r;return r=N.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},Kv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e);m.level++;var p="valid"+m.level,h=e.schema.then,v=e.schema.else,$=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),P=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),R=m.baseId;if($||P){var N;m.createErrors=!1,m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var q=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=R,m.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=q,$?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=R,r+=" "+g+" = "+p+"; ",$&&P?(N="ifClause"+n,r+=" var "+N+" = 'then'; "):N="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+p+") { ",P&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=R,r+=" "+g+" = "+p+"; ",$&&P?(N="ifClause"+n,r+=" var "+N+" = 'else'; "):N="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+N+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+N+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},Bv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,P="data"+$,R=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(i)){var N=e.schema.additionalItems;if(N===!1){r+=" "+g+" = "+f+".length <= "+i.length+"; ";var q=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var K=r;r=J.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+K+"]); ":r+=" validate.errors = ["+K+"]; return false; ":r+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=q,u&&(p+="}",r+=" else { ")}var B=i;if(B){for(var te,re=-1,Q=B.length-1;re<Q;)if(te=B[re+=1],e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){r+=" "+h+" = true; if ("+f+".length > "+re+") { ";var U=f+"["+re+"]";m.schema=te,m.schemaPath=l+"["+re+"]",m.errSchemaPath=c+"/"+re,m.errorPath=e.util.getPathExpr(e.errorPath,re,e.opts.jsonPointers,!0),m.dataPathArr[$]=re;var L=e.validate(m);m.baseId=R,e.util.varOccurences(L,P)<2?r+=" "+e.util.varReplace(L,P,U)+" ":r+=" var "+P+" = "+U+"; "+L+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof N=="object"&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))){m.schema=N,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+h+" = true; if ("+f+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var U=f+"["+v+"]";m.dataPathArr[$]=v;var L=e.validate(m);m.baseId=R,e.util.varOccurences(L,P)<2?r+=" "+e.util.varReplace(L,P,U)+" ":r+=" var "+P+" = "+U+"; "+L+" ",u&&(r+=" if (!"+h+") break; "),r+=" } } ",u&&(r+=" if ("+h+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){m.schema=i,m.schemaPath=l,m.errSchemaPath=c,r+=" for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var U=f+"["+v+"]";m.dataPathArr[$]=v;var L=e.validate(m);m.baseId=R,e.util.varOccurences(L,P)<2?r+=" "+e.util.varReplace(L,P,U)+" ":r+=" var "+P+" = "+U+"; "+L+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+d+" == errors) {"),r},fu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,R,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=a=="maximum",p=m?"exclusiveMaximum":"exclusiveMinimum",h=e.schema[p],v=e.opts.$data&&h&&h.$data,$=m?"<":">",P=m?">":"<",R=void 0;if(!(g||typeof i=="number"||i===void 0))throw new Error(a+" must be number");if(!(v||h===void 0||typeof h=="number"||typeof h=="boolean"))throw new Error(p+" must be number or boolean");if(v){var N=e.util.getData(h.$data,o,e.dataPathArr),q="exclusive"+n,J="exclType"+n,K="exclIsNumber"+n,B="op"+n,te="' + "+B+" + '";r+=" var schemaExcl"+n+" = "+N+"; ",N="schemaExcl"+n,r+=" var "+q+"; var "+J+" = typeof "+N+"; if ("+J+" != 'boolean' && "+J+" != 'undefined' && "+J+" != 'number') { ";var R=p,re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=re.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+J+" == 'number' ? ( ("+q+" = "+d+" === undefined || "+N+" "+$+"= "+d+") ? "+f+" "+P+"= "+N+" : "+f+" "+P+" "+d+" ) : ( ("+q+" = "+N+" === true) ? "+f+" "+P+"= "+d+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { var op"+n+" = "+q+" ? '"+$+"' : '"+$+"='; ",i===void 0&&(R=p,c=e.errSchemaPath+"/"+p,d=N,g=v)}else{var K=typeof h=="number",te=$;if(K&&g){var B="'"+te+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+h+" "+$+"= "+d+" ? "+f+" "+P+"= "+h+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { "}else{K&&i===void 0?(q=!0,R=p,c=e.errSchemaPath+"/"+p,d=h,P+="="):(K&&(d=Math[m?"min":"max"](h,i)),h===(K?d:!0)?(q=!0,R=p,c=e.errSchemaPath+"/"+p,P+="="):(q=!1,te+="="));var B="'"+te+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+" "+P+" "+d+" || "+f+" !== "+f+") { "}}R=R||a;var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+B+", limit: "+d+", exclusive: "+q+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+te+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;return r=re.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},hu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+".length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},pu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+f+".length ":r+=" ucs2length("+f+") ",r+=" "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},mu=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+f+").length "+m+" "+d+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Jv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+f+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var p=r;return r=m.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Qv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var m="valid"+d.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=l,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var h;d.opts.allErrors&&(h=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,h&&(d.opts.allErrors=h),e.compositeRule=d.compositeRule=p,r+=" if ("+m+") { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var $=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},Gv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,$="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+$+" = false , "+g+" = false , "+P+" = null; ";var R=e.compositeRule;e.compositeRule=m.compositeRule=!0;var N=i;if(N)for(var q,J=-1,K=N.length-1;J<K;)q=N[J+=1],(e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all))?(m.schema=q,m.schemaPath=l+"["+J+"]",m.errSchemaPath=c+"/"+J,r+=" "+e.validate(m)+" ",m.baseId=v):r+=" var "+h+" = true; ",J&&(r+=" if ("+h+" && "+$+") { "+g+" = false; "+P+" = ["+P+", "+J+"]; } else { ",p+="}"),r+=" if ("+h+") { "+g+" = "+$+" = true; "+P+" = "+J+"; }";return e.compositeRule=m.compositeRule=R,r+=""+p+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r},Wv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var m=g?"(new RegExp("+d+"))":e.usePattern(i);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+m+".test("+f+") ) { ";var p=p||[];p.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var h=r;return r=p.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+h+"]); ":r+=" validate.errors = ["+h+"]; return false; ":r+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Xv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level,h="key"+n,v="idx"+n,$=d.dataLevel=e.dataLevel+1,P="data"+$,R="dataProperties"+n,N=Object.keys(i||{}).filter(we),q=e.schema.patternProperties||{},J=Object.keys(q).filter(we),K=e.schema.additionalProperties,B=N.length||J.length,te=K===!1,re=typeof K=="object"&&Object.keys(K).length,Q=e.opts.removeAdditional,U=te||re||Q,L=e.opts.ownProperties,ne=e.baseId,$e=e.schema.required;if($e&&!(e.opts.$data&&$e.$data)&&$e.length<e.opts.loopRequired)var he=e.util.toHash($e);function we(Pr){return Pr!=="__proto__"}if(r+="var "+g+" = errors;var "+p+" = true;",L&&(r+=" var "+R+" = undefined;"),U){if(L?r+=" "+R+" = "+R+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+R+".length; "+v+"++) { var "+h+" = "+R+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",B){if(r+=" var isAdditional"+n+" = !(false ",N.length)if(N.length>8)r+=" || validate.schema"+l+".hasOwnProperty("+h+") ";else{var pe=N;if(pe)for(var x,k=-1,F=pe.length-1;k<F;)x=pe[k+=1],r+=" || "+h+" == "+e.util.toQuotedString(x)+" "}if(J.length){var C=J;if(C)for(var y,w=-1,D=C.length-1;w<D;)y=C[w+=1],r+=" || "+e.usePattern(y)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(Q=="all")r+=" delete "+f+"["+h+"]; ";else{var G=e.errorPath,Y="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),te)if(Q)r+=" delete "+f+"["+h+"]; ";else{r+=" "+p+" = false; ";var me=c;c=e.errSchemaPath+"/additionalProperties";var ce=ce||[];ce.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Y+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=ce.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=me,u&&(r+=" break; ")}else if(re)if(Q=="failing"){r+=" var "+g+" = errors; ";var I=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=K,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var M=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,P)<2?r+=" "+e.util.varReplace(V,P,M)+" ":r+=" var "+P+" = "+M+"; "+V+" ",r+=" if (!"+p+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+h+"]; } ",e.compositeRule=d.compositeRule=I}else{d.schema=K,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var M=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,P)<2?r+=" "+e.util.varReplace(V,P,M)+" ":r+=" var "+P+" = "+M+"; "+V+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=G}B&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var se=e.opts.useDefaults&&!e.compositeRule;if(N.length){var ue=N;if(ue)for(var x,qe=-1,et=ue.length-1;qe<et;){x=ue[qe+=1];var Oe=i[x];if(e.opts.strictKeywords?typeof Oe=="object"&&Object.keys(Oe).length>0||Oe===!1:e.util.schemaHasRules(Oe,e.RULES.all)){var ze=e.util.getProperty(x),M=f+ze,He=se&&Oe.default!==void 0;d.schema=Oe,d.schemaPath=l+ze,d.errSchemaPath=c+"/"+e.util.escapeFragment(x),d.errorPath=e.util.getPath(e.errorPath,x,e.opts.jsonPointers),d.dataPathArr[$]=e.util.toQuotedString(x);var V=e.validate(d);if(d.baseId=ne,e.util.varOccurences(V,P)<2){V=e.util.varReplace(V,P,M);var De=M}else{var De=P;r+=" var "+P+" = "+M+"; "}if(He)r+=" "+V+" ";else{if(he&&he[x]){r+=" if ( "+De+" === undefined ",L&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(x)+"') "),r+=") { "+p+" = false; ";var G=e.errorPath,me=c,Ce=e.util.escapeQuotes(x);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(G,x,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var ce=ce||[];ce.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ce+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Ce+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=ce.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=me,e.errorPath=G,r+=" } else { "}else u?(r+=" if ( "+De+" === undefined ",L&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(x)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+De+" !== undefined ",L&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(x)+"') "),r+=" ) { ");r+=" "+V+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(J.length){var rt=J;if(rt)for(var y,or=-1,Qt=rt.length-1;or<Qt;){y=rt[or+=1];var Oe=q[y];if(e.opts.strictKeywords?typeof Oe=="object"&&Object.keys(Oe).length>0||Oe===!1:e.util.schemaHasRules(Oe,e.RULES.all)){d.schema=Oe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(y),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(y),L?r+=" "+R+" = "+R+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+R+".length; "+v+"++) { var "+h+" = "+R+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" if ("+e.usePattern(y)+".test("+h+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var M=f+"["+h+"]";d.dataPathArr[$]=h;var V=e.validate(d);d.baseId=ne,e.util.varOccurences(V,P)<2?r+=" "+e.util.varReplace(V,P,M)+" ":r+=" var "+P+" = "+M+"; "+V+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},Yv=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="errs__"+n,d=e.util.copy(e),m="";d.level++;var p="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=l,d.errSchemaPath=c;var h="key"+n,v="idx"+n,$="i"+n,P="' + "+h+" + '",R=d.dataLevel=e.dataLevel+1,N="data"+R,q="dataProperties"+n,J=e.opts.ownProperties,K=e.baseId;J&&(r+=" var "+q+" = undefined; "),J?r+=" "+q+" = "+q+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+q+".length; "+v+"++) { var "+h+" = "+q+"["+v+"]; ":r+=" for (var "+h+" in "+f+") { ",r+=" var startErrs"+n+" = errors; ";var B=h,te=e.compositeRule;e.compositeRule=d.compositeRule=!0;var re=e.validate(d);d.baseId=K,e.util.varOccurences(re,N)<2?r+=" "+e.util.varReplace(re,N,B)+" ":r+=" var "+N+" = "+B+"; "+re+" ",e.compositeRule=d.compositeRule=te,r+=" if (!"+p+") { for (var "+$+"=startErrs"+n+"; "+$+"<errors; "+$+"++) { vErrors["+$+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),u&&(r+=" break; "),r+=" } }"}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},eg=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data;d&&(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var m="schema"+n;if(!d)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],h=i;if(h)for(var v,$=-1,P=h.length-1;$<P;){v=h[$+=1];var R=e.schema.properties[v];R&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))||(p[p.length]=v)}}else var p=i;if(d||p.length){var N=e.errorPath,q=d||p.length>=e.opts.loopRequired,J=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",q){d||(r+=" var "+m+" = validate.schema"+l+"; ");var K="i"+n,B="schema"+n+"["+K+"]",te="' + "+B+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,B,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+K+" = 0; "+K+" < "+m+".length; "+K+"++) { "+g+" = "+f+"["+m+"["+K+"]] !== undefined ",J&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", "+m+"["+K+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+te+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=re.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var U=p;if(U)for(var L,K=-1,ne=U.length-1;K<ne;){L=U[K+=1],K&&(r+=" || ");var $e=e.util.getProperty(L),he=f+$e;r+=" ( ( "+he+" === undefined ",J&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:$e)+") ) "}r+=") { ";var B="missing"+n,te="' + "+B+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(N,B,!0):N+" + "+B);var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+te+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var Q=r;r=re.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+Q+"]); ":r+=" validate.errors = ["+Q+"]; return false; ":r+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(q){d||(r+=" var "+m+" = validate.schema"+l+"; ");var K="i"+n,B="schema"+n+"["+K+"]",te="' + "+B+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,B,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+te+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+K+" = 0; "+K+" < "+m+".length; "+K+"++) { if ("+f+"["+m+"["+K+"]] === undefined ",J&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+m+"["+K+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+te+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var we=p;if(we)for(var L,pe=-1,x=we.length-1;pe<x;){L=we[pe+=1];var $e=e.util.getProperty(L),te=e.util.escapeQuotes(L),he=f+$e;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,L,e.opts.jsonPointers)),r+=" if ( "+he+" === undefined ",J&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+te+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+te+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=N}else u&&(r+=" if (true) {");return r},tg=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,m;if(d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",m="schema"+n):m=i,(i||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+m+" === false || "+m+" === undefined) "+g+" = true; else if (typeof "+m+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+f+".length , "+g+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,h=Array.isArray(p);if(!p||p=="object"||p=="array"||h&&(p.indexOf("object")>=0||p.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var v="checkDataType"+(h?"s":"");r+=" if ("+e.util[v](p,"item",e.opts.strictNumbers,!0)+") continue; ",h&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+l:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var P=r;r=$.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},rg={$ref:Mv,allOf:Lv,anyOf:Fv,$comment:qv,const:Uv,contains:Vv,dependencies:zv,enum:Hv,format:Zv,if:Kv,items:Bv,maximum:fu,minimum:fu,maxItems:hu,minItems:hu,maxLength:pu,minLength:pu,maxProperties:mu,minProperties:mu,multipleOf:Jv,not:Qv,oneOf:Gv,pattern:Wv,properties:Xv,propertyNames:Yv,required:eg,uniqueItems:tg,validate:Wc},vu=rg,no=Fr.toHash,ag=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],a=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=no(a),e.types=no(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var i;if(typeof o=="object"){var l=Object.keys(o)[0];i=o[l],o=l,i.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(o);var c=e.all[o]={keyword:o,code:vu[o],implements:i};return c}),e.all.$comment={keyword:"$comment",code:vu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=no(a.concat(s)),e.custom={},e},gu=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],sg=function(t,e){for(var a=0;a<e.length;a++){t=JSON.parse(JSON.stringify(t));var s=e[a].split("/"),r=t,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<gu.length;n++){var o=gu[n],i=r[o];i&&(r[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},ng=ro.MissingRef,ig=yu;function yu(t,e,a){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(a=e,e=void 0);var r=n(t).then(function(){var i=s._addSchema(t,void 0,e);return i.validate||o(i)});return a&&r.then(function(i){a(null,i)},a),r;function n(i){var l=i.$schema;return l&&!s.getSchema(l)?yu.call(s,{$ref:l},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(c){if(c instanceof ng)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var f=s._loadingSchemas[u];return f||(f=s._loadingSchemas[u]=s._opts.loadSchema(u),f.then(g,g)),f.then(function(m){if(!d(u))return n(m).then(function(){d(u)||s.addSchema(m,u,void 0,e)})}).then(function(){return o(i)});function g(){delete s._loadingSchemas[u]}function d(m){return s._refs[m]||s._schemas[m]}}}}var og=function(e,a,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,f,g="data"+(o||""),d="valid"+n,m="errs__"+n,p=e.opts.$data&&i&&i.$data,h;p?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",h="schema"+n):h=i;var v=this,$="definition"+n,P=v.definition,R="",N,q,J,K,B;if(p&&P.$data){B="keywordValidate"+n;var te=P.validateSchema;r+=" var "+$+" = RULES.custom['"+a+"'].definition; var "+B+" = "+$+".validate;"}else{if(K=e.useCustomRule(v,i,e.schema,e),!K)return;h="validate.schema"+l,B=K.code,N=P.compile,q=P.inline,J=P.macro}var re=B+".errors",Q="i"+n,U="ruleErr"+n,L=P.async;if(L&&!e.async)throw new Error("async keyword in sync schema");if(q||J||(r+=""+re+" = null;"),r+="var "+m+" = errors;var "+d+";",p&&P.$data&&(R+="}",r+=" if ("+h+" === undefined) { "+d+" = true; } else { ",te&&(R+="}",r+=" "+d+" = "+$+".validateSchema("+h+"); if ("+d+") { ")),q)P.statements?r+=" "+K.validate+" ":r+=" "+d+" = "+K.validate+"; ";else if(J){var ne=e.util.copy(e),R="";ne.level++;var $e="valid"+ne.level;ne.schema=K.validate,ne.schemaPath="";var he=e.compositeRule;e.compositeRule=ne.compositeRule=!0;var we=e.validate(ne).replace(/validate\.schema/g,B);e.compositeRule=ne.compositeRule=he,r+=" "+we}else{var pe=pe||[];pe.push(r),r="",r+=" "+B+".call( ",e.opts.passContext?r+="this":r+="self",N||P.schema===!1?r+=" , "+g+" ":r+=" , "+h+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var x=o?"data"+(o-1||""):"parentData",k=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+x+" , "+k+" , rootData ) ";var F=r;r=pe.pop(),P.errors===!1?(r+=" "+d+" = ",L&&(r+="await "),r+=""+F+"; "):L?(re="customErrors"+n,r+=" var "+re+" = null; try { "+d+" = await "+F+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+re+" = e.errors; else throw e; } "):r+=" "+re+" = null; "+d+" = "+F+"; "}if(P.modifying&&(r+=" if ("+x+") "+g+" = "+x+"["+k+"];"),r+=""+R,P.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",J?r+=""+$e:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",f=v.keyword;var pe=pe||[];pe.push(r),r="";var pe=pe||[];pe.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var C=r;r=pe.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var y=r;r=pe.pop(),q?P.errors?P.errors!="full"&&(r+=" for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+y+" ":(r+=" if ("+m+" == errors) { "+y+" } else { for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+U+".schemaPath === undefined) { "+U+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } } "):J?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+y+" ":(r+=" if (Array.isArray("+re+")) { if (vErrors === null) vErrors = "+re+"; else vErrors = vErrors.concat("+re+"); errors = vErrors.length; for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+U+" = vErrors["+Q+"]; if ("+U+".dataPath === undefined) "+U+".dataPath = (dataPath || '') + "+e.errorPath+"; "+U+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+U+".schema = "+h+"; "+U+".data = "+g+"; "),r+=" } } else { "+y+" } "),r+=" } ",u&&(r+=" else { ")}return r};const _u={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var $u=_u,lg={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:$u.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:$u.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},cg=/^[a-z_$][a-z0-9_$-]*$/i,ug=og,dg=lg,fg={add:hg,get:pg,remove:mg,validate:io};function hg(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!cg.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(t,s[r],e);else o(t,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}a.keywords[t]=a.all[t]=!0;function o(i,l,c){for(var u,f=0;f<a.length;f++){var g=a[f];if(g.type==l){u=g;break}}u||(u={type:l,rules:[]},a.push(u));var d={keyword:i,definition:c,custom:!0,code:ug,implements:c.implements};u.rules.push(d),a.custom[i]=d}return this}function pg(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function mg(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var a=0;a<e.length;a++)for(var s=e[a].rules,r=0;r<s.length;r++)if(s[r].keyword==t){s.splice(r,1);break}return this}function io(t,e){io.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(dg,!0);if(a(t))return!0;if(io.errors=a.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}const vg={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var wu=vv,$r=Wi,gg=Pv,bu=Hc,yg=Gc,_g=Cv,$g=ag,Pu=sg,Eu=Fr,wg=Ze;Ze.prototype.validate=Pg,Ze.prototype.compile=Eg,Ze.prototype.addSchema=Sg,Ze.prototype.addMetaSchema=Rg,Ze.prototype.validateSchema=kg,Ze.prototype.getSchema=Og,Ze.prototype.removeSchema=Ig,Ze.prototype.addFormat=Fg,Ze.prototype.errorsText=Lg,Ze.prototype._addSchema=Ng,Ze.prototype._compile=Ag,Ze.prototype.compileAsync=ig;var js=fg;Ze.prototype.addKeyword=js.add,Ze.prototype.getKeyword=js.get,Ze.prototype.removeKeyword=js.remove,Ze.prototype.validateKeyword=js.validate;var Su=ro;Ze.ValidationError=Su.Validation,Ze.MissingRefError=Su.MissingRef,Ze.$dataMetaSchema=Pu;var Ds="http://json-schema.org/draft-07/schema",Ru=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],bg=["/properties"];function Ze(t){if(!(this instanceof Ze))return new Ze(t);t=this._opts=Eu.copy(t)||{},Zg(this),this._schemas={},this._refs={},this._fragments={},this._formats=_g(t.format),this._cache=t.cache||new gg,this._loadingSchemas={},this._compilations=[],this.RULES=$g(),this._getId=jg(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=yg),this._metaOpts=Hg(this),t.formats&&Vg(this),t.keywords&&zg(this),qg(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Ug(this)}function Pg(t,e){var a;if(typeof t=="string"){if(a=this.getSchema(t),!a)throw new Error('no schema with key or ref "'+t+'"')}else{var s=this._addSchema(t);a=s.validate||this._compile(s)}var r=a(e);return a.$async!==!0&&(this.errors=a.errors),r}function Eg(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function Sg(t,e,a,s){if(Array.isArray(t)){for(var r=0;r<t.length;r++)this.addSchema(t[r],void 0,a,s);return this}var n=this._getId(t);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=$r.normalizeId(e||n),Tu(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function Rg(t,e,a){return this.addSchema(t,e,a,!0),this}function kg(t,e){var a=t.$schema;if(a!==void 0&&typeof a!="string")throw new Error("$schema must be a string");if(a=a||this._opts.defaultMeta||Tg(this),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(a,t);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function Tg(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Ds)?Ds:void 0,t._opts.defaultMeta}function Og(t){var e=ku(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Cg(this,t)}}function Cg(t,e){var a=$r.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,o=wu.call(t,s,r,void 0,n);return t._fragments[e]=new bu({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function ku(t,e){return e=$r.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Ig(t){if(t instanceof RegExp)return xs(this,this._schemas,t),xs(this,this._refs,t),this;switch(typeof t){case"undefined":return xs(this,this._schemas),xs(this,this._refs),this._cache.clear(),this;case"string":var e=ku(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var a=this._opts.serialize,s=a?a(t):t;this._cache.del(s);var r=this._getId(t);r&&(r=$r.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function xs(t,e,a){for(var s in e){var r=e[s];!r.meta&&(!a||a.test(s))&&(t._cache.del(r.cacheKey),delete e[s])}}function Ng(t,e,a,s){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(t):t,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=$r.normalizeId(this._getId(t));i&&s&&Tu(this,i);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=i&&i==$r.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=$r.ids.call(this,t),f=new bu({id:i,schema:t,localRefs:u,cacheKey:n,meta:a});return i[0]!="#"&&s&&(this._refs[i]=f),this._cache.put(n,f),l&&c&&this.validateSchema(t,!0),f}function Ag(t,e){if(t.compiling)return t.validate=r,r.schema=t.schema,r.errors=null,r.root=e||r,t.schema.$async===!0&&(r.$async=!0),r;t.compiling=!0;var a;t.meta&&(a=this._opts,this._opts=this._metaOpts);var s;try{s=wu.call(this,t.schema,e,t.localRefs)}catch(n){throw delete t.validate,n}finally{t.compiling=!1,t.meta&&(this._opts=a)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function r(){var n=t.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function jg(t){switch(t.schemaId){case"auto":return Mg;case"id":return Dg;default:return xg}}function Dg(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function xg(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function Mg(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function Lg(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var a=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<t.length;n++){var o=t[n];o&&(r+=s+o.dataPath+" "+o.message+a)}return r.slice(0,-a.length)}function Fg(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function qg(t){var e;if(t._opts.$data&&(e=vg,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=_u;t._opts.$data&&(a=Pu(a,bg)),t.addMetaSchema(a,Ds,!0),t._refs["http://json-schema.org/schema"]=Ds}}function Ug(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var a in e)t.addSchema(e[a],a)}function Vg(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function zg(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function Tu(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Hg(t){for(var e=Eu.copy(t._opts),a=0;a<Ru.length;a++)delete e[Ru[a]];return e}function Zg(t){var e=t._opts.logger;if(e===!1)t.logger={log:oo,warn:oo,error:oo};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function oo(){}const Ou=Lo(wg);class Kg extends Ui{constructor(e,a){var s;super(a),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._ajv=new Ou}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Vi(this._capabilities,e)}assertCapability(e,a){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${a})`)}async connect(e,a){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:_r,capabilities:this._capabilities,clientInfo:this._clientInfo}},wi,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!fi.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var a,s,r,n,o;switch(e){case"logging/setLevel":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var a;switch(e){case"notifications/roots/list_changed":if(!(!((a=this._capabilities.roots)===null||a===void 0)&&a.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},rr,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},Li,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},rr,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},Ni,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},Ci,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},ki,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},Ti,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},Oi,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},rr,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},rr,a)}async callTool(e,a=$s,s){const r=await this.request({method:"tools/call",params:e},a,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new je(T.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new je(T.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof je?o:new je(T.ErrorCode.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const a of e)if(a.outputSchema)try{const s=this._ajv.compile(a.outputSchema);this._cachedToolOutputValidators.set(a.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,a){const s=await this.request({method:"tools/list",params:e},Ai,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let lo;lo=globalThis.crypto;async function Bg(t){return(await lo).getRandomValues(new Uint8Array(t))}async function Jg(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await Bg(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function Qg(t){return await Jg(t)}async function Gg(t){const e=await(await lo).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Wg(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Qg(t),a=await Gg(e);return{code_verifier:e,code_challenge:a}}const Xg=W({resource:O().url(),authorization_servers:ie(O().url()).optional(),jwks_uri:O().url().optional(),scopes_supported:ie(O()).optional(),bearer_methods_supported:ie(O()).optional(),resource_signing_alg_values_supported:ie(O()).optional(),resource_name:O().optional(),resource_documentation:O().optional(),resource_policy_uri:O().url().optional(),resource_tos_uri:O().url().optional(),tls_client_certificate_bound_access_tokens:Xe().optional(),authorization_details_types_supported:ie(O()).optional(),dpop_signing_alg_values_supported:ie(O()).optional(),dpop_bound_access_tokens_required:Xe().optional()}).passthrough(),co=W({issuer:O(),authorization_endpoint:O(),token_endpoint:O(),registration_endpoint:O().optional(),scopes_supported:ie(O()).optional(),response_types_supported:ie(O()),response_modes_supported:ie(O()).optional(),grant_types_supported:ie(O()).optional(),token_endpoint_auth_methods_supported:ie(O()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(O()).optional(),service_documentation:O().optional(),revocation_endpoint:O().optional(),revocation_endpoint_auth_methods_supported:ie(O()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ie(O()).optional(),introspection_endpoint:O().optional(),introspection_endpoint_auth_methods_supported:ie(O()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ie(O()).optional(),code_challenge_methods_supported:ie(O()).optional()}).passthrough(),Yg=W({issuer:O(),authorization_endpoint:O(),token_endpoint:O(),userinfo_endpoint:O().optional(),jwks_uri:O(),registration_endpoint:O().optional(),scopes_supported:ie(O()).optional(),response_types_supported:ie(O()),response_modes_supported:ie(O()).optional(),grant_types_supported:ie(O()).optional(),acr_values_supported:ie(O()).optional(),subject_types_supported:ie(O()),id_token_signing_alg_values_supported:ie(O()),id_token_encryption_alg_values_supported:ie(O()).optional(),id_token_encryption_enc_values_supported:ie(O()).optional(),userinfo_signing_alg_values_supported:ie(O()).optional(),userinfo_encryption_alg_values_supported:ie(O()).optional(),userinfo_encryption_enc_values_supported:ie(O()).optional(),request_object_signing_alg_values_supported:ie(O()).optional(),request_object_encryption_alg_values_supported:ie(O()).optional(),request_object_encryption_enc_values_supported:ie(O()).optional(),token_endpoint_auth_methods_supported:ie(O()).optional(),token_endpoint_auth_signing_alg_values_supported:ie(O()).optional(),display_values_supported:ie(O()).optional(),claim_types_supported:ie(O()).optional(),claims_supported:ie(O()).optional(),service_documentation:O().optional(),claims_locales_supported:ie(O()).optional(),ui_locales_supported:ie(O()).optional(),claims_parameter_supported:Xe().optional(),request_parameter_supported:Xe().optional(),request_uri_parameter_supported:Xe().optional(),require_request_uri_registration:Xe().optional(),op_policy_uri:O().optional(),op_tos_uri:O().optional()}).passthrough().merge(co.pick({code_challenge_methods_supported:!0})),Cu=W({access_token:O(),id_token:O().optional(),token_type:O(),expires_in:tt().optional(),scope:O().optional(),refresh_token:O().optional()}).strip(),ey=W({error:O(),error_description:O().optional(),error_uri:O().optional()}),ty=W({redirect_uris:ie(O()).refine(t=>t.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:O().optional(),grant_types:ie(O()).optional(),response_types:ie(O()).optional(),client_name:O().optional(),client_uri:O().optional(),logo_uri:O().optional(),scope:O().optional(),contacts:ie(O()).optional(),tos_uri:O().optional(),policy_uri:O().optional(),jwks_uri:O().optional(),jwks:_m().optional(),software_id:O().optional(),software_version:O().optional(),software_statement:O().optional()}).strip(),ry=W({client_id:O(),client_secret:O().optional(),client_id_issued_at:tt().optional(),client_secret_expires_at:tt().optional()}).strip(),ay=ty.merge(ry);W({error:O(),error_description:O().optional()}).strip(),W({token:O(),token_type_hint:O().optional()}).strip();function sy(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function ny({requestedResource:t,configuredResource:e}){const a=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const r=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}class nt extends Error{constructor(e,a){super(e),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class uo extends nt{}uo.errorCode="invalid_request";class Ms extends nt{}Ms.errorCode="invalid_client";class Ls extends nt{}Ls.errorCode="invalid_grant";class Fs extends nt{}Fs.errorCode="unauthorized_client";class fo extends nt{}fo.errorCode="unsupported_grant_type";class ho extends nt{}ho.errorCode="invalid_scope";class po extends nt{}po.errorCode="access_denied";class qr extends nt{}qr.errorCode="server_error";class mo extends nt{}mo.errorCode="temporarily_unavailable";class vo extends nt{}vo.errorCode="unsupported_response_type";class go extends nt{}go.errorCode="unsupported_token_type";class yo extends nt{}yo.errorCode="invalid_token";class _o extends nt{}_o.errorCode="method_not_allowed";class $o extends nt{}$o.errorCode="too_many_requests";class wo extends nt{}wo.errorCode="invalid_client_metadata";class bo extends nt{}bo.errorCode="insufficient_scope";const iy={[uo.errorCode]:uo,[Ms.errorCode]:Ms,[Ls.errorCode]:Ls,[Fs.errorCode]:Fs,[fo.errorCode]:fo,[ho.errorCode]:ho,[po.errorCode]:po,[qr.errorCode]:qr,[mo.errorCode]:mo,[vo.errorCode]:vo,[go.errorCode]:go,[yo.errorCode]:yo,[_o.errorCode]:_o,[$o.errorCode]:$o,[wo.errorCode]:wo,[bo.errorCode]:bo};class Rt extends Error{constructor(e){super(e??"Unauthorized")}}function Iu(t,e){const a=t.client_secret!==void 0;return e.length===0?a?"client_secret_post":"none":a&&e.includes("client_secret_basic")?"client_secret_basic":a&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":a?"client_secret_post":"none"}function Nu(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":oy(r,n,a);return;case"client_secret_post":ly(r,n,s);return;case"none":cy(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function oy(t,e,a){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const s=btoa(`${t}:${e}`);a.set("Authorization",`Basic ${s}`)}function ly(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function cy(t,e){e.set("client_id",t)}async function qs(t){const e=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{const s=ey.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:o}=s,i=iy[r]||qr;return new i(n||"",o)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new qr(r)}}async function wr(t,e){var a,s;try{return await Po(t,e)}catch(r){if(r instanceof Ms||r instanceof Fs)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await Po(t,e);if(r instanceof Ls)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Po(t,e);throw r}}async function Po(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,i;try{o=await ju(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);const l=await Au(e,t,o),c=await Lu(i,{fetchFn:n});let u=await Promise.resolve(t.clientInformation());if(!u){if(a!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const p=await Vu(i,{metadata:c,clientMetadata:t.clientMetadata});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await qu(i,{metadata:c,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const f=await t.tokens();if(f!=null&&f.refresh_token)try{const p=await Uu(i,{metadata:c,clientInformation:u,refreshToken:f.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof nt)||p instanceof qr))throw p}const g=t.state?await t.state():void 0,{authorizationUrl:d,codeVerifier:m}=await Fu(i,{metadata:c,clientInformation:u,state:g,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(d),"REDIRECT"}async function Au(t,e,a){const s=sy(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!ny({requestedResource:s,configuredResource:a.resource}))throw new Error(`Protected resource ${a.resource} does not match expected ${s} (or origin)`);return new URL(a.resource)}}function Us(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[a,s]=e.split(" ");if(a.toLowerCase()!=="bearer"||!s)return;const n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function ju(t,e,a=fetch){const s=await xu(t,"oauth-protected-resource",a,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Xg.parse(await s.json())}async function Eo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?Eo(t,void 0,a):void 0;throw s}}function uy(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Du(t,e,a=fetch){return await Eo(t,{"MCP-Protocol-Version":e},a)}function dy(t,e){return!t||t.status===404&&e!=="/"}async function xu(t,e,a,s){var r,n;const o=new URL(t),i=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:_r;let l;if(s!=null&&s.metadataUrl)l=new URL(s.metadataUrl);else{const u=uy(e,o.pathname);l=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),l.search=o.search}let c=await Du(l,i,a);if(!(s!=null&&s.metadataUrl)&&dy(c,o.pathname)){const u=new URL(`/.well-known/${e}`,o);c=await Du(u,i,a)}return c}async function fy(t,{authorizationServerUrl:e,protocolVersion:a}={},s=fetch){typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),a??(a=_r);const r=await xu(e,"oauth-authorization-server",s,{protocolVersion:a,metadataServerUrl:e});if(!(!r||r.status===404)){if(!r.ok)throw new Error(`HTTP ${r.status} trying to load well-known OAuth metadata`);return co.parse(await r.json())}}function Mu(t){const e=typeof t=="string"?new URL(t):t,a=e.pathname!=="/",s=[];if(!a)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function Lu(t,{fetchFn:e=fetch,protocolVersion:a=_r}={}){var s;const r={"MCP-Protocol-Version":a},n=Mu(t);for(const{url:o,type:i}of n){const l=await Eo(o,r,e);if(!l)throw new Error(`CORS error trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`);if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return co.parse(await l.json());{const c=Yg.parse(await l.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return c}}}async function Fu(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:o}){const i="code",l="S256";let c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(l))throw new Error(`Incompatible auth server: does not support code challenge method ${l}`)}else c=new URL("/authorize",t);const u=await Wg(),f=u.code_verifier,g=u.code_challenge;return c.searchParams.set("response_type",i),c.searchParams.set("client_id",a.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",l),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:f}}async function qu(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:i,fetchFn:l}){var c;const u="authorization_code",f=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:u,code:s,code_verifier:r,redirect_uri:String(n)});if(i)i(g,d,t,e);else{const p=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=Iu(a,p);Nu(h,a,g,d)}o&&d.set("resource",o.href);const m=await(l??fetch)(f,{method:"POST",headers:g,body:d});if(!m.ok)throw await qs(m);return Cu.parse(await m.json())}async function Uu(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var i;const l="refresh_token";let c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else c=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:l,refresh_token:s});if(n)n(u,f,t,e);else{const d=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],m=Iu(a,d);Nu(m,a,u,f)}r&&f.set("resource",r.href);const g=await(o??fetch)(c,{method:"POST",headers:u,body:f});if(!g.ok)throw await qs(g);return Cu.parse({refresh_token:s,...await g.json()})}async function Vu(t,{metadata:e,clientMetadata:a,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",t);const n=await(s??fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok)throw await qs(n);return ay.parse(await n.json())}class zu extends Error{constructor(e,a){super(e),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}}function So(t){}function Hu(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=So,onError:a=So,onRetry:s=So,onComment:r}=t;let n="",o=!0,i,l="",c="";function u(p){const h=o?p.replace(/^\xEF\xBB\xBF/,""):p,[v,$]=hy(`${n}${h}`);for(const P of v)f(P);n=$,o=!1}function f(p){if(p===""){d();return}if(p.startsWith(":")){r&&r(p.slice(p.startsWith(": ")?2:1));return}const h=p.indexOf(":");if(h!==-1){const v=p.slice(0,h),$=p[h+1]===" "?2:1,P=p.slice(h+$);g(v,P,p);return}g(p,"",p)}function g(p,h,v){switch(p){case"event":c=h;break;case"data":l=`${l}${h}
|
|
9
|
+
`;break;case"id":i=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new zu(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:v}));break;default:a(new zu(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:h,line:v}));break}}function d(){l.length>0&&e({id:i,event:c||void 0,data:l.endsWith(`
|
|
10
|
+
`)?l.slice(0,-1):l}),i=void 0,l="",c=""}function m(p={}){n&&p.consume&&f(n),o=!0,i=void 0,l="",c="",n=""}return{feed:u,reset:m}}function hy(t){const e=[];let a="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),n=t.indexOf(`
|
|
11
11
|
`,s);let o=-1;if(r!==-1&&n!==-1?o=Math.min(r,n):r!==-1?o=r:n!==-1&&(o=n),o===-1){a=t.slice(s);break}else{const i=t.slice(s,o);e.push(i),s=o+1,t[s-1]==="\r"&&t[s]===`
|
|
12
|
-
`&&s++}}return[e,a]}class Vu extends Event{constructor(e,a){var s,r;super(e),this.code=(s=a==null?void 0:a.code)!=null?s:void 0,this.message=(r=a==null?void 0:a.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,a,s){return s(zu(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(zu(this),a)}}function Yg(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Po(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Po).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Po(t.cause)}`:t.message:`${t}`}function zu(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Hu=t=>{throw TypeError(t)},Eo=(t,e,a)=>e.has(t)||Hu("Cannot "+a),Ee=(t,e,a)=>(Eo(t,e,"read from private field"),a?a.call(t):e.get(t)),Xe=(t,e,a)=>e.has(t)?Hu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),Le=(t,e,a,s)=>(Eo(t,e,"write to private field"),e.set(t,a),a),Jt=(t,e,a)=>(Eo(t,e,"access private method"),a),ft,wr,qr,Us,Vs,_a,Ur,$a,nr,Vr,zr,Hr,wa,kt,So,Ro,ko,Zu,To,Oo,ba,Co,Io;class zs extends EventTarget{constructor(e,a){var s,r;super(),Xe(this,kt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xe(this,ft),Xe(this,wr),Xe(this,qr),Xe(this,Us),Xe(this,Vs),Xe(this,_a),Xe(this,Ur),Xe(this,$a,null),Xe(this,nr),Xe(this,Vr),Xe(this,zr,null),Xe(this,Hr,null),Xe(this,wa,null),Xe(this,Ro,async n=>{var o;Ee(this,Vr).reset();const{body:i,redirected:l,status:c,headers:u}=n;if(c===204){Jt(this,kt,ba).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Le(this,qr,new URL(n.url)):Le(this,qr,void 0),c!==200){Jt(this,kt,ba).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Jt(this,kt,ba).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(Ee(this,ft)===this.CLOSED)return;Le(this,ft,this.OPEN);const f=new Event("open");if((o=Ee(this,wa))==null||o.call(this,f),this.dispatchEvent(f),typeof i!="object"||!i||!("getReader"in i)){Jt(this,kt,ba).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const g=new TextDecoder,d=i.getReader();let m=!0;do{const{done:p,value:h}=await d.read();h&&Ee(this,Vr).feed(g.decode(h,{stream:!p})),p&&(m=!1,Ee(this,Vr).reset(),Jt(this,kt,Co).call(this))}while(m)}),Xe(this,ko,n=>{Le(this,nr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Jt(this,kt,Co).call(this,Po(n))}),Xe(this,To,n=>{typeof n.id=="string"&&Le(this,$a,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:Ee(this,qr)?Ee(this,qr).origin:Ee(this,wr).origin,lastEventId:n.id||""});Ee(this,Hr)&&(!n.event||n.event==="message")&&Ee(this,Hr).call(this,o),this.dispatchEvent(o)}),Xe(this,Oo,n=>{Le(this,_a,n)}),Xe(this,Io,()=>{Le(this,Ur,void 0),Ee(this,ft)===this.CONNECTING&&Jt(this,kt,So).call(this)});try{if(e instanceof URL)Le(this,wr,e);else if(typeof e=="string")Le(this,wr,new URL(e,ey()));else throw new Error("Invalid URL")}catch{throw Yg("An invalid or illegal string was specified")}Le(this,Vr,Uu({onEvent:Ee(this,To),onRetry:Ee(this,Oo)})),Le(this,ft,this.CONNECTING),Le(this,_a,3e3),Le(this,Vs,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),Le(this,Us,(r=a==null?void 0:a.withCredentials)!=null?r:!1),Jt(this,kt,So).call(this)}get readyState(){return Ee(this,ft)}get url(){return Ee(this,wr).href}get withCredentials(){return Ee(this,Us)}get onerror(){return Ee(this,zr)}set onerror(e){Le(this,zr,e)}get onmessage(){return Ee(this,Hr)}set onmessage(e){Le(this,Hr,e)}get onopen(){return Ee(this,wa)}set onopen(e){Le(this,wa,e)}addEventListener(e,a,s){const r=a;super.addEventListener(e,r,s)}removeEventListener(e,a,s){const r=a;super.removeEventListener(e,r,s)}close(){Ee(this,Ur)&&clearTimeout(Ee(this,Ur)),Ee(this,ft)!==this.CLOSED&&(Ee(this,nr)&&Ee(this,nr).abort(),Le(this,ft,this.CLOSED),Le(this,nr,void 0))}}ft=new WeakMap,wr=new WeakMap,qr=new WeakMap,Us=new WeakMap,Vs=new WeakMap,_a=new WeakMap,Ur=new WeakMap,$a=new WeakMap,nr=new WeakMap,Vr=new WeakMap,zr=new WeakMap,Hr=new WeakMap,wa=new WeakMap,kt=new WeakSet,So=function(){Le(this,ft,this.CONNECTING),Le(this,nr,new AbortController),Ee(this,Vs)(Ee(this,wr),Jt(this,kt,Zu).call(this)).then(Ee(this,Ro)).catch(Ee(this,ko))},Ro=new WeakMap,ko=new WeakMap,Zu=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ee(this,$a)?{"Last-Event-ID":Ee(this,$a)}:void 0},cache:"no-store",signal:(t=Ee(this,nr))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},To=new WeakMap,Oo=new WeakMap,ba=function(t,e){var a;Ee(this,ft)!==this.CLOSED&&Le(this,ft,this.CLOSED);const s=new Vu("error",{code:e,message:t});(a=Ee(this,zr))==null||a.call(this,s),this.dispatchEvent(s)},Co=function(t,e){var a;if(Ee(this,ft)===this.CLOSED)return;Le(this,ft,this.CONNECTING);const s=new Vu("error",{code:e,message:t});(a=Ee(this,zr))==null||a.call(this,s),this.dispatchEvent(s),Le(this,Ur,setTimeout(Ee(this,Io),Ee(this,_a)))},Io=new WeakMap,zs.CONNECTING=0,zs.OPEN=1,zs.CLOSED=2;function ey(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}class Ku extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class ty{constructor(e,a){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=a==null?void 0:a.eventSourceInit,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let a;try{a=await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(a!=="AUTHORIZED")throw new Rt;return await this._startOrAuth()}async _commonHeaders(){var e;const a={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(a.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion),new Headers({...a,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,a,s;const r=(s=(a=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&a!==void 0?a:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((n,o)=>{this._eventSource=new zs(this._url.href,{...this._eventSourceInit,fetch:async(i,l)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const u=await r(i,{...l,headers:c});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=qs(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var l;if(i.code===401&&this._authProvider){this._authThenStart().then(n,o);return}const c=new Ku(i.code,i.message,i);o(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var l;const c=i;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){o(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}n()}),this._eventSource.onmessage=i=>{var l,c;const u=i;let f;try{f=pa.parse(JSON.parse(u.data))}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g);return}(c=this.onmessage)===null||c===void 0||c.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await $r(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,a,s;(e=this._abortController)===null||e===void 0||e.abort(),(a=this._eventSource)===null||a===void 0||a.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var a,s,r;if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const o={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},i=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,o);if(!i.ok){if(i.status===401&&this._authProvider){if(this._resourceMetadataUrl=qs(i),await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const l=await i.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${l}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class ry extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=Uu({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:a,onComment:s})},transform(n){r.feed(n)}})}}const ay={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Hs extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class sy{constructor(e,a){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch,this._sessionId=a==null?void 0:a.sessionId,this._reconnectionOptions=(s=a==null?void 0:a.reconnectionOptions)!==null&&s!==void 0?s:ay}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let a;try{a=await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(a!=="AUTHORIZED")throw new Rt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const a={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(a.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(a["mcp-session-id"]=this._sessionId),this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...a,...s})}async _startOrAuthSse(e){var a,s,r;const{resumptionToken:n}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);const i=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Hs(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){const a=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(a*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,a=0){var s;const r=this._reconnectionOptions.maxRetries;if(r>0&&a>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const n=this._getNextReconnectionDelay(a);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,a+1)})},n)}_handleSseStream(e,a,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:n}=a;let o;(async()=>{var l,c,u,f;try{const g=e.pipeThrough(new TextDecoderStream).pipeThrough(new ry).getReader();for(;;){const{value:d,done:m}=await g.read();if(m)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{const p=pa.parse(JSON.parse(d.data));n!==void 0&&ss(p)&&(p.id=n),(l=this.onmessage)===null||l===void 0||l.call(this,p)}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p)}}}catch(g){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await $r(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,a;(e=this._abortController)===null||e===void 0||e.abort(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e,a){var s,r,n,o;try{const{resumptionToken:i,onresumptiontoken:l}=a||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:hi(e)?e.id:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},f=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),g=f.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=qs(f),await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const h=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${h}`)}if(f.status===202){sc(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const m=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,p=f.headers.get("content-type");if(m)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:l},!1);else if(p!=null&&p.includes("application/json")){const h=await f.json(),v=Array.isArray(h)?h.map($=>pa.parse($)):[pa.parse(h)];for(const $ of v)(n=this.onmessage)===null||n===void 0||n.call(this,$)}else throw new Hs(-1,`Unexpected content type: ${p}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,a,s;if(this._sessionId)try{const r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,n);if(!o.ok&&o.status!==405)throw new Hs(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}class ny extends Li{constructor(e,a){var s;super(a),this._serverInfo=e,this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._instructions=a==null?void 0:a.instructions,this.setRequestHandler(is,r=>this._oninitialize(r)),this.setNotificationHandler(os,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Fi(this._capabilities,e)}assertCapabilityForMethod(e){var a,s,r;switch(e){case"sampling/createMessage":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break}}async _oninitialize(e){const a=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ci.includes(a)?a:yr,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},tr)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},Ni,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},Ai,a);if(s.action==="accept"&&s.content)try{const r=new Ru,n=r.compile(e.requestedSchema);if(!n(s.content))throw new je(O.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof je?r:new je(O.ErrorCode.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},xi,a)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const iy=Symbol("Let zodToJsonSchema decide on which parser to use"),Bu={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},oy=t=>typeof t=="string"?{...Bu,name:t}:{...Bu,...t},ly=t=>{const e=oy(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Ju(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function Ne(t,e,a,s,r){t[e]=a,Ju(t,e,s,r)}const Qu=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function ht(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Qu(e,t.currentPath):e.join("/")}}function cy(t,e){var s,r,n;const a={type:"array"};return(s=t.type)!=null&&s._def&&((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!==J.ZodAny&&(a.items=Ce(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ne(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ne(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ne(a,"minItems",t.exactLength.value,t.exactLength.message,e),Ne(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function uy(t,e){const a={type:"integer",format:"int64"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?Ne(a,"minimum",s.value,s.message,e):Ne(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Ne(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Ne(a,"maximum",s.value,s.message,e):Ne(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Ne(a,"maximum",s.value,s.message,e));break;case"multipleOf":Ne(a,"multipleOf",s.value,s.message,e);break}return a}function dy(){return{type:"boolean"}}function Gu(t,e){return Ce(t.type._def,e)}const fy=(t,e)=>Ce(t.innerType._def,e);function Wu(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Wu(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hy(t,e)}}const hy=(t,e)=>{const a={type:"integer",format:"unix-time"};if(e.target==="openApi3")return a;for(const s of t.checks)switch(s.kind){case"min":Ne(a,"minimum",s.value,s.message,e);break;case"max":Ne(a,"maximum",s.value,s.message,e);break}return a};function py(t,e){return{...Ce(t.innerType._def,e),default:t.defaultValue()}}function my(t,e){return e.effectStrategy==="input"?Ce(t.schema._def,e):ht(e)}function vy(t){return{type:"string",enum:Array.from(t.values)}}const gy=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function yy(t,e){const a=[Ce(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Ce(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n);let s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(n=>{if(gy(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:i,...l}=n;o=l}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function _y(t,e){const a=typeof t.value;return a!=="bigint"&&a!=="number"&&a!=="boolean"&&a!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:a==="bigint"?"integer":a,enum:[t.value]}:{type:a==="bigint"?"integer":a,const:t.value}}let No;const Tt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(No===void 0&&(No=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),No),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Xu(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Ne(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":Ne(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ot(a,"email",s.message,e);break;case"format:idn-email":Ot(a,"idn-email",s.message,e);break;case"pattern:zod":ct(a,Tt.email,s.message,e);break}break;case"url":Ot(a,"uri",s.message,e);break;case"uuid":Ot(a,"uuid",s.message,e);break;case"regex":ct(a,s.regex,s.message,e);break;case"cuid":ct(a,Tt.cuid,s.message,e);break;case"cuid2":ct(a,Tt.cuid2,s.message,e);break;case"startsWith":ct(a,RegExp(`^${Ao(s.value,e)}`),s.message,e);break;case"endsWith":ct(a,RegExp(`${Ao(s.value,e)}$`),s.message,e);break;case"datetime":Ot(a,"date-time",s.message,e);break;case"date":Ot(a,"date",s.message,e);break;case"time":Ot(a,"time",s.message,e);break;case"duration":Ot(a,"duration",s.message,e);break;case"length":Ne(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),Ne(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{ct(a,RegExp(Ao(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Ot(a,"ipv4",s.message,e),s.version!=="v4"&&Ot(a,"ipv6",s.message,e);break}case"base64url":ct(a,Tt.base64url,s.message,e);break;case"jwt":ct(a,Tt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ct(a,Tt.ipv4Cidr,s.message,e),s.version!=="v4"&&ct(a,Tt.ipv6Cidr,s.message,e);break}case"emoji":ct(a,Tt.emoji(),s.message,e);break;case"ulid":{ct(a,Tt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ot(a,"binary",s.message,e);break}case"contentEncoding:base64":{Ne(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{ct(a,Tt.base64,s.message,e);break}}break}case"nanoid":ct(a,Tt.nanoid,s.message,e)}return a}function Ao(t,e){return e.patternStrategy==="escape"?wy(t):t}const $y=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function wy(t){let e="";for(let a=0;a<t.length;a++)$y.has(t[a])||(e+="\\"),e+=t[a];return e}function Ot(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&s.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):Ne(t,"format",e,a,s)}function ct(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&s.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Yu(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):Ne(t,"pattern",Yu(e,s),a,s)}function Yu(t,e){var l;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=a.i?t.source.toLowerCase():t.source;let r="",n=!1,o=!1,i=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(a.i){if(o){if(s[c].match(/[a-z]/)){i?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),i=!1):s[c+1]==="-"&&((l=s[c+2])!=null&&l.match(/[a-z]/))?(r+=s[c],i=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(a.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
12
|
+
`&&s++}}return[e,a]}class Zu extends Event{constructor(e,a){var s,r;super(e),this.code=(s=a==null?void 0:a.code)!=null?s:void 0,this.message=(r=a==null?void 0:a.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,a,s){return s(Ku(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(Ku(this),a)}}function py(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Ro(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Ro).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Ro(t.cause)}`:t.message:`${t}`}function Ku(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Bu=t=>{throw TypeError(t)},ko=(t,e,a)=>e.has(t)||Bu("Cannot "+a),Se=(t,e,a)=>(ko(t,e,"read from private field"),a?a.call(t):e.get(t)),Ye=(t,e,a)=>e.has(t)?Bu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),Fe=(t,e,a,s)=>(ko(t,e,"write to private field"),e.set(t,a),a),Jt=(t,e,a)=>(ko(t,e,"access private method"),a),ht,br,Ur,Vs,zs,wa,Vr,ba,ir,zr,Hr,Zr,Pa,kt,To,Oo,Co,Ju,Io,No,Ea,Ao,jo;class Hs extends EventTarget{constructor(e,a){var s,r;super(),Ye(this,kt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Ye(this,ht),Ye(this,br),Ye(this,Ur),Ye(this,Vs),Ye(this,zs),Ye(this,wa),Ye(this,Vr),Ye(this,ba,null),Ye(this,ir),Ye(this,zr),Ye(this,Hr,null),Ye(this,Zr,null),Ye(this,Pa,null),Ye(this,Oo,async n=>{var o;Se(this,zr).reset();const{body:i,redirected:l,status:c,headers:u}=n;if(c===204){Jt(this,kt,Ea).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Fe(this,Ur,new URL(n.url)):Fe(this,Ur,void 0),c!==200){Jt(this,kt,Ea).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Jt(this,kt,Ea).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(Se(this,ht)===this.CLOSED)return;Fe(this,ht,this.OPEN);const f=new Event("open");if((o=Se(this,Pa))==null||o.call(this,f),this.dispatchEvent(f),typeof i!="object"||!i||!("getReader"in i)){Jt(this,kt,Ea).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const g=new TextDecoder,d=i.getReader();let m=!0;do{const{done:p,value:h}=await d.read();h&&Se(this,zr).feed(g.decode(h,{stream:!p})),p&&(m=!1,Se(this,zr).reset(),Jt(this,kt,Ao).call(this))}while(m)}),Ye(this,Co,n=>{Fe(this,ir,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Jt(this,kt,Ao).call(this,Ro(n))}),Ye(this,Io,n=>{typeof n.id=="string"&&Fe(this,ba,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:Se(this,Ur)?Se(this,Ur).origin:Se(this,br).origin,lastEventId:n.id||""});Se(this,Zr)&&(!n.event||n.event==="message")&&Se(this,Zr).call(this,o),this.dispatchEvent(o)}),Ye(this,No,n=>{Fe(this,wa,n)}),Ye(this,jo,()=>{Fe(this,Vr,void 0),Se(this,ht)===this.CONNECTING&&Jt(this,kt,To).call(this)});try{if(e instanceof URL)Fe(this,br,e);else if(typeof e=="string")Fe(this,br,new URL(e,my()));else throw new Error("Invalid URL")}catch{throw py("An invalid or illegal string was specified")}Fe(this,zr,Hu({onEvent:Se(this,Io),onRetry:Se(this,No)})),Fe(this,ht,this.CONNECTING),Fe(this,wa,3e3),Fe(this,zs,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),Fe(this,Vs,(r=a==null?void 0:a.withCredentials)!=null?r:!1),Jt(this,kt,To).call(this)}get readyState(){return Se(this,ht)}get url(){return Se(this,br).href}get withCredentials(){return Se(this,Vs)}get onerror(){return Se(this,Hr)}set onerror(e){Fe(this,Hr,e)}get onmessage(){return Se(this,Zr)}set onmessage(e){Fe(this,Zr,e)}get onopen(){return Se(this,Pa)}set onopen(e){Fe(this,Pa,e)}addEventListener(e,a,s){const r=a;super.addEventListener(e,r,s)}removeEventListener(e,a,s){const r=a;super.removeEventListener(e,r,s)}close(){Se(this,Vr)&&clearTimeout(Se(this,Vr)),Se(this,ht)!==this.CLOSED&&(Se(this,ir)&&Se(this,ir).abort(),Fe(this,ht,this.CLOSED),Fe(this,ir,void 0))}}ht=new WeakMap,br=new WeakMap,Ur=new WeakMap,Vs=new WeakMap,zs=new WeakMap,wa=new WeakMap,Vr=new WeakMap,ba=new WeakMap,ir=new WeakMap,zr=new WeakMap,Hr=new WeakMap,Zr=new WeakMap,Pa=new WeakMap,kt=new WeakSet,To=function(){Fe(this,ht,this.CONNECTING),Fe(this,ir,new AbortController),Se(this,zs)(Se(this,br),Jt(this,kt,Ju).call(this)).then(Se(this,Oo)).catch(Se(this,Co))},Oo=new WeakMap,Co=new WeakMap,Ju=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Se(this,ba)?{"Last-Event-ID":Se(this,ba)}:void 0},cache:"no-store",signal:(t=Se(this,ir))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Io=new WeakMap,No=new WeakMap,Ea=function(t,e){var a;Se(this,ht)!==this.CLOSED&&Fe(this,ht,this.CLOSED);const s=new Zu("error",{code:e,message:t});(a=Se(this,Hr))==null||a.call(this,s),this.dispatchEvent(s)},Ao=function(t,e){var a;if(Se(this,ht)===this.CLOSED)return;Fe(this,ht,this.CONNECTING);const s=new Zu("error",{code:e,message:t});(a=Se(this,Hr))==null||a.call(this,s),this.dispatchEvent(s),Fe(this,Vr,setTimeout(Se(this,jo),Se(this,wa)))},jo=new WeakMap,Hs.CONNECTING=0,Hs.OPEN=1,Hs.CLOSED=2;function my(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}class Qu extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class vy{constructor(e,a){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=a==null?void 0:a.eventSourceInit,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let a;try{a=await wr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(a!=="AUTHORIZED")throw new Rt;return await this._startOrAuth()}async _commonHeaders(){var e;const a={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(a.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion),new Headers({...a,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,a,s;const r=(s=(a=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&a!==void 0?a:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((n,o)=>{this._eventSource=new Hs(this._url.href,{...this._eventSourceInit,fetch:async(i,l)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const u=await r(i,{...l,headers:c});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Us(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var l;if(i.code===401&&this._authProvider){this._authThenStart().then(n,o);return}const c=new Qu(i.code,i.message,i);o(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var l;const c=i;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){o(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}n()}),this._eventSource.onmessage=i=>{var l,c;const u=i;let f;try{f=va.parse(JSON.parse(u.data))}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g);return}(c=this.onmessage)===null||c===void 0||c.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await wr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,a,s;(e=this._abortController)===null||e===void 0||e.abort(),(a=this._eventSource)===null||a===void 0||a.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var a,s,r;if(!this._endpoint)throw new Error("Not connected");try{const n=await this._commonHeaders();n.set("content-type","application/json");const o={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},i=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,o);if(!i.ok){if(i.status===401&&this._authProvider){if(this._resourceMetadataUrl=Us(i),await wr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const l=await i.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${i.status}): ${l}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class gy extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=Hu({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:a,onComment:s})},transform(n){r.feed(n)}})}}const yy={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Zs extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class _y{constructor(e,a){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=a==null?void 0:a.requestInit,this._authProvider=a==null?void 0:a.authProvider,this._fetch=a==null?void 0:a.fetch,this._sessionId=a==null?void 0:a.sessionId,this._reconnectionOptions=(s=a==null?void 0:a.reconnectionOptions)!==null&&s!==void 0?s:yy}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let a;try{a=await wr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(a!=="AUTHORIZED")throw new Rt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const a={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(a.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(a["mcp-session-id"]=this._sessionId),this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);const s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...a,...s})}async _startOrAuthSse(e){var a,s,r;const{resumptionToken:n}=e;try{const o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);const i=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Zs(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){const a=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(a*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,a=0){var s;const r=this._reconnectionOptions.maxRetries;if(r>0&&a>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const n=this._getNextReconnectionDelay(a);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,a+1)})},n)}_handleSseStream(e,a,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:n}=a;let o;(async()=>{var l,c,u,f;try{const g=e.pipeThrough(new TextDecoderStream).pipeThrough(new gy).getReader();for(;;){const{value:d,done:m}=await g.read();if(m)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{const p=va.parse(JSON.parse(d.data));n!==void 0&&ns(p)&&(p.id=n),(l=this.onmessage)===null||l===void 0||l.call(this,p)}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p)}}}catch(g){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await wr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,a;(e=this._abortController)===null||e===void 0||e.abort(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e,a){var s,r,n,o;try{const{resumptionToken:i,onresumptiontoken:l}=a||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:vi(e)?e.id:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},f=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),g=f.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=Us(f),await wr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const h=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${h}`)}if(f.status===202){oc(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const m=(Array.isArray(e)?e:[e]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,p=f.headers.get("content-type");if(m)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:l},!1);else if(p!=null&&p.includes("application/json")){const h=await f.json(),v=Array.isArray(h)?h.map($=>va.parse($)):[va.parse(h)];for(const $ of v)(n=this.onmessage)===null||n===void 0||n.call(this,$)}else throw new Zs(-1,`Unexpected content type: ${p}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,a,s;if(this._sessionId)try{const r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,n);if(!o.ok&&o.status!==405)throw new Zs(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}class $y extends Ui{constructor(e,a){var s;super(a),this._serverInfo=e,this._capabilities=(s=a==null?void 0:a.capabilities)!==null&&s!==void 0?s:{},this._instructions=a==null?void 0:a.instructions,this.setRequestHandler(os,r=>this._oninitialize(r)),this.setNotificationHandler(ls,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Vi(this._capabilities,e)}assertCapabilityForMethod(e){var a,s,r;switch(e){case"sampling/createMessage":if(!(!((a=this._clientCapabilities)===null||a===void 0)&&a.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break}}async _oninitialize(e){const a=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:fi.includes(a)?a:_r,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},rr)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},Di,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},xi,a);if(s.action==="accept"&&s.content)try{const r=new Ou,n=r.compile(e.requestedSchema);if(!n(s.content))throw new je(T.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof je?r:new je(T.ErrorCode.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},Fi,a)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const wy=Symbol("Let zodToJsonSchema decide on which parser to use"),Gu={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},by=t=>typeof t=="string"?{...Gu,name:t}:{...Gu,...t},Py=t=>{const e=by(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Wu(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function Ne(t,e,a,s,r){t[e]=a,Wu(t,e,s,r)}const Xu=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function pt(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Xu(e,t.currentPath):e.join("/")}}function Ey(t,e){var s,r,n;const a={type:"array"};return(s=t.type)!=null&&s._def&&((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!==Z.ZodAny&&(a.items=Ie(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ne(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ne(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ne(a,"minItems",t.exactLength.value,t.exactLength.message,e),Ne(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function Sy(t,e){const a={type:"integer",format:"int64"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?Ne(a,"minimum",s.value,s.message,e):Ne(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Ne(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Ne(a,"maximum",s.value,s.message,e):Ne(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Ne(a,"maximum",s.value,s.message,e));break;case"multipleOf":Ne(a,"multipleOf",s.value,s.message,e);break}return a}function Ry(){return{type:"boolean"}}function Yu(t,e){return Ie(t.type._def,e)}const ky=(t,e)=>Ie(t.innerType._def,e);function ed(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>ed(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ty(t,e)}}const Ty=(t,e)=>{const a={type:"integer",format:"unix-time"};if(e.target==="openApi3")return a;for(const s of t.checks)switch(s.kind){case"min":Ne(a,"minimum",s.value,s.message,e);break;case"max":Ne(a,"maximum",s.value,s.message,e);break}return a};function Oy(t,e){return{...Ie(t.innerType._def,e),default:t.defaultValue()}}function Cy(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):pt(e)}function Iy(t){return{type:"string",enum:Array.from(t.values)}}const Ny=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Ay(t,e){const a=[Ie(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Ie(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n);let s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(n=>{if(Ny(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:i,...l}=n;o=l}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function jy(t,e){const a=typeof t.value;return a!=="bigint"&&a!=="number"&&a!=="boolean"&&a!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:a==="bigint"?"integer":a,enum:[t.value]}:{type:a==="bigint"?"integer":a,const:t.value}}let Do;const Tt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Do===void 0&&(Do=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Do),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function td(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Ne(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":Ne(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ot(a,"email",s.message,e);break;case"format:idn-email":Ot(a,"idn-email",s.message,e);break;case"pattern:zod":ut(a,Tt.email,s.message,e);break}break;case"url":Ot(a,"uri",s.message,e);break;case"uuid":Ot(a,"uuid",s.message,e);break;case"regex":ut(a,s.regex,s.message,e);break;case"cuid":ut(a,Tt.cuid,s.message,e);break;case"cuid2":ut(a,Tt.cuid2,s.message,e);break;case"startsWith":ut(a,RegExp(`^${xo(s.value,e)}`),s.message,e);break;case"endsWith":ut(a,RegExp(`${xo(s.value,e)}$`),s.message,e);break;case"datetime":Ot(a,"date-time",s.message,e);break;case"date":Ot(a,"date",s.message,e);break;case"time":Ot(a,"time",s.message,e);break;case"duration":Ot(a,"duration",s.message,e);break;case"length":Ne(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),Ne(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{ut(a,RegExp(xo(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Ot(a,"ipv4",s.message,e),s.version!=="v4"&&Ot(a,"ipv6",s.message,e);break}case"base64url":ut(a,Tt.base64url,s.message,e);break;case"jwt":ut(a,Tt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ut(a,Tt.ipv4Cidr,s.message,e),s.version!=="v4"&&ut(a,Tt.ipv6Cidr,s.message,e);break}case"emoji":ut(a,Tt.emoji(),s.message,e);break;case"ulid":{ut(a,Tt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ot(a,"binary",s.message,e);break}case"contentEncoding:base64":{Ne(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{ut(a,Tt.base64,s.message,e);break}}break}case"nanoid":ut(a,Tt.nanoid,s.message,e)}return a}function xo(t,e){return e.patternStrategy==="escape"?xy(t):t}const Dy=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function xy(t){let e="";for(let a=0;a<t.length;a++)Dy.has(t[a])||(e+="\\"),e+=t[a];return e}function Ot(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&s.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):Ne(t,"format",e,a,s)}function ut(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&s.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:rd(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):Ne(t,"pattern",rd(e,s),a,s)}function rd(t,e){var l;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=a.i?t.source.toLowerCase():t.source;let r="",n=!1,o=!1,i=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(a.i){if(o){if(s[c].match(/[a-z]/)){i?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),i=!1):s[c+1]==="-"&&((l=s[c+2])!=null&&l.match(/[a-z]/))?(r+=s[c],i=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(a.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
13
13
|
]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
|
|
14
14
|
]))`;continue}}if(a.s&&s[c]==="."){r+=o?`${s[c]}\r
|
|
15
15
|
`:`[${s[c]}\r
|
|
16
|
-
]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return r}function ed(t,e){var s,r,n,o,i,l;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=t.keyType)==null?void 0:s._def.typeName)===J.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,u)=>({...c,[u]:Ce(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??ht(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Ce(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return a;if(((r=t.keyType)==null?void 0:r._def.typeName)===J.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:c,...u}=Xu(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===J.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===J.ZodBranded&&t.keyType._def.type._def.typeName===J.ZodString&&((l=t.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=Gu(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function by(t,e){if(e.mapStrategy==="record")return ed(t,e);const a=Ce(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ht(e),s=Ce(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ht(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function Py(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Ey(t){return t.target==="openAi"?void 0:{not:ht({...t,currentPath:[...t.currentPath,"not"]})}}function Sy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const Zs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ry(t,e){if(e.target==="openApi3")return td(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in Zs&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const o=Zs[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===a.length){const r=s.filter((n,o,i)=>i.indexOf(n)===o);return{type:r.length>1?r:r[0],enum:a.reduce((n,o)=>n.includes(o._def.value)?n:[...n,o._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return td(t,e)}const td=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Ce(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function ky(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Zs[t.innerType._def.typeName],nullable:!0}:{type:[Zs[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Ce(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Ce(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function Ty(t,e){const a={type:"number"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"int":a.type="integer",Ju(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?Ne(a,"minimum",s.value,s.message,e):Ne(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Ne(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Ne(a,"maximum",s.value,s.message,e):Ne(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Ne(a,"maximum",s.value,s.message,e));break;case"multipleOf":Ne(a,"multipleOf",s.value,s.message,e);break}return a}function Oy(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const i in n){let l=n[i];if(l===void 0||l._def===void 0)continue;let c=Iy(l);c&&a&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Ce(l._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});u!==void 0&&(s.properties[i]=u,c||r.push(i))}r.length&&(s.required=r);const o=Cy(t,e);return o!==void 0&&(s.additionalProperties=o),s}function Cy(t,e){if(t.catchall._def.typeName!=="ZodNever")return Ce(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Iy(t){try{return t.isOptional()}catch{return!0}}const Ny=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Ce(t.innerType._def,e);const a=Ce(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ht(e)},a]}:ht(e)},Ay=(t,e)=>{if(e.pipeStrategy==="input")return Ce(t.in._def,e);if(e.pipeStrategy==="output")return Ce(t.out._def,e);const a=Ce(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Ce(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function jy(t,e){return Ce(t.type._def,e)}function Dy(t,e){const s={type:"array",uniqueItems:!0,items:Ce(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Ne(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ne(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function xy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Ce(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Ce(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Ce(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function My(t){return{not:ht(t)}}function Ly(t){return ht(t)}const Fy=(t,e)=>Ce(t.innerType._def,e),qy=(t,e,a)=>{switch(e){case J.ZodString:return Xu(t,a);case J.ZodNumber:return Ty(t,a);case J.ZodObject:return Oy(t,a);case J.ZodBigInt:return uy(t,a);case J.ZodBoolean:return dy();case J.ZodDate:return Wu(t,a);case J.ZodUndefined:return My(a);case J.ZodNull:return Sy(a);case J.ZodArray:return cy(t,a);case J.ZodUnion:case J.ZodDiscriminatedUnion:return Ry(t,a);case J.ZodIntersection:return yy(t,a);case J.ZodTuple:return xy(t,a);case J.ZodRecord:return ed(t,a);case J.ZodLiteral:return _y(t,a);case J.ZodEnum:return vy(t);case J.ZodNativeEnum:return Py(t);case J.ZodNullable:return ky(t,a);case J.ZodOptional:return Ny(t,a);case J.ZodMap:return by(t,a);case J.ZodSet:return Dy(t,a);case J.ZodLazy:return()=>t.getter()._def;case J.ZodPromise:return jy(t,a);case J.ZodNaN:case J.ZodNever:return Ey(a);case J.ZodEffects:return my(t,a);case J.ZodAny:return ht(a);case J.ZodUnknown:return Ly(a);case J.ZodDefault:return py(t,a);case J.ZodBranded:return Gu(t,a);case J.ZodReadonly:return Fy(t,a);case J.ZodCatch:return fy(t,a);case J.ZodPipeline:return Ay(t,a);case J.ZodFunction:case J.ZodVoid:case J.ZodSymbol:return;default:return(s=>{})()}};function Ce(t,e,a=!1){var i;const s=e.seen.get(t);if(e.override){const l=(i=e.override)==null?void 0:i.call(e,t,e,s,a);if(l!==iy)return l}if(s&&!a){const l=Uy(s,e);if(l!==void 0)return l}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=qy(t,t.typeName,e),o=typeof n=="function"?Ce(n(),e):n;if(o&&Vy(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return r.jsonSchema=o,l}return r.jsonSchema=o,o}const Uy=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Qu(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ht(e)):e.$refStrategy==="seen"?ht(e):void 0}},Vy=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),rd=(t,e)=>{const a=ly(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Ce(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,c]},!0)??ht(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Ce(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??ht(a),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),a.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[a.openAiAnyTypeName]||(s[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:a.$refStrategy==="relative"?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const i=r===void 0?s?{...n,[a.definitionPath]:s}:n:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...s,[r]:n}};return a.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(a.target==="jsonSchema2019-09"||a.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),a.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};class zy{constructor(e,a){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ny(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ys.shape.method.value),this.server.assertCanSetRequestHandler($s.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(ys,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,a])=>{const s={name:e,title:a.title,description:a.description,inputSchema:a.inputSchema?rd(a.inputSchema,{strictUnions:!0}):Zy,annotations:a.annotations};return a.outputSchema&&(s.outputSchema=rd(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler($s,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new je(O.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new je(O.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){const n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new je(O.ErrorCode.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);const o=n.data,i=s.callback;try{r=await Promise.resolve(i(o,a))}catch(l){r={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(o){r={content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new je(O.ErrorCode.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new je(O.ErrorCode.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ws.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ws,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new je(O.ErrorCode.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,a){const s=this._registeredPrompts[a.name];if(!s)throw new je(O.ErrorCode.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new je(O.ErrorCode.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return Ks;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof ga))return Ks;const o=await r._def.complete(e.params.argument.value,e.params.context);return sd(o)}async handleResourceCompletion(e,a){const s=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===a.uri);if(!s){if(this._registeredResources[a.uri])return Ks;throw new je(O.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Ks;const n=await r(e.params.argument.value,e.params.context);return sd(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(us.shape.method.value),this.server.assertCanSetRequestHandler(ds.shape.method.value),this.server.assertCanSetRequestHandler(fs.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(us,async(e,a)=>{const s=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),r=[];for(const n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;const o=await n.resourceTemplate.listCallback(a);for(const i of o.resources)r.push({...n.metadata,...i})}return{resources:[...s,...r]}}),this.server.setRequestHandler(ds,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(fs,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new je(O.ErrorCode.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,a)}for(const n of Object.values(this._registeredResourceTemplates)){const o=n.resourceTemplate.uriTemplate.match(s.toString());if(o)return n.readCallback(s,o,a)}throw new je(O.ErrorCode.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(hs.shape.method.value),this.server.assertCanSetRequestHandler(ps.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(hs,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,a])=>({name:e,title:a.title,description:a.description,arguments:a.argsSchema?By(a.argsSchema):void 0}))})),this.server.setRequestHandler(ps,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new je(O.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new je(O.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new je(O.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);const n=r.data,o=s.callback;return await Promise.resolve(o(n,a))}else{const r=s.callback;return await Promise.resolve(r(a))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,a,...s){let r;typeof s[0]=="object"&&(r=s.shift());const n=s[0];if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const o=this._createRegisteredResource(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const o=this._createRegisteredResourceTemplate(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,a,s,r){if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const n=this._createRegisteredResource(e,s.title,a,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const n=this._createRegisteredResourceTemplate(e,s.title,a,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,a,s,r,n){const o={name:e,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==s&&(delete this._registeredResources[s],i.uri&&(this._registeredResources[i.uri]=o)),typeof i.name<"u"&&(o.name=i.name),typeof i.title<"u"&&(o.title=i.title),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=o,o}_createRegisteredResourceTemplate(e,a,s,r,n){const o={resourceTemplate:s,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredResourceTemplates[e],i.name&&(this._registeredResourceTemplates[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.template<"u"&&(o.resourceTemplate=i.template),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,a,s,r,n){const o={title:a,description:s,argsSchema:r===void 0?void 0:W(r),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.description<"u"&&(o.description=i.description),typeof i.argsSchema<"u"&&(o.argsSchema=W(i.argsSchema)),typeof i.callback<"u"&&(o.callback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,a,s,r,n,o,i){const l={title:a,description:s,inputSchema:r===void 0?void 0:W(r),outputSchema:n===void 0?void 0:W(n),annotations:o,callback:i,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==e&&(delete this._registeredTools[e],c.name&&(this._registeredTools[c.name]=l)),typeof c.title<"u"&&(l.title=c.title),typeof c.description<"u"&&(l.description=c.description),typeof c.paramsSchema<"u"&&(l.inputSchema=W(c.paramsSchema)),typeof c.callback<"u"&&(l.callback=c.callback),typeof c.annotations<"u"&&(l.annotations=c.annotations),typeof c.enabled<"u"&&(l.enabled=c.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,o;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const l=a[0];ad(l)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!ad(a[0])&&(o=a.shift())):typeof l=="object"&&l!==null&&(o=a.shift())}const i=a[0];return this._createRegisteredTool(e,void 0,s,r,n,o,i)}registerTool(e,a,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:r,description:n,inputSchema:o,outputSchema:i,annotations:l}=a;return this._createRegisteredTool(e,r,n,o,i,l,s)}prompt(e,...a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof a[0]=="string"&&(s=a.shift());let r;a.length>1&&(r=a.shift());const n=a[0],o=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,a,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:r,description:n,argsSchema:o}=a,i=this._createRegisteredPrompt(e,r,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class Hy{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new Bt(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var a;return(a=this._callbacks.complete)===null||a===void 0?void 0:a[e]}}const Zy={type:"object",properties:{}};function ad(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Ky)}function Ky(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function By(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function sd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const Ks={completion:{values:[],hasMore:!1}};O.Ajv=Np,O.AudioContentSchema=gs,O.BaseMetadataSchema=Mr,O.BlobResourceContentsSchema=bi,O.BooleanSchemaSchema=Rc,O.CallToolRequestSchema=$s,O.CallToolResultSchema=_s,O.CancelledNotificationSchema=ns,O.Client=Ig,O.ClientCapabilitiesSchema=rc,O.ClientNotificationSchema=fm,O.ClientRequestSchema=dm,O.ClientResultSchema=hm,O.CompatibilityCallToolResultSchema=cm,O.Completable=ga,O.CompleteRequestSchema=ws,O.CompleteResultSchema=Di,O.ContentBlockSchema=Ti,O.CreateMessageRequestSchema=Sc,O.CreateMessageResultSchema=Ni,O.CursorSchema=di,O.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=im,O.DEFAULT_REQUEST_TIMEOUT_MSEC=Lc,O.ElicitRequestSchema=Ic,O.ElicitResultSchema=Ai,O.EmbeddedResourceSchema=hc,O.EmptyResultSchema=tr,O.EnumSchemaSchema=Oc,O.GetPromptRequestSchema=ps,O.GetPromptResultSchema=Oi,O.ImageContentSchema=vs,O.ImplementationSchema=gi,O.InitializeRequestSchema=is,O.InitializeResultSchema=yi,O.InitializedNotificationSchema=os,O.JSONRPCErrorSchema=vi,O.JSONRPCMessageSchema=pa,O.JSONRPCNotificationSchema=pi,O.JSONRPCRequestSchema=fi,O.JSONRPCResponseSchema=mi,O.JSONRPC_VERSION=da,O.LATEST_PROTOCOL_VERSION=yr,O.ListPromptsRequestSchema=hs,O.ListPromptsResultSchema=ki,O.ListResourceTemplatesRequestSchema=ds,O.ListResourceTemplatesResultSchema=Si,O.ListResourcesRequestSchema=us,O.ListResourcesResultSchema=Ei,O.ListRootsRequestSchema=jc,O.ListRootsResultSchema=xi,O.ListToolsRequestSchema=ys,O.ListToolsResultSchema=Ci,O.LoggingLevelSchema=Ii,O.LoggingMessageNotificationSchema=wc,O.McpError=je,O.McpServer=zy,O.ModelHintSchema=bc,O.ModelPreferencesSchema=Pc,O.NotificationSchema=St,O.NumberSchemaSchema=Tc,O.PaginatedRequestSchema=ma,O.PaginatedResultSchema=va,O.PingRequestSchema=ls,O.PrimitiveSchemaDefinitionSchema=Cc,O.ProgressNotificationSchema=cs,O.ProgressSchema=nc,O.ProgressTokenSchema=ui,O.PromptArgumentSchema=dc,O.PromptListChangedNotificationSchema=vc,O.PromptMessageSchema=mc,O.PromptReferenceSchema=Nc,O.PromptSchema=fc,O.Protocol=Li,O.ReadResourceRequestSchema=fs,O.ReadResourceResultSchema=Ri,O.RequestIdSchema=ha,O.RequestSchema=lt,O.ResourceContentsSchema=_i,O.ResourceLinkSchema=pc,O.ResourceListChangedNotificationSchema=oc,O.ResourceReferenceSchema=um,O.ResourceSchema=Pi,O.ResourceTemplate=Hy,O.ResourceTemplateReferenceSchema=ji,O.ResourceTemplateSchema=ic,O.ResourceUpdatedNotificationSchema=uc,O.ResultSchema=pt,O.RootSchema=Ac,O.RootsListChangedNotificationSchema=Dc,O.SSEClientTransport=ty,O.SUPPORTED_PROTOCOL_VERSIONS=ci,O.SamplingMessageSchema=Ec,O.ServerCapabilitiesSchema=ac,O.ServerNotificationSchema=mm,O.ServerRequestSchema=pm,O.ServerResultSchema=vm,O.SetLevelRequestSchema=$c,O.SseError=Ku,O.StreamableHTTPClientTransport=sy,O.StreamableHTTPError=Hs,O.StringSchemaSchema=kc,O.SubscribeRequestSchema=lc,O.TextContentSchema=ms,O.TextResourceContentsSchema=$i,O.ToolAnnotationsSchema=gc,O.ToolListChangedNotificationSchema=_c,O.ToolSchema=yc,O.UnauthorizedError=Rt,O.UnsubscribeRequestSchema=cc,O.UriTemplate=Bt,O.auth=$r,O.buildDiscoveryUrls=ju,O.completable=ym,O.discoverAuthorizationServerMetadata=Du,O.discoverOAuthMetadata=Wg,O.discoverOAuthProtectedResourceMetadata=Iu,O.exchangeAuthorization=Mu,O.extractResourceMetadataUrl=qs,O.getDisplayName=$m,O.isInitializeRequest=lm,O.isInitializedNotification=sc,O.isJSONRPCError=tc,O.isJSONRPCNotification=ec,O.isJSONRPCRequest=hi,O.isJSONRPCResponse=ss,O.mergeCapabilities=Fi,O.parseErrorResponse=Fs,O.refreshAuthorization=Lu,O.registerClient=Fu,O.selectResourceURL=Cu,O.startAuthorization=xu,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|
|
16
|
+
]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return r}function ad(t,e){var s,r,n,o,i,l;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=t.keyType)==null?void 0:s._def.typeName)===Z.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,u)=>({...c,[u]:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??pt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return a;if(((r=t.keyType)==null?void 0:r._def.typeName)===Z.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:c,...u}=td(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===Z.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===Z.ZodBranded&&t.keyType._def.type._def.typeName===Z.ZodString&&((l=t.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=Yu(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function My(t,e){if(e.mapStrategy==="record")return ad(t,e);const a=Ie(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pt(e),s=Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pt(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function Ly(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Fy(t){return t.target==="openAi"?void 0:{not:pt({...t,currentPath:[...t.currentPath,"not"]})}}function qy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const Ks={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Uy(t,e){if(e.target==="openApi3")return sd(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in Ks&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const o=Ks[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===a.length){const r=s.filter((n,o,i)=>i.indexOf(n)===o);return{type:r.length>1?r:r[0],enum:a.reduce((n,o)=>n.includes(o._def.value)?n:[...n,o._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return sd(t,e)}const sd=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Ie(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function Vy(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Ks[t.innerType._def.typeName],nullable:!0}:{type:[Ks[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function zy(t,e){const a={type:"number"};if(!t.checks)return a;for(const s of t.checks)switch(s.kind){case"int":a.type="integer",Wu(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?Ne(a,"minimum",s.value,s.message,e):Ne(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Ne(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Ne(a,"maximum",s.value,s.message,e):Ne(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Ne(a,"maximum",s.value,s.message,e));break;case"multipleOf":Ne(a,"multipleOf",s.value,s.message,e);break}return a}function Hy(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const i in n){let l=n[i];if(l===void 0||l._def===void 0)continue;let c=Ky(l);c&&a&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Ie(l._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});u!==void 0&&(s.properties[i]=u,c||r.push(i))}r.length&&(s.required=r);const o=Zy(t,e);return o!==void 0&&(s.additionalProperties=o),s}function Zy(t,e){if(t.catchall._def.typeName!=="ZodNever")return Ie(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Ky(t){try{return t.isOptional()}catch{return!0}}const By=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Ie(t.innerType._def,e);const a=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:pt(e)},a]}:pt(e)},Jy=(t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);const a=Ie(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Ie(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Qy(t,e){return Ie(t.type._def,e)}function Gy(t,e){const s={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Ne(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ne(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function Wy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Ie(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Ie(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Ie(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Xy(t){return{not:pt(t)}}function Yy(t){return pt(t)}const e_=(t,e)=>Ie(t.innerType._def,e),t_=(t,e,a)=>{switch(e){case Z.ZodString:return td(t,a);case Z.ZodNumber:return zy(t,a);case Z.ZodObject:return Hy(t,a);case Z.ZodBigInt:return Sy(t,a);case Z.ZodBoolean:return Ry();case Z.ZodDate:return ed(t,a);case Z.ZodUndefined:return Xy(a);case Z.ZodNull:return qy(a);case Z.ZodArray:return Ey(t,a);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return Uy(t,a);case Z.ZodIntersection:return Ay(t,a);case Z.ZodTuple:return Wy(t,a);case Z.ZodRecord:return ad(t,a);case Z.ZodLiteral:return jy(t,a);case Z.ZodEnum:return Iy(t);case Z.ZodNativeEnum:return Ly(t);case Z.ZodNullable:return Vy(t,a);case Z.ZodOptional:return By(t,a);case Z.ZodMap:return My(t,a);case Z.ZodSet:return Gy(t,a);case Z.ZodLazy:return()=>t.getter()._def;case Z.ZodPromise:return Qy(t,a);case Z.ZodNaN:case Z.ZodNever:return Fy(a);case Z.ZodEffects:return Cy(t,a);case Z.ZodAny:return pt(a);case Z.ZodUnknown:return Yy(a);case Z.ZodDefault:return Oy(t,a);case Z.ZodBranded:return Yu(t,a);case Z.ZodReadonly:return e_(t,a);case Z.ZodCatch:return ky(t,a);case Z.ZodPipeline:return Jy(t,a);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(s=>{})()}};function Ie(t,e,a=!1){var i;const s=e.seen.get(t);if(e.override){const l=(i=e.override)==null?void 0:i.call(e,t,e,s,a);if(l!==wy)return l}if(s&&!a){const l=r_(s,e);if(l!==void 0)return l}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=t_(t,t.typeName,e),o=typeof n=="function"?Ie(n(),e):n;if(o&&a_(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return r.jsonSchema=o,l}return r.jsonSchema=o,o}const r_=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Xu(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pt(e)):e.$refStrategy==="seen"?pt(e):void 0}},a_=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),nd=(t,e)=>{const a=Py(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Ie(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,c]},!0)??pt(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Ie(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??pt(a),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),a.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[a.openAiAnyTypeName]||(s[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:a.$refStrategy==="relative"?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const i=r===void 0?s?{...n,[a.definitionPath]:s}:n:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...s,[r]:n}};return a.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(a.target==="jsonSchema2019-09"||a.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),a.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};class s_{constructor(e,a){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new $y(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(_s.shape.method.value),this.server.assertCanSetRequestHandler(ws.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(_s,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,a])=>{const s={name:e,title:a.title,description:a.description,inputSchema:a.inputSchema?nd(a.inputSchema,{strictUnions:!0}):i_,annotations:a.annotations};return a.outputSchema&&(s.outputSchema=nd(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(ws,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new je(T.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new je(T.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);let r;if(s.inputSchema){const n=await s.inputSchema.safeParseAsync(e.params.arguments);if(!n.success)throw new je(T.ErrorCode.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);const o=n.data,i=s.callback;try{r=await Promise.resolve(i(o,a))}catch(l){r={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(o){r={content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new je(T.ErrorCode.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const n=await s.outputSchema.safeParseAsync(r.structuredContent);if(!n.success)throw new je(T.ErrorCode.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(bs.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(bs,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new je(T.ErrorCode.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,a){const s=this._registeredPrompts[a.name];if(!s)throw new je(T.ErrorCode.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new je(T.ErrorCode.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return Bs;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof _a))return Bs;const o=await r._def.complete(e.params.argument.value,e.params.context);return od(o)}async handleResourceCompletion(e,a){const s=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===a.uri);if(!s){if(this._registeredResources[a.uri])return Bs;throw new je(T.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Bs;const n=await r(e.params.argument.value,e.params.context);return od(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ds.shape.method.value),this.server.assertCanSetRequestHandler(fs.shape.method.value),this.server.assertCanSetRequestHandler(hs.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ds,async(e,a)=>{const s=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),r=[];for(const n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;const o=await n.resourceTemplate.listCallback(a);for(const i of o.resources)r.push({...n.metadata,...i})}return{resources:[...s,...r]}}),this.server.setRequestHandler(fs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(hs,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new je(T.ErrorCode.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,a)}for(const n of Object.values(this._registeredResourceTemplates)){const o=n.resourceTemplate.uriTemplate.match(s.toString());if(o)return n.readCallback(s,o,a)}throw new je(T.ErrorCode.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(ps.shape.method.value),this.server.assertCanSetRequestHandler(ms.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ps,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,a])=>({name:e,title:a.title,description:a.description,arguments:a.argsSchema?l_(a.argsSchema):void 0}))})),this.server.setRequestHandler(ms,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new je(T.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new je(T.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new je(T.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);const n=r.data,o=s.callback;return await Promise.resolve(o(n,a))}else{const r=s.callback;return await Promise.resolve(r(a))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,a,...s){let r;typeof s[0]=="object"&&(r=s.shift());const n=s[0];if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const o=this._createRegisteredResource(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const o=this._createRegisteredResourceTemplate(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,a,s,r){if(typeof a=="string"){if(this._registeredResources[a])throw new Error(`Resource ${a} is already registered`);const n=this._createRegisteredResource(e,s.title,a,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const n=this._createRegisteredResourceTemplate(e,s.title,a,s,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,a,s,r,n){const o={name:e,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==s&&(delete this._registeredResources[s],i.uri&&(this._registeredResources[i.uri]=o)),typeof i.name<"u"&&(o.name=i.name),typeof i.title<"u"&&(o.title=i.title),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=o,o}_createRegisteredResourceTemplate(e,a,s,r,n){const o={resourceTemplate:s,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredResourceTemplates[e],i.name&&(this._registeredResourceTemplates[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.template<"u"&&(o.resourceTemplate=i.template),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,a,s,r,n){const o={title:a,description:s,argsSchema:r===void 0?void 0:W(r),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.description<"u"&&(o.description=i.description),typeof i.argsSchema<"u"&&(o.argsSchema=W(i.argsSchema)),typeof i.callback<"u"&&(o.callback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,a,s,r,n,o,i){const l={title:a,description:s,inputSchema:r===void 0?void 0:W(r),outputSchema:n===void 0?void 0:W(n),annotations:o,callback:i,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==e&&(delete this._registeredTools[e],c.name&&(this._registeredTools[c.name]=l)),typeof c.title<"u"&&(l.title=c.title),typeof c.description<"u"&&(l.description=c.description),typeof c.paramsSchema<"u"&&(l.inputSchema=W(c.paramsSchema)),typeof c.callback<"u"&&(l.callback=c.callback),typeof c.annotations<"u"&&(l.annotations=c.annotations),typeof c.enabled<"u"&&(l.enabled=c.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,o;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const l=a[0];id(l)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!id(a[0])&&(o=a.shift())):typeof l=="object"&&l!==null&&(o=a.shift())}const i=a[0];return this._createRegisteredTool(e,void 0,s,r,n,o,i)}registerTool(e,a,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:r,description:n,inputSchema:o,outputSchema:i,annotations:l}=a;return this._createRegisteredTool(e,r,n,o,i,l,s)}prompt(e,...a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof a[0]=="string"&&(s=a.shift());let r;a.length>1&&(r=a.shift());const n=a[0],o=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,a,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:r,description:n,argsSchema:o}=a,i=this._createRegisteredPrompt(e,r,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class n_{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new Bt(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var a;return(a=this._callbacks.complete)===null||a===void 0?void 0:a[e]}}const i_={type:"object",properties:{}};function id(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(o_)}function o_(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function l_(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function od(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const Bs={completion:{values:[],hasMore:!1}};T.Ajv=Bp,T.AudioContentSchema=ys,T.BaseMetadataSchema=Lr,T.BlobResourceContentsSchema=Si,T.BooleanSchemaSchema=Oc,T.CallToolRequestSchema=ws,T.CallToolResultSchema=$s,T.CancelledNotificationSchema=is,T.Client=Kg,T.ClientCapabilitiesSchema=nc,T.ClientNotificationSchema=km,T.ClientRequestSchema=Rm,T.ClientResultSchema=Tm,T.CompatibilityCallToolResultSchema=Em,T.Completable=_a,T.CompleteRequestSchema=bs,T.CompleteResultSchema=Li,T.ContentBlockSchema=Ii,T.CreateMessageRequestSchema=Tc,T.CreateMessageResultSchema=Di,T.CursorSchema=pi,T.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=wm,T.DEFAULT_REQUEST_TIMEOUT_MSEC=Uc,T.ElicitRequestSchema=jc,T.ElicitResultSchema=xi,T.EmbeddedResourceSchema=vc,T.EmptyResultSchema=rr,T.EnumSchemaSchema=Nc,T.GetPromptRequestSchema=ms,T.GetPromptResultSchema=Ni,T.ImageContentSchema=gs,T.ImplementationSchema=$i,T.InitializeRequestSchema=os,T.InitializeResultSchema=wi,T.InitializedNotificationSchema=ls,T.JSONRPCErrorSchema=_i,T.JSONRPCMessageSchema=va,T.JSONRPCNotificationSchema=gi,T.JSONRPCRequestSchema=mi,T.JSONRPCResponseSchema=yi,T.JSONRPC_VERSION=ha,T.LATEST_PROTOCOL_VERSION=_r,T.ListPromptsRequestSchema=ps,T.ListPromptsResultSchema=Ci,T.ListResourceTemplatesRequestSchema=fs,T.ListResourceTemplatesResultSchema=Ti,T.ListResourcesRequestSchema=ds,T.ListResourcesResultSchema=ki,T.ListRootsRequestSchema=Mc,T.ListRootsResultSchema=Fi,T.ListToolsRequestSchema=_s,T.ListToolsResultSchema=Ai,T.LoggingLevelSchema=ji,T.LoggingMessageNotificationSchema=Ec,T.McpError=je,T.McpServer=s_,T.ModelHintSchema=Sc,T.ModelPreferencesSchema=Rc,T.NotificationSchema=St,T.NumberSchemaSchema=Ic,T.PaginatedRequestSchema=ga,T.PaginatedResultSchema=ya,T.PingRequestSchema=cs,T.PrimitiveSchemaDefinitionSchema=Ac,T.ProgressNotificationSchema=us,T.ProgressSchema=lc,T.ProgressTokenSchema=hi,T.PromptArgumentSchema=pc,T.PromptListChangedNotificationSchema=_c,T.PromptMessageSchema=yc,T.PromptReferenceSchema=Dc,T.PromptSchema=mc,T.Protocol=Ui,T.ReadResourceRequestSchema=hs,T.ReadResourceResultSchema=Oi,T.RequestIdSchema=ma,T.RequestSchema=ct,T.ResourceContentsSchema=bi,T.ResourceLinkSchema=gc,T.ResourceListChangedNotificationSchema=uc,T.ResourceReferenceSchema=Sm,T.ResourceSchema=Ri,T.ResourceTemplate=n_,T.ResourceTemplateReferenceSchema=Mi,T.ResourceTemplateSchema=cc,T.ResourceUpdatedNotificationSchema=hc,T.ResultSchema=mt,T.RootSchema=xc,T.RootsListChangedNotificationSchema=Lc,T.SSEClientTransport=vy,T.SUPPORTED_PROTOCOL_VERSIONS=fi,T.SamplingMessageSchema=kc,T.ServerCapabilitiesSchema=ic,T.ServerNotificationSchema=Cm,T.ServerRequestSchema=Om,T.ServerResultSchema=Im,T.SetLevelRequestSchema=Pc,T.SseError=Qu,T.StreamableHTTPClientTransport=_y,T.StreamableHTTPError=Zs,T.StringSchemaSchema=Cc,T.SubscribeRequestSchema=dc,T.TextContentSchema=vs,T.TextResourceContentsSchema=Pi,T.ToolAnnotationsSchema=$c,T.ToolListChangedNotificationSchema=bc,T.ToolSchema=wc,T.UnauthorizedError=Rt,T.UnsubscribeRequestSchema=fc,T.UriTemplate=Bt,T.auth=wr,T.buildDiscoveryUrls=Mu,T.completable=Am,T.discoverAuthorizationServerMetadata=Lu,T.discoverOAuthMetadata=fy,T.discoverOAuthProtectedResourceMetadata=ju,T.exchangeAuthorization=qu,T.extractResourceMetadataUrl=Us,T.getDisplayName=Dm,T.isInitializeRequest=Pm,T.isInitializedNotification=oc,T.isJSONRPCError=sc,T.isJSONRPCNotification=ac,T.isJSONRPCRequest=vi,T.isJSONRPCResponse=ns,T.mergeCapabilities=Vi,T.parseErrorResponse=qs,T.refreshAuthorization=Uu,T.registerClient=Vu,T.selectResourceURL=Au,T.startAuthorization=Fu,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|