@opentiny/next-sdk 0.1.14 → 0.1.15
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/agent/AgentModelProvider.ts +49 -20
- package/agent/type.ts +4 -4
- package/dist/McpSdk.d.ts +14 -0
- package/dist/WebAgent.d.ts +5 -0
- package/dist/WebMcp.d.ts +20 -0
- package/dist/WebMcpClient.d.ts +250 -1152
- package/dist/WebMcpServer.d.ts +190 -78
- package/dist/Zod.d.ts +1 -0
- package/dist/agent/AgentModelProvider.d.ts +6 -4
- package/dist/agent/type.d.ts +6 -2
- package/dist/agent/utils/getAISDKTools.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.es.dev.js +21741 -23457
- package/dist/index.es.js +24309 -23733
- package/dist/index.js +1789 -25
- package/dist/index.umd.dev.js +21720 -23436
- package/dist/index.umd.js +184 -132
- package/dist/{mcpsdk@1.17.0.dev.js → mcpsdk@1.23.0.dev.js} +14784 -15255
- package/dist/{mcpsdk@1.17.0.es.dev.js → mcpsdk@1.23.0.es.dev.js} +14787 -15258
- package/dist/mcpsdk@1.23.0.es.js +15584 -0
- package/dist/mcpsdk@1.23.0.js +43 -0
- package/dist/remoter/createRemoter.d.ts +9 -0
- package/dist/remoter/tooltips.d.ts +36 -0
- package/dist/script/utils.d.ts +1 -0
- package/dist/transport/ExtensionClientTransport.d.ts +3 -2
- package/dist/transport/ExtensionContentServerTransport.d.ts +3 -2
- package/dist/transport/ExtensionPageServerTransport.d.ts +3 -2
- package/dist/vite-build-tsc.d.ts +2 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.mcpSdk.d.ts +2 -0
- package/dist/vite.config.webAgent.d.ts +2 -0
- package/dist/vite.config.webMcp.d.ts +2 -0
- package/dist/vite.config.webMcpFull.d.ts +2 -0
- package/dist/vite.config.zod.d.ts +2 -0
- package/dist/webagent.dev.js +18780 -18491
- package/dist/webagent.es.dev.js +18455 -18166
- package/dist/webagent.es.js +22389 -20343
- package/dist/webagent.js +172 -113
- package/dist/webmcp-full.dev.js +14943 -15356
- package/dist/webmcp-full.es.dev.js +14959 -15372
- package/dist/webmcp-full.es.js +13785 -12666
- package/dist/webmcp-full.js +43 -16
- package/package.json +3 -2
- package/remoter/createRemoter.ts +126 -71
- package/remoter/tooltips.ts +260 -0
- package/tsconfig.json +5 -3
- package/vite-build-tsc.ts +60 -0
- package/vite-env.d.ts +5 -0
- package/dist/WebMcpClient.js +0 -363
- package/dist/WebMcpServer.js +0 -283
- package/dist/agent/AgentModelProvider.js +0 -293
- package/dist/agent/type.js +0 -1
- package/dist/agent/utils/getAISDKTools.js +0 -36
- package/dist/mcpsdk@1.17.0.es.js +0 -14505
- package/dist/mcpsdk@1.17.0.js +0 -16
- package/dist/remoter/QrCode.js +0 -55
- package/dist/remoter/createRemoter.js +0 -743
- package/dist/transport/ExtensionClientTransport.js +0 -81
- package/dist/transport/ExtensionContentServerTransport.js +0 -128
- package/dist/transport/ExtensionPageServerTransport.js +0 -118
- package/dist/transport/messages.js +0 -51
- package/dist/utils/uuid.js +0 -10
package/dist/mcpsdk@1.17.0.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
(function(R,ta){typeof exports=="object"&&typeof module<"u"?ta(exports):typeof define=="function"&&define.amd?define(["exports"],ta):(R=typeof globalThis<"u"?globalThis:R||self,ta(R.MCPSDK={}))})(this,function(R){"use strict";var ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Go(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ln={exports:{}},Wo={},wt={},Nr={},ra={},ge={},aa={};(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((E,T)=>`${E}${T}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((E,T)=>(T instanceof a&&(E[T.str]=(E[T.str]||0)+1),E),{})}}t._Code=s,t.nil=new s("");function r(v,...$){const E=[v[0]];let T=0;for(;T<$.length;)o(E,$[T]),E.push(v[++T]);return new s(E)}t._=r;const n=new s("+");function i(v,...$){const E=[f(v[0])];let T=0;for(;T<$.length;)E.push(n),o(E,$[T]),E.push(n,f(v[++T]));return c(E),new s(E)}t.str=i;function o(v,$){$ instanceof s?v.push(...$._items):$ instanceof a?v.push($):v.push(d($))}t.addCodeArg=o;function c(v){let $=1;for(;$<v.length-1;){if(v[$]===n){const E=l(v[$-1],v[$+1]);if(E!==void 0){v.splice($-1,3,E);continue}v[$++]="+"}$++}}function l(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()?$:i`${v}${$}`}t.strConcat=u;function d(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:f(Array.isArray(v)?v.join(","):v)}function y(v){return new s(f(v))}t.stringify=y;function f(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;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})(aa);var cn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=aa;class a extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var s;(function(c){c[c.Started=0]="Started",c[c.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:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const u=this._names[l]||this._nameGroup(l);return`${l}${u.index++}`}_nameGroup(l){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=r;class n extends e.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:d}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends r{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?i:e.nil}}get(){return this._scope}name(l){return new n(l,this._newName(l))}value(l,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const y=this.toName(l),{prefix:f}=y,m=(d=u.key)!==null&&d!==void 0?d:u.ref;let p=this._values[f];if(p){const $=p.get(m);if($)return $}else p=this._values[f]=new Map;p.set(m,y);const h=this._scope[f]||(this._scope[f]=[]),v=h.length;return h[v]=u.ref,y.setValue(u,{property:f,itemIndex:v}),y}getValue(l,u){const d=this._values[l];if(d)return d.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${l}${d.scopePath}`})}scopeCode(l=this._values,u,d){return this._reduceValues(l,y=>{if(y.value===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return y.value.code},u,d)}_reduceValues(l,u,d={},y){let f=e.nil;for(const m in l){const p=l[m];if(!p)continue;const h=d[m]=d[m]||new Map;p.forEach(v=>{if(h.has(v))return;h.set(v,s.Started);let $=u(v);if($){const E=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${E} ${v} = ${$};${this.opts._n}`}else if($=y==null?void 0:y(v))f=(0,e._)`${f}${$}${this.opts._n}`;else throw new a(v);h.set(v,s.Completed)})}return f}}t.ValueScope=o})(cn),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=aa,a=cn;var s=aa;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=cn;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(g,w){return this}}class i extends n{constructor(g,w,A){super(),this.varKind=g,this.name=w,this.rhs=A}render({es5:g,_n:w}){const A=g?a.varKinds.var:this.varKind,Z=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${Z};`+w}optimizeNames(g,w){if(g[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,g,w)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(g,w,A){super(),this.lhs=g,this.rhs=w,this.sideEffects=A}render({_n:g}){return`${this.lhs} = ${this.rhs};`+g}optimizeNames(g,w){if(!(this.lhs instanceof e.Name&&!g[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,g,w),this}get names(){const g=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(g,this.rhs)}}class c extends o{constructor(g,w,A,Z){super(g,A,Z),this.op=w}render({_n:g}){return`${this.lhs} ${this.op}= ${this.rhs};`+g}}class l extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`${this.label}:`+g}}class u extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`break${this.label?` ${this.label}`:""};`+g}}class d extends n{constructor(g){super(),this.error=g}render({_n:g}){return`throw ${this.error};`+g}get names(){return this.error.names}}class y extends n{constructor(g){super(),this.code=g}render({_n:g}){return`${this.code};`+g}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(g,w){return this.code=M(this.code,g,w),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends n{constructor(g=[]){super(),this.nodes=g}render(g){return this.nodes.reduce((w,A)=>w+A.render(g),"")}optimizeNodes(){const{nodes:g}=this;let w=g.length;for(;w--;){const A=g[w].optimizeNodes();Array.isArray(A)?g.splice(w,1,...A):A?g[w]=A:g.splice(w,1)}return g.length>0?this:void 0}optimizeNames(g,w){const{nodes:A}=this;let Z=A.length;for(;Z--;){const Q=A[Z];Q.optimizeNames(g,w)||(re(g,Q.names),A.splice(Z,1))}return A.length>0?this:void 0}get names(){return this.nodes.reduce((g,w)=>B(g,w.names),{})}}class m extends f{render(g){return"{"+g._n+super.render(g)+"}"+g._n}}class p extends f{}class h extends m{}h.kind="else";class v extends m{constructor(g,w){super(w),this.condition=g}render(g){let w=`if(${this.condition})`+super.render(g);return this.else&&(w+="else "+this.else.render(g)),w}optimizeNodes(){super.optimizeNodes();const g=this.condition;if(g===!0)return this.nodes;let w=this.else;if(w){const A=w.optimizeNodes();w=this.else=Array.isArray(A)?new h(A):A}if(w)return g===!1?w instanceof v?w:w.nodes:this.nodes.length?this:new v(_e(g),w instanceof v?[w]:w.nodes);if(!(g===!1||!this.nodes.length))return this}optimizeNames(g,w){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(g,w),!!(super.optimizeNames(g,w)||this.else))return this.condition=M(this.condition,g,w),this}get names(){const g=super.names;return F(g,this.condition),this.else&&B(g,this.else.names),g}}v.kind="if";class $ extends m{}$.kind="for";class E extends ${constructor(g){super(),this.iteration=g}render(g){return`for(${this.iteration})`+super.render(g)}optimizeNames(g,w){if(super.optimizeNames(g,w))return this.iteration=M(this.iteration,g,w),this}get names(){return B(super.names,this.iteration.names)}}class T extends ${constructor(g,w,A,Z){super(),this.varKind=g,this.name=w,this.from=A,this.to=Z}render(g){const w=g.es5?a.varKinds.var:this.varKind,{name:A,from:Z,to:Q}=this;return`for(${w} ${A}=${Z}; ${A}<${Q}; ${A}++)`+super.render(g)}get names(){const g=F(super.names,this.from);return F(g,this.to)}}class C extends ${constructor(g,w,A,Z){super(),this.loop=g,this.varKind=w,this.name=A,this.iterable=Z}render(g){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(g)}optimizeNames(g,w){if(super.optimizeNames(g,w))return this.iterable=M(this.iterable,g,w),this}get names(){return B(super.names,this.iterable.names)}}class x extends m{constructor(g,w,A){super(),this.name=g,this.args=w,this.async=A}render(g){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(g)}}x.kind="func";class K extends f{render(g){return"return "+super.render(g)}}K.kind="return";class V extends m{render(g){let w="try"+super.render(g);return this.catch&&(w+=this.catch.render(g)),this.finally&&(w+=this.finally.render(g)),w}optimizeNodes(){var g,w;return super.optimizeNodes(),(g=this.catch)===null||g===void 0||g.optimizeNodes(),(w=this.finally)===null||w===void 0||w.optimizeNodes(),this}optimizeNames(g,w){var A,Z;return super.optimizeNames(g,w),(A=this.catch)===null||A===void 0||A.optimizeNames(g,w),(Z=this.finally)===null||Z===void 0||Z.optimizeNames(g,w),this}get names(){const g=super.names;return this.catch&&B(g,this.catch.names),this.finally&&B(g,this.finally.names),g}}class z extends m{constructor(g){super(),this.error=g}render(g){return`catch(${this.error})`+super.render(g)}}z.kind="catch";class X extends m{render(g){return"finally"+super.render(g)}}X.kind="finally";class Y{constructor(g,w={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...w,_n:w.lines?`
|
|
2
|
-
`:""},this._extScope=g,this._scope=new a.Scope({parent:g}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(g){return this._scope.name(g)}scopeName(g){return this._extScope.name(g)}scopeValue(g,w){const A=this._extScope.value(g,w);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(g,w){return this._extScope.getValue(g,w)}scopeRefs(g){return this._extScope.scopeRefs(g,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(g,w,A,Z){const Q=this._scope.toName(w);return A!==void 0&&Z&&(this._constants[Q.str]=A),this._leafNode(new i(g,Q,A)),Q}const(g,w,A){return this._def(a.varKinds.const,g,w,A)}let(g,w,A){return this._def(a.varKinds.let,g,w,A)}var(g,w,A){return this._def(a.varKinds.var,g,w,A)}assign(g,w,A){return this._leafNode(new o(g,w,A))}add(g,w){return this._leafNode(new c(g,t.operators.ADD,w))}code(g){return typeof g=="function"?g():g!==e.nil&&this._leafNode(new y(g)),this}object(...g){const w=["{"];for(const[A,Z]of g)w.length>1&&w.push(","),w.push(A),(A!==Z||this.opts.es5)&&(w.push(":"),(0,e.addCodeArg)(w,Z));return w.push("}"),new e._Code(w)}if(g,w,A){if(this._blockNode(new v(g)),w&&A)this.code(w).else().code(A).endIf();else if(w)this.code(w).endIf();else if(A)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(g){return this._elseNode(new v(g))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(g,w){return this._blockNode(g),w&&this.code(w).endFor(),this}for(g,w){return this._for(new E(g),w)}forRange(g,w,A,Z,Q=this.opts.es5?a.varKinds.var:a.varKinds.let){const fe=this._scope.toName(g);return this._for(new T(Q,fe,w,A),()=>Z(fe))}forOf(g,w,A,Z=a.varKinds.const){const Q=this._scope.toName(g);if(this.opts.es5){const fe=w instanceof e.Name?w:this.var("_arr",w);return this.forRange("_i",0,(0,e._)`${fe}.length`,ie=>{this.var(Q,(0,e._)`${fe}[${ie}]`),A(Q)})}return this._for(new C("of",Z,Q,w),()=>A(Q))}forIn(g,w,A,Z=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(g,(0,e._)`Object.keys(${w})`,A);const Q=this._scope.toName(g);return this._for(new C("in",Z,Q,w),()=>A(Q))}endFor(){return this._endBlockNode($)}label(g){return this._leafNode(new l(g))}break(g){return this._leafNode(new u(g))}return(g){const w=new K;if(this._blockNode(w),this.code(g),w.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(K)}try(g,w,A){if(!w&&!A)throw new Error('CodeGen: "try" without "catch" and "finally"');const Z=new V;if(this._blockNode(Z),this.code(g),w){const Q=this.name("e");this._currNode=Z.catch=new z(Q),w(Q)}return A&&(this._currNode=Z.finally=new X,this.code(A)),this._endBlockNode(z,X)}throw(g){return this._leafNode(new d(g))}block(g,w){return this._blockStarts.push(this._nodes.length),g&&this.code(g).endBlock(w),this}endBlock(g){const w=this._blockStarts.pop();if(w===void 0)throw new Error("CodeGen: not in self-balancing block");const A=this._nodes.length-w;if(A<0||g!==void 0&&A!==g)throw new Error(`CodeGen: wrong number of nodes: ${A} vs ${g} expected`);return this._nodes.length=w,this}func(g,w=e.nil,A,Z){return this._blockNode(new x(g,w,A)),Z&&this.code(Z).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(g=1){for(;g-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(g){return this._currNode.nodes.push(g),this}_blockNode(g){this._currNode.nodes.push(g),this._nodes.push(g)}_endBlockNode(g,w){const A=this._currNode;if(A instanceof g||w&&A instanceof w)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${w?`${g.kind}/${w.kind}`:g.kind}"`)}_elseNode(g){const w=this._currNode;if(!(w instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=w.else=g,this}get _root(){return this._nodes[0]}get _currNode(){const g=this._nodes;return g[g.length-1]}set _currNode(g){const w=this._nodes;w[w.length-1]=g}}t.CodeGen=Y;function B(O,g){for(const w in g)O[w]=(O[w]||0)+(g[w]||0);return O}function F(O,g){return g instanceof e._CodeOrName?B(O,g.names):O}function M(O,g,w){if(O instanceof e.Name)return A(O);if(!Z(O))return O;return new e._Code(O._items.reduce((Q,fe)=>(fe instanceof e.Name&&(fe=A(fe)),fe instanceof e._Code?Q.push(...fe._items):Q.push(fe),Q),[]));function A(Q){const fe=w[Q.str];return fe===void 0||g[Q.str]!==1?Q:(delete g[Q.str],fe)}function Z(Q){return Q instanceof e._Code&&Q._items.some(fe=>fe instanceof e.Name&&g[fe.str]===1&&w[fe.str]!==void 0)}}function re(O,g){for(const w in g)O[w]=(O[w]||0)-(g[w]||0)}function _e(O){return typeof O=="boolean"||typeof O=="number"||O===null?!O:(0,e._)`!${D(O)}`}t.not=_e;const ve=S(t.operators.AND);function be(...O){return O.reduce(ve)}t.and=be;const de=S(t.operators.OR);function j(...O){return O.reduce(de)}t.or=j;function S(O){return(g,w)=>g===e.nil?w:w===e.nil?g:(0,e._)`${D(g)} ${O} ${D(w)}`}function D(O){return O instanceof e.Name?O:(0,e._)`(${O})`}}(ge);var G={};Object.defineProperty(G,"__esModule",{value:!0}),G.checkStrictMode=G.getErrorPath=G.Type=G.useFunc=G.setEvaluated=G.evaluatedPropsToName=G.mergeEvaluated=G.eachItem=G.unescapeJsonPointer=G.escapeJsonPointer=G.escapeFragment=G.unescapeFragment=G.schemaRefOrVal=G.schemaHasRulesButRef=G.schemaHasRules=G.checkUnknownRules=G.alwaysValidSchema=G.toHash=void 0;const Te=ge,Bd=aa;function Jd(t){const e={};for(const a of t)e[a]=!0;return e}G.toHash=Jd;function Qd(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Xo(t,e),!Yo(e,t.self.RULES.all))}G.alwaysValidSchema=Qd;function Xo(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]||sl(t,`unknown keyword: "${n}"`)}G.checkUnknownRules=Xo;function Yo(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}G.schemaHasRules=Yo;function Gd(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(a!=="$ref"&&e.all[a])return!0;return!1}G.schemaHasRulesButRef=Gd;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,Te._)`${a}`}return(0,Te._)`${t}${e}${(0,Te.getProperty)(s)}`}G.schemaRefOrVal=Wd;function Xd(t){return el(decodeURIComponent(t))}G.unescapeFragment=Xd;function Yd(t){return encodeURIComponent(un(t))}G.escapeFragment=Yd;function un(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=un;function el(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=el;function ef(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}G.eachItem=ef;function tl({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,i,o)=>{const c=i===void 0?n:i instanceof Te.Name?(n instanceof Te.Name?t(r,n,i):e(r,n,i),i):n instanceof Te.Name?(e(r,i,n),n):a(n,i);return o===Te.Name&&!(c instanceof Te.Name)?s(r,c):c}}G.mergeEvaluated={props:tl({mergeNames:(t,e,a)=>t.if((0,Te._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,Te._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,Te._)`${a} || {}`).code((0,Te._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,Te._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,Te._)`${a} || {}`),dn(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:rl}),items:tl({mergeNames:(t,e,a)=>t.if((0,Te._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,Te._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,Te._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,Te._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function rl(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,Te._)`{}`);return e!==void 0&&dn(t,a,e),a}G.evaluatedPropsToName=rl;function dn(t,e,a){Object.keys(a).forEach(s=>t.assign((0,Te._)`${e}${(0,Te.getProperty)(s)}`,!0))}G.setEvaluated=dn;const al={};function tf(t,e){return t.scopeValue("func",{ref:e,code:al[e.code]||(al[e.code]=new Bd._Code(e.code))})}G.useFunc=tf;var fn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fn||(G.Type=fn={}));function rf(t,e,a){if(t instanceof Te.Name){const s=e===fn.Num;return a?s?(0,Te._)`"[" + ${t} + "]"`:(0,Te._)`"['" + ${t} + "']"`:s?(0,Te._)`"/" + ${t}`:(0,Te._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,Te.getProperty)(t).toString():"/"+un(t)}G.getErrorPath=rf;function sl(t,e,a=t.opts.strictSchema){if(a){if(e=`strict mode: ${e}`,a===!0)throw new Error(e);t.self.logger.warn(e)}}G.checkStrictMode=sl;var It={};Object.defineProperty(It,"__esModule",{value:!0});const rt=ge,af={data:new rt.Name("data"),valCxt:new rt.Name("valCxt"),instancePath:new rt.Name("instancePath"),parentData:new rt.Name("parentData"),parentDataProperty:new rt.Name("parentDataProperty"),rootData:new rt.Name("rootData"),dynamicAnchors:new rt.Name("dynamicAnchors"),vErrors:new rt.Name("vErrors"),errors:new rt.Name("errors"),this:new rt.Name("this"),self:new rt.Name("self"),scope:new rt.Name("scope"),json:new rt.Name("json"),jsonPos:new rt.Name("jsonPos"),jsonLen:new rt.Name("jsonLen"),jsonPart:new rt.Name("jsonPart")};It.default=af,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=ge,a=G,s=It;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,$,E){const{it:T}=h,{gen:C,compositeRule:x,allErrors:K}=T,V=d(h,v,$);E??(x||K)?c(C,V):l(T,(0,e._)`[${V}]`)}t.reportError=r;function n(h,v=t.keywordError,$){const{it:E}=h,{gen:T,compositeRule:C,allErrors:x}=E,K=d(h,v,$);c(T,K),C||x||l(E,s.default.vErrors)}t.reportExtraError=n;function i(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=i;function o({gen:h,keyword:v,schemaValue:$,data:E,errsCount:T,it:C}){if(T===void 0)throw new Error("ajv implementation error");const x=h.name("err");h.forRange("i",T,s.default.errors,K=>{h.const(x,(0,e._)`${s.default.vErrors}[${K}]`),h.if((0,e._)`${x}.instancePath === undefined`,()=>h.assign((0,e._)`${x}.instancePath`,(0,e.strConcat)(s.default.instancePath,C.errorPath))),h.assign((0,e._)`${x}.schemaPath`,(0,e.str)`${C.errSchemaPath}/${v}`),C.opts.verbose&&(h.assign((0,e._)`${x}.schema`,$),h.assign((0,e._)`${x}.data`,E))})}t.extendErrors=o;function c(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 l(h,v){const{gen:$,validateName:E,schemaEnv:T}=h;T.$async?$.throw((0,e._)`new ${h.ValidationError}(${v})`):($.assign((0,e._)`${E}.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 d(h,v,$){const{createErrors:E}=h.it;return E===!1?(0,e._)`{}`:y(h,v,$)}function y(h,v,$={}){const{gen:E,it:T}=h,C=[f(T,$),m(h,$)];return p(h,v,C),E.object(...C)}function f({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:E}){let T=E?v:(0,e.str)`${v}/${h}`;return $&&(T=(0,e.str)`${T}${(0,a.getErrorPath)($,a.Type.Str)}`),[u.schemaPath,T]}function p(h,{params:v,message:$},E){const{keyword:T,data:C,schemaValue:x,it:K}=h,{opts:V,propertyName:z,topSchemaRef:X,schemaPath:Y}=K;E.push([u.keyword,T],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),V.messages&&E.push([u.message,typeof $=="function"?$(h):$]),V.verbose&&E.push([u.schema,x],[u.parentSchema,(0,e._)`${X}${Y}`],[s.default.data,C]),z&&E.push([u.propertyName,z])}}(ra),Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.boolOrEmptySchema=Nr.topBoolOrEmptySchema=void 0;const sf=ra,nf=ge,of=It,lf={message:"boolean schema is false"};function cf(t){const{gen:e,schema:a,validateName:s}=t;a===!1?nl(t,!1):typeof a=="object"&&a.$async===!0?e.return(of.default.data):(e.assign((0,nf._)`${s}.errors`,null),e.return(!0))}Nr.topBoolOrEmptySchema=cf;function uf(t,e){const{gen:a,schema:s}=t;s===!1?(a.var(e,!1),nl(t)):a.var(e,!0)}Nr.boolOrEmptySchema=uf;function nl(t,e){const{gen:a,data:s}=t,r={gen:a,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,sf.reportError)(r,lf,void 0,e)}var Je={},pr={};Object.defineProperty(pr,"__esModule",{value:!0}),pr.getRules=pr.isJSONType=void 0;const df=["string","number","integer","boolean","null","object","array"],ff=new Set(df);function hf(t){return typeof t=="string"&&ff.has(t)}pr.isJSONType=hf;function pf(){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:{}}}pr.getRules=pf;var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.shouldUseRule=Vt.shouldUseGroup=Vt.schemaHasRulesForType=void 0;function mf({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&il(t,s)}Vt.schemaHasRulesForType=mf;function il(t,e){return e.rules.some(a=>ol(t,a))}Vt.shouldUseGroup=il;function ol(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))}Vt.shouldUseRule=ol,Object.defineProperty(Je,"__esModule",{value:!0}),Je.reportTypeError=Je.checkDataTypes=Je.checkDataType=Je.coerceAndCheckDataType=Je.getJSONTypes=Je.getSchemaTypes=Je.DataType=void 0;const vf=pr,gf=Vt,yf=ra,pe=ge,ll=G;var Ar;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ar||(Je.DataType=Ar={}));function _f(t){const e=cl(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}Je.getSchemaTypes=_f;function cl(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(vf.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Je.getJSONTypes=cl;function $f(t,e){const{gen:a,data:s,opts:r}=t,n=wf(e,r.coerceTypes),i=e.length>0&&!(n.length===0&&e.length===1&&(0,gf.schemaHasRulesForType)(t,e[0]));if(i){const o=pn(e,s,r.strictNumbers,Ar.Wrong);a.if(o,()=>{n.length?bf(t,e,n):mn(t)})}return i}Je.coerceAndCheckDataType=$f;const ul=new Set(["string","number","integer","boolean","null"]);function wf(t,e){return e?t.filter(a=>ul.has(a)||e==="array"&&a==="array"):[]}function bf(t,e,a){const{gen:s,data:r,opts:n}=t,i=s.let("dataType",(0,pe._)`typeof ${r}`),o=s.let("coerced",(0,pe._)`undefined`);n.coerceTypes==="array"&&s.if((0,pe._)`${i} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>s.assign(r,(0,pe._)`${r}[0]`).assign(i,(0,pe._)`typeof ${r}`).if(pn(e,r,n.strictNumbers),()=>s.assign(o,r))),s.if((0,pe._)`${o} !== undefined`);for(const l of a)(ul.has(l)||l==="array"&&n.coerceTypes==="array")&&c(l);s.else(),mn(t),s.endIf(),s.if((0,pe._)`${o} !== undefined`,()=>{s.assign(r,o),Pf(t,o)});function c(l){switch(l){case"string":s.elseIf((0,pe._)`${i} == "number" || ${i} == "boolean"`).assign(o,(0,pe._)`"" + ${r}`).elseIf((0,pe._)`${r} === null`).assign(o,(0,pe._)`""`);return;case"number":s.elseIf((0,pe._)`${i} == "boolean" || ${r} === null
|
|
3
|
-
|| (${i} == "string" && ${r} && ${r} == +${r})`).assign(o,(0,pe._)`+${r}`);return;case"integer":s.elseIf((0,pe._)`${i} === "boolean" || ${r} === null
|
|
4
|
-
|| (${i} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(o,(0,pe._)`+${r}`);return;case"boolean":s.elseIf((0,pe._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(o,!1).elseIf((0,pe._)`${r} === "true" || ${r} === 1`).assign(o,!0);return;case"null":s.elseIf((0,pe._)`${r} === "" || ${r} === 0 || ${r} === false`),s.assign(o,null);return;case"array":s.elseIf((0,pe._)`${i} === "string" || ${i} === "number"
|
|
5
|
-
|| ${i} === "boolean" || ${r} === null`).assign(o,(0,pe._)`[${r}]`)}}}function Pf({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,pe._)`${e} !== undefined`,()=>t.assign((0,pe._)`${e}[${a}]`,s))}function hn(t,e,a,s=Ar.Correct){const r=s===Ar.Correct?pe.operators.EQ:pe.operators.NEQ;let n;switch(t){case"null":return(0,pe._)`${e} ${r} null`;case"array":n=(0,pe._)`Array.isArray(${e})`;break;case"object":n=(0,pe._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":n=i((0,pe._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":n=i();break;default:return(0,pe._)`typeof ${e} ${r} ${t}`}return s===Ar.Correct?n:(0,pe.not)(n);function i(o=pe.nil){return(0,pe.and)((0,pe._)`typeof ${e} == "number"`,o,a?(0,pe._)`isFinite(${e})`:pe.nil)}}Je.checkDataType=hn;function pn(t,e,a,s){if(t.length===1)return hn(t[0],e,a,s);let r;const n=(0,ll.toHash)(t);if(n.array&&n.object){const i=(0,pe._)`typeof ${e} != "object"`;r=n.null?i:(0,pe._)`!${e} || ${i}`,delete n.null,delete n.array,delete n.object}else r=pe.nil;n.number&&delete n.integer;for(const i in n)r=(0,pe.and)(r,hn(i,e,a,s));return r}Je.checkDataTypes=pn;const Ef={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,pe._)`{type: ${t}}`:(0,pe._)`{type: ${e}}`};function mn(t){const e=Sf(t);(0,yf.reportError)(e,Ef)}Je.reportTypeError=mn;function Sf(t){const{gen:e,data:a,schema:s}=t,r=(0,ll.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var xa={};Object.defineProperty(xa,"__esModule",{value:!0}),xa.assignDefaults=void 0;const jr=ge,Rf=G;function kf(t,e){const{properties:a,items:s}=t.schema;if(e==="object"&&a)for(const r in a)dl(t,r,a[r].default);else e==="array"&&Array.isArray(s)&&s.forEach((r,n)=>dl(t,n,r.default))}xa.assignDefaults=kf;function dl(t,e,a){const{gen:s,compositeRule:r,data:n,opts:i}=t;if(a===void 0)return;const o=(0,jr._)`${n}${(0,jr.getProperty)(e)}`;if(r){(0,Rf.checkStrictMode)(t,`default is ignored for: ${o}`);return}let c=(0,jr._)`${o} === undefined`;i.useDefaults==="empty"&&(c=(0,jr._)`${c} || ${o} === null || ${o} === ""`),s.if(c,(0,jr._)`${o} = ${(0,jr.stringify)(a)}`)}var Nt={},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.validateUnion=ye.validateArray=ye.usePattern=ye.callValidateCode=ye.schemaProperties=ye.allSchemaProperties=ye.noPropertyInData=ye.propertyInData=ye.isOwnProperty=ye.hasPropFunc=ye.reportMissingProp=ye.checkMissingProp=ye.checkReportMissingProp=void 0;const Ne=ge,vn=G,tr=It,Tf=G;function Of(t,e){const{gen:a,data:s,it:r}=t;a.if(yn(a,s,e,r.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ne._)`${e}`},!0),t.error()})}ye.checkReportMissingProp=Of;function Cf({gen:t,data:e,it:{opts:a}},s,r){return(0,Ne.or)(...s.map(n=>(0,Ne.and)(yn(t,e,n,a.ownProperties),(0,Ne._)`${r} = ${n}`)))}ye.checkMissingProp=Cf;function If(t,e){t.setParams({missingProperty:e},!0),t.error()}ye.reportMissingProp=If;function fl(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}ye.hasPropFunc=fl;function gn(t,e,a){return(0,Ne._)`${fl(t)}.call(${e}, ${a})`}ye.isOwnProperty=gn;function Nf(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} !== undefined`;return s?(0,Ne._)`${r} && ${gn(t,e,a)}`:r}ye.propertyInData=Nf;function yn(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} === undefined`;return s?(0,Ne.or)(r,(0,Ne.not)(gn(t,e,a))):r}ye.noPropertyInData=yn;function hl(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ye.allSchemaProperties=hl;function Af(t,e){return hl(e).filter(a=>!(0,vn.alwaysValidSchema)(t,e[a]))}ye.schemaProperties=Af;function jf({schemaCode:t,data:e,it:{gen:a,topSchemaRef:s,schemaPath:r,errorPath:n},it:i},o,c,l){const u=l?(0,Ne._)`${t}, ${e}, ${s}${r}`:e,d=[[tr.default.instancePath,(0,Ne.strConcat)(tr.default.instancePath,n)],[tr.default.parentData,i.parentData],[tr.default.parentDataProperty,i.parentDataProperty],[tr.default.rootData,tr.default.rootData]];i.opts.dynamicRef&&d.push([tr.default.dynamicAnchors,tr.default.dynamicAnchors]);const y=(0,Ne._)`${u}, ${a.object(...d)}`;return c!==Ne.nil?(0,Ne._)`${o}.call(${c}, ${y})`:(0,Ne._)`${o}(${y})`}ye.callValidateCode=jf;const Df=(0,Ne._)`new RegExp`;function xf({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,Ne._)`${r.code==="new RegExp"?Df:(0,Tf.useFunc)(t,r)}(${a}, ${s})`})}ye.usePattern=xf;function Mf(t){const{gen:e,data:a,keyword:s,it:r}=t,n=e.name("valid");if(r.allErrors){const o=e.let("valid",!0);return i(()=>e.assign(o,!1)),o}return e.var(n,!0),i(()=>e.break()),n;function i(o){const c=e.const("len",(0,Ne._)`${a}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:vn.Type.Num},n),e.if((0,Ne.not)(n),o)})}}ye.validateArray=Mf;function Lf(t){const{gen:e,schema:a,keyword:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(c=>(0,vn.alwaysValidSchema)(r,c))&&!r.opts.unevaluated)return;const i=e.let("valid",!1),o=e.name("_valid");e.block(()=>a.forEach((c,l)=>{const u=t.subschema({keyword:s,schemaProp:l,compositeRule:!0},o);e.assign(i,(0,Ne._)`${i} || ${o}`),t.mergeValidEvaluated(u,o)||e.if((0,Ne.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}ye.validateUnion=Lf,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;const st=ge,mr=It,Ff=ye,qf=ra;function Uf(t,e){const{gen:a,keyword:s,schema:r,parentSchema:n,it:i}=t,o=e.macro.call(i.self,r,n,i),c=ml(a,s,o);i.opts.validateSchema!==!1&&i.self.validateSchema(o,!0);const l=a.name("valid");t.subschema({schema:o,schemaPath:st.nil,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Nt.macroKeywordCode=Uf;function Vf(t,e){var a;const{gen:s,keyword:r,schema:n,parentSchema:i,$data:o,it:c}=t;Hf(c,e);const l=!o&&e.compile?e.compile.call(c.self,n,i,c):e.validate,u=ml(s,r,l),d=s.let("valid");t.block$data(d,y),t.ok((a=e.valid)!==null&&a!==void 0?a:d);function y(){if(e.errors===!1)p(),e.modifying&&pl(t),h(()=>t.error());else{const v=e.async?f():m();e.modifying&&pl(t),h(()=>zf(t,v))}}function f(){const v=s.let("ruleErrs",null);return s.try(()=>p((0,st._)`await `),$=>s.assign(d,!1).if((0,st._)`${$} instanceof ${c.ValidationError}`,()=>s.assign(v,(0,st._)`${$}.errors`),()=>s.throw($))),v}function m(){const v=(0,st._)`${u}.errors`;return s.assign(v,null),p(st.nil),v}function p(v=e.async?(0,st._)`await `:st.nil){const $=c.opts.passContext?mr.default.this:mr.default.self,E=!("compile"in e&&!o||e.schema===!1);s.assign(d,(0,st._)`${v}${(0,Ff.callValidateCode)(t,u,$,E)}`,e.modifying)}function h(v){var $;s.if((0,st.not)(($=e.valid)!==null&&$!==void 0?$:d),v)}}Nt.funcKeywordCode=Vf;function pl(t){const{gen:e,data:a,it:s}=t;e.if(s.parentData,()=>e.assign(a,(0,st._)`${s.parentData}[${s.parentDataProperty}]`))}function zf(t,e){const{gen:a}=t;a.if((0,st._)`Array.isArray(${e})`,()=>{a.assign(mr.default.vErrors,(0,st._)`${mr.default.vErrors} === null ? ${e} : ${mr.default.vErrors}.concat(${e})`).assign(mr.default.errors,(0,st._)`${mr.default.vErrors}.length`),(0,qf.extendErrors)(t)},()=>t.error())}function Hf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function ml(t,e,a){if(a===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof a=="function"?{ref:a}:{ref:a,code:(0,st.stringify)(a)})}function Zf(t,e,a=!1){return!e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||a&&typeof t>"u")}Nt.validSchemaType=Zf;function Kf({schema:t,opts:e,self:a,errSchemaPath:s},r,n){if(Array.isArray(r.keyword)?!r.keyword.includes(n):r.keyword!==n)throw new Error("ajv implementation error");const i=r.dependencies;if(i!=null&&i.some(o=>!Object.prototype.hasOwnProperty.call(t,o)))throw new Error(`parent schema must have dependencies of ${n}: ${i.join(",")}`);if(r.validateSchema&&!r.validateSchema(t[n])){const c=`keyword "${n}" value is invalid at path "${s}": `+a.errorsText(r.validateSchema.errors);if(e.validateSchema==="log")a.logger.error(c);else throw new Error(c)}}Nt.validateKeywordUsage=Kf;var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.extendSubschemaMode=rr.extendSubschemaData=rr.getSubschema=void 0;const At=ge,vl=G;function Bf(t,{keyword:e,schemaProp:a,schema:s,schemaPath:r,errSchemaPath:n,topSchemaRef:i}){if(e!==void 0&&s!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const o=t.schema[e];return a===void 0?{schema:o,schemaPath:(0,At._)`${t.schemaPath}${(0,At.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:o[a],schemaPath:(0,At._)`${t.schemaPath}${(0,At.getProperty)(e)}${(0,At.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,vl.escapeFragment)(a)}`}}if(s!==void 0){if(r===void 0||n===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:r,topSchemaRef:i,errSchemaPath:n}}throw new Error('either "keyword" or "schema" must be passed')}rr.getSubschema=Bf;function Jf(t,e,{dataProp:a,dataPropType:s,data:r,dataTypes:n,propertyName:i}){if(r!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:o}=e;if(a!==void 0){const{errorPath:l,dataPathArr:u,opts:d}=e,y=o.let("data",(0,At._)`${e.data}${(0,At.getProperty)(a)}`,!0);c(y),t.errorPath=(0,At.str)`${l}${(0,vl.getErrorPath)(a,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0,At._)`${a}`,t.dataPathArr=[...u,t.parentDataProperty]}if(r!==void 0){const l=r instanceof At.Name?r:o.let("data",r,!0);c(l),i!==void 0&&(t.propertyName=i)}n&&(t.dataTypes=n);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}rr.extendSubschemaData=Jf;function Qf(t,{jtdDiscriminator:e,jtdMetadata:a,compositeRule:s,createErrors:r,allErrors:n}){s!==void 0&&(t.compositeRule=s),r!==void 0&&(t.createErrors=r),n!==void 0&&(t.allErrors=n),t.jtdDiscriminator=e,t.jtdMetadata=a}rr.extendSubschemaMode=Qf;var Ye={},sa=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 i=n[r];if(!t(e[i],a[i]))return!1}return!0}return e!==e&&a!==a},gl={exports:{}},ar=gl.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(){};Ma(e,s,r,t,"",t)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},ar.propsKeywords={$defs:!0,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 Ma(t,e,a,s,r,n,i,o,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,l);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in ar.arrayKeywords)for(var y=0;y<d.length;y++)Ma(t,e,a,d[y],r+"/"+u+"/"+y,n,r,u,s,y)}else if(u in ar.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ma(t,e,a,d[f],r+"/"+u+"/"+Gf(f),n,r,u,s,f)}else(u in ar.keywords||t.allKeys&&!(u in ar.skipKeywords))&&Ma(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,c,l)}}function Gf(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var Wf=gl.exports;Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.getSchemaRefs=Ye.resolveUrl=Ye.normalizeId=Ye._getFullPath=Ye.getFullPath=Ye.inlineRef=void 0;const Xf=G,Yf=sa,eh=Wf,th=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!_n(t):e?yl(t)<=e:!1}Ye.inlineRef=rh;const ah=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function _n(t){for(const e in t){if(ah.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(_n)||typeof a=="object"&&_n(a))return!0}return!1}function yl(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!th.has(a)&&(typeof t[a]=="object"&&(0,Xf.eachItem)(t[a],s=>e+=yl(s)),e===1/0))return 1/0}return e}function _l(t,e="",a){a!==!1&&(e=Dr(e));const s=t.parse(e);return $l(t,s)}Ye.getFullPath=_l;function $l(t,e){return t.serialize(e).split("#")[0]+"#"}Ye._getFullPath=$l;const sh=/#\/?$/;function Dr(t){return t?t.replace(sh,""):""}Ye.normalizeId=Dr;function nh(t,e,a){return a=Dr(a),t.resolve(e,a)}Ye.resolveUrl=nh;const ih=/^[a-z_][-a-z0-9._]*$/i;function oh(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=Dr(t[a]||e),n={"":r},i=_l(s,r,!1),o={},c=new Set;return eh(t,{allKeys:!0},(d,y,f,m)=>{if(m===void 0)return;const p=i+y;let h=n[m];typeof d[a]=="string"&&(h=v.call(this,d[a])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),n[y]=h;function v(E){const T=this.opts.uriResolver.resolve;if(E=Dr(h?T(h,E):E),c.has(E))throw u(E);c.add(E);let C=this.refs[E];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?l(d,C.schema,E):E!==Dr(p)&&(E[0]==="#"?(l(d,o[E],E),o[E]=d):this.refs[E]=p),E}function $(E){if(typeof E=="string"){if(!ih.test(E))throw new Error(`invalid anchor "${E}"`);v.call(this,`#${E}`)}}}),o;function l(d,y,f){if(y!==void 0&&!Yf(d,y))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ye.getSchemaRefs=oh,Object.defineProperty(wt,"__esModule",{value:!0}),wt.getData=wt.KeywordCxt=wt.validateFunctionCode=void 0;const wl=Nr,bl=Je,$n=Vt,La=Je,lh=xa,na=Nt,wn=rr,ae=ge,le=It,ch=Ye,zt=G,ia=ra;function uh(t){if(Rl(t)&&(kl(t),Sl(t))){hh(t);return}Pl(t,()=>(0,wl.topBoolOrEmptySchema)(t))}wt.validateFunctionCode=uh;function Pl({gen:t,validateName:e,schema:a,schemaEnv:s,opts:r},n){r.code.es5?t.func(e,(0,ae._)`${le.default.data}, ${le.default.valCxt}`,s.$async,()=>{t.code((0,ae._)`"use strict"; ${El(a,r)}`),fh(t,r),t.code(n)}):t.func(e,(0,ae._)`${le.default.data}, ${dh(r)}`,s.$async,()=>t.code(El(a,r)).code(n))}function dh(t){return(0,ae._)`{${le.default.instancePath}="", ${le.default.parentData}, ${le.default.parentDataProperty}, ${le.default.rootData}=${le.default.data}${t.dynamicRef?(0,ae._)`, ${le.default.dynamicAnchors}={}`:ae.nil}}={}`}function fh(t,e){t.if(le.default.valCxt,()=>{t.var(le.default.instancePath,(0,ae._)`${le.default.valCxt}.${le.default.instancePath}`),t.var(le.default.parentData,(0,ae._)`${le.default.valCxt}.${le.default.parentData}`),t.var(le.default.parentDataProperty,(0,ae._)`${le.default.valCxt}.${le.default.parentDataProperty}`),t.var(le.default.rootData,(0,ae._)`${le.default.valCxt}.${le.default.rootData}`),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ae._)`${le.default.valCxt}.${le.default.dynamicAnchors}`)},()=>{t.var(le.default.instancePath,(0,ae._)`""`),t.var(le.default.parentData,(0,ae._)`undefined`),t.var(le.default.parentDataProperty,(0,ae._)`undefined`),t.var(le.default.rootData,le.default.data),e.dynamicRef&&t.var(le.default.dynamicAnchors,(0,ae._)`{}`)})}function hh(t){const{schema:e,opts:a,gen:s}=t;Pl(t,()=>{a.$comment&&e.$comment&&Ol(t),yh(t),s.let(le.default.vErrors,null),s.let(le.default.errors,0),a.unevaluated&&ph(t),Tl(t),wh(t)})}function ph(t){const{gen:e,validateName:a}=t;t.evaluated=e.const("evaluated",(0,ae._)`${a}.evaluated`),e.if((0,ae._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ae._)`${t.evaluated}.props`,(0,ae._)`undefined`)),e.if((0,ae._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ae._)`${t.evaluated}.items`,(0,ae._)`undefined`))}function El(t,e){const a=typeof t=="object"&&t[e.schemaId];return a&&(e.code.source||e.code.process)?(0,ae._)`/*# sourceURL=${a} */`:ae.nil}function mh(t,e){if(Rl(t)&&(kl(t),Sl(t))){vh(t,e);return}(0,wl.boolOrEmptySchema)(t,e)}function Sl({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const a in t)if(e.RULES.all[a])return!0;return!1}function Rl(t){return typeof t.schema!="boolean"}function vh(t,e){const{schema:a,gen:s,opts:r}=t;r.$comment&&a.$comment&&Ol(t),_h(t),$h(t);const n=s.const("_errs",le.default.errors);Tl(t,n),s.var(e,(0,ae._)`${n} === ${le.default.errors}`)}function kl(t){(0,zt.checkUnknownRules)(t),gh(t)}function Tl(t,e){if(t.opts.jtd)return Cl(t,[],!1,e);const a=(0,bl.getSchemaTypes)(t.schema),s=(0,bl.coerceAndCheckDataType)(t,a);Cl(t,a,!s,e)}function gh(t){const{schema:e,errSchemaPath:a,opts:s,self:r}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,zt.schemaHasRulesButRef)(e,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function yh(t){const{schema:e,opts:a}=t;e.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,zt.checkStrictMode)(t,"default is ignored in the schema root")}function _h(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,ch.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function $h(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Ol({gen:t,schemaEnv:e,schema:a,errSchemaPath:s,opts:r}){const n=a.$comment;if(r.$comment===!0)t.code((0,ae._)`${le.default.self}.logger.log(${n})`);else if(typeof r.$comment=="function"){const i=(0,ae.str)`${s}/$comment`,o=t.scopeValue("root",{ref:e.root});t.code((0,ae._)`${le.default.self}.opts.$comment(${n}, ${i}, ${o}.schema)`)}}function wh(t){const{gen:e,schemaEnv:a,validateName:s,ValidationError:r,opts:n}=t;a.$async?e.if((0,ae._)`${le.default.errors} === 0`,()=>e.return(le.default.data),()=>e.throw((0,ae._)`new ${r}(${le.default.vErrors})`)):(e.assign((0,ae._)`${s}.errors`,le.default.vErrors),n.unevaluated&&bh(t),e.return((0,ae._)`${le.default.errors} === 0`))}function bh({gen:t,evaluated:e,props:a,items:s}){a instanceof ae.Name&&t.assign((0,ae._)`${e}.props`,a),s instanceof ae.Name&&t.assign((0,ae._)`${e}.items`,s)}function Cl(t,e,a,s){const{gen:r,schema:n,data:i,allErrors:o,opts:c,self:l}=t,{RULES:u}=l;if(n.$ref&&(c.ignoreKeywordsWithRef||!(0,zt.schemaHasRulesButRef)(n,u))){r.block(()=>jl(t,"$ref",u.all.$ref.definition));return}c.jtd||Ph(t,e),r.block(()=>{for(const y of u.rules)d(y);d(u.post)});function d(y){(0,$n.shouldUseGroup)(n,y)&&(y.type?(r.if((0,La.checkDataType)(y.type,i,c.strictNumbers)),Il(t,y),e.length===1&&e[0]===y.type&&a&&(r.else(),(0,La.reportTypeError)(t)),r.endIf()):Il(t,y),o||r.if((0,ae._)`${le.default.errors} === ${s||0}`))}}function Il(t,e){const{gen:a,schema:s,opts:{useDefaults:r}}=t;r&&(0,lh.assignDefaults)(t,e.type),a.block(()=>{for(const n of e.rules)(0,$n.shouldUseRule)(s,n)&&jl(t,n.keyword,n.definition,e.type)})}function Ph(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Eh(t,e),t.opts.allowUnionTypes||Sh(t,e),Rh(t,t.dataTypes))}function Eh(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(a=>{Nl(t.dataTypes,a)||bn(t,`type "${a}" not allowed by context "${t.dataTypes.join(",")}"`)}),Th(t,e)}}function Sh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&bn(t,"use allowUnionTypes to allow union type keyword")}function Rh(t,e){const a=t.self.RULES.all;for(const s in a){const r=a[s];if(typeof r=="object"&&(0,$n.shouldUseRule)(t.schema,r)){const{type:n}=r.definition;n.length&&!n.some(i=>kh(e,i))&&bn(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function kh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Nl(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Th(t,e){const a=[];for(const s of t.dataTypes)Nl(e,s)?a.push(s):e.includes("integer")&&s==="number"&&a.push("integer");t.dataTypes=a}function bn(t,e){const a=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${a}" (strictTypes)`,(0,zt.checkStrictMode)(t,e,t.opts.strictTypes)}class Al{constructor(e,a,s){if((0,na.validateKeywordUsage)(e,a,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=a.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,zt.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=a.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=a,this.$data)this.schemaCode=e.gen.const("vSchema",Dl(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,na.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:a.errors!==!1)&&(this.errsCount=e.gen.const("_errs",le.default.errors))}result(e,a,s){this.failResult((0,ae.not)(e),a,s)}failResult(e,a,s){this.gen.if(e),s?s():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,a){this.failResult((0,ae.not)(e),void 0,a)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:a}=this;this.fail((0,ae._)`${a} !== undefined && (${(0,ae.or)(this.invalid$data(),e)})`)}error(e,a,s){if(a){this.setParams(a),this._error(e,s),this.setParams({});return}this._error(e,s)}_error(e,a){(e?ia.reportExtraError:ia.reportError)(this,this.def.error,a)}$dataError(){(0,ia.reportError)(this,this.def.$dataError||ia.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ia.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,a){a?Object.assign(this.params,e):this.params=e}block$data(e,a,s=ae.nil){this.gen.block(()=>{this.check$data(e,s),a()})}check$data(e=ae.nil,a=ae.nil){if(!this.$data)return;const{gen:s,schemaCode:r,schemaType:n,def:i}=this;s.if((0,ae.or)((0,ae._)`${r} === undefined`,a)),e!==ae.nil&&s.assign(e,!0),(n.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==ae.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:a,schemaType:s,def:r,it:n}=this;return(0,ae.or)(i(),o());function i(){if(s.length){if(!(a instanceof ae.Name))throw new Error("ajv implementation error");const c=Array.isArray(s)?s:[s];return(0,ae._)`${(0,La.checkDataTypes)(c,a,n.opts.strictNumbers,La.DataType.Wrong)}`}return ae.nil}function o(){if(r.validateSchema){const c=e.scopeValue("validate$data",{ref:r.validateSchema});return(0,ae._)`!${c}(${a})`}return ae.nil}}subschema(e,a){const s=(0,wn.getSubschema)(this.it,e);(0,wn.extendSubschemaData)(s,this.it,e),(0,wn.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return mh(r,a),r}mergeEvaluated(e,a){const{it:s,gen:r}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=zt.mergeEvaluated.props(r,e.props,s.props,a)),s.items!==!0&&e.items!==void 0&&(s.items=zt.mergeEvaluated.items(r,e.items,s.items,a)))}mergeValidEvaluated(e,a){const{it:s,gen:r}=this;if(s.opts.unevaluated&&(s.props!==!0||s.items!==!0))return r.if(a,()=>this.mergeEvaluated(e,ae.Name)),!0}}wt.KeywordCxt=Al;function jl(t,e,a,s){const r=new Al(t,a,e);"code"in a?a.code(r,s):r.$data&&a.validate?(0,na.funcKeywordCode)(r,a):"macro"in a?(0,na.macroKeywordCode)(r,a):(a.compile||a.validate)&&(0,na.funcKeywordCode)(r,a)}const Oh=/^\/(?:[^~]|~0|~1)*$/,Ch=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Dl(t,{dataLevel:e,dataNames:a,dataPathArr:s}){let r,n;if(t==="")return le.default.rootData;if(t[0]==="/"){if(!Oh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);r=t,n=le.default.rootData}else{const l=Ch.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+l[1];if(r=l[2],r==="#"){if(u>=e)throw new Error(c("property/index",u));return s[e-u]}if(u>e)throw new Error(c("data",u));if(n=a[e-u],!r)return n}let i=n;const o=r.split("/");for(const l of o)l&&(n=(0,ae._)`${n}${(0,ae.getProperty)((0,zt.unescapeJsonPointer)(l))}`,i=(0,ae._)`${i} && ${n}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}wt.getData=Dl;var oa={};Object.defineProperty(oa,"__esModule",{value:!0});let Ih=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};oa.default=Ih;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});const Pn=Ye;let Nh=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,Pn.resolveUrl)(e,a,s),this.missingSchema=(0,Pn.normalizeId)((0,Pn.getFullPath)(e,this.missingRef))}};xr.default=Nh;var ct={};Object.defineProperty(ct,"__esModule",{value:!0}),ct.resolveSchema=ct.getCompilingSchema=ct.resolveRef=ct.compileSchema=ct.SchemaEnv=void 0;const bt=ge,Ah=oa,vr=It,Pt=Ye,xl=G,jh=wt;class Fa{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={}}}ct.SchemaEnv=Fa;function En(t){const e=Ml.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,i=new bt.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let o;t.$async&&(o=i.scopeValue("Error",{ref:Ah.default,code:(0,bt._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");t.validateName=c;const l={gen:i,allErrors:this.opts.allErrors,data:vr.default.data,parentData:vr.default.parentData,parentDataProperty:vr.default.parentDataProperty,dataNames:[vr.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,bt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:o,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,jh.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const d=i.toString();u=`${i.scopeRefs(vr.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const f=new Function(`${vr.default.self}`,`${vr.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){const{props:m,items:p}=l;f.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},f.source&&(f.source.evaluated=(0,bt.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}ct.compileSchema=En;function Dh(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=Lh.call(this,t,a);if(n===void 0){const i=(s=t.localRefs)===null||s===void 0?void 0:s[a],{schemaId:o}=this.opts;i&&(n=new Fa({schema:i,schemaId:o,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=xh.call(this,n)}ct.resolveRef=Dh;function xh(t){return(0,Pt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:En.call(this,t)}function Ml(t){for(const e of this._compilations)if(Mh(e,t))return e}ct.getCompilingSchema=Ml;function Mh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Lh(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||qa.call(this,t,e)}function qa(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 Sn.call(this,a,t);const n=(0,Pt.normalizeId)(s),i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const o=qa.call(this,t,i);return typeof(o==null?void 0:o.schema)!="object"?void 0:Sn.call(this,a,o)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||En.call(this,i),n===(0,Pt.normalizeId)(e)){const{schema:o}=i,{schemaId:c}=this.opts,l=o[c];return l&&(r=(0,Pt.resolveUrl)(this.opts.uriResolver,r,l)),new Fa({schema:o,schemaId:c,root:t,baseId:r})}return Sn.call(this,a,i)}}ct.resolveSchema=qa;const Fh=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Sn(t,{baseId:e,schema:a,root:s}){var r;if(((r=t.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(const o of t.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const c=a[(0,xl.unescapeFragment)(o)];if(c===void 0)return;a=c;const l=typeof a=="object"&&a[this.opts.schemaId];!Fh.has(o)&&l&&(e=(0,Pt.resolveUrl)(this.opts.uriResolver,e,l))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,xl.schemaHasRulesButRef)(a,this.RULES)){const o=(0,Pt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=qa.call(this,s,o)}const{schemaId:i}=this.opts;if(n=n||new Fa({schema:a,schemaId:i,root:s,baseId:e}),n.schema!==n.root.schema)return n}const qh={$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 Rn={},Ua={exports:{}},Uh={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:Vh}=Uh,zh=/^(?:(?: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(Ul(t,".")<3)return{host:t,isIPV4:!1};const e=t.match(zh)||[],[a]=e;return a?{host:Zh(a,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function Fl(t,e=!1){let a="",s=!0;for(const r of t){if(Vh[r]===void 0)return;r!=="0"&&s===!0&&(s=!1),s||(a+=r)}return e&&a.length===0&&(a="0"),a}function Hh(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,i=!1,o=!1;function c(){if(r.length){if(n===!1){const l=Fl(r);if(l!==void 0)s.push(l);else return a.error=!0,!1}r.length=0}return!0}for(let l=0;l<t.length;l++){const u=t[l];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(o=!0),!c())break;if(e++,s.push(":"),e>7){a.error=!0;break}l-1>=0&&t[l-1]===":"&&(i=!0);continue}else if(u==="%"){if(!c())break;n=!0}else{r.push(u);continue}}return r.length&&(n?a.zone=r.join(""):o?s.push(r.join("")):s.push(Fl(r))),a.address=s.join(""),a}function ql(t){if(Ul(t,":")<2)return{host:t,isIPV6:!1};const e=Hh(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 Zh(t,e){let a="",s=!0;const r=t.length;for(let n=0;n<r;n++){const i=t[n];i==="0"&&s?(n+1<=r&&t[n+1]===e||n+1===r)&&(a+=i,s=!1):(i===e?s=!0:s=!1,a+=i)}return a}function Ul(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}const Vl=/^\.\.?\//u,zl=/^\/\.(?:\/|$)/u,Hl=/^\/\.\.(?:\/|$)/u,Kh=/^\/?(?:.|\n)*?(?=\/|$)/u;function Bh(t){const e=[];for(;t.length;)if(t.match(Vl))t=t.replace(Vl,"");else if(t.match(zl))t=t.replace(zl,"/");else if(t.match(Hl))t=t.replace(Hl,"/"),e.pop();else if(t==="."||t==="..")t="";else{const a=t.match(Kh);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 Jh(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 Qh(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=ql(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 Gh={recomposeAuthority:Qh,normalizeComponentEncoding:Jh,removeDotSegments:Bh,normalizeIPv4:Ll,normalizeIPv6:ql};const Wh=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,Xh=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Zl(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function Kl(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Bl(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 Yh(t){return t.secure=Zl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function ep(t){if((t.port===(Zl(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 tp(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(Xh);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=kn[r];t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function rp(t,e){const a=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),r=`${a}:${e.nid||s}`,n=kn[r];n&&(t=n.serialize(t,e));const i=t,o=t.nss;return i.path=`${s||e.nid}:${o}`,e.skipEscape=!0,i}function ap(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!Wh.test(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function sp(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const Jl={scheme:"http",domainHost:!0,parse:Kl,serialize:Bl},np={scheme:"https",domainHost:Jl.domainHost,parse:Kl,serialize:Bl},Va={scheme:"ws",domainHost:!0,parse:Yh,serialize:ep},ip={scheme:"wss",domainHost:Va.domainHost,parse:Va.parse,serialize:Va.serialize},kn={http:Jl,https:np,ws:Va,wss:ip,urn:{scheme:"urn",parse:tp,serialize:rp,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:ap,serialize:sp,skipNormalize:!0}};var op=kn;const{normalizeIPv6:lp,normalizeIPv4:cp,removeDotSegments:la,recomposeAuthority:up,normalizeComponentEncoding:za}=Gh,Tn=op;function dp(t,e){return typeof t=="string"?t=jt(Ht(t,e),e):typeof t=="object"&&(t=Ht(jt(t,e),e)),t}function fp(t,e,a){const s=Object.assign({scheme:"null"},a),r=Ql(Ht(t,s),Ht(e,s),s,!0);return jt(r,{...s,skipEscape:!0})}function Ql(t,e,a,s){const r={};return s||(t=Ht(jt(t,a),a),e=Ht(jt(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=la(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=la(e.path||""),r.query=e.query):(e.path?(e.path.charAt(0)==="/"?r.path=la(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=la(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 hp(t,e,a){return typeof t=="string"?(t=unescape(t),t=jt(za(Ht(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=jt(za(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=jt(za(Ht(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=jt(za(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function jt(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=Tn[(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 i=up(a);if(i!==void 0&&(s.reference!=="suffix"&&r.push("//"),r.push(i),a.path&&a.path.charAt(0)!=="/"&&r.push("/")),a.path!==void 0){let o=a.path;!s.absolutePath&&(!n||!n.absolutePath)&&(o=la(o)),i===void 0&&(o=o.replace(/^\/\//u,"/%2F")),r.push(o)}return a.query!==void 0&&r.push("?",a.query),a.fragment!==void 0&&r.push("#",a.fragment),r.join("")}const pp=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function mp(t){let e=0;for(let a=0,s=t.length;a<s;++a)if(e=t.charCodeAt(a),e>126||pp[e])return!0;return!1}const vp=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ht(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 i=t.match(vp);if(i){if(s.scheme=i[1],s.userinfo=i[3],s.host=i[4],s.port=parseInt(i[5],10),s.path=i[6]||"",s.query=i[7],s.fragment=i[8],isNaN(s.port)&&(s.port=i[5]),s.host){const c=cp(s.host);if(c.isIPV4===!1){const l=lp(c.host);s.host=l.host.toLowerCase(),n=l.isIPV6}else s.host=c.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 o=Tn[(a.scheme||s.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!o||!o.unicodeSupport)&&s.host&&(a.domainHost||o&&o.domainHost)&&n===!1&&mp(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(c){s.error=s.error||"Host's domain name can not be converted to ASCII: "+c}(!o||o&&!o.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)))),o&&o.parse&&o.parse(s,a)}else s.error=s.error||"URI can not be parsed.";return s}const On={SCHEMES:Tn,normalize:dp,resolve:fp,resolveComponents:Ql,equal:hp,serialize:jt,parse:Ht};Ua.exports=On,Ua.exports.default=On,Ua.exports.fastUri=On;var gp=Ua.exports;Object.defineProperty(Rn,"__esModule",{value:!0});const Gl=gp;Gl.code='require("ajv/dist/runtime/uri").default',Rn.default=Gl,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=wt;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var a=ge;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=oa,r=xr,n=pr,i=ct,o=ge,c=Ye,l=Je,u=G,d=qh,y=Rn,f=(j,S)=>new RegExp(j,S);f.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 E(j){var S,D,O,g,w,A,Z,Q,fe,ie,he,at,Ve,Oe,gt,Ke,Mt,Ct,qe,yt,Xt,Me,Le,Xe,fr;const Yt=j.strict,Tr=(S=j.code)===null||S===void 0?void 0:S.optimize,an=Tr===!0||Tr===void 0?1:Tr||0,_t=(O=(D=j.code)===null||D===void 0?void 0:D.regExp)!==null&&O!==void 0?O:f,Or=(g=j.uriResolver)!==null&&g!==void 0?g:y.default;return{strictSchema:(A=(w=j.strictSchema)!==null&&w!==void 0?w:Yt)!==null&&A!==void 0?A:!0,strictNumbers:(Q=(Z=j.strictNumbers)!==null&&Z!==void 0?Z:Yt)!==null&&Q!==void 0?Q:!0,strictTypes:(ie=(fe=j.strictTypes)!==null&&fe!==void 0?fe:Yt)!==null&&ie!==void 0?ie:"log",strictTuples:(at=(he=j.strictTuples)!==null&&he!==void 0?he:Yt)!==null&&at!==void 0?at:"log",strictRequired:(Oe=(Ve=j.strictRequired)!==null&&Ve!==void 0?Ve:Yt)!==null&&Oe!==void 0?Oe:!1,code:j.code?{...j.code,optimize:an,regExp:_t}:{optimize:an,regExp:_t},loopRequired:(gt=j.loopRequired)!==null&>!==void 0?gt:$,loopEnum:(Ke=j.loopEnum)!==null&&Ke!==void 0?Ke:$,meta:(Mt=j.meta)!==null&&Mt!==void 0?Mt:!0,messages:(Ct=j.messages)!==null&&Ct!==void 0?Ct:!0,inlineRefs:(qe=j.inlineRefs)!==null&&qe!==void 0?qe:!0,schemaId:(yt=j.schemaId)!==null&&yt!==void 0?yt:"$id",addUsedSchema:(Xt=j.addUsedSchema)!==null&&Xt!==void 0?Xt:!0,validateSchema:(Me=j.validateSchema)!==null&&Me!==void 0?Me:!0,validateFormats:(Le=j.validateFormats)!==null&&Le!==void 0?Le:!0,unicodeRegExp:(Xe=j.unicodeRegExp)!==null&&Xe!==void 0?Xe:!0,int32range:(fr=j.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:Or}}class T{constructor(S={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,S=this.opts={...S,...E(S)};const{es5:D,lines:O}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:p,es5:D,lines:O}),this.logger=B(S.logger);const g=S.validateFormats;S.validateFormats=!1,this.RULES=(0,n.getRules)(),C.call(this,h,S,"NOT SUPPORTED"),C.call(this,v,S,"DEPRECATED","warn"),this._metaOpts=X.call(this),S.formats&&V.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),S.keywords&&z.call(this,S.keywords),typeof S.meta=="object"&&this.addMetaSchema(S.meta),K.call(this),S.validateFormats=g}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:S,meta:D,schemaId:O}=this.opts;let g=d;O==="id"&&(g={...d},g.id=g.$id,delete g.$id),D&&S&&this.addMetaSchema(g,g[O],!1)}defaultMeta(){const{meta:S,schemaId:D}=this.opts;return this.opts.defaultMeta=typeof S=="object"?S[D]||S:void 0}validate(S,D){let O;if(typeof S=="string"){if(O=this.getSchema(S),!O)throw new Error(`no schema with key or ref "${S}"`)}else O=this.compile(S);const g=O(D);return"$async"in O||(this.errors=O.errors),g}compile(S,D){const O=this._addSchema(S,D);return O.validate||this._compileSchemaEnv(O)}compileAsync(S,D){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:O}=this.opts;return g.call(this,S,D);async function g(ie,he){await w.call(this,ie.$schema);const at=this._addSchema(ie,he);return at.validate||A.call(this,at)}async function w(ie){ie&&!this.getSchema(ie)&&await g.call(this,{$ref:ie},!0)}async function A(ie){try{return this._compileSchemaEnv(ie)}catch(he){if(!(he instanceof r.default))throw he;return Z.call(this,he),await Q.call(this,he.missingSchema),A.call(this,ie)}}function Z({missingSchema:ie,missingRef:he}){if(this.refs[ie])throw new Error(`AnySchema ${ie} is loaded but ${he} cannot be resolved`)}async function Q(ie){const he=await fe.call(this,ie);this.refs[ie]||await w.call(this,he.$schema),this.refs[ie]||this.addSchema(he,ie,D)}async function fe(ie){const he=this._loading[ie];if(he)return he;try{return await(this._loading[ie]=O(ie))}finally{delete this._loading[ie]}}}addSchema(S,D,O,g=this.opts.validateSchema){if(Array.isArray(S)){for(const A of S)this.addSchema(A,void 0,O,g);return this}let w;if(typeof S=="object"){const{schemaId:A}=this.opts;if(w=S[A],w!==void 0&&typeof w!="string")throw new Error(`schema ${A} must be string`)}return D=(0,c.normalizeId)(D||w),this._checkUnique(D),this.schemas[D]=this._addSchema(S,O,D,g,!0),this}addMetaSchema(S,D,O=this.opts.validateSchema){return this.addSchema(S,D,!0,O),this}validateSchema(S,D){if(typeof S=="boolean")return!0;let O;if(O=S.$schema,O!==void 0&&typeof O!="string")throw new Error("$schema must be a string");if(O=O||this.opts.defaultMeta||this.defaultMeta(),!O)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const g=this.validate(O,S);if(!g&&D){const w="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(w);else throw new Error(w)}return g}getSchema(S){let D;for(;typeof(D=x.call(this,S))=="string";)S=D;if(D===void 0){const{schemaId:O}=this.opts,g=new i.SchemaEnv({schema:{},schemaId:O});if(D=i.resolveSchema.call(this,g,S),!D)return;this.refs[S]=D}return D.validate||this._compileSchemaEnv(D)}removeSchema(S){if(S instanceof RegExp)return this._removeAllSchemas(this.schemas,S),this._removeAllSchemas(this.refs,S),this;switch(typeof S){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const D=x.call(this,S);return typeof D=="object"&&this._cache.delete(D.schema),delete this.schemas[S],delete this.refs[S],this}case"object":{const D=S;this._cache.delete(D);let O=S[this.opts.schemaId];return O&&(O=(0,c.normalizeId)(O),delete this.schemas[O],delete this.refs[O]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(S){for(const D of S)this.addKeyword(D);return this}addKeyword(S,D){let O;if(typeof S=="string")O=S,typeof D=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),D.keyword=O);else if(typeof S=="object"&&D===void 0){if(D=S,O=D.keyword,Array.isArray(O)&&!O.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M.call(this,O,D),!D)return(0,u.eachItem)(O,w=>re.call(this,w)),this;ve.call(this,D);const g={...D,type:(0,l.getJSONTypes)(D.type),schemaType:(0,l.getJSONTypes)(D.schemaType)};return(0,u.eachItem)(O,g.type.length===0?w=>re.call(this,w,g):w=>g.type.forEach(A=>re.call(this,w,g,A))),this}getKeyword(S){const D=this.RULES.all[S];return typeof D=="object"?D.definition:!!D}removeKeyword(S){const{RULES:D}=this;delete D.keywords[S],delete D.all[S];for(const O of D.rules){const g=O.rules.findIndex(w=>w.keyword===S);g>=0&&O.rules.splice(g,1)}return this}addFormat(S,D){return typeof D=="string"&&(D=new RegExp(D)),this.formats[S]=D,this}errorsText(S=this.errors,{separator:D=", ",dataVar:O="data"}={}){return!S||S.length===0?"No errors":S.map(g=>`${O}${g.instancePath} ${g.message}`).reduce((g,w)=>g+D+w)}$dataMetaSchema(S,D){const O=this.RULES.all;S=JSON.parse(JSON.stringify(S));for(const g of D){const w=g.split("/").slice(1);let A=S;for(const Z of w)A=A[Z];for(const Z in O){const Q=O[Z];if(typeof Q!="object")continue;const{$data:fe}=Q.definition,ie=A[Z];fe&&ie&&(A[Z]=de(ie))}}return S}_removeAllSchemas(S,D){for(const O in S){const g=S[O];(!D||D.test(O))&&(typeof g=="string"?delete S[O]:g&&!g.meta&&(this._cache.delete(g.schema),delete S[O]))}}_addSchema(S,D,O,g=this.opts.validateSchema,w=this.opts.addUsedSchema){let A;const{schemaId:Z}=this.opts;if(typeof S=="object")A=S[Z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof S!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(S);if(Q!==void 0)return Q;O=(0,c.normalizeId)(A||O);const fe=c.getSchemaRefs.call(this,S,O);return Q=new i.SchemaEnv({schema:S,schemaId:Z,meta:D,baseId:O,localRefs:fe}),this._cache.set(Q.schema,Q),w&&!O.startsWith("#")&&(O&&this._checkUnique(O),this.refs[O]=Q),g&&this.validateSchema(S,!0),Q}_checkUnique(S){if(this.schemas[S]||this.refs[S])throw new Error(`schema with key or id "${S}" already exists`)}_compileSchemaEnv(S){if(S.meta?this._compileMetaSchema(S):i.compileSchema.call(this,S),!S.validate)throw new Error("ajv implementation error");return S.validate}_compileMetaSchema(S){const D=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,S)}finally{this.opts=D}}}T.ValidationError=s.default,T.MissingRefError=r.default,t.default=T;function C(j,S,D,O="error"){for(const g in j){const w=g;w in S&&this.logger[O](`${D}: option ${g}. ${j[w]}`)}}function x(j){return j=(0,c.normalizeId)(j),this.schemas[j]||this.refs[j]}function K(){const j=this.opts.schemas;if(j)if(Array.isArray(j))this.addSchema(j);else for(const S in j)this.addSchema(j[S],S)}function V(){for(const j in this.opts.formats){const S=this.opts.formats[j];S&&this.addFormat(j,S)}}function z(j){if(Array.isArray(j)){this.addVocabulary(j);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const S in j){const D=j[S];D.keyword||(D.keyword=S),this.addKeyword(D)}}function X(){const j={...this.opts};for(const S of m)delete j[S];return j}const Y={log(){},warn(){},error(){}};function B(j){if(j===!1)return Y;if(j===void 0)return console;if(j.log&&j.warn&&j.error)return j;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function M(j,S){const{RULES:D}=this;if((0,u.eachItem)(j,O=>{if(D.keywords[O])throw new Error(`Keyword ${O} is already defined`);if(!F.test(O))throw new Error(`Keyword ${O} has invalid name`)}),!!S&&S.$data&&!("code"in S||"validate"in S))throw new Error('$data keyword must have "code" or "validate" function')}function re(j,S,D){var O;const g=S==null?void 0:S.post;if(D&&g)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:w}=this;let A=g?w.post:w.rules.find(({type:Q})=>Q===D);if(A||(A={type:D,rules:[]},w.rules.push(A)),w.keywords[j]=!0,!S)return;const Z={keyword:j,definition:{...S,type:(0,l.getJSONTypes)(S.type),schemaType:(0,l.getJSONTypes)(S.schemaType)}};S.before?_e.call(this,A,Z,S.before):A.rules.push(Z),w.all[j]=Z,(O=S.implements)===null||O===void 0||O.forEach(Q=>this.addKeyword(Q))}function _e(j,S,D){const O=j.rules.findIndex(g=>g.keyword===D);O>=0?j.rules.splice(O,0,S):(j.rules.push(S),this.logger.warn(`rule ${D} is not defined`))}function ve(j){let{metaSchema:S}=j;S!==void 0&&(j.$data&&this.opts.$data&&(S=de(S)),j.validateSchema=this.compile(S,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function de(j){return{anyOf:[j,be]}}}(Wo);var Cn={},In={},Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const yp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Nn.default=yp;var gr={};Object.defineProperty(gr,"__esModule",{value:!0}),gr.callRef=gr.getValidate=void 0;const _p=xr,Wl=ye,ut=ge,Mr=It,Xl=ct,Ha=G,$p={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:i,opts:o,self:c}=s,{root:l}=n;if((a==="#"||a==="#/")&&r===l.baseId)return d();const u=Xl.resolveRef.call(c,l,r,a);if(u===void 0)throw new _p.default(s.opts.uriResolver,r,a);if(u instanceof Xl.SchemaEnv)return y(u);return f(u);function d(){if(n===l)return Za(t,i,n,n.$async);const m=e.scopeValue("root",{ref:l});return Za(t,(0,ut._)`${m}.validate`,l,l.$async)}function y(m){const p=Yl(t,m);Za(t,p,m,m.$async)}function f(m){const p=e.scopeValue("schema",o.code.source===!0?{ref:m,code:(0,ut.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:ut.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(v),t.ok(h)}}};function Yl(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,ut._)`${a.scopeValue("wrapper",{ref:e})}.validate`}gr.getValidate=Yl;function Za(t,e,a,s){const{gen:r,it:n}=t,{allErrors:i,schemaEnv:o,opts:c}=n,l=c.passContext?Mr.default.this:ut.nil;s?u():d();function u(){if(!o.$async)throw new Error("async schema referenced by sync schema");const m=r.let("valid");r.try(()=>{r.code((0,ut._)`await ${(0,Wl.callValidateCode)(t,e,l)}`),f(e),i||r.assign(m,!0)},p=>{r.if((0,ut._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),y(p),i||r.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Wl.callValidateCode)(t,e,l),()=>f(e),()=>y(e))}function y(m){const p=(0,ut._)`${m}.errors`;r.assign(Mr.default.vErrors,(0,ut._)`${Mr.default.vErrors} === null ? ${p} : ${Mr.default.vErrors}.concat(${p})`),r.assign(Mr.default.errors,(0,ut._)`${Mr.default.vErrors}.length`)}function f(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=Ha.mergeEvaluated.props(r,h.props,n.props));else{const v=r.var("props",(0,ut._)`${m}.evaluated.props`);n.props=Ha.mergeEvaluated.props(r,v,n.props,ut.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=Ha.mergeEvaluated.items(r,h.items,n.items));else{const v=r.var("items",(0,ut._)`${m}.evaluated.items`);n.items=Ha.mergeEvaluated.items(r,v,n.items,ut.Name)}}}gr.callRef=Za,gr.default=$p,Object.defineProperty(In,"__esModule",{value:!0});const wp=Nn,bp=gr,Pp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wp.default,bp.default];In.default=Pp;var An={},jn={};Object.defineProperty(jn,"__esModule",{value:!0});const Ka=ge,sr=Ka.operators,Ba={maximum:{okStr:"<=",ok:sr.LTE,fail:sr.GT},minimum:{okStr:">=",ok:sr.GTE,fail:sr.LT},exclusiveMaximum:{okStr:"<",ok:sr.LT,fail:sr.GTE},exclusiveMinimum:{okStr:">",ok:sr.GT,fail:sr.LTE}},Ep={message:({keyword:t,schemaCode:e})=>(0,Ka.str)`must be ${Ba[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ka._)`{comparison: ${Ba[t].okStr}, limit: ${e}}`},Sp={keyword:Object.keys(Ba),type:"number",schemaType:"number",$data:!0,error:Ep,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,Ka._)`${a} ${Ba[e].fail} ${s} || isNaN(${a})`)}};jn.default=Sp;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const ca=ge,Rp={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,ca.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ca._)`{multipleOf: ${t}}`},code(t){const{gen:e,data:a,schemaCode:s,it:r}=t,n=r.opts.multipleOfPrecision,i=e.let("res"),o=n?(0,ca._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${n}`:(0,ca._)`${i} !== parseInt(${i})`;t.fail$data((0,ca._)`(${s} === 0 || (${i} = ${a}/${s}, ${o}))`)}};Dn.default=Rp;var xn={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});function ec(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}Mn.default=ec,ec.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(xn,"__esModule",{value:!0});const yr=ge,kp=G,Tp=Mn,Op={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,yr.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,yr._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?yr.operators.GT:yr.operators.LT,i=r.opts.unicode===!1?(0,yr._)`${a}.length`:(0,yr._)`${(0,kp.useFunc)(t.gen,Tp.default)}(${a})`;t.fail$data((0,yr._)`${i} ${n} ${s}`)}};xn.default=Op;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const Cp=ye,Ja=ge,Ip={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ja.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ja._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,i=n.opts.unicodeRegExp?"u":"",o=a?(0,Ja._)`(new RegExp(${r}, ${i}))`:(0,Cp.usePattern)(t,s);t.fail$data((0,Ja._)`!${o}.test(${e})`)}};Ln.default=Ip;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const ua=ge,Np={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,ua.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,ua._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?ua.operators.GT:ua.operators.LT;t.fail$data((0,ua._)`Object.keys(${a}).length ${r} ${s}`)}};Fn.default=Np;var qn={};Object.defineProperty(qn,"__esModule",{value:!0});const da=ye,fa=ge,Ap=G,jp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,fa.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,fa._)`{missingProperty: ${t}}`},code(t){const{gen:e,schema:a,schemaCode:s,data:r,$data:n,it:i}=t,{opts:o}=i;if(!n&&a.length===0)return;const c=a.length>=o.loopRequired;if(i.allErrors?l():u(),o.strictRequired){const f=t.parentSchema.properties,{definedProperties:m}=t.it;for(const p of a)if((f==null?void 0:f[p])===void 0&&!m.has(p)){const h=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,Ap.checkStrictMode)(i,v,i.opts.strictRequired)}}function l(){if(c||n)t.block$data(fa.nil,d);else for(const f of a)(0,da.checkReportMissingProp)(t,f)}function u(){const f=e.let("missing");if(c||n){const m=e.let("valid",!0);t.block$data(m,()=>y(f,m)),t.ok(m)}else e.if((0,da.checkMissingProp)(t,a,f)),(0,da.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",s,f=>{t.setParams({missingProperty:f}),e.if((0,da.noPropertyInData)(e,r,f,o.ownProperties),()=>t.error())})}function y(f,m){t.setParams({missingProperty:f}),e.forOf(f,s,()=>{e.assign(m,(0,da.propertyInData)(e,r,f,o.ownProperties)),e.if((0,fa.not)(m),()=>{t.error(),e.break()})},fa.nil)}}};qn.default=jp;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const ha=ge,Dp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,ha.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,ha._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?ha.operators.GT:ha.operators.LT;t.fail$data((0,ha._)`${a}.length ${r} ${s}`)}};Un.default=Dp;var Vn={},pa={};Object.defineProperty(pa,"__esModule",{value:!0});const tc=sa;tc.code='require("ajv/dist/runtime/equal").default',pa.default=tc,Object.defineProperty(Vn,"__esModule",{value:!0});const zn=Je,et=ge,xp=G,Mp=pa,Lp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,et.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,et._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:i,it:o}=t;if(!s&&!r)return;const c=e.let("valid"),l=n.items?(0,zn.getSchemaTypes)(n.items):[];t.block$data(c,u,(0,et._)`${i} === false`),t.ok(c);function u(){const m=e.let("i",(0,et._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(c,!0),e.if((0,et._)`${m} > 1`,()=>(d()?y:f)(m,p))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function y(m,p){const h=e.name("item"),v=(0,zn.checkDataTypes)(l,h,o.opts.strictNumbers,zn.DataType.Wrong),$=e.const("indices",(0,et._)`{}`);e.for((0,et._)`;${m}--;`,()=>{e.let(h,(0,et._)`${a}[${m}]`),e.if(v,(0,et._)`continue`),l.length>1&&e.if((0,et._)`typeof ${h} == "string"`,(0,et._)`${h} += "_"`),e.if((0,et._)`typeof ${$}[${h}] == "number"`,()=>{e.assign(p,(0,et._)`${$}[${h}]`),t.error(),e.assign(c,!1).break()}).code((0,et._)`${$}[${h}] = ${m}`)})}function f(m,p){const h=(0,xp.useFunc)(e,Mp.default),v=e.name("outer");e.label(v).for((0,et._)`;${m}--;`,()=>e.for((0,et._)`${p} = ${m}; ${p}--;`,()=>e.if((0,et._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Vn.default=Lp;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const Zn=ge,Fp=G,qp=pa,Up={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,Zn._)`{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,Zn._)`!${(0,Fp.useFunc)(e,qp.default)}(${a}, ${r})`):t.fail((0,Zn._)`${n} !== ${a}`)}};Hn.default=Up;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});const ma=ge,Vp=G,zp=pa,Hp={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ma._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:a,$data:s,schema:r,schemaCode:n,it:i}=t;if(!s&&r.length===0)throw new Error("enum must have non-empty array");const o=r.length>=i.opts.loopEnum;let c;const l=()=>c??(c=(0,Vp.useFunc)(e,zp.default));let u;if(o||s)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(r))throw new Error("ajv implementation error");const f=e.const("vSchema",n);u=(0,ma.or)(...r.map((m,p)=>y(f,p)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",n,f=>e.if((0,ma._)`${l()}(${a}, ${f})`,()=>e.assign(u,!0).break()))}function y(f,m){const p=r[m];return typeof p=="object"&&p!==null?(0,ma._)`${l()}(${a}, ${f}[${m}])`:(0,ma._)`${a} === ${p}`}}};Kn.default=Hp,Object.defineProperty(An,"__esModule",{value:!0});const Zp=jn,Kp=Dn,Bp=xn,Jp=Ln,Qp=Fn,Gp=qn,Wp=Un,Xp=Vn,Yp=Hn,em=Kn,tm=[Zp.default,Kp.default,Bp.default,Jp.default,Qp.default,Gp.default,Wp.default,Xp.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Yp.default,em.default];An.default=tm;var Bn={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.validateAdditionalItems=void 0;const _r=ge,Jn=G,rm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,_r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,_r._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,Jn.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}rc(t,s)}};function rc(t,e){const{gen:a,schema:s,data:r,keyword:n,it:i}=t;i.items=!0;const o=a.const("len",(0,_r._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,_r._)`${o} <= ${e.length}`);else if(typeof s=="object"&&!(0,Jn.alwaysValidSchema)(i,s)){const l=a.var("valid",(0,_r._)`${o} <= ${e.length}`);a.if((0,_r.not)(l),()=>c(l)),t.ok(l)}function c(l){a.forRange("i",e.length,o,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Jn.Type.Num},l),i.allErrors||a.if((0,_r.not)(l),()=>a.break())})}}Lr.validateAdditionalItems=rc,Lr.default=rm;var Qn={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.validateTuple=void 0;const ac=ge,Qa=G,am=ye,sm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return sc(t,"additionalItems",e);a.items=!0,!(0,Qa.alwaysValidSchema)(a,e)&&t.ok((0,am.validateArray)(t))}};function sc(t,e,a=t.schema){const{gen:s,parentSchema:r,data:n,keyword:i,it:o}=t;u(r),o.opts.unevaluated&&a.length&&o.items!==!0&&(o.items=Qa.mergeEvaluated.items(s,a.length,o.items));const c=s.name("valid"),l=s.const("len",(0,ac._)`${n}.length`);a.forEach((d,y)=>{(0,Qa.alwaysValidSchema)(o,d)||(s.if((0,ac._)`${l} > ${y}`,()=>t.subschema({keyword:i,schemaProp:y,dataProp:y},c)),t.ok(c))});function u(d){const{opts:y,errSchemaPath:f}=o,m=a.length,p=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(y.strictTuples&&!p){const h=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Qa.checkStrictMode)(o,h,y.strictTuples)}}}Fr.validateTuple=sc,Fr.default=sm,Object.defineProperty(Qn,"__esModule",{value:!0});const nm=Fr,im={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,nm.validateTuple)(t,"items")};Qn.default=im;var Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});const nc=ge,om=G,lm=ye,cm=Lr,um={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,nc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,nc._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,om.alwaysValidSchema)(s,e)&&(r?(0,cm.validateAdditionalItems)(t,r):t.ok((0,lm.validateArray)(t)))}};Gn.default=um;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});const pt=ge,Ga=G,dm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,pt.str)`must contain at least ${t} valid item(s)`:(0,pt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,pt._)`{minContains: ${t}}`:(0,pt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let i,o;const{minContains:c,maxContains:l}=s;n.opts.next?(i=c===void 0?1:c,o=l):i=1;const u=e.const("len",(0,pt._)`${r}.length`);if(t.setParams({min:i,max:o}),o===void 0&&i===0){(0,Ga.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&i>o){(0,Ga.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ga.alwaysValidSchema)(n,a)){let p=(0,pt._)`${u} >= ${i}`;o!==void 0&&(p=(0,pt._)`${p} && ${u} <= ${o}`),t.pass(p);return}n.items=!0;const d=e.name("valid");o===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),o!==void 0&&e.if((0,pt._)`${r}.length > 0`,y)):(e.let(d,!1),y()),t.result(d,()=>t.reset());function y(){const p=e.name("_valid"),h=e.let("count",0);f(p,()=>e.if(p,()=>m(h)))}function f(p,h){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Ga.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,pt._)`${p}++`),o===void 0?e.if((0,pt._)`${p} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,pt._)`${p} > ${o}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,pt._)`${p} >= ${i}`,()=>e.assign(d,!0)))}}};Wn.default=dm;var ic={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ge,a=G,s=ye;t.error={message:({params:{property:c,depsCount:l,deps:u}})=>{const d=l===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:u,missingProperty:d}})=>(0,e._)`{property: ${c},
|
|
6
|
-
missingProperty: ${d},
|
|
7
|
-
depsCount: ${l},
|
|
8
|
-
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[l,u]=n(c);i(c,l),o(c,u)}};function n({schema:c}){const l={},u={};for(const d in c){if(d==="__proto__")continue;const y=Array.isArray(c[d])?l:u;y[d]=c[d]}return[l,u]}function i(c,l=c.schema){const{gen:u,data:d,it:y}=c;if(Object.keys(l).length===0)return;const f=u.let("missing");for(const m in l){const p=l[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,d,m,y.opts.ownProperties);c.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),y.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(c,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(c,p,f)})`),(0,s.reportMissingProp)(c,f),u.else())}}t.validatePropertyDeps=i;function o(c,l=c.schema){const{gen:u,data:d,keyword:y,it:f}=c,m=u.name("valid");for(const p in l)(0,a.alwaysValidSchema)(f,l[p])||(u.if((0,s.propertyInData)(u,d,p,f.opts.ownProperties),()=>{const h=c.subschema({keyword:y,schemaProp:p},m);c.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),c.ok(m))}t.validateSchemaDeps=o,t.default=r})(ic);var Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});const oc=ge,fm=G,hm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,oc._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,fm.alwaysValidSchema)(r,a))return;const n=e.name("valid");e.forIn("key",s,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},n),e.if((0,oc.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};Xn.default=hm;var Wa={};Object.defineProperty(Wa,"__esModule",{value:!0});const Xa=ye,Et=ge,pm=It,Ya=G,mm={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:i}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:o,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ya.alwaysValidSchema)(i,a))return;const l=(0,Xa.allSchemaProperties)(s.properties),u=(0,Xa.allSchemaProperties)(s.patternProperties);d(),t.ok((0,Et._)`${n} === ${pm.default.errors}`);function d(){e.forIn("key",r,h=>{!l.length&&!u.length?m(h):e.if(y(h),()=>m(h))})}function y(h){let v;if(l.length>8){const $=(0,Ya.schemaRefOrVal)(i,s.properties,"properties");v=(0,Xa.isOwnProperty)(e,$,h)}else l.length?v=(0,Et.or)(...l.map($=>(0,Et._)`${h} === ${$}`)):v=Et.nil;return u.length&&(v=(0,Et.or)(v,...u.map($=>(0,Et._)`${(0,Xa.usePattern)(t,$)}.test(${h})`))),(0,Et.not)(v)}function f(h){e.code((0,Et._)`delete ${r}[${h}]`)}function m(h){if(c.removeAdditional==="all"||c.removeAdditional&&a===!1){f(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),o||e.break();return}if(typeof a=="object"&&!(0,Ya.alwaysValidSchema)(i,a)){const v=e.name("valid");c.removeAdditional==="failing"?(p(h,v,!1),e.if((0,Et.not)(v),()=>{t.reset(),f(h)})):(p(h,v),o||e.if((0,Et.not)(v),()=>e.break()))}}function p(h,v,$){const E={keyword:"additionalProperties",dataProp:h,dataPropType:Ya.Type.Str};$===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(E,v)}}};Wa.default=mm;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});const vm=wt,lc=ye,ei=G,cc=Wa,gm={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&&cc.default.code(new vm.KeywordCxt(n,cc.default,"additionalProperties"));const i=(0,lc.allSchemaProperties)(a);for(const d of i)n.definedProperties.add(d);n.opts.unevaluated&&i.length&&n.props!==!0&&(n.props=ei.mergeEvaluated.props(e,(0,ei.toHash)(i),n.props));const o=i.filter(d=>!(0,ei.alwaysValidSchema)(n,a[d]));if(o.length===0)return;const c=e.name("valid");for(const d of o)l(d)?u(d):(e.if((0,lc.propertyInData)(e,r,d,n.opts.ownProperties)),u(d),n.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return n.opts.useDefaults&&!n.compositeRule&&a[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Yn.default=gm;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const uc=ye,es=ge,dc=G,fc=G,ym={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:a,data:s,parentSchema:r,it:n}=t,{opts:i}=n,o=(0,uc.allSchemaProperties)(a),c=o.filter(p=>(0,dc.alwaysValidSchema)(n,a[p]));if(o.length===0||c.length===o.length&&(!n.opts.unevaluated||n.props===!0))return;const l=i.strictSchema&&!i.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof es.Name)&&(n.props=(0,fc.evaluatedPropsToName)(e,n.props));const{props:d}=n;y();function y(){for(const p of o)l&&f(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function f(p){for(const h in l)new RegExp(p).test(h)&&(0,dc.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,es._)`${(0,uc.usePattern)(t,p)}.test(${h})`,()=>{const v=c.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:fc.Type.Str},u),n.opts.unevaluated&&d!==!0?e.assign((0,es._)`${d}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,es.not)(u),()=>e.break())})})}}};ti.default=ym;var ri={};Object.defineProperty(ri,"__esModule",{value:!0});const _m=G,$m={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,_m.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"}};ri.default=$m;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});const wm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ye.validateUnion,error:{message:"must match a schema in anyOf"}};ai.default=wm;var si={};Object.defineProperty(si,"__esModule",{value:!0});const ts=ge,bm=G,Pm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ts._)`{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,i=e.let("valid",!1),o=e.let("passing",null),c=e.name("_valid");t.setParams({passing:o}),e.block(l),t.result(i,()=>t.reset(),()=>t.error(!0));function l(){n.forEach((u,d)=>{let y;(0,bm.alwaysValidSchema)(r,u)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,ts._)`${c} && ${i}`).assign(i,!1).assign(o,(0,ts._)`[${o}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(o,d),y&&t.mergeEvaluated(y,ts.Name)})})}}};si.default=Pm;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const Em=G,Sm={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,i)=>{if((0,Em.alwaysValidSchema)(s,n))return;const o=t.subschema({keyword:"allOf",schemaProp:i},r);t.ok(r),t.mergeEvaluated(o)})}};ni.default=Sm;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const rs=ge,hc=G,Rm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,rs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,rs._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,hc.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=pc(s,"then"),n=pc(s,"else");if(!r&&!n)return;const i=e.let("valid",!0),o=e.name("_valid");if(c(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(o,l("then",u),l("else",u))}else r?e.if(o,l("then")):e.if((0,rs.not)(o),l("else"));t.pass(i,()=>t.error(!0));function c(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);t.mergeEvaluated(u)}function l(u,d){return()=>{const y=t.subschema({keyword:u},o);e.assign(i,o),t.mergeValidEvaluated(y,i),d?e.assign(d,(0,rs._)`${u}`):t.setParams({ifClause:u})}}}};function pc(t,e){const a=t.schema[e];return a!==void 0&&!(0,hc.alwaysValidSchema)(t,a)}ii.default=Rm;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});const km=G,Tm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,km.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};oi.default=Tm,Object.defineProperty(Bn,"__esModule",{value:!0});const Om=Lr,Cm=Qn,Im=Fr,Nm=Gn,Am=Wn,jm=ic,Dm=Xn,xm=Wa,Mm=Yn,Lm=ti,Fm=ri,qm=ai,Um=si,Vm=ni,zm=ii,Hm=oi;function Zm(t=!1){const e=[Fm.default,qm.default,Um.default,Vm.default,zm.default,Hm.default,Dm.default,xm.default,jm.default,Mm.default,Lm.default];return t?e.push(Cm.default,Nm.default):e.push(Om.default,Im.default),e.push(Am.default),e}Bn.default=Zm;var li={},ci={};Object.defineProperty(ci,"__esModule",{value:!0});const Ue=ge,Km={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,Ue.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ue._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:i,it:o}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=o;if(!c.validateFormats)return;r?y():f();function y(){const m=a.scopeValue("formats",{ref:d.formats,code:c.code.formats}),p=a.const("fDef",(0,Ue._)`${m}[${i}]`),h=a.let("fType"),v=a.let("format");a.if((0,Ue._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,Ue._)`${p}.type || "string"`).assign(v,(0,Ue._)`${p}.validate`),()=>a.assign(h,(0,Ue._)`"string"`).assign(v,p)),t.fail$data((0,Ue.or)($(),E()));function $(){return c.strictSchema===!1?Ue.nil:(0,Ue._)`${i} && !${v}`}function E(){const T=u.$async?(0,Ue._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,Ue._)`${v}(${s})`,C=(0,Ue._)`(typeof ${v} == "function" ? ${T} : ${v}.test(${s}))`;return(0,Ue._)`${v} && ${v} !== true && ${h} === ${e} && !${C}`}}function f(){const m=d.formats[n];if(!m){$();return}if(m===!0)return;const[p,h,v]=E(m);p===e&&t.pass(T());function $(){if(c.strictSchema===!1){d.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${n}" ignored in schema at path "${l}"`}}function E(C){const x=C instanceof RegExp?(0,Ue.regexpCode)(C):c.code.formats?(0,Ue._)`${c.code.formats}${(0,Ue.getProperty)(n)}`:void 0,K=a.scopeValue("formats",{key:n,ref:C,code:x});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Ue._)`${K}.validate`]:["string",C,K]}function T(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ue._)`await ${v}(${s})`}return typeof h=="function"?(0,Ue._)`${v}(${s})`:(0,Ue._)`${v}.test(${s})`}}}};ci.default=Km,Object.defineProperty(li,"__esModule",{value:!0});const Bm=[ci.default];li.default=Bm;var qr={};Object.defineProperty(qr,"__esModule",{value:!0}),qr.contentVocabulary=qr.metadataVocabulary=void 0,qr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],qr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Cn,"__esModule",{value:!0});const Jm=In,Qm=An,Gm=Bn,Wm=li,mc=qr,Xm=[Jm.default,Qm.default,(0,Gm.default)(),Wm.default,mc.metadataVocabulary,mc.contentVocabulary];Cn.default=Xm;var ui={},as={};Object.defineProperty(as,"__esModule",{value:!0}),as.DiscrError=void 0;var vc;(function(t){t.Tag="tag",t.Mapping="mapping"})(vc||(as.DiscrError=vc={})),Object.defineProperty(ui,"__esModule",{value:!0});const Ur=ge,di=as,gc=ct,Ym=xr,ev=G,tv={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===di.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,Ur._)`{error: ${t}, tag: ${a}, tagValue: ${e}}`},code(t){const{gen:e,data:a,schema:s,parentSchema:r,it:n}=t,{oneOf:i}=r;if(!n.opts.discriminator)throw new Error("discriminator: requires discriminator option");const o=s.propertyName;if(typeof o!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=e.let("valid",!1),l=e.const("tag",(0,Ur._)`${a}${(0,Ur.getProperty)(o)}`);e.if((0,Ur._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:di.DiscrError.Tag,tag:l,tagName:o})),t.ok(c);function u(){const f=y();e.if(!1);for(const m in f)e.elseIf((0,Ur._)`${l} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:di.DiscrError.Mapping,tag:l,tagName:o}),e.endIf()}function d(f){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(p,Ur.Name),m}function y(){var f;const m={},p=v(r);let h=!0;for(let T=0;T<i.length;T++){let C=i[T];if(C!=null&&C.$ref&&!(0,ev.schemaHasRulesButRef)(C,n.self.RULES)){const K=C.$ref;if(C=gc.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,K),C instanceof gc.SchemaEnv&&(C=C.schema),C===void 0)throw new Ym.default(n.opts.uriResolver,n.baseId,K)}const x=(f=C==null?void 0:C.properties)===null||f===void 0?void 0:f[o];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);h=h&&(p||v(C)),$(x,T)}if(!h)throw new Error(`discriminator: "${o}" must be required`);return m;function v({required:T}){return Array.isArray(T)&&T.includes(o)}function $(T,C){if(T.const)E(T.const,C);else if(T.enum)for(const x of T.enum)E(x,C);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function E(T,C){if(typeof T!="string"||T in m)throw new Error(`discriminator: "${o}" values must be unique strings`);m[T]=C}}}};ui.default=tv;const rv={$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=Wo,s=Cn,r=ui,n=rv,i=["/properties"],o="http://json-schema.org/draft-07/schema";class c 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,i):n;this.addMetaSchema(m,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=wt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=ge;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 d=oa;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var y=xr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return y.default}})})(ln,ln.exports);var av=ln.exports;const sv=Go(av);var Se;(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 i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},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 i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Se||(Se={}));var yc;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(yc||(yc={}));const W=Se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}},q=Se.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 Zt 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 i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof Zt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Se.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()}}Zt.create=t=>new Zt(t);const fi=(t,e)=>{let a;switch(t.code){case q.invalid_type:t.received===W.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,Se.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:a=`Unrecognized key(s) in object: ${Se.joinValues(t.keys,", ")}`;break;case q.invalid_union:a="Invalid input";break;case q.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Se.joinValues(t.options)}`;break;case q.invalid_enum_value:a=`Invalid enum value. Expected ${Se.joinValues(t.options)}, received '${t.received}'`;break;case q.invalid_arguments:a="Invalid function arguments";break;case q.invalid_return_type:a="Invalid function return type";break;case q.invalid_date:a="Invalid date";break;case q.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}"`:Se.assertNever(t.validation):t.validation!=="regex"?a=`Invalid ${t.validation}`:a="Invalid";break;case q.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 q.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 q.custom:a="Invalid input";break;case q.invalid_intersection_types:a="Intersection results could not be merged";break;case q.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case q.not_finite:a="Number must be finite";break;default:a=e.defaultError,Se.assertNever(t)}return{message:a}};let nv=fi;function iv(){return nv}const ov=t=>{const{data:e,path:a,errorMaps:s,issueData:r}=t,n=[...a,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="";const c=s.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}};function J(t,e){const a=iv(),s=ov({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===fi?void 0:fi].filter(r=>!!r)});t.common.issues.push(s)}class nt{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 oe;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,i=await r.value;s.push({key:n,value:i})}return nt.mergeObjectSync(e,s)}static mergeObjectSync(e,a){const s={};for(const r of a){const{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return oe;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const oe=Object.freeze({status:"aborted"}),va=t=>({status:"dirty",value:t}),mt=t=>({status:"valid",value:t}),_c=t=>t.status==="aborted",$c=t=>t.status==="dirty",Vr=t=>t.status==="valid",ss=t=>typeof Promise<"u"&&t instanceof Promise;var te;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(te||(te={}));class Dt{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 wc=(t,e)=>{if(Vr(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 Zt(t.common.issues);return this._error=a,this._error}}};function me(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:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??a??o.defaultError}},description:r}}class $e{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(ss(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:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return wc(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:nr(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return Vr(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=>Vr(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:nr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(ss(r)?r:Promise.resolve(r));return wc(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 i=e(r),o=()=>n.addIssue({code:q.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!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 br({schema:this,typeName:U.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 Jt.create(this,this._def)}nullable(){return Pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xt.create(this)}promise(){return us.create(this,this._def)}or(e){return is.create([this,e],this._def)}and(e){return os.create(this,e,this._def)}transform(e){return new br({...me(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ds({...me(this._def),innerType:this,defaultValue:a,typeName:U.ZodDefault})}brand(){return new Oc({typeName:U.ZodBranded,type:this,...me(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new fs({...me(this._def),innerType:this,catchValue:a,typeName:U.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return Pi.create(this,e)}readonly(){return hs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const lv=/^c[^\s-]{8,}$/i,cv=/^[0-9a-z]+$/,uv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dv=/^[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,fv=/^[a-z0-9_-]{21}$/i,hv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pv=/^[-+]?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)?)??$/,mv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let hi;const gv=/^(?:(?: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])$/,yv=/^(?:(?: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])$/,_v=/^(([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]))$/,$v=/^(([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])$/,wv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bc="((\\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])))",Pv=new RegExp(`^${bc}$`);function Pc(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 Ev(t){return new RegExp(`^${Pc(t)}$`)}function Sv(t){let e=`${bc}T${Pc(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 Rv(t,e){return!!((e==="v4"||!e)&&gv.test(t)||(e==="v6"||!e)&&_v.test(t))}function kv(t,e){if(!hv.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 Tv(t,e){return!!((e==="v4"||!e)&&yv.test(t)||(e==="v6"||!e)&&$v.test(t))}class Kt extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.string,received:n.parsedType}),oe}const s=new nt;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),J(r,{code:q.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),J(r,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?J(r,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&J(r,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")mv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"email",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")hi||(hi=new RegExp(vv,"u")),hi.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"emoji",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")dv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"uuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")fv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"nanoid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")lv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")cv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cuid2",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")uv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"ulid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),J(r,{validation:"url",code:q.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),J(r,{validation:"regex",code:q.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),J(r,{code:q.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),J(r,{code:q.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Sv(n).test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Pv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ev(n).test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:q.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?pv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"duration",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Rv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"ip",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?kv(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"jwt",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Tv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"cidr",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?wv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"base64",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?bv.test(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{validation:"base64url",code:q.invalid_string,message:n.message}),s.dirty()):Se.assertNever(n);return{status:s.value,value:e.data}}_regex(e,a,s){return this.refinement(r=>e.test(r),{validation:a,code:q.invalid_string,...te.errToObj(s)})}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...te.errToObj(e)})}url(e){return this._addCheck({kind:"url",...te.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...te.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...te.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...te.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...te.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...te.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...te.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...te.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...te.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...te.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...te.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...te.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,...te.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,...te.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...te.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...te.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...te.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...te.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...te.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...te.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...te.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...te.errToObj(a)})}nonempty(e){return this.min(1,te.errToObj(e))}trim(){return new Kt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kt({...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}}Kt.create=t=>new Kt({checks:[],typeName:U.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...me(t)});function Ov(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(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}class zr extends $e{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)!==W.number){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.number,received:n.parsedType}),oe}let s;const r=new nt;for(const n of this._def.checks)n.kind==="int"?Se.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:q.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),J(s,{code:q.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),J(s,{code:q.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Ov(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),J(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:q.not_finite,message:n.message}),r.dirty()):Se.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,te.toString(a))}gt(e,a){return this.setLimit("min",e,!1,te.toString(a))}lte(e,a){return this.setLimit("max",e,!0,te.toString(a))}lt(e,a){return this.setLimit("max",e,!1,te.toString(a))}setLimit(e,a,s,r){return new zr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:te.toString(r)}]})}_addCheck(e){return new zr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:te.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:te.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.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"&&Se.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)}}zr.create=t=>new zr({checks:[],typeName:U.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...me(t)});class ga extends $e{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)!==W.bigint)return this._getInvalidInput(e);let s;const r=new nt;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),J(s,{code:q.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),J(s,{code:q.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),J(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Se.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return J(a,{code:q.invalid_type,expected:W.bigint,received:a.parsedType}),oe}gte(e,a){return this.setLimit("min",e,!0,te.toString(a))}gt(e,a){return this.setLimit("min",e,!1,te.toString(a))}lte(e,a){return this.setLimit("max",e,!0,te.toString(a))}lt(e,a){return this.setLimit("max",e,!1,te.toString(a))}setLimit(e,a,s,r){return new ga({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:te.toString(r)}]})}_addCheck(e){return new ga({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:te.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}}ga.create=t=>new ga({checks:[],typeName:U.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...me(t)});class pi extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.boolean,received:s.parsedType}),oe}return mt(e.data)}}pi.create=t=>new pi({typeName:U.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...me(t)});class ns extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_type,expected:W.date,received:n.parsedType}),oe}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return J(n,{code:q.invalid_date}),oe}const s=new nt;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),J(r,{code:q.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),J(r,{code:q.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Se.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ns({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:te.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:te.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}}ns.create=t=>new ns({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:U.ZodDate,...me(t)});class Ec extends $e{_parse(e){if(this._getType(e)!==W.symbol){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.symbol,received:s.parsedType}),oe}return mt(e.data)}}Ec.create=t=>new Ec({typeName:U.ZodSymbol,...me(t)});class mi extends $e{_parse(e){if(this._getType(e)!==W.undefined){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.undefined,received:s.parsedType}),oe}return mt(e.data)}}mi.create=t=>new mi({typeName:U.ZodUndefined,...me(t)});class vi extends $e{_parse(e){if(this._getType(e)!==W.null){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.null,received:s.parsedType}),oe}return mt(e.data)}}vi.create=t=>new vi({typeName:U.ZodNull,...me(t)});class gi extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return mt(e.data)}}gi.create=t=>new gi({typeName:U.ZodAny,...me(t)});class yi extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mt(e.data)}}yi.create=t=>new yi({typeName:U.ZodUnknown,...me(t)});class ir extends $e{_parse(e){const a=this._getOrReturnCtx(e);return J(a,{code:q.invalid_type,expected:W.never,received:a.parsedType}),oe}}ir.create=t=>new ir({typeName:U.ZodNever,...me(t)});class Sc extends $e{_parse(e){if(this._getType(e)!==W.undefined){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.void,received:s.parsedType}),oe}return mt(e.data)}}Sc.create=t=>new Sc({typeName:U.ZodVoid,...me(t)});class xt extends $e{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==W.array)return J(a,{code:q.invalid_type,expected:W.array,received:a.parsedType}),oe;if(r.exactLength!==null){const i=a.data.length>r.exactLength.value,o=a.data.length<r.exactLength.value;(i||o)&&(J(a,{code:i?q.too_big:q.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?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&&(J(a,{code:q.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&&(J(a,{code:q.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((i,o)=>r.type._parseAsync(new Dt(a,i,a.path,o)))).then(i=>nt.mergeArray(s,i));const n=[...a.data].map((i,o)=>r.type._parseSync(new Dt(a,i,a.path,o)));return nt.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new xt({...this._def,minLength:{value:e,message:te.toString(a)}})}max(e,a){return new xt({...this._def,maxLength:{value:e,message:te.toString(a)}})}length(e,a){return new xt({...this._def,exactLength:{value:e,message:te.toString(a)}})}nonempty(e){return this.min(1,e)}}xt.create=(t,e)=>new xt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...me(e)});function Hr(t){if(t instanceof Ze){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Jt.create(Hr(s))}return new Ze({...t._def,shape:()=>e})}else return t instanceof xt?new xt({...t._def,type:Hr(t.element)}):t instanceof Jt?Jt.create(Hr(t.unwrap())):t instanceof Pr?Pr.create(Hr(t.unwrap())):t instanceof $r?$r.create(t.items.map(e=>Hr(e))):t}class Ze extends $e{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=Se.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==W.object){const l=this._getOrReturnCtx(e);return J(l,{code:q.invalid_type,expected:W.object,received:l.parsedType}),oe}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ir&&this._def.unknownKeys==="strip"))for(const l in r.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const u=n[l],d=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Dt(r,d,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof ir){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(l==="strict")o.length>0&&(J(r,{code:q.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const d=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Dt(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const d=await u.key,y=await u.value;l.push({key:d,value:y,alwaysSet:u.alwaysSet})}return l}).then(l=>nt.mergeObjectSync(s,l)):nt.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return te.errToObj,new Ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,s)=>{var n,i;const r=((i=(n=this._def).errorMap)==null?void 0:i.call(n,a,s).message)??s.defaultError;return a.code==="unrecognized_keys"?{message:te.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:U.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Ze({...this._def,catchall:e})}pick(e){const a={};for(const s of Se.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Ze({...this._def,shape:()=>a})}omit(e){const a={};for(const s of Se.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Ze({...this._def,shape:()=>a})}deepPartial(){return Hr(this)}partial(e){const a={};for(const s of Se.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Ze({...this._def,shape:()=>a})}required(e){const a={};for(const s of Se.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Jt;)n=n._def.innerType;a[s]=n}return new Ze({...this._def,shape:()=>a})}keyof(){return kc(Se.objectKeys(this.shape))}}Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:ir.create(),typeName:U.ZodObject,...me(e)}),Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:ir.create(),typeName:U.ZodObject,...me(e)}),Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:ir.create(),typeName:U.ZodObject,...me(e)});class is extends $e{_parse(e){const{ctx:a}=this._processInputParams(e),s=this._def.options;function r(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return a.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new Zt(o.ctx.common.issues));return J(a,{code:q.invalid_union,unionErrors:i}),oe}if(a.common.async)return Promise.all(s.map(async n=>{const i={...a,common:{...a.common,issues:[]},parent:null};return{result:await n._parseAsync({data:a.data,path:a.path,parent:i}),ctx:i}})).then(r);{let n;const i=[];for(const c of s){const l={...a,common:{...a.common,issues:[]},parent:null},u=c._parseSync({data:a.data,path:a.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(c=>new Zt(c));return J(a,{code:q.invalid_union,unionErrors:o}),oe}}get options(){return this._def.options}}is.create=(t,e)=>new is({options:t,typeName:U.ZodUnion,...me(e)});const Bt=t=>t instanceof wi?Bt(t.schema):t instanceof br?Bt(t.innerType()):t instanceof cs?[t.value]:t instanceof wr?t.options:t instanceof bi?Se.objectValues(t.enum):t instanceof ds?Bt(t._def.innerType):t instanceof mi?[void 0]:t instanceof vi?[null]:t instanceof Jt?[void 0,...Bt(t.unwrap())]:t instanceof Pr?[null,...Bt(t.unwrap())]:t instanceof Oc||t instanceof hs?Bt(t.unwrap()):t instanceof fs?Bt(t._def.innerType):[];class _i extends $e{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==W.object)return J(a,{code:q.invalid_type,expected:W.object,received:a.parsedType}),oe;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}):(J(a,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),oe)}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 i=Bt(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new _i({typeName:U.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,...me(s)})}}function $i(t,e){const a=nr(t),s=nr(e);if(t===e)return{valid:!0,data:t};if(a===W.object&&s===W.object){const r=Se.objectKeys(e),n=Se.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const c=$i(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(a===W.array&&s===W.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],c=$i(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return a===W.date&&s===W.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class os extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(_c(n)||_c(i))return oe;const o=$i(n.value,i.value);return o.valid?(($c(n)||$c(i))&&a.dirty(),{status:a.value,value:o.data}):(J(s,{code:q.invalid_intersection_types}),oe)};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,i])=>r(n,i)):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}))}}os.create=(t,e,a)=>new os({left:t,right:e,typeName:U.ZodIntersection,...me(a)});class $r extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.array)return J(s,{code:q.invalid_type,expected:W.array,received:s.parsedType}),oe;if(s.data.length<this._def.items.length)return J(s,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&s.data.length>this._def.items.length&&(J(s,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const n=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Dt(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>nt.mergeArray(a,i)):nt.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new $r({...this._def,rest:e})}}$r.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $r({items:t,typeName:U.ZodTuple,rest:null,...me(e)})};class ls extends $e{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!==W.object)return J(s,{code:q.invalid_type,expected:W.object,received:s.parsedType}),oe;const r=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:n._parse(new Dt(s,o,s.path,o)),value:i._parse(new Dt(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?nt.mergeObjectAsync(a,r):nt.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof $e?new ls({keyType:e,valueType:a,typeName:U.ZodRecord,...me(s)}):new ls({keyType:Kt.create(),valueType:e,typeName:U.ZodRecord,...me(a)})}}class Rc extends $e{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!==W.map)return J(s,{code:q.invalid_type,expected:W.map,received:s.parsedType}),oe;const r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],l)=>({key:r._parse(new Dt(s,o,s.path,[l,"key"])),value:n._parse(new Dt(s,c,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(l.value,u.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(l.value,u.value)}return{status:a.value,value:o}}}}Rc.create=(t,e,a)=>new Rc({valueType:e,keyType:t,typeName:U.ZodMap,...me(a)});class ya extends $e{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==W.set)return J(s,{code:q.invalid_type,expected:W.set,received:s.parsedType}),oe;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(J(s,{code:q.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&&(J(s,{code:q.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),a.dirty());const n=this._def.valueType;function i(c){const l=new Set;for(const u of c){if(u.status==="aborted")return oe;u.status==="dirty"&&a.dirty(),l.add(u.value)}return{status:a.value,value:l}}const o=[...s.data.values()].map((c,l)=>n._parse(new Dt(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,a){return new ya({...this._def,minSize:{value:e,message:te.toString(a)}})}max(e,a){return new ya({...this._def,maxSize:{value:e,message:te.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}ya.create=(t,e)=>new ya({valueType:t,minSize:null,maxSize:null,typeName:U.ZodSet,...me(e)});class wi extends $e{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})}}wi.create=(t,e)=>new wi({getter:t,typeName:U.ZodLazy,...me(e)});class cs extends $e{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return J(a,{received:a.data,code:q.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}cs.create=(t,e)=>new cs({value:t,typeName:U.ZodLiteral,...me(e)});function kc(t,e){return new wr({values:t,typeName:U.ZodEnum,...me(e)})}class wr extends $e{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return J(a,{expected:Se.joinValues(s),received:a.parsedType,code:q.invalid_type}),oe}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 J(a,{received:a.data,code:q.invalid_enum_value,options:s}),oe}return mt(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 wr.create(e,{...this._def,...a})}exclude(e,a=this._def){return wr.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}wr.create=kc;class bi extends $e{_parse(e){const a=Se.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==W.string&&s.parsedType!==W.number){const r=Se.objectValues(a);return J(s,{expected:Se.joinValues(r),received:s.parsedType,code:q.invalid_type}),oe}if(this._cache||(this._cache=new Set(Se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Se.objectValues(a);return J(s,{received:s.data,code:q.invalid_enum_value,options:r}),oe}return mt(e.data)}get enum(){return this._def.values}}bi.create=(t,e)=>new bi({values:t,typeName:U.ZodNativeEnum,...me(e)});class us extends $e{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==W.promise&&a.common.async===!1)return J(a,{code:q.invalid_type,expected:W.promise,received:a.parsedType}),oe;const s=a.parsedType===W.promise?a.data:Promise.resolve(a.data);return mt(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}us.create=(t,e)=>new us({type:t,typeName:U.ZodPromise,...me(e)});class br extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.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:i=>{J(s,i),i.fatal?a.abort():a.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){const i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(a.value==="aborted")return oe;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?oe:c.status==="dirty"||a.value==="dirty"?va(c.value):c});{if(a.value==="aborted")return oe;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?oe:o.status==="dirty"||a.value==="dirty"?va(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?oe:(o.status==="dirty"&&a.dirty(),i(o.value),{status:a.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?oe:(o.status==="dirty"&&a.dirty(),i(o.value).then(()=>({status:a.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Vr(i))return oe;const o=r.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Vr(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:a.value,value:o})):oe);Se.assertNever(r)}}br.create=(t,e,a)=>new br({schema:t,typeName:U.ZodEffects,effect:e,...me(a)}),br.createWithPreprocess=(t,e,a)=>new br({schema:e,effect:{type:"preprocess",transform:t},typeName:U.ZodEffects,...me(a)});class Jt extends $e{_parse(e){return this._getType(e)===W.undefined?mt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Jt.create=(t,e)=>new Jt({innerType:t,typeName:U.ZodOptional,...me(e)});class Pr extends $e{_parse(e){return this._getType(e)===W.null?mt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pr.create=(t,e)=>new Pr({innerType:t,typeName:U.ZodNullable,...me(e)});class ds extends $e{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===W.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ds.create=(t,e)=>new ds({innerType:t,typeName:U.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});class fs extends $e{_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 ss(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Zt(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Zt(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}fs.create=(t,e)=>new fs({innerType:t,typeName:U.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});class Tc extends $e{_parse(e){if(this._getType(e)!==W.nan){const s=this._getOrReturnCtx(e);return J(s,{code:q.invalid_type,expected:W.nan,received:s.parsedType}),oe}return{status:"valid",value:e.data}}}Tc.create=t=>new Tc({typeName:U.ZodNaN,...me(t)});class Oc extends $e{_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 Pi extends $e{_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"?oe:n.status==="dirty"?(a.dirty(),va(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"?oe: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 Pi({in:e,out:a,typeName:U.ZodPipeline})}}class hs extends $e{_parse(e){const a=this._def.innerType._parse(e),s=r=>(Vr(r)&&(r.value=Object.freeze(r.value)),r);return ss(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}hs.create=(t,e)=>new hs({innerType:t,typeName:U.ZodReadonly,...me(e)});var U;(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"})(U||(U={}));const k=Kt.create,We=zr.create,Qe=pi.create,Cv=gi.create,_a=yi.create;ir.create;const ee=xt.create,H=Ze.create,it=is.create,Iv=_i.create;os.create,$r.create;const $a=ls.create,ue=cs.create,Qt=wr.create;us.create;const L=Jt.create;Pr.create;const Er="2025-06-18",Nv="2025-03-26",Ei=[Er,"2025-03-26","2024-11-05","2024-10-07"],wa="2.0",Si=it([k(),We().int()]),Ri=k(),Av=H({progressToken:L(Si)}).passthrough(),vt=H({_meta:L(Av)}).passthrough(),ot=H({method:k(),params:L(vt)}),ba=H({_meta:L(H({}).passthrough())}).passthrough(),St=H({method:k(),params:L(ba)}),ht=H({_meta:L(H({}).passthrough())}).passthrough(),Pa=it([k(),We().int()]),ki=H({jsonrpc:ue(wa),id:Pa}).merge(ot).strict(),Ti=t=>ki.safeParse(t).success,Oi=H({jsonrpc:ue(wa)}).merge(St).strict(),Cc=t=>Oi.safeParse(t).success,Ci=H({jsonrpc:ue(wa),id:Pa,result:ht}).strict(),ps=t=>Ci.safeParse(t).success;R.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"}(R.ErrorCode||(R.ErrorCode={}));const Ii=H({jsonrpc:ue(wa),id:Pa,error:H({code:We().int(),message:k(),data:L(_a())})}).strict(),Ic=t=>Ii.safeParse(t).success,Ea=it([ki,Oi,Ci,Ii]),or=ht.strict(),ms=St.extend({method:ue("notifications/cancelled"),params:ba.extend({requestId:Pa,reason:k().optional()})}),Zr=H({name:k(),title:L(k())}).passthrough(),Ni=Zr.extend({version:k()}),Nc=H({experimental:L(H({}).passthrough()),sampling:L(H({}).passthrough()),elicitation:L(H({}).passthrough()),roots:L(H({listChanged:L(Qe())}).passthrough())}).passthrough(),vs=ot.extend({method:ue("initialize"),params:vt.extend({protocolVersion:k(),capabilities:Nc,clientInfo:Ni})}),jv=t=>vs.safeParse(t).success,Ac=H({experimental:L(H({}).passthrough()),logging:L(H({}).passthrough()),completions:L(H({}).passthrough()),prompts:L(H({listChanged:L(Qe())}).passthrough()),resources:L(H({subscribe:L(Qe()),listChanged:L(Qe())}).passthrough()),tools:L(H({listChanged:L(Qe())}).passthrough())}).passthrough(),Ai=ht.extend({protocolVersion:k(),capabilities:Ac,serverInfo:Ni,instructions:L(k())}),gs=St.extend({method:ue("notifications/initialized")}),jc=t=>gs.safeParse(t).success,ys=ot.extend({method:ue("ping")}),Dc=H({progress:We(),total:L(We()),message:L(k())}).passthrough(),_s=St.extend({method:ue("notifications/progress"),params:ba.merge(Dc).extend({progressToken:Si})}),Sa=ot.extend({params:vt.extend({cursor:L(Ri)}).optional()}),Ra=ht.extend({nextCursor:L(Ri)}),ji=H({uri:k(),mimeType:L(k()),_meta:L(H({}).passthrough())}).passthrough(),Di=ji.extend({text:k()}),xi=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Mi=ji.extend({blob:xi}),Li=Zr.extend({uri:k(),description:L(k()),mimeType:L(k()),_meta:L(H({}).passthrough())}),xc=Zr.extend({uriTemplate:k(),description:L(k()),mimeType:L(k()),_meta:L(H({}).passthrough())}),$s=Sa.extend({method:ue("resources/list")}),Fi=Ra.extend({resources:ee(Li)}),ws=Sa.extend({method:ue("resources/templates/list")}),qi=Ra.extend({resourceTemplates:ee(xc)}),bs=ot.extend({method:ue("resources/read"),params:vt.extend({uri:k()})}),Ui=ht.extend({contents:ee(it([Di,Mi]))}),Mc=St.extend({method:ue("notifications/resources/list_changed")}),Lc=ot.extend({method:ue("resources/subscribe"),params:vt.extend({uri:k()})}),Fc=ot.extend({method:ue("resources/unsubscribe"),params:vt.extend({uri:k()})}),qc=St.extend({method:ue("notifications/resources/updated"),params:ba.extend({uri:k()})}),Uc=H({name:k(),description:L(k()),required:L(Qe())}).passthrough(),Vc=Zr.extend({description:L(k()),arguments:L(ee(Uc)),_meta:L(H({}).passthrough())}),Ps=Sa.extend({method:ue("prompts/list")}),Vi=Ra.extend({prompts:ee(Vc)}),Es=ot.extend({method:ue("prompts/get"),params:vt.extend({name:k(),arguments:L($a(k()))})}),Ss=H({type:ue("text"),text:k(),_meta:L(H({}).passthrough())}).passthrough(),Rs=H({type:ue("image"),data:xi,mimeType:k(),_meta:L(H({}).passthrough())}).passthrough(),ks=H({type:ue("audio"),data:xi,mimeType:k(),_meta:L(H({}).passthrough())}).passthrough(),zc=H({type:ue("resource"),resource:it([Di,Mi]),_meta:L(H({}).passthrough())}).passthrough(),Hc=Li.extend({type:ue("resource_link")}),zi=it([Ss,Rs,ks,Hc,zc]),Zc=H({role:Qt(["user","assistant"]),content:zi}).passthrough(),Hi=ht.extend({description:L(k()),messages:ee(Zc)}),Kc=St.extend({method:ue("notifications/prompts/list_changed")}),Bc=H({title:L(k()),readOnlyHint:L(Qe()),destructiveHint:L(Qe()),idempotentHint:L(Qe()),openWorldHint:L(Qe())}).passthrough(),Jc=Zr.extend({description:L(k()),inputSchema:H({type:ue("object"),properties:L(H({}).passthrough()),required:L(ee(k()))}).passthrough(),outputSchema:L(H({type:ue("object"),properties:L(H({}).passthrough()),required:L(ee(k()))}).passthrough()),annotations:L(Bc),_meta:L(H({}).passthrough())}),Ts=Sa.extend({method:ue("tools/list")}),Zi=Ra.extend({tools:ee(Jc)}),Os=ht.extend({content:ee(zi).default([]),structuredContent:H({}).passthrough().optional(),isError:L(Qe())}),Dv=Os.or(ht.extend({toolResult:_a()})),Cs=ot.extend({method:ue("tools/call"),params:vt.extend({name:k(),arguments:L($a(_a()))})}),Qc=St.extend({method:ue("notifications/tools/list_changed")}),Ki=Qt(["debug","info","notice","warning","error","critical","alert","emergency"]),Gc=ot.extend({method:ue("logging/setLevel"),params:vt.extend({level:Ki})}),Wc=St.extend({method:ue("notifications/message"),params:ba.extend({level:Ki,logger:L(k()),data:_a()})}),Xc=H({name:k().optional()}).passthrough(),Yc=H({hints:L(ee(Xc)),costPriority:L(We().min(0).max(1)),speedPriority:L(We().min(0).max(1)),intelligencePriority:L(We().min(0).max(1))}).passthrough(),eu=H({role:Qt(["user","assistant"]),content:it([Ss,Rs,ks])}).passthrough(),tu=ot.extend({method:ue("sampling/createMessage"),params:vt.extend({messages:ee(eu),systemPrompt:L(k()),includeContext:L(Qt(["none","thisServer","allServers"])),temperature:L(We()),maxTokens:We().int(),stopSequences:L(ee(k())),metadata:L(H({}).passthrough()),modelPreferences:L(Yc)})}),Bi=ht.extend({model:k(),stopReason:L(Qt(["endTurn","stopSequence","maxTokens"]).or(k())),role:Qt(["user","assistant"]),content:Iv("type",[Ss,Rs,ks])}),ru=H({type:ue("boolean"),title:L(k()),description:L(k()),default:L(Qe())}).passthrough(),au=H({type:ue("string"),title:L(k()),description:L(k()),minLength:L(We()),maxLength:L(We()),format:L(Qt(["email","uri","date","date-time"]))}).passthrough(),su=H({type:Qt(["number","integer"]),title:L(k()),description:L(k()),minimum:L(We()),maximum:L(We())}).passthrough(),nu=H({type:ue("string"),title:L(k()),description:L(k()),enum:ee(k()),enumNames:L(ee(k()))}).passthrough(),iu=it([ru,au,su,nu]),ou=ot.extend({method:ue("elicitation/create"),params:vt.extend({message:k(),requestedSchema:H({type:ue("object"),properties:$a(k(),iu),required:L(ee(k()))}).passthrough()})}),Ji=ht.extend({action:Qt(["accept","decline","cancel"]),content:L($a(k(),_a()))}),Qi=H({type:ue("ref/resource"),uri:k()}).passthrough(),xv=Qi,lu=H({type:ue("ref/prompt"),name:k()}).passthrough(),Is=ot.extend({method:ue("completion/complete"),params:vt.extend({ref:it([lu,Qi]),argument:H({name:k(),value:k()}).passthrough(),context:L(H({arguments:L($a(k(),k()))}))})}),Gi=ht.extend({completion:H({values:ee(k()).max(100),total:L(We().int()),hasMore:L(Qe())}).passthrough()}),cu=H({uri:k().startsWith("file://"),name:L(k()),_meta:L(H({}).passthrough())}).passthrough(),uu=ot.extend({method:ue("roots/list")}),Wi=ht.extend({roots:ee(cu)}),du=St.extend({method:ue("notifications/roots/list_changed")}),Mv=it([ys,vs,Is,Gc,Es,Ps,$s,ws,bs,Lc,Fc,Cs,Ts]),Lv=it([ms,_s,gs,du]),Fv=it([or,Bi,Ji,Wi]),qv=it([ys,tu,ou,uu]),Uv=it([ms,_s,Wc,qc,Mc,Qc,Kc]),Vv=it([or,Ai,Gi,Hi,Vi,Fi,qi,Ui,Os,Zi]);class Ce extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const fu=1e6,Xi=1e6,hu=1e4,zv=1e6;class Gt{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){Gt.validateLength(e,fu,"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 i=e.indexOf("}",r);if(i===-1)throw new Error("Unclosed template expression");if(n++,n>hu)throw new Error(`Template contains too many expressions (max ${hu})`);const o=e.slice(r+1,i),c=this.getOperator(o),l=o.includes("*"),u=this.getNames(o),d=u[0];for(const y of u)Gt.validateLength(y,Xi,"Variable name");a.push({name:d,operator:c,names:u,exploded:l}),r=i+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 Gt.validateLength(e,Xi,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(c=>{const l=a[c];if(l===void 0)return"";const u=Array.isArray(l)?l.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${c}=${u}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){const i=e.names.map(o=>a[o]).filter(o=>o!==void 0);return i.length===0?"":i.map(o=>Array.isArray(o)?o[0]:o).join(",")}const s=a[e.name];if(s===void 0)return"";const n=(Array.isArray(s)?s:[s]).map(i=>this.encodeValue(i,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)Gt.validateLength(n,Xi,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let n=0;n<e.names.length;n++){const i=e.names[n],o=n===0?"\\"+e.operator:"&";a.push({pattern:o+this.escapeRegExp(i)+"=([^&]+)",name:i})}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){Gt.validateLength(e,fu,"URI");let a="^";const s=[];for(const o of this.parts)if(typeof o=="string")a+=this.escapeRegExp(o);else{const c=this.partToRegExp(o);for(const{pattern:l,name:u}of c)a+=l,s.push({name:u,exploded:o.exploded})}a+="$",Gt.validateLength(a,zv,"Generated regex pattern");const r=new RegExp(a),n=e.match(r);if(!n)return null;const i={};for(let o=0;o<s.length;o++){const{name:c,exploded:l}=s[o],u=n[o+1],d=c.replace("*","");l&&u.includes(",")?i[d]=u.split(","):i[d]=u}return i}}R.McpZodTypeKind=void 0,function(t){t.Completable="McpCompletable"}(R.McpZodTypeKind||(R.McpZodTypeKind={}));class ka extends $e{_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}}ka.create=(t,e)=>new ka({type:t,typeName:R.McpZodTypeKind.Completable,complete:e.complete,...Zv(e)});function Hv(t,e){return ka.create(t,{...t._def,complete:e})}function Zv(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:(i,o)=>{var c,l;const{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(c=u??s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(l=u??a)!==null&&l!==void 0?l:o.defaultError}},description:r}}function Kv(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 pu=6e4;class Yi{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(ms,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(_s,a=>{this._onprogress(a)}),this.setRequestHandler(ys,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 Ce(R.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 i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i==null||i(c),this._onerror(c)};const o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,l)=>{o==null||o(c,l),ps(c)||Ic(c)?this._onresponse(c):Ti(c)?this._onrequest(c,l):Cc(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},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 Ce(R.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,i;const o=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler;if(o===void 0){(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",id:e.id,error:{code:R.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);const l={signal:c.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,y)=>this.request(u,d,{...y,relatedRequestId:e.id}),authInfo:a==null?void 0:a.authInfo,requestId:e.id,requestInfo:a==null?void 0:a.requestInfo};Promise.resolve().then(()=>o(e,l)).then(u=>{var d;if(!c.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d,y;if(!c.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:R.ErrorCode.InternalError,message:(y=u.message)!==null&&y!==void 0?y:"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 i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);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),ps(e))s(e);else{const r=new Ce(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:i}=s??{};return new Promise((o,c)=>{var l,u,d,y,f,m;if(!this._transport){c(new Error("Not connected"));return}((l=this._options)===null||l===void 0?void 0:l.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:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:p}});const v=T=>{var C;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(C=this._transport)===null||C===void 0||C.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(T)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(x=>this._onerror(new Error(`Failed to send cancellation: ${x}`))),c(T)};this._responseHandlers.set(p,T=>{var C;if(!(!((C=s==null?void 0:s.signal)===null||C===void 0)&&C.aborted)){if(T instanceof Error)return c(T);try{const x=a.parse(T.result);o(x)}catch(x){c(x)}}}),(y=s==null?void 0:s.signal)===null||y===void 0||y.addEventListener("abort",()=>{var T;v((T=s==null?void 0:s.signal)===null||T===void 0?void 0:T.reason)});const $=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:pu,E=()=>v(new Ce(R.ErrorCode.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(p,$,s==null?void 0:s.maxTotalTimeout,E,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(T=>{this._cleanupTimeout(p),c(T)})})}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 c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const l={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(l,a).catch(u=>this._onerror(u))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,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 eo(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 to={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)})(ta,function(a){function s(){for(var b=arguments.length,_=Array(b),P=0;P<b;P++)_[P]=arguments[P];if(_.length>1){_[0]=_[0].slice(0,-1);for(var N=_.length-1,I=1;I<N;++I)_[I]=_[I].slice(1,-1);return _[N]=_[N].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 i(b){return b.toUpperCase()}function o(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 c(b,_){var P=b;if(_)for(var N in _)P[N]=_[N];return P}function l(b){var _="[A-Za-z]",P="[0-9]",N=s(P,"[A-Fa-f]"),I=r(r("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+r("%[89A-Fa-f]"+N+"%"+N+N)+"|"+r("%"+N+N)),se="[\\:\\/\\?\\#\\[\\]\\@]",ne="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=s(se,ne),Ae=b?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ze=b?"[\\uE000-\\uF8FF]":"[]",Pe=s(_,P,"[\\-\\.\\_\\~]",Ae);r(_+s(_,P,"[\\+\\-\\.]")+"*"),r(r(I+"|"+s(Pe,ne,"[\\:]"))+"*");var Ie=r(r("25[0-5]")+"|"+r("2[0-4]"+P)+"|"+r("1"+P+P)+"|"+r("0?[1-9]"+P)+"|0?0?"+P),He=r(Ie+"\\."+Ie+"\\."+Ie+"\\."+Ie),ce=r(N+"{1,4}"),De=r(r(ce+"\\:"+ce)+"|"+He),Be=r(r(ce+"\\:")+"{6}"+De),xe=r("\\:\\:"+r(ce+"\\:")+"{5}"+De),hr=r(r(ce)+"?\\:\\:"+r(ce+"\\:")+"{4}"+De),Ft=r(r(r(ce+"\\:")+"{0,1}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{3}"+De),qt=r(r(r(ce+"\\:")+"{0,2}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{2}"+De),ea=r(r(r(ce+"\\:")+"{0,3}"+ce)+"?\\:\\:"+ce+"\\:"+De),Cr=r(r(r(ce+"\\:")+"{0,4}"+ce)+"?\\:\\:"+De),$t=r(r(r(ce+"\\:")+"{0,5}"+ce)+"?\\:\\:"+ce),Ut=r(r(r(ce+"\\:")+"{0,6}"+ce)+"?\\:\\:"),Ir=r([Be,xe,hr,Ft,qt,ea,Cr,$t,Ut].join("|")),er=r(r(Pe+"|"+I)+"+");r("[vV]"+N+"+\\."+s(Pe,ne,"[\\:]")+"+"),r(r(I+"|"+s(Pe,ne))+"*");var ja=r(I+"|"+s(Pe,ne,"[\\:\\@]"));return r(r(I+"|"+s(Pe,ne,"[\\@]"))+"+"),r(r(ja+"|"+s("[\\/\\?]",ze))+"*"),{NOT_SCHEME:new RegExp(s("[^]",_,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",Pe,ne),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",Pe,ne),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",Pe,ne),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",Pe,ne),"g"),NOT_QUERY:new RegExp(s("[^\\%]",Pe,ne,"[\\:\\@\\/\\?]",ze),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",Pe,ne,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",Pe,ne),"g"),UNRESERVED:new RegExp(Pe,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",Pe,Ee),"g"),PCT_ENCODED:new RegExp(I,"g"),IPV4ADDRESS:new RegExp("^("+He+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ir+")"+r(r("\\%25|\\%(?!"+N+"{2})")+"("+er+")")+"?\\]?$")}}var u=l(!1),d=l(!0),y=function(){function b(_,P){var N=[],I=!0,se=!1,ne=void 0;try{for(var Ee=_[Symbol.iterator](),Ae;!(I=(Ae=Ee.next()).done)&&(N.push(Ae.value),!(P&&N.length===P));I=!0);}catch(ze){se=!0,ne=ze}finally{try{!I&&Ee.return&&Ee.return()}finally{if(se)throw ne}}return N}return function(_,P){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return b(_,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(b){if(Array.isArray(b)){for(var _=0,P=Array(b.length);_<b.length;_++)P[_]=b[_];return P}else return Array.from(b)},m=2147483647,p=36,h=1,v=26,$=38,E=700,T=72,C=128,x="-",K=/^xn--/,V=/[^\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,B=Math.floor,F=String.fromCharCode;function M(b){throw new RangeError(X[b])}function re(b,_){for(var P=[],N=b.length;N--;)P[N]=_(b[N]);return P}function _e(b,_){var P=b.split("@"),N="";P.length>1&&(N=P[0]+"@",b=P[1]),b=b.replace(z,".");var I=b.split("."),se=re(I,_).join(".");return N+se}function ve(b){for(var _=[],P=0,N=b.length;P<N;){var I=b.charCodeAt(P++);if(I>=55296&&I<=56319&&P<N){var se=b.charCodeAt(P++);(se&64512)==56320?_.push(((I&1023)<<10)+(se&1023)+65536):(_.push(I),P--)}else _.push(I)}return _}var be=function(_){return String.fromCodePoint.apply(String,f(_))},de=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:p},j=function(_,P){return _+22+75*(_<26)-((P!=0)<<5)},S=function(_,P,N){var I=0;for(_=N?B(_/E):_>>1,_+=B(_/P);_>Y*v>>1;I+=p)_=B(_/Y);return B(I+(Y+1)*_/(_+$))},D=function(_){var P=[],N=_.length,I=0,se=C,ne=T,Ee=_.lastIndexOf(x);Ee<0&&(Ee=0);for(var Ae=0;Ae<Ee;++Ae)_.charCodeAt(Ae)>=128&&M("not-basic"),P.push(_.charCodeAt(Ae));for(var ze=Ee>0?Ee+1:0;ze<N;){for(var Pe=I,Ie=1,He=p;;He+=p){ze>=N&&M("invalid-input");var ce=de(_.charCodeAt(ze++));(ce>=p||ce>B((m-I)/Ie))&&M("overflow"),I+=ce*Ie;var De=He<=ne?h:He>=ne+v?v:He-ne;if(ce<De)break;var Be=p-De;Ie>B(m/Be)&&M("overflow"),Ie*=Be}var xe=P.length+1;ne=S(I-Pe,xe,Pe==0),B(I/xe)>m-se&&M("overflow"),se+=B(I/xe),I%=xe,P.splice(I++,0,se)}return String.fromCodePoint.apply(String,P)},O=function(_){var P=[];_=ve(_);var N=_.length,I=C,se=0,ne=T,Ee=!0,Ae=!1,ze=void 0;try{for(var Pe=_[Symbol.iterator](),Ie;!(Ee=(Ie=Pe.next()).done);Ee=!0){var He=Ie.value;He<128&&P.push(F(He))}}catch(Da){Ae=!0,ze=Da}finally{try{!Ee&&Pe.return&&Pe.return()}finally{if(Ae)throw ze}}var ce=P.length,De=ce;for(ce&&P.push(x);De<N;){var Be=m,xe=!0,hr=!1,Ft=void 0;try{for(var qt=_[Symbol.iterator](),ea;!(xe=(ea=qt.next()).done);xe=!0){var Cr=ea.value;Cr>=I&&Cr<Be&&(Be=Cr)}}catch(Da){hr=!0,Ft=Da}finally{try{!xe&&qt.return&&qt.return()}finally{if(hr)throw Ft}}var $t=De+1;Be-I>B((m-se)/$t)&&M("overflow"),se+=(Be-I)*$t,I=Be;var Ut=!0,Ir=!1,er=void 0;try{for(var ja=_[Symbol.iterator](),zd;!(Ut=(zd=ja.next()).done);Ut=!0){var Hd=zd.value;if(Hd<I&&++se>m&&M("overflow"),Hd==I){for(var sn=se,nn=p;;nn+=p){var on=nn<=ne?h:nn>=ne+v?v:nn-ne;if(sn<on)break;var Zd=sn-on,Kd=p-on;P.push(F(j(on+Zd%Kd,0))),sn=B(Zd/Kd)}P.push(F(j(sn,0))),ne=S(se,$t,De==ce),se=0,++De}}}catch(Da){Ir=!0,er=Da}finally{try{!Ut&&ja.return&&ja.return()}finally{if(Ir)throw er}}++se,++I}return P.join("")},g=function(_){return _e(_,function(P){return K.test(P)?D(P.slice(4).toLowerCase()):P})},w=function(_){return _e(_,function(P){return V.test(P)?"xn--"+O(P):P})},A={version:"2.1.0",ucs2:{decode:ve,encode:be},decode:D,encode:O,toASCII:w,toUnicode:g},Z={};function Q(b){var _=b.charCodeAt(0),P=void 0;return _<16?P="%0"+_.toString(16).toUpperCase():_<128?P="%"+_.toString(16).toUpperCase():_<2048?P="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():P="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),P}function fe(b){for(var _="",P=0,N=b.length;P<N;){var I=parseInt(b.substr(P+1,2),16);if(I<128)_+=String.fromCharCode(I),P+=3;else if(I>=194&&I<224){if(N-P>=6){var se=parseInt(b.substr(P+4,2),16);_+=String.fromCharCode((I&31)<<6|se&63)}else _+=b.substr(P,6);P+=6}else if(I>=224){if(N-P>=9){var ne=parseInt(b.substr(P+4,2),16),Ee=parseInt(b.substr(P+7,2),16);_+=String.fromCharCode((I&15)<<12|(ne&63)<<6|Ee&63)}else _+=b.substr(P,9);P+=9}else _+=b.substr(P,3),P+=3}return _}function ie(b,_){function P(N){var I=fe(N);return I.match(_.UNRESERVED)?I:N}return b.scheme&&(b.scheme=String(b.scheme).replace(_.PCT_ENCODED,P).toLowerCase().replace(_.NOT_SCHEME,"")),b.userinfo!==void 0&&(b.userinfo=String(b.userinfo).replace(_.PCT_ENCODED,P).replace(_.NOT_USERINFO,Q).replace(_.PCT_ENCODED,i)),b.host!==void 0&&(b.host=String(b.host).replace(_.PCT_ENCODED,P).toLowerCase().replace(_.NOT_HOST,Q).replace(_.PCT_ENCODED,i)),b.path!==void 0&&(b.path=String(b.path).replace(_.PCT_ENCODED,P).replace(b.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,Q).replace(_.PCT_ENCODED,i)),b.query!==void 0&&(b.query=String(b.query).replace(_.PCT_ENCODED,P).replace(_.NOT_QUERY,Q).replace(_.PCT_ENCODED,i)),b.fragment!==void 0&&(b.fragment=String(b.fragment).replace(_.PCT_ENCODED,P).replace(_.NOT_FRAGMENT,Q).replace(_.PCT_ENCODED,i)),b}function he(b){return b.replace(/^0*(.*)/,"$1")||"0"}function at(b,_){var P=b.match(_.IPV4ADDRESS)||[],N=y(P,2),I=N[1];return I?I.split(".").map(he).join("."):b}function Ve(b,_){var P=b.match(_.IPV6ADDRESS)||[],N=y(P,3),I=N[1],se=N[2];if(I){for(var ne=I.toLowerCase().split("::").reverse(),Ee=y(ne,2),Ae=Ee[0],ze=Ee[1],Pe=ze?ze.split(":").map(he):[],Ie=Ae.split(":").map(he),He=_.IPV4ADDRESS.test(Ie[Ie.length-1]),ce=He?7:8,De=Ie.length-ce,Be=Array(ce),xe=0;xe<ce;++xe)Be[xe]=Pe[xe]||Ie[De+xe]||"";He&&(Be[ce-1]=at(Be[ce-1],_));var hr=Be.reduce(function($t,Ut,Ir){if(!Ut||Ut==="0"){var er=$t[$t.length-1];er&&er.index+er.length===Ir?er.length++:$t.push({index:Ir,length:1})}return $t},[]),Ft=hr.sort(function($t,Ut){return Ut.length-$t.length})[0],qt=void 0;if(Ft&&Ft.length>1){var ea=Be.slice(0,Ft.index),Cr=Be.slice(Ft.index+Ft.length);qt=ea.join(":")+"::"+Cr.join(":")}else qt=Be.join(":");return se&&(qt+="%"+se),qt}else return b}var Oe=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,gt="".match(/(){0}/)[1]===void 0;function Ke(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P={},N=_.iri!==!1?d:u;_.reference==="suffix"&&(b=(_.scheme?_.scheme+":":"")+"//"+b);var I=b.match(Oe);if(I){gt?(P.scheme=I[1],P.userinfo=I[3],P.host=I[4],P.port=parseInt(I[5],10),P.path=I[6]||"",P.query=I[7],P.fragment=I[8],isNaN(P.port)&&(P.port=I[5])):(P.scheme=I[1]||void 0,P.userinfo=b.indexOf("@")!==-1?I[3]:void 0,P.host=b.indexOf("//")!==-1?I[4]:void 0,P.port=parseInt(I[5],10),P.path=I[6]||"",P.query=b.indexOf("?")!==-1?I[7]:void 0,P.fragment=b.indexOf("#")!==-1?I[8]:void 0,isNaN(P.port)&&(P.port=b.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),P.host&&(P.host=Ve(at(P.host,N),N)),P.scheme===void 0&&P.userinfo===void 0&&P.host===void 0&&P.port===void 0&&!P.path&&P.query===void 0?P.reference="same-document":P.scheme===void 0?P.reference="relative":P.fragment===void 0?P.reference="absolute":P.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==P.reference&&(P.error=P.error||"URI is not a "+_.reference+" reference.");var se=Z[(_.scheme||P.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!se||!se.unicodeSupport)){if(P.host&&(_.domainHost||se&&se.domainHost))try{P.host=A.toASCII(P.host.replace(N.PCT_ENCODED,fe).toLowerCase())}catch(ne){P.error=P.error||"Host's domain name can not be converted to ASCII via punycode: "+ne}ie(P,u)}else ie(P,N);se&&se.parse&&se.parse(P,_)}else P.error=P.error||"URI can not be parsed.";return P}function Mt(b,_){var P=_.iri!==!1?d:u,N=[];return b.userinfo!==void 0&&(N.push(b.userinfo),N.push("@")),b.host!==void 0&&N.push(Ve(at(String(b.host),P),P).replace(P.IPV6ADDRESS,function(I,se,ne){return"["+se+(ne?"%25"+ne:"")+"]"})),(typeof b.port=="number"||typeof b.port=="string")&&(N.push(":"),N.push(String(b.port))),N.length?N.join(""):void 0}var Ct=/^\.\.?\//,qe=/^\/\.(\/|$)/,yt=/^\/\.\.(\/|$)/,Xt=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(b){for(var _=[];b.length;)if(b.match(Ct))b=b.replace(Ct,"");else if(b.match(qe))b=b.replace(qe,"/");else if(b.match(yt))b=b.replace(yt,"/"),_.pop();else if(b==="."||b==="..")b="";else{var P=b.match(Xt);if(P){var N=P[0];b=b.slice(N.length),_.push(N)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function Le(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=_.iri?d:u,N=[],I=Z[(_.scheme||b.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize(b,_),b.host&&!P.IPV6ADDRESS.test(b.host)){if(_.domainHost||I&&I.domainHost)try{b.host=_.iri?A.toUnicode(b.host):A.toASCII(b.host.replace(P.PCT_ENCODED,fe).toLowerCase())}catch(Ee){b.error=b.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}ie(b,P),_.reference!=="suffix"&&b.scheme&&(N.push(b.scheme),N.push(":"));var se=Mt(b,_);if(se!==void 0&&(_.reference!=="suffix"&&N.push("//"),N.push(se),b.path&&b.path.charAt(0)!=="/"&&N.push("/")),b.path!==void 0){var ne=b.path;!_.absolutePath&&(!I||!I.absolutePath)&&(ne=Me(ne)),se===void 0&&(ne=ne.replace(/^\/\//,"/%2F")),N.push(ne)}return b.query!==void 0&&(N.push("?"),N.push(b.query)),b.fragment!==void 0&&(N.push("#"),N.push(b.fragment)),N.join("")}function Xe(b,_){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=arguments[3],I={};return N||(b=Ke(Le(b,P),P),_=Ke(Le(_,P),P)),P=P||{},!P.tolerant&&_.scheme?(I.scheme=_.scheme,I.userinfo=_.userinfo,I.host=_.host,I.port=_.port,I.path=Me(_.path||""),I.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(I.userinfo=_.userinfo,I.host=_.host,I.port=_.port,I.path=Me(_.path||""),I.query=_.query):(_.path?(_.path.charAt(0)==="/"?I.path=Me(_.path):((b.userinfo!==void 0||b.host!==void 0||b.port!==void 0)&&!b.path?I.path="/"+_.path:b.path?I.path=b.path.slice(0,b.path.lastIndexOf("/")+1)+_.path:I.path=_.path,I.path=Me(I.path)),I.query=_.query):(I.path=b.path,_.query!==void 0?I.query=_.query:I.query=b.query),I.userinfo=b.userinfo,I.host=b.host,I.port=b.port),I.scheme=b.scheme),I.fragment=_.fragment,I}function fr(b,_,P){var N=c({scheme:"null"},P);return Le(Xe(Ke(b,N),Ke(_,N),N,!0),N)}function Yt(b,_){return typeof b=="string"?b=Le(Ke(b,_),_):n(b)==="object"&&(b=Ke(Le(b,_),_)),b}function Tr(b,_,P){return typeof b=="string"?b=Le(Ke(b,P),P):n(b)==="object"&&(b=Le(b,P)),typeof _=="string"?_=Le(Ke(_,P),P):n(_)==="object"&&(_=Le(_,P)),b===_}function an(b,_){return b&&b.toString().replace(!_||!_.iri?u.ESCAPE:d.ESCAPE,Q)}function _t(b,_){return b&&b.toString().replace(!_||!_.iri?u.PCT_ENCODED:d.PCT_ENCODED,fe)}var Or={scheme:"http",domainHost:!0,parse:function(_,P){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,P){var N=String(_.scheme).toLowerCase()==="https";return(_.port===(N?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},Dd={scheme:"https",domainHost:Or.domainHost,parse:Or.parse,serialize:Or.serialize};function xd(b){return typeof b.secure=="boolean"?b.secure:String(b.scheme).toLowerCase()==="wss"}var Aa={scheme:"ws",domainHost:!0,parse:function(_,P){var N=_;return N.secure=xd(N),N.resourceName=(N.path||"/")+(N.query?"?"+N.query:""),N.path=void 0,N.query=void 0,N},serialize:function(_,P){if((_.port===(xd(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var N=_.resourceName.split("?"),I=y(N,2),se=I[0],ne=I[1];_.path=se&&se!=="/"?se:void 0,_.query=ne,_.resourceName=void 0}return _.fragment=void 0,_}},Md={scheme:"wss",domainHost:Aa.domainHost,parse:Aa.parse,serialize:Aa.serialize},$0={},Ld="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Lt="[0-9A-Fa-f]",w0=r(r("%[EFef]"+Lt+"%"+Lt+Lt+"%"+Lt+Lt)+"|"+r("%[89A-Fa-f]"+Lt+"%"+Lt+Lt)+"|"+r("%"+Lt+Lt)),b0="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",P0="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",E0=s(P0,'[\\"\\\\]'),S0="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",R0=new RegExp(Ld,"g"),Yr=new RegExp(w0,"g"),k0=new RegExp(s("[^]",b0,"[\\.]",'[\\"]',E0),"g"),Fd=new RegExp(s("[^]",Ld,S0),"g"),T0=Fd;function Qo(b){var _=fe(b);return _.match(R0)?_:b}var qd={scheme:"mailto",parse:function(_,P){var N=_,I=N.to=N.path?N.path.split(","):[];if(N.path=void 0,N.query){for(var se=!1,ne={},Ee=N.query.split("&"),Ae=0,ze=Ee.length;Ae<ze;++Ae){var Pe=Ee[Ae].split("=");switch(Pe[0]){case"to":for(var Ie=Pe[1].split(","),He=0,ce=Ie.length;He<ce;++He)I.push(Ie[He]);break;case"subject":N.subject=_t(Pe[1],P);break;case"body":N.body=_t(Pe[1],P);break;default:se=!0,ne[_t(Pe[0],P)]=_t(Pe[1],P);break}}se&&(N.headers=ne)}N.query=void 0;for(var De=0,Be=I.length;De<Be;++De){var xe=I[De].split("@");if(xe[0]=_t(xe[0]),P.unicodeSupport)xe[1]=_t(xe[1],P).toLowerCase();else try{xe[1]=A.toASCII(_t(xe[1],P).toLowerCase())}catch(hr){N.error=N.error||"Email address's domain name can not be converted to ASCII via punycode: "+hr}I[De]=xe.join("@")}return N},serialize:function(_,P){var N=_,I=o(_.to);if(I){for(var se=0,ne=I.length;se<ne;++se){var Ee=String(I[se]),Ae=Ee.lastIndexOf("@"),ze=Ee.slice(0,Ae).replace(Yr,Qo).replace(Yr,i).replace(k0,Q),Pe=Ee.slice(Ae+1);try{Pe=P.iri?A.toUnicode(Pe):A.toASCII(_t(Pe,P).toLowerCase())}catch(De){N.error=N.error||"Email address's domain name can not be converted to "+(P.iri?"Unicode":"ASCII")+" via punycode: "+De}I[se]=ze+"@"+Pe}N.path=I.join(",")}var Ie=_.headers=_.headers||{};_.subject&&(Ie.subject=_.subject),_.body&&(Ie.body=_.body);var He=[];for(var ce in Ie)Ie[ce]!==$0[ce]&&He.push(ce.replace(Yr,Qo).replace(Yr,i).replace(Fd,Q)+"="+Ie[ce].replace(Yr,Qo).replace(Yr,i).replace(T0,Q));return He.length&&(N.query=He.join("&")),N}},O0=/^([^\:]+)\:(.*)/,Ud={scheme:"urn",parse:function(_,P){var N=_.path&&_.path.match(O0),I=_;if(N){var se=P.scheme||I.scheme||"urn",ne=N[1].toLowerCase(),Ee=N[2],Ae=se+":"+(P.nid||ne),ze=Z[Ae];I.nid=ne,I.nss=Ee,I.path=void 0,ze&&(I=ze.parse(I,P))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(_,P){var N=P.scheme||_.scheme||"urn",I=_.nid,se=N+":"+(P.nid||I),ne=Z[se];ne&&(_=ne.serialize(_,P));var Ee=_,Ae=_.nss;return Ee.path=(I||P.nid)+":"+Ae,Ee}},C0=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Vd={scheme:"urn:uuid",parse:function(_,P){var N=_;return N.uuid=N.nss,N.nss=void 0,!P.tolerant&&(!N.uuid||!N.uuid.match(C0))&&(N.error=N.error||"UUID is not valid."),N},serialize:function(_,P){var N=_;return N.nss=(_.uuid||"").toLowerCase(),N}};Z[Or.scheme]=Or,Z[Dd.scheme]=Dd,Z[Aa.scheme]=Aa,Z[Md.scheme]=Md,Z[qd.scheme]=qd,Z[Ud.scheme]=Ud,Z[Vd.scheme]=Vd,a.SCHEMES=Z,a.pctEncChar=Q,a.pctDecChars=fe,a.parse=Ke,a.removeDotSegments=Me,a.serialize=Le,a.resolveComponents=Xe,a.resolve=fr,a.normalize=Yt,a.equal=Tr,a.escapeComponent=an,a.unescapeComponent=_t,Object.defineProperty(a,"__esModule",{value:!0})})})(to,to.exports);var Bv=to.exports,Jv=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},Kr={copy:Qv,checkDataType:ro,checkDataTypes:Gv,coerceToTypes:Wv,toHash:ao,getProperty:so,escapeQuotes:no,equal:sa,ucs2length:Jv,varOccurences:eg,varReplace:tg,schemaHasRules:rg,schemaHasRulesExcept:ag,schemaUnknownRules:sg,toQuotedString:io,getPathExpr:ng,getPath:ig,getData:cg,unescapeFragment:ug,unescapeJsonPointer:lo,escapeFragment:dg,escapeJsonPointer:oo};function Qv(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function ro(t,e,a,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(t){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(a?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+t+'"'+(a?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+t+'"'}}function Gv(t,e,a){switch(t.length){case 1:return ro(t[0],e,a,!0);default:var s="",r=ao(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?" && ":"")+ro(n,e,a,!0);return s}}var mu=ao(["string","number","integer","boolean","null"]);function Wv(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(mu[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(mu[e])return[e];if(t==="array"&&e==="array")return["array"]}}function ao(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var Xv=/^[a-z$_][a-z$_0-9]*$/i,Yv=/'|\\/g;function so(t){return typeof t=="number"?"["+t+"]":Xv.test(t)?"."+t:"['"+no(t)+"']"}function no(t){return t.replace(Yv,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function eg(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function tg(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function rg(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function ag(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function sg(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function io(t){return"'"+no(t)+"'"}function ng(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return vu(t,r)}function ig(t,e,a){var s=io(a?"/"+oo(e):so(e));return vu(t,s)}var og=/^\/(?:[^~]|~0|~1)*$/,lg=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function cg(t,e,a){var s,r,n,i;if(t==="")return"rootData";if(t[0]=="/"){if(!og.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(i=t.match(lg),!i)throw new Error("Invalid JSON-pointer: "+t);if(s=+i[1],r=i[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 o=n,c=r.split("/"),l=0;l<c.length;l++){var u=c[l];u&&(n+=so(lo(u)),o+=" && "+n)}return o}function vu(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function ug(t){return lo(decodeURIComponent(t))}function dg(t){return encodeURIComponent(oo(t))}function oo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function lo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var fg=Kr,gu=hg;function hg(t){fg.copy(t,this)}var yu={exports:{}},lr=yu.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(){};Ns(e,s,r,t,"",t)};lr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},lr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},lr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},lr.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 Ns(t,e,a,s,r,n,i,o,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,l);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in lr.arrayKeywords)for(var y=0;y<d.length;y++)Ns(t,e,a,d[y],r+"/"+u+"/"+y,n,r,u,s,y)}else if(u in lr.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ns(t,e,a,d[f],r+"/"+u+"/"+pg(f),n,r,u,s,f)}else(u in lr.keywords||t.allKeys&&!(u in lr.skipKeywords))&&Ns(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,c,l)}}function pg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var mg=yu.exports,Ta=Bv,_u=sa,As=Kr,js=gu,vg=mg,co=cr;cr.normalizeId=ur,cr.fullPath=xs,cr.url=Ms,cr.ids=wg,cr.inlineRef=uo,cr.schema=Ds;function cr(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return cr.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof js)return uo(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ds.call(this,e,a),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof js?i=n.validate||t.call(this,n.schema,e,void 0,o):n!==void 0&&(i=uo(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,o)),i}function Ds(t,e){var a=Ta.parse(e),s=wu(a),r=xs(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=ur(s),i=this._refs[n];if(typeof i=="string")return gg.call(this,t,i,a);if(i instanceof js)i.validate||this._compile(i),t=i;else if(i=this._schemas[n],i instanceof js){if(i.validate||this._compile(i),n==ur(e))return{schema:i,root:t,baseId:r};t=i}else return;if(!t.schema)return;r=xs(this._getId(t.schema))}return $u.call(this,a,r,t.schema,t)}function gg(t,e,a){var s=Ds.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var i=this._getId(r);return i&&(n=Ms(n,i)),$u.call(this,a,n,r,t)}}var yg=As.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function $u(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 i=r[n];if(i){if(i=As.unescapeFragment(i),a=a[i],a===void 0)break;var o;if(!yg[i]&&(o=this._getId(a),o&&(e=Ms(e,o)),a.$ref)){var c=Ms(e,a.$ref),l=Ds.call(this,s,c);l&&(a=l.schema,s=l.root,e=l.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var _g=As.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function uo(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return fo(t);if(e)return ho(t)<=e}function fo(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!fo(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!fo(e)))return!1;return!0}function ho(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+=ho(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(_g[r])e++;else if(a=t[r],typeof a=="object"&&(e+=ho(a)+1),e==1/0)return 1/0}return e}function xs(t,e){e!==!1&&(t=ur(t));var a=Ta.parse(t);return wu(a)}function wu(t){return Ta.serialize(t).split("#")[0]+"#"}var $g=/#\/?$/;function ur(t){return t?t.replace($g,""):""}function Ms(t,e){return e=ur(e),Ta.resolve(t,e)}function wg(t){var e=ur(this._getId(t)),a={"":e},s={"":xs(e,!1)},r={},n=this;return vg(t,{allKeys:!0},function(i,o,c,l,u,d,y){if(o!==""){var f=n._getId(i),m=a[l],p=s[l]+"/"+u;if(y!==void 0&&(p+="/"+(typeof y=="number"?y:As.escapeFragment(y))),typeof f=="string"){f=m=ur(m?Ta.resolve(m,f):f);var h=n._refs[f];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!_u(i,h.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=ur(p))if(f[0]=="#"){if(r[f]&&!_u(i,r[f]))throw new Error('id "'+f+'" resolves to more than one schema');r[f]=i}else n._refs[f]=p}a[o]=m,s[o]=p}}),r}var po=co,mo={Validation:bu(bg),MissingRef:bu(vo)};function bg(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}vo.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function vo(t,e,a){this.message=a||vo.message(t,e),this.missingRef=po.url(t,e),this.missingSchema=po.normalizeId(po.fullPath(this.missingRef))}function bu(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Pu=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(i){return function(o,c){var l={key:o,value:i[o]},u={key:c,value:i[c]};return n(l,u)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o<i.length;o++)o&&(c+=","),c+=n(i[o])||"null";return c+"]"}if(i===null)return"null";if(r.indexOf(i)!==-1){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=r.push(i)-1,u=Object.keys(i).sort(s&&s(i));for(c="",o=0;o<u.length;o++){var d=u[o],y=n(i[d]);y&&(c&&(c+=","),c+=JSON.stringify(d)+":"+y)}return r.splice(l,1),"{"+c+"}"}}(t)},Eu=function(e,a,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var l="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(l);else throw new Error(l)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var a="false schema",u=e.level,d=e.dataLevel,y=e.schema[a],f=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,C=!e.opts.allErrors,V,p="data"+(d||""),T="valid"+u;if(e.schema===!1){e.isTop?C=!0:r+=" var "+T+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"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&&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++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+T+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var $=e.isTop,u=e.level=0,d=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 E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,d=e.dataLevel,p="data"+(d||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+u+" = errors;"}var T="valid"+u,C=!e.opts.allErrors,x="",K="",V,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&&i){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&&(i=!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 B=e.RULES.types[z];if(Y||X||B===!0||B&&!qe(B)){var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",f=e.schemaPath+".type",m=e.errSchemaPath+"/type",F=X?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[F](z,p,e.opts.strictNumbers,!0)+") { ",Y){var M="dataType"+u,re="coerced"+u;r+=" var "+M+" = typeof "+p+"; var "+re+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+M+" == 'object' && Array.isArray("+p+") && "+p+".length == 1) { "+p+" = "+p+"[0]; "+M+" = typeof "+p+"; if ("+e.util.checkDataType(e.schema.type,p,e.opts.strictNumbers)+") "+re+" = "+p+"; } "),r+=" if ("+re+" !== undefined) ; ";var _e=Y;if(_e)for(var ve,be=-1,de=_e.length-1;be<de;)ve=_e[be+=1],ve=="string"?r+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+re+" = '' + "+p+"; else if ("+p+" === null) "+re+" = ''; ":ve=="number"||ve=="integer"?(r+=" else if ("+M+" == 'boolean' || "+p+" === null || ("+M+" == 'string' && "+p+" && "+p+" == +"+p+" ",ve=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+re+" = +"+p+"; "):ve=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+re+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+re+" = true; ":ve=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+re+" = null; ":e.opts.coerceTypes=="array"&&ve=="array"&&(r+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+p+" == null) "+re+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"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"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),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++; ",r+=" } if ("+re+" !== undefined) { ";var j=d?"data"+(d-1||""):"parentData",S=d?e.dataPathArr[d]:"parentDataProperty";r+=" "+p+" = "+re+"; ",d||(r+="if ("+j+" !== undefined)"),r+=" "+j+"["+S+"] = "+re+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"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"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),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++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",C&&(r+=" } if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",K+="}");else{var D=e.RULES;if(D){for(var B,O=-1,g=D.length-1;O<g;)if(B=D[O+=1],qe(B)){if(B.type&&(r+=" if ("+e.util.checkDataType(B.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(B.type=="object"&&e.schema.properties){var y=e.schema.properties,w=Object.keys(y),A=w;if(A)for(var Z,Q=-1,fe=A.length-1;Q<fe;){Z=A[Q+=1];var ie=y[Z];if(ie.default!==void 0){var he=p+e.util.getProperty(Z);if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ie.default)+" ":r+=" "+JSON.stringify(ie.default)+" ",r+="; "}}}else if(B.type=="array"&&Array.isArray(e.schema.items)){var at=e.schema.items;if(at){for(var ie,be=-1,Ve=at.length-1;be<Ve;)if(ie=at[be+=1],ie.default!==void 0){var he=p+"["+be+"]";if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ie.default)+" ":r+=" "+JSON.stringify(ie.default)+" ",r+="; "}}}}var Oe=B.rules;if(Oe){for(var gt,Ke=-1,Mt=Oe.length-1;Ke<Mt;)if(gt=Oe[Ke+=1],yt(gt)){var Ct=gt.code(e,gt.keyword,B.type);Ct&&(r+=" "+Ct+" ",C&&(x+="}"))}}if(C&&(r+=" "+x+" ",x=""),B.type&&(r+=" } ",z&&z===B.type&&!Y)){r+=" else { ";var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(V||"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"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),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++; ",r+=" } "}C&&(r+=" if (errors === ",$?r+="0":r+="errs_"+u,r+=") { ",K+="}")}}}C&&(r+=" "+K+" "),$?(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 "+T+" = errors === errs_"+u+";";function qe(Me){for(var Le=Me.rules,Xe=0;Xe<Le.length;Xe++)if(yt(Le[Xe]))return!0}function yt(Me){return e.schema[Me.keyword]!==void 0||Me.implements&&Xt(Me)}function Xt(Me){for(var Le=Me.implements,Xe=0;Xe<Le.length;Xe++)if(e.schema[Le[Xe]]!==void 0)return!0}return r},Ls=co,Fs=Kr,Su=mo,Pg=Pu,Ru=Eu,Eg=Fs.ucs2length,Sg=sa,Rg=Su.Validation,kg=go;function go(t,e,a,s){var r=this,n=this._opts,i=[void 0],o={},c=[],l={},u=[],d={},y=[];e=e||{schema:t,refVal:i,refs:o};var f=Tg.call(this,t,e,s),m=this._compilations[f.index];if(f.compiling)return m.callValidate=E;var p=this._formats,h=this.RULES;try{var v=T(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{Og.call(this,t,e,s)}function E(){var F=m.validate,M=F.apply(this,arguments);return E.errors=F.errors,M}function T(F,M,re,_e){var ve=!M||M&&M.schema==F;if(M.schema!=e.schema)return go.call(r,F,M,re,_e);var be=F.$async===!0,de=Ru({isTop:!0,schema:F,isRoot:ve,baseId:_e,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Su.MissingRef,RULES:h,validate:Ru,util:Fs,resolve:Ls,resolveRef:C,usePattern:X,useDefault:Y,useCustomRule:B,opts:n,formats:p,logger:r.logger,self:r});de=qs(i,Ng)+qs(c,Cg)+qs(u,Ig)+qs(y,Ag)+de,n.processCode&&(de=n.processCode(de,F));var j;try{var S=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",de);j=S(r,h,p,e,i,u,y,Sg,Eg,Rg),i[0]=j}catch(D){throw r.logger.error("Error compiling schema, function code:",de),D}return j.schema=F,j.errors=null,j.refs=o,j.refVal=i,j.root=ve?j:M,be&&(j.$async=!0),n.sourceCode===!0&&(j.source={code:de,patterns:c,defaults:u}),j}function C(F,M,re){M=Ls.url(F,M);var _e=o[M],ve,be;if(_e!==void 0)return ve=i[_e],be="refVal["+_e+"]",z(ve,be);if(!re&&e.refs){var de=e.refs[M];if(de!==void 0)return ve=e.refVal[de],be=x(M,ve),z(ve,be)}be=x(M);var j=Ls.call(r,T,e,M);if(j===void 0){var S=a&&a[M];S&&(j=Ls.inlineRef(S,n.inlineRefs)?S:go.call(r,S,e,a,F))}if(j===void 0)K(M);else return V(M,j),z(j,be)}function x(F,M){var re=i.length;return i[re]=M,o[F]=re,"refVal"+re}function K(F){delete o[F]}function V(F,M){var re=o[F];i[re]=M}function z(F,M){return typeof F=="object"||typeof F=="boolean"?{code:M,schema:F,inline:!0}:{code:M,$async:F&&!!F.$async}}function X(F){var M=l[F];return M===void 0&&(M=l[F]=c.length,c[M]=F),"pattern"+M}function Y(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return Fs.toQuotedString(F);case"object":if(F===null)return"null";var M=Pg(F),re=d[M];return re===void 0&&(re=d[M]=u.length,u[re]=F),"default"+re}}function B(F,M,re,_e){if(r._opts.validateSchema!==!1){var ve=F.definition.dependencies;if(ve&&!ve.every(function(A){return Object.prototype.hasOwnProperty.call(re,A)}))throw new Error("parent schema must have all required keywords: "+ve.join(","));var be=F.definition.validateSchema;if(be){var de=be(M);if(!de){var j="keyword schema is invalid: "+r.errorsText(be.errors);if(r._opts.validateSchema=="log")r.logger.error(j);else throw new Error(j)}}}var S=F.definition.compile,D=F.definition.inline,O=F.definition.macro,g;if(S)g=S.call(r,M,re,_e);else if(O)g=O.call(r,M,re,_e),n.validateSchema!==!1&&r.validateSchema(g,!0);else if(D)g=D.call(r,_e,F.keyword,M,re);else if(g=F.definition.validate,!g)return;if(g===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var w=y.length;return y[w]=g,{code:"customRule"+w,validate:g}}}function Tg(t,e,a){var s=ku.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 Og(t,e,a){var s=ku.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function ku(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 Cg(t,e){return"var pattern"+t+" = new RegExp("+Fs.toQuotedString(e[t])+");"}function Ig(t){return"var default"+t+" = defaults["+t+"];"}function Ng(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function Ag(t){return"var customRule"+t+" = customRules["+t+"];"}function qs(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var Tu={exports:{}},Us=Tu.exports=function(){this._cache={}};Us.prototype.put=function(e,a){this._cache[e]=a},Us.prototype.get=function(e){return this._cache[e]},Us.prototype.del=function(e){delete this._cache[e]},Us.prototype.clear=function(){this._cache={}};var jg=Tu.exports,Dg=Kr,xg=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Mg=[0,31,28,31,30,31,30,31,31,30,31,30,31],Lg=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ou=/^(?=.{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,Fg=/^(?:[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,qg=/^(?:[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,Cu=/^(?:(?:[^\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,Iu=/^(?:(?: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,Au=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ju=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Du=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ug=Vs;function Vs(t){return t=t=="full"?"full":"fast",Dg.copy(Vs[t])}Vs.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":Cu,url:Iu,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:Ou,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:Nu,"json-pointer":Au,"json-pointer-uri-fragment":ju,"relative-json-pointer":Du},Vs.full={date:xu,time:Mu,"date-time":Hg,uri:Kg,"uri-reference":qg,"uri-template":Cu,url:Iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Ou,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:Nu,"json-pointer":Au,"json-pointer-uri-fragment":ju,"relative-json-pointer":Du};function Vg(t){return t%4===0&&(t%100!==0||t%400===0)}function xu(t){var e=t.match(xg);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Vg(a)?29:Mg[s])}function Mu(t,e){var a=t.match(Lg);if(!a)return!1;var s=a[1],r=a[2],n=a[3],i=a[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var zg=/t|\s/i;function Hg(t){var e=t.split(zg);return e.length==2&&xu(e[0])&&Mu(e[1],!0)}var Zg=/\/|:/;function Kg(t){return Zg.test(t)&&Fg.test(t)}var Bg=/[^\\]\\Z/;function Lu(t){if(Bg.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var Jg=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,u="data"+(i||""),d="valid"+n,y,f;if(o=="#"||o=="#/")e.isRoot?(y=e.async,f="validate"):(y=e.root.schema.$async===!0,f="root.refVal[0]");else{var m=e.resolveRef(e.baseId,o,e.isRoot);if(m===void 0){var p=e.MissingRefError.message(e.baseId,o);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(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),r+=" } "):r+=" {} ";var v=r;r=h.pop(),!e.compositeRule&&l?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++; ",l&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),l&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,p)}else if(m.inline){var $=e.util.copy(e);$.level++;var E="valid"+$.level;$.schema=m.schema,$.schemaPath="",$.errSchemaPath=o;var T=e.validate($).replace(/validate\.schema/g,m.code);r+=" "+T+" ",l&&(r+=" if ("+E+") { ")}else y=m.$async===!0||e.async&&m.$async!==!1,f=m.code}if(f){var h=h||[];h.push(r),r="",e.opts.passContext?r+=" "+f+".call(this, ":r+=" "+f+"( ",r+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var C=i?"data"+(i-1||""):"parentData",x=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+C+" , "+x+", rootData) ";var K=r;if(r=h.pop(),y){if(!e.async)throw new Error("async schema referenced by sync schema");l&&(r+=" var "+d+"; "),r+=" try { await "+K+"; ",l&&(r+=" "+d+" = 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; ",l&&(r+=" "+d+" = false; "),r+=" } ",l&&(r+=" if ("+d+") { ")}else r+=" if (!"+K+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",l&&(r+=" else { ")}return r},Qg=function(e,a,s){var r=" ",n=e.schema[a],i=e.schemaPath+e.util.getProperty(a),o=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,l=e.util.copy(e),u="";l.level++;var d="valid"+l.level,y=l.baseId,f=!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))&&(f=!1,l.schema=p,l.schemaPath=i+"["+h+"]",l.errSchemaPath=o+"/"+h,r+=" "+e.validate(l)+" ",l.baseId=y,c&&(r+=" if ("+d+") { ",u+="}"));return c&&(f?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},Gg=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=o.every(function(V){return e.opts.strictKeywords?typeof V=="object"&&Object.keys(V).length>0||V===!1:e.util.schemaHasRules(V,e.RULES.all)});if(v){var $=m.baseId;r+=" var "+f+" = errors; var "+y+" = false; ";var E=e.compositeRule;e.compositeRule=m.compositeRule=!0;var T=o;if(T)for(var C,x=-1,K=T.length-1;x<K;)C=T[x+=1],m.schema=C,m.schemaPath=c+"["+x+"]",m.errSchemaPath=l+"/"+x,r+=" "+e.validate(m)+" ",m.baseId=$,r+=" "+y+" = "+y+" || "+h+"; if (!"+y+") { ",p+="}";e.compositeRule=m.compositeRule=E,r+=" "+p+" if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else u&&(r+=" if (true) { ");return r},Wg=function(e,a,s){var r=" ",n=e.schema[a],i=e.errSchemaPath+"/"+a;e.opts.allErrors;var o=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+o+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+o+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r},Xg=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; "),f||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+y+" = equal("+d+", schema"+n+"); if (!"+y+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},Yg=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,E="data"+$,T=e.baseId,C=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+f+" = errors;var "+y+";",C){var x=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=o,m.schemaPath=c,m.errSchemaPath=l,r+=" var "+h+" = false; for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var K=d+"["+v+"]";m.dataPathArr[$]=v;var V=e.validate(m);m.baseId=T,e.util.varOccurences(V,E)<2?r+=" "+e.util.varReplace(V,E,K)+" ":r+=" var "+E+" = "+K+"; "+V+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=x,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+d+".length == 0) {";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 { ",C&&(r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},ey=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h={},v={},$=e.opts.ownProperties;for(x in o)if(x!="__proto__"){var E=o[x],T=Array.isArray(E)?v:h;T[x]=E}r+="var "+y+" = errors;";var C=e.errorPath;r+="var missing"+n+";";for(var x in v)if(T=v[x],T.length){if(r+=" if ( "+d+e.util.getProperty(x)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),u){r+=" && ( ";var K=T;if(K)for(var V,z=-1,X=K.length-1;z<X;){V=K[z+=1],z&&(r+=" || ");var Y=e.util.getProperty(V),B=d+Y;r+=" ( ( "+B+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(V)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?V:Y)+") ) "}r+=")) { ";var F="missing"+n,M="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,F,!0):C+" + "+F);var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(x)+"', missingProperty: '"+M+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(x)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var _e=r;r=re.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 ve=T;if(ve)for(var V,be=-1,de=ve.length-1;be<de;){V=ve[be+=1];var Y=e.util.getProperty(V),M=e.util.escapeQuotes(V),B=d+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,V,e.opts.jsonPointers)),r+=" if ( "+B+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(V)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(x)+"', missingProperty: '"+M+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(x)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",u&&(m+="}",r+=" else { ")}e.errorPath=C;var j=f.baseId;for(var x in h){var E=h[x];(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(r+=" "+p+" = true; if ( "+d+e.util.getProperty(x)+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),r+=") { ",f.schema=E,f.schemaPath=c+e.util.getProperty(x),f.errSchemaPath=l+"/"+e.util.escapeFragment(x),r+=" "+e.validate(f)+" ",f.baseId=j,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+y+" == errors) {"),r},ty=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="i"+n,p="schema"+n;f||(r+=" var "+p+" = validate.schema"+c+";"),r+="var "+y+";",f&&(r+=" if (schema"+n+" === undefined) "+y+" = true; else if (!Array.isArray(schema"+n+")) "+y+" = false; else {"),r+=""+y+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+d+", "+p+"["+m+"])) { "+y+" = true; break; }",f&&(r+=" } "),r+=" if (!"+y+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},ry=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var y=e.opts.$data&&o&&o.$data,f;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=e.opts.unknownFormats,p=Array.isArray(m);if(y){var h="format"+n,v="isObject"+n,$="formatType"+n;r+=" var "+h+" = formats["+f+"]; 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 ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+f+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),r+=") || "),r+=" ("+h+" && "+$+" == '"+s+"' && !(typeof "+h+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+h+"("+d+") : "+h+"("+d+")) ":r+=" "+h+"("+d+") ",r+=" : "+h+".test("+d+"))))) {"}else{var h=e.formats[o];if(!h){if(m=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(r+=" if (true) { "),r;if(p&&m.indexOf(o)>=0)return u&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" 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 E=h.async===!0;h=h.validate}if($!=s)return u&&(r+=" if (true) { "),r;if(E){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+T+"("+d+"))) { "}else{r+=" if (! ";var T="formats"+e.util.getProperty(o);v&&(T+=".validate"),typeof h=="function"?r+=" "+T+"("+d+") ":r+=" "+T+".test("+d+") ",r+=") { "}}var C=C||[];C.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",y?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,y?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var x=r;return r=C.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+=" } ",u&&(r+=" else { "),r},ay=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f="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)),E=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),T=m.baseId;if($||E){var C;m.createErrors=!1,m.schema=o,m.schemaPath=c,m.errSchemaPath=l,r+=" var "+f+" = errors; var "+y+" = true; ";var x=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=T,m.createErrors=!0,r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=x,$?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=T,r+=" "+y+" = "+p+"; ",$&&E?(C="ifClause"+n,r+=" var "+C+" = 'then'; "):C="'then'",r+=" } ",E&&(r+=" else { ")):r+=" if (!"+p+") { ",E&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=T,r+=" "+y+" = "+p+"; ",$&&E?(C="ifClause"+n,r+=" var "+C+" = 'else'; "):C="'else'",r+=" } "),r+=" if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+C+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+C+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},sy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,$=m.dataLevel=e.dataLevel+1,E="data"+$,T=e.baseId;if(r+="var "+f+" = errors;var "+y+";",Array.isArray(o)){var C=e.schema.additionalItems;if(C===!1){r+=" "+y+" = "+d+".length <= "+o.length+"; ";var x=l;l=e.errSchemaPath+"/additionalItems",r+=" if (!"+y+") { ";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var V=r;r=K.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+=" } ",l=x,u&&(p+="}",r+=" else { ")}var z=o;if(z){for(var X,Y=-1,B=z.length-1;Y<B;)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 ("+d+".length > "+Y+") { ";var F=d+"["+Y+"]";m.schema=X,m.schemaPath=c+"["+Y+"]",m.errSchemaPath=l+"/"+Y,m.errorPath=e.util.getPathExpr(e.errorPath,Y,e.opts.jsonPointers,!0),m.dataPathArr[$]=Y;var M=e.validate(m);m.baseId=T,e.util.varOccurences(M,E)<2?r+=" "+e.util.varReplace(M,E,F)+" ":r+=" var "+E+" = "+F+"; "+M+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof C=="object"&&(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))){m.schema=C,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+h+" = true; if ("+d+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";m.dataPathArr[$]=v;var M=e.validate(m);m.baseId=T,e.util.varOccurences(M,E)<2?r+=" "+e.util.varReplace(M,E,F)+" ":r+=" var "+E+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" } } ",u&&(r+=" if ("+h+") { ",p+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=c,m.errSchemaPath=l,r+=" for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";m.dataPathArr[$]=v;var M=e.validate(m);m.baseId=T,e.util.varOccurences(M,E)<2?r+=" "+e.util.varReplace(M,E,F)+" ":r+=" var "+E+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+f+" == errors) {"),r},Fu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,T,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=a=="maximum",p=m?"exclusiveMaximum":"exclusiveMinimum",h=e.schema[p],v=e.opts.$data&&h&&h.$data,$=m?"<":">",E=m?">":"<",T=void 0;if(!(y||typeof o=="number"||o===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 C=e.util.getData(h.$data,i,e.dataPathArr),x="exclusive"+n,K="exclType"+n,V="exclIsNumber"+n,z="op"+n,X="' + "+z+" + '";r+=" var schemaExcl"+n+" = "+C+"; ",C="schemaExcl"+n,r+=" var "+x+"; var "+K+" = typeof "+C+"; if ("+K+" != 'boolean' && "+K+" != 'undefined' && "+K+" != 'number') { ";var T=p,Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var B=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+K+" == 'number' ? ( ("+x+" = "+f+" === undefined || "+C+" "+$+"= "+f+") ? "+d+" "+E+"= "+C+" : "+d+" "+E+" "+f+" ) : ( ("+x+" = "+C+" === true) ? "+d+" "+E+"= "+f+" : "+d+" "+E+" "+f+" ) || "+d+" !== "+d+") { var op"+n+" = "+x+" ? '"+$+"' : '"+$+"='; ",o===void 0&&(T=p,l=e.errSchemaPath+"/"+p,f=C,y=v)}else{var V=typeof h=="number",X=$;if(V&&y){var z="'"+X+"'";r+=" if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" ( "+f+" === undefined || "+h+" "+$+"= "+f+" ? "+d+" "+E+"= "+h+" : "+d+" "+E+" "+f+" ) || "+d+" !== "+d+") { "}else{V&&o===void 0?(x=!0,T=p,l=e.errSchemaPath+"/"+p,f=h,E+="="):(V&&(f=Math[m?"min":"max"](h,o)),h===(V?f:!0)?(x=!0,T=p,l=e.errSchemaPath+"/"+p,E+="="):(x=!1,X+="="));var z="'"+X+"'";r+=" if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+d+" "+E+" "+f+" || "+d+" !== "+d+") { "}}T=T||a;var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+z+", limit: "+f+", exclusive: "+x+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+X+" ",y?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var B=r;return r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},qu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+d+".length "+m+" "+f+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",y?r+="' + "+f+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},Uu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),e.opts.unicode===!1?r+=" "+d+".length ":r+=" ucs2length("+d+") ",r+=" "+m+" "+f+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",y?r+="' + "+f+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},Vu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(y||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" Object.keys("+d+").length "+m+" "+f+") { ";var p=a,h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",y?r+="' + "+f+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},ny=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;if(y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(y||typeof o=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",y&&(r+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),r+=" (division"+n+" = "+d+" / "+f+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",y&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",y?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},iy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="errs__"+n,f=e.util.copy(e);f.level++;var m="valid"+f.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=c,f.errSchemaPath=l,r+=" var "+y+" = errors; ";var p=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var h;f.opts.allErrors&&(h=f.opts.allErrors,f.opts.allErrors=!1),r+=" "+e.validate(f)+" ",f.createErrors=!0,h&&(f.opts.allErrors=h),e.compositeRule=f.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(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 = "+y+"; if (vErrors !== null) { if ("+y+") vErrors.length = "+y+"; 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(l)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},oy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,$="prevValid"+n,E="passingSchemas"+n;r+="var "+f+" = errors , "+$+" = false , "+y+" = false , "+E+" = null; ";var T=e.compositeRule;e.compositeRule=m.compositeRule=!0;var C=o;if(C)for(var x,K=-1,V=C.length-1;K<V;)x=C[K+=1],(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))?(m.schema=x,m.schemaPath=c+"["+K+"]",m.errSchemaPath=l+"/"+K,r+=" "+e.validate(m)+" ",m.baseId=v):r+=" var "+h+" = true; ",K&&(r+=" if ("+h+" && "+$+") { "+y+" = false; "+E+" = ["+E+", "+K+"]; } else { ",p+="}"),r+=" if ("+h+") { "+y+" = "+$+" = true; "+E+" = "+K+"; }";return e.compositeRule=m.compositeRule=T,r+=""+p+"if (!"+y+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r},ly=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y=e.opts.$data&&o&&o.$data,f;y?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=y?"(new RegExp("+f+"))":e.usePattern(o);r+="if ( ",y&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),r+=" !"+m+".test("+d+") ) { ";var p=p||[];p.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { pattern: ",y?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,y?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",y?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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},cy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h="key"+n,v="idx"+n,$=f.dataLevel=e.dataLevel+1,E="data"+$,T="dataProperties"+n,C=Object.keys(o||{}).filter(be),x=e.schema.patternProperties||{},K=Object.keys(x).filter(be),V=e.schema.additionalProperties,z=C.length||K.length,X=V===!1,Y=typeof V=="object"&&Object.keys(V).length,B=e.opts.removeAdditional,F=X||Y||B,M=e.opts.ownProperties,re=e.baseId,_e=e.schema.required;if(_e&&!(e.opts.$data&&_e.$data)&&_e.length<e.opts.loopRequired)var ve=e.util.toHash(_e);function be(Tr){return Tr!=="__proto__"}if(r+="var "+y+" = errors;var "+p+" = true;",M&&(r+=" var "+T+" = undefined;"),F){if(M?r+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+h+" = "+T+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",z){if(r+=" var isAdditional"+n+" = !(false ",C.length)if(C.length>8)r+=" || validate.schema"+c+".hasOwnProperty("+h+") ";else{var de=C;if(de)for(var j,S=-1,D=de.length-1;S<D;)j=de[S+=1],r+=" || "+h+" == "+e.util.toQuotedString(j)+" "}if(K.length){var O=K;if(O)for(var g,w=-1,A=O.length-1;w<A;)g=O[w+=1],r+=" || "+e.usePattern(g)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(B=="all")r+=" delete "+d+"["+h+"]; ";else{var Z=e.errorPath,Q="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),X)if(B)r+=" delete "+d+"["+h+"]; ";else{r+=" "+p+" = false; ";var fe=l;l=e.errSchemaPath+"/additionalProperties";var ie=ie||[];ie.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+Q+"' } ",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: "+d+" "),r+=" } "):r+=" {} ";var he=r;r=ie.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+he+"]); ":r+=" validate.errors = ["+he+"]; return false; ":r+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=fe,u&&(r+=" break; ")}else if(Y)if(B=="failing"){r+=" var "+y+" = errors; ";var at=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=V,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=d+"["+h+"]";f.dataPathArr[$]=h;var Oe=e.validate(f);f.baseId=re,e.util.varOccurences(Oe,E)<2?r+=" "+e.util.varReplace(Oe,E,Ve)+" ":r+=" var "+E+" = "+Ve+"; "+Oe+" ",r+=" if (!"+p+") { errors = "+y+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+h+"]; } ",e.compositeRule=f.compositeRule=at}else{f.schema=V,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=d+"["+h+"]";f.dataPathArr[$]=h;var Oe=e.validate(f);f.baseId=re,e.util.varOccurences(Oe,E)<2?r+=" "+e.util.varReplace(Oe,E,Ve)+" ":r+=" var "+E+" = "+Ve+"; "+Oe+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=Z}z&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var gt=e.opts.useDefaults&&!e.compositeRule;if(C.length){var Ke=C;if(Ke)for(var j,Mt=-1,Ct=Ke.length-1;Mt<Ct;){j=Ke[Mt+=1];var qe=o[j];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){var yt=e.util.getProperty(j),Ve=d+yt,Xt=gt&&qe.default!==void 0;f.schema=qe,f.schemaPath=c+yt,f.errSchemaPath=l+"/"+e.util.escapeFragment(j),f.errorPath=e.util.getPath(e.errorPath,j,e.opts.jsonPointers),f.dataPathArr[$]=e.util.toQuotedString(j);var Oe=e.validate(f);if(f.baseId=re,e.util.varOccurences(Oe,E)<2){Oe=e.util.varReplace(Oe,E,Ve);var Me=Ve}else{var Me=E;r+=" var "+E+" = "+Ve+"; "}if(Xt)r+=" "+Oe+" ";else{if(ve&&ve[j]){r+=" if ( "+Me+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),r+=") { "+p+" = false; ";var Z=e.errorPath,fe=l,Le=e.util.escapeQuotes(j);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Z,j,e.opts.jsonPointers)),l=e.errSchemaPath+"/required";var ie=ie||[];ie.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+Le+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Le+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var he=r;r=ie.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+he+"]); ":r+=" validate.errors = ["+he+"]; return false; ":r+=" var err = "+he+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=fe,e.errorPath=Z,r+=" } else { "}else u?(r+=" if ( "+Me+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+Me+" !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),r+=" ) { ");r+=" "+Oe+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(K.length){var Xe=K;if(Xe)for(var g,fr=-1,Yt=Xe.length-1;fr<Yt;){g=Xe[fr+=1];var qe=x[g];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){f.schema=qe,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(g),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(g),M?r+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+h+" = "+T+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" if ("+e.usePattern(g)+".test("+h+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ve=d+"["+h+"]";f.dataPathArr[$]=h;var Oe=e.validate(f);f.baseId=re,e.util.varOccurences(Oe,E)<2?r+=" "+e.util.varReplace(Oe,E,Ve)+" ":r+=" var "+E+" = "+Ve+"; "+Oe+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+y+" == errors) {"),r},uy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level;if(r+="var "+y+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=c,f.errSchemaPath=l;var h="key"+n,v="idx"+n,$="i"+n,E="' + "+h+" + '",T=f.dataLevel=e.dataLevel+1,C="data"+T,x="dataProperties"+n,K=e.opts.ownProperties,V=e.baseId;K&&(r+=" var "+x+" = undefined; "),K?r+=" "+x+" = "+x+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+x+".length; "+v+"++) { var "+h+" = "+x+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" var startErrs"+n+" = errors; ";var z=h,X=e.compositeRule;e.compositeRule=f.compositeRule=!0;var Y=e.validate(f);f.baseId=V,e.util.varOccurences(Y,C)<2?r+=" "+e.util.varReplace(Y,C,z)+" ":r+=" var "+C+" = "+z+"; "+Y+" ",e.compositeRule=f.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(l)+" , params: { propertyName: '"+E+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+E+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 ("+y+" == errors) {"),r},dy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f=e.opts.$data&&o&&o.$data;f&&(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var m="schema"+n;if(!f)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],h=o;if(h)for(var v,$=-1,E=h.length-1;$<E;){v=h[$+=1];var T=e.schema.properties[v];T&&(e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all))||(p[p.length]=v)}}else var p=o;if(f||p.length){var C=e.errorPath,x=f||p.length>=e.opts.loopRequired,K=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",x){f||(r+=" var "+m+" = validate.schema"+c+"; ");var V="i"+n,z="schema"+n+"["+V+"]",X="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,z,e.opts.jsonPointers)),r+=" var "+y+" = true; ",f&&(r+=" if (schema"+n+" === undefined) "+y+" = true; else if (!Array.isArray(schema"+n+")) "+y+" = false; else {"),r+=" for (var "+V+" = 0; "+V+" < "+m+".length; "+V+"++) { "+y+" = "+d+"["+m+"["+V+"]] !== undefined ",K&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", "+m+"["+V+"]) "),r+="; if (!"+y+") break; } ",f&&(r+=" } "),r+=" if (!"+y+") { ";var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var B=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var F=p;if(F)for(var M,V=-1,re=F.length-1;V<re;){M=F[V+=1],V&&(r+=" || ");var _e=e.util.getProperty(M),ve=d+_e;r+=" ( ( "+ve+" === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:_e)+") ) "}r+=") { ";var z="missing"+n,X="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,z,!0):C+" + "+z);var Y=Y||[];Y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var B=r;r=Y.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+B+"]); ":r+=" validate.errors = ["+B+"]; return false; ":r+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(x){f||(r+=" var "+m+" = validate.schema"+c+"; ");var V="i"+n,z="schema"+n+"["+V+"]",X="' + "+z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,z,e.opts.jsonPointers)),f&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+V+" = 0; "+V+" < "+m+".length; "+V+"++) { if ("+d+"["+m+"["+V+"]] === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+m+"["+V+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(r+=" } ")}else{var be=p;if(be)for(var M,de=-1,j=be.length-1;de<j;){M=be[de+=1];var _e=e.util.getProperty(M),X=e.util.escapeQuotes(M),ve=d+_e;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,M,e.opts.jsonPointers)),r+=" if ( "+ve+" === undefined ",K&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else u&&(r+=" if (true) {");return r},fy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),y="valid"+n,f=e.opts.$data&&o&&o.$data,m;if(f?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+n):m=o,(o||f)&&e.opts.uniqueItems!==!1){f&&(r+=" var "+y+"; if ("+m+" === false || "+m+" === undefined) "+y+" = true; else if (typeof "+m+" != 'boolean') "+y+" = false; else { "),r+=" var i = "+d+".length , "+y+" = 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("+d+"[i], "+d+"[j])) { "+y+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[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') { "+y+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",f&&(r+=" } "),r+=" if (!"+y+") { ";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , 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: ",f?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var E=r;r=$.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++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},hy={$ref:Jg,allOf:Qg,anyOf:Gg,$comment:Wg,const:Xg,contains:Yg,dependencies:ey,enum:ty,format:ry,if:ay,items:sy,maximum:Fu,minimum:Fu,maxItems:qu,minItems:qu,maxLength:Uu,minLength:Uu,maxProperties:Vu,minProperties:Vu,multipleOf:ny,not:iy,oneOf:oy,pattern:ly,properties:cy,propertyNames:uy,required:dy,uniqueItems:fy,validate:Eu},zu=hy,yo=Kr.toHash,py=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=yo(a),e.types=yo(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(i);var l=e.all[i]={keyword:i,code:zu[i],implements:o};return l}),e.all.$comment={keyword:"$comment",code:zu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=yo(a.concat(s)),e.custom={},e},Hu=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],my=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<Hu.length;n++){var i=Hu[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},vy=mo.MissingRef,gy=Zu;function Zu(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 o=s._addSchema(t,void 0,e);return o.validate||i(o)});return a&&r.then(function(o){a(null,o)},a),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?Zu.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(l){if(l instanceof vy)return c(l);throw l}function c(l){var u=l.missingSchema;if(f(u))throw new Error("Schema "+u+" is loaded but "+l.missingRef+" cannot be resolved");var d=s._loadingSchemas[u];return d||(d=s._loadingSchemas[u]=s._opts.loadSchema(u),d.then(y,y)),d.then(function(m){if(!f(u))return n(m).then(function(){f(u)||s.addSchema(m,u,void 0,e)})}).then(function(){return i(o)});function y(){delete s._loadingSchemas[u]}function f(m){return s._refs[m]||s._schemas[m]}}}}var yy=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],c=e.schemaPath+e.util.getProperty(a),l=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d,y="data"+(i||""),f="valid"+n,m="errs__"+n,p=e.opts.$data&&o&&o.$data,h;p?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",h="schema"+n):h=o;var v=this,$="definition"+n,E=v.definition,T="",C,x,K,V,z;if(p&&E.$data){z="keywordValidate"+n;var X=E.validateSchema;r+=" var "+$+" = RULES.custom['"+a+"'].definition; var "+z+" = "+$+".validate;"}else{if(V=e.useCustomRule(v,o,e.schema,e),!V)return;h="validate.schema"+c,z=V.code,C=E.compile,x=E.inline,K=E.macro}var Y=z+".errors",B="i"+n,F="ruleErr"+n,M=E.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(x||K||(r+=""+Y+" = null;"),r+="var "+m+" = errors;var "+f+";",p&&E.$data&&(T+="}",r+=" if ("+h+" === undefined) { "+f+" = true; } else { ",X&&(T+="}",r+=" "+f+" = "+$+".validateSchema("+h+"); if ("+f+") { ")),x)E.statements?r+=" "+V.validate+" ":r+=" "+f+" = "+V.validate+"; ";else if(K){var re=e.util.copy(e),T="";re.level++;var _e="valid"+re.level;re.schema=V.validate,re.schemaPath="";var ve=e.compositeRule;e.compositeRule=re.compositeRule=!0;var be=e.validate(re).replace(/validate\.schema/g,z);e.compositeRule=re.compositeRule=ve,r+=" "+be}else{var de=de||[];de.push(r),r="",r+=" "+z+".call( ",e.opts.passContext?r+="this":r+="self",C||E.schema===!1?r+=" , "+y+" ":r+=" , "+h+" , "+y+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var j=i?"data"+(i-1||""):"parentData",S=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+j+" , "+S+" , rootData ) ";var D=r;r=de.pop(),E.errors===!1?(r+=" "+f+" = ",M&&(r+="await "),r+=""+D+"; "):M?(Y="customErrors"+n,r+=" var "+Y+" = null; try { "+f+" = await "+D+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+Y+" = e.errors; else throw e; } "):r+=" "+Y+" = null; "+f+" = "+D+"; "}if(E.modifying&&(r+=" if ("+j+") "+y+" = "+j+"["+S+"];"),r+=""+T,E.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",E.valid===void 0?(r+=" !",K?r+=""+_e:r+=""+f):r+=" "+!E.valid+" ",r+=") { ",d=v.keyword;var de=de||[];de.push(r),r="";var de=de||[];de.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var O=r;r=de.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var g=r;r=de.pop(),x?E.errors?E.errors!="full"&&(r+=" for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } "):E.errors===!1?r+=" "+g+" ":(r+=" if ("+m+" == errors) { "+g+" } else { for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+l+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } } "):K?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),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; ")):E.errors===!1?r+=" "+g+" ":(r+=" if (Array.isArray("+Y+")) { if (vErrors === null) vErrors = "+Y+"; else vErrors = vErrors.concat("+Y+"); errors = vErrors.length; for (var "+B+"="+m+"; "+B+"<errors; "+B+"++) { var "+F+" = vErrors["+B+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+l+'"; ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+y+"; "),r+=" } } else { "+g+" } "),r+=" } ",u&&(r+=" else { ")}return r};const Ku={$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 Bu=Ku,_y={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Bu.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Bu.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"}]}}},$y=/^[a-z_$][a-z0-9_$-]*$/i,wy=yy,by=_y,Py={add:Ey,get:Sy,remove:Ry,validate:_o};function Ey(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!$y.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++)i(t,s[r],e);else i(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 i(o,c,l){for(var u,d=0;d<a.length;d++){var y=a[d];if(y.type==c){u=y;break}}u||(u={type:c,rules:[]},a.push(u));var f={keyword:o,definition:l,custom:!0,code:wy,implements:l.implements};u.rules.push(f),a.custom[o]=f}return this}function Sy(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function Ry(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 _o(t,e){_o.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(by,!0);if(a(t))return!0;if(_o.errors=a.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}const ky={$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 Ju=kg,Sr=co,Ty=jg,Qu=gu,Oy=Pu,Cy=Ug,Iy=py,Gu=my,Wu=Kr,Ny=Fe;Fe.prototype.validate=jy,Fe.prototype.compile=Dy,Fe.prototype.addSchema=xy,Fe.prototype.addMetaSchema=My,Fe.prototype.validateSchema=Ly,Fe.prototype.getSchema=qy,Fe.prototype.removeSchema=Vy,Fe.prototype.addFormat=Gy,Fe.prototype.errorsText=Qy,Fe.prototype._addSchema=zy,Fe.prototype._compile=Hy,Fe.prototype.compileAsync=gy;var zs=Py;Fe.prototype.addKeyword=zs.add,Fe.prototype.getKeyword=zs.get,Fe.prototype.removeKeyword=zs.remove,Fe.prototype.validateKeyword=zs.validate;var Xu=mo;Fe.ValidationError=Xu.Validation,Fe.MissingRefError=Xu.MissingRef,Fe.$dataMetaSchema=Gu;var Hs="http://json-schema.org/draft-07/schema",Yu=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Ay=["/properties"];function Fe(t){if(!(this instanceof Fe))return new Fe(t);t=this._opts=Wu.copy(t)||{},r_(this),this._schemas={},this._refs={},this._fragments={},this._formats=Cy(t.format),this._cache=t.cache||new Ty,this._loadingSchemas={},this._compilations=[],this.RULES=Iy(),this._getId=Zy(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=Oy),this._metaOpts=t_(this),t.formats&&Yy(this),t.keywords&&e_(this),Wy(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Xy(this)}function jy(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 Dy(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function xy(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=Sr.normalizeId(e||n),td(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function My(t,e,a){return this.addSchema(t,e,a,!0),this}function Ly(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||Fy(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 Fy(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Hs)?Hs:void 0,t._opts.defaultMeta}function qy(t){var e=ed(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Uy(this,t)}}function Uy(t,e){var a=Sr.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,i=Ju.call(t,s,r,void 0,n);return t._fragments[e]=new Qu({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function ed(t,e){return e=Sr.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Vy(t){if(t instanceof RegExp)return Zs(this,this._schemas,t),Zs(this,this._refs,t),this;switch(typeof t){case"undefined":return Zs(this,this._schemas),Zs(this,this._refs),this._cache.clear(),this;case"string":var e=ed(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=Sr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Zs(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 zy(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,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=Sr.normalizeId(this._getId(t));o&&s&&td(this,o);var c=this._opts.validateSchema!==!1&&!e,l;c&&!(l=o&&o==Sr.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=Sr.ids.call(this,t),d=new Qu({id:o,schema:t,localRefs:u,cacheKey:n,meta:a});return o[0]!="#"&&s&&(this._refs[o]=d),this._cache.put(n,d),c&&l&&this.validateSchema(t,!0),d}function Hy(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=Ju.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,i=n.apply(this,arguments);return r.errors=n.errors,i}}function Zy(t){switch(t.schemaId){case"auto":return Jy;case"id":return Ky;default:return By}}function Ky(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function By(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function Jy(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 Qy(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 i=t[n];i&&(r+=s+i.dataPath+" "+i.message+a)}return r.slice(0,-a.length)}function Gy(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Wy(t){var e;if(t._opts.$data&&(e=ky,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=Ku;t._opts.$data&&(a=Gu(a,Ay)),t.addMetaSchema(a,Hs,!0),t._refs["http://json-schema.org/schema"]=Hs}}function Xy(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 Yy(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function e_(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function td(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function t_(t){for(var e=Wu.copy(t._opts),a=0;a<Yu.length;a++)delete e[Yu[a]];return e}function r_(t){var e=t._opts.logger;if(e===!1)t.logger={log:$o,warn:$o,error:$o};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 $o(){}const rd=Go(Ny);class a_ extends Yi{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 rd}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=eo(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:Er,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ai,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ei.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,i;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(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.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"},or,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},Gi,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},or,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},Hi,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},Vi,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},Fi,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},qi,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},Ui,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},or,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},or,a)}async callTool(e,a=Os,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 Ce(R.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 Ce(R.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof Ce?i:new Ce(R.ErrorCode.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}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},Zi,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let wo;wo=globalThis.crypto;async function s_(t){return(await wo).getRandomValues(new Uint8Array(t))}async function n_(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await s_(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function i_(t){return await n_(t)}async function o_(t){const e=await(await wo).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function l_(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await i_(t),a=await o_(e);return{code_verifier:e,code_challenge:a}}const c_=H({resource:k().url(),authorization_servers:ee(k().url()).optional(),jwks_uri:k().url().optional(),scopes_supported:ee(k()).optional(),bearer_methods_supported:ee(k()).optional(),resource_signing_alg_values_supported:ee(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:Qe().optional(),authorization_details_types_supported:ee(k()).optional(),dpop_signing_alg_values_supported:ee(k()).optional(),dpop_bound_access_tokens_required:Qe().optional()}).passthrough(),bo=H({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),registration_endpoint:k().optional(),scopes_supported:ee(k()).optional(),response_types_supported:ee(k()),response_modes_supported:ee(k()).optional(),grant_types_supported:ee(k()).optional(),token_endpoint_auth_methods_supported:ee(k()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(k()).optional(),service_documentation:k().optional(),revocation_endpoint:k().optional(),revocation_endpoint_auth_methods_supported:ee(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ee(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:ee(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ee(k()).optional(),code_challenge_methods_supported:ee(k()).optional()}).passthrough(),u_=H({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),userinfo_endpoint:k().optional(),jwks_uri:k(),registration_endpoint:k().optional(),scopes_supported:ee(k()).optional(),response_types_supported:ee(k()),response_modes_supported:ee(k()).optional(),grant_types_supported:ee(k()).optional(),acr_values_supported:ee(k()).optional(),subject_types_supported:ee(k()),id_token_signing_alg_values_supported:ee(k()),id_token_encryption_alg_values_supported:ee(k()).optional(),id_token_encryption_enc_values_supported:ee(k()).optional(),userinfo_signing_alg_values_supported:ee(k()).optional(),userinfo_encryption_alg_values_supported:ee(k()).optional(),userinfo_encryption_enc_values_supported:ee(k()).optional(),request_object_signing_alg_values_supported:ee(k()).optional(),request_object_encryption_alg_values_supported:ee(k()).optional(),request_object_encryption_enc_values_supported:ee(k()).optional(),token_endpoint_auth_methods_supported:ee(k()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(k()).optional(),display_values_supported:ee(k()).optional(),claim_types_supported:ee(k()).optional(),claims_supported:ee(k()).optional(),service_documentation:k().optional(),claims_locales_supported:ee(k()).optional(),ui_locales_supported:ee(k()).optional(),claims_parameter_supported:Qe().optional(),request_parameter_supported:Qe().optional(),request_uri_parameter_supported:Qe().optional(),require_request_uri_registration:Qe().optional(),op_policy_uri:k().optional(),op_tos_uri:k().optional()}).passthrough().merge(bo.pick({code_challenge_methods_supported:!0})),ad=H({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:We().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),d_=H({error:k(),error_description:k().optional(),error_uri:k().optional()}),f_=H({redirect_uris:ee(k()).refine(t=>t.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:k().optional(),grant_types:ee(k()).optional(),response_types:ee(k()).optional(),client_name:k().optional(),client_uri:k().optional(),logo_uri:k().optional(),scope:k().optional(),contacts:ee(k()).optional(),tos_uri:k().optional(),policy_uri:k().optional(),jwks_uri:k().optional(),jwks:Cv().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),h_=H({client_id:k(),client_secret:k().optional(),client_id_issued_at:We().optional(),client_secret_expires_at:We().optional()}).strip(),p_=f_.merge(h_);H({error:k(),error_description:k().optional()}).strip(),H({token:k(),token_type_hint:k().optional()}).strip();function m_(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function v_({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 tt 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 Po extends tt{}Po.errorCode="invalid_request";class Ks extends tt{}Ks.errorCode="invalid_client";class Bs extends tt{}Bs.errorCode="invalid_grant";class Js extends tt{}Js.errorCode="unauthorized_client";class Eo extends tt{}Eo.errorCode="unsupported_grant_type";class So extends tt{}So.errorCode="invalid_scope";class Ro extends tt{}Ro.errorCode="access_denied";class Br extends tt{}Br.errorCode="server_error";class ko extends tt{}ko.errorCode="temporarily_unavailable";class To extends tt{}To.errorCode="unsupported_response_type";class Oo extends tt{}Oo.errorCode="unsupported_token_type";class Co extends tt{}Co.errorCode="invalid_token";class Io extends tt{}Io.errorCode="method_not_allowed";class No extends tt{}No.errorCode="too_many_requests";class Ao extends tt{}Ao.errorCode="invalid_client_metadata";class jo extends tt{}jo.errorCode="insufficient_scope";const g_={[Po.errorCode]:Po,[Ks.errorCode]:Ks,[Bs.errorCode]:Bs,[Js.errorCode]:Js,[Eo.errorCode]:Eo,[So.errorCode]:So,[Ro.errorCode]:Ro,[Br.errorCode]:Br,[ko.errorCode]:ko,[To.errorCode]:To,[Oo.errorCode]:Oo,[Co.errorCode]:Co,[Io.errorCode]:Io,[No.errorCode]:No,[Ao.errorCode]:Ao,[jo.errorCode]:jo};class Rt extends Error{constructor(e){super(e??"Unauthorized")}}function sd(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 nd(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":y_(r,n,a);return;case"client_secret_post":__(r,n,s);return;case"none":$_(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function y_(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 __(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function $_(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=d_.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:i}=s,o=g_[r]||Br;return new o(n||"",i)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new Br(r)}}async function Rr(t,e){var a,s;try{return await Do(t,e)}catch(r){if(r instanceof Ks||r instanceof Js)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await Do(t,e);if(r instanceof Bs)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Do(t,e);throw r}}async function Do(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let i,o;try{i=await od(e,{resourceMetadataUrl:r},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);const c=await id(e,t,i),l=await dd(o,{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 md(o,{metadata:l,clientMetadata:t.clientMetadata});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await hd(o,{metadata:l,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const d=await t.tokens();if(d!=null&&d.refresh_token)try{const p=await pd(o,{metadata:l,clientInformation:u,refreshToken:d.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof tt)||p instanceof Br))throw p}const y=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:m}=await fd(o,{metadata:l,clientInformation:u,state:y,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(f),"REDIRECT"}async function id(t,e,a){const s=m_(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!v_({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 Gs(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 od(t,e,a=fetch){const s=await cd(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 c_.parse(await s.json())}async function xo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?xo(t,void 0,a):void 0;throw s}}function w_(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function ld(t,e,a=fetch){return await xo(t,{"MCP-Protocol-Version":e},a)}function b_(t,e){return!t||t.status===404&&e!=="/"}async function cd(t,e,a,s){var r,n;const i=new URL(t),o=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Er;let c;if(s!=null&&s.metadataUrl)c=new URL(s.metadataUrl);else{const u=w_(e,i.pathname);c=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),c.search=i.search}let l=await ld(c,o,a);if(!(s!=null&&s.metadataUrl)&&b_(l,i.pathname)){const u=new URL(`/.well-known/${e}`,i);l=await ld(u,o,a)}return l}async function P_(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=Er);const r=await cd(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 bo.parse(await r.json())}}function ud(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 dd(t,{fetchFn:e=fetch,protocolVersion:a=Er}={}){var s;const r={"MCP-Protocol-Version":a},n=ud(t);for(const{url:i,type:o}of n){const c=await xo(i,r,e);if(!c)throw new Error(`CORS error trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`);if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(o==="oauth")return bo.parse(await c.json());{const l=u_.parse(await c.json());if(!(!((s=l.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${i}: does not support S256 code challenge method required by MCP specification`);return l}}}async function fd(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:i}){const o="code",c="S256";let l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else l=new URL("/authorize",t);const u=await l_(),d=u.code_verifier,y=u.code_challenge;return l.searchParams.set("response_type",o),l.searchParams.set("client_id",a.client_id),l.searchParams.set("code_challenge",y),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(s)),n&&l.searchParams.set("state",n),r&&l.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&l.searchParams.append("prompt","consent"),i&&l.searchParams.set("resource",i.href),{authorizationUrl:l,codeVerifier:d}}async function hd(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:c}){var l;const u="authorization_code",d=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 y=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),f=new URLSearchParams({grant_type:u,code:s,code_verifier:r,redirect_uri:String(n)});if(o)o(y,f,t,e);else{const p=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],h=sd(a,p);nd(h,a,y,f)}i&&f.set("resource",i.href);const m=await(c??fetch)(d,{method:"POST",headers:y,body:f});if(!m.ok)throw await Qs(m);return ad.parse(await m.json())}async function pd(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:i}){var o;const c="refresh_token";let l;if(e){if(l=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else l=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:s});if(n)n(u,d,t,e);else{const f=(o=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],m=sd(a,f);nd(m,a,u,d)}r&&d.set("resource",r.href);const y=await(i??fetch)(l,{method:"POST",headers:u,body:d});if(!y.ok)throw await Qs(y);return ad.parse({refresh_token:s,...await y.json()})}async function md(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 p_.parse(await n.json())}class vd 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 Mo(t){}function gd(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=Mo,onError:a=Mo,onRetry:s=Mo,onComment:r}=t;let n="",i=!0,o,c="",l="";function u(p){const h=i?p.replace(/^\xEF\xBB\xBF/,""):p,[v,$]=E_(`${n}${h}`);for(const E of v)d(E);n=$,i=!1}function d(p){if(p===""){f();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,E=p.slice(h+$);y(v,E,p);return}y(p,"",p)}function y(p,h,v){switch(p){case"event":l=h;break;case"data":c=`${c}${h}
|
|
9
|
-
`;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new vd(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:v}));break;default:a(new vd(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:h,line:v}));break}}function f(){c.length>0&&e({id:o,event:l||void 0,data:c.endsWith(`
|
|
10
|
-
`)?c.slice(0,-1):c}),o=void 0,c="",l=""}function m(p={}){n&&p.consume&&d(n),i=!0,o=void 0,c="",l="",n=""}return{feed:u,reset:m}}function E_(t){const e=[];let a="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),n=t.indexOf(`
|
|
11
|
-
`,s);let i=-1;if(r!==-1&&n!==-1?i=Math.min(r,n):r!==-1?i=r:n!==-1&&(i=n),i===-1){a=t.slice(s);break}else{const o=t.slice(s,i);e.push(o),s=i+1,t[s-1]==="\r"&&t[s]===`
|
|
12
|
-
`&&s++}}return[e,a]}class yd 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(_d(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(_d(this),a)}}function S_(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Lo(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Lo).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Lo(t.cause)}`:t.message:`${t}`}function _d(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var $d=t=>{throw TypeError(t)},Fo=(t,e,a)=>e.has(t)||$d("Cannot "+a),we=(t,e,a)=>(Fo(t,e,"read from private field"),a?a.call(t):e.get(t)),Ge=(t,e,a)=>e.has(t)?$d("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),je=(t,e,a,s)=>(Fo(t,e,"write to private field"),e.set(t,a),a),Wt=(t,e,a)=>(Fo(t,e,"access private method"),a),dt,kr,Jr,Ws,Xs,Oa,Qr,Ca,dr,Gr,Wr,Xr,Ia,kt,qo,Uo,Vo,wd,zo,Ho,Na,Zo,Ko;class Ys extends EventTarget{constructor(e,a){var s,r;super(),Ge(this,kt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Ge(this,dt),Ge(this,kr),Ge(this,Jr),Ge(this,Ws),Ge(this,Xs),Ge(this,Oa),Ge(this,Qr),Ge(this,Ca,null),Ge(this,dr),Ge(this,Gr),Ge(this,Wr,null),Ge(this,Xr,null),Ge(this,Ia,null),Ge(this,Uo,async n=>{var i;we(this,Gr).reset();const{body:o,redirected:c,status:l,headers:u}=n;if(l===204){Wt(this,kt,Na).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?je(this,Jr,new URL(n.url)):je(this,Jr,void 0),l!==200){Wt(this,kt,Na).call(this,`Non-200 status code (${l})`,l);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Wt(this,kt,Na).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(we(this,dt)===this.CLOSED)return;je(this,dt,this.OPEN);const d=new Event("open");if((i=we(this,Ia))==null||i.call(this,d),this.dispatchEvent(d),typeof o!="object"||!o||!("getReader"in o)){Wt(this,kt,Na).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const y=new TextDecoder,f=o.getReader();let m=!0;do{const{done:p,value:h}=await f.read();h&&we(this,Gr).feed(y.decode(h,{stream:!p})),p&&(m=!1,we(this,Gr).reset(),Wt(this,kt,Zo).call(this))}while(m)}),Ge(this,Vo,n=>{je(this,dr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Wt(this,kt,Zo).call(this,Lo(n))}),Ge(this,zo,n=>{typeof n.id=="string"&&je(this,Ca,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:we(this,Jr)?we(this,Jr).origin:we(this,kr).origin,lastEventId:n.id||""});we(this,Xr)&&(!n.event||n.event==="message")&&we(this,Xr).call(this,i),this.dispatchEvent(i)}),Ge(this,Ho,n=>{je(this,Oa,n)}),Ge(this,Ko,()=>{je(this,Qr,void 0),we(this,dt)===this.CONNECTING&&Wt(this,kt,qo).call(this)});try{if(e instanceof URL)je(this,kr,e);else if(typeof e=="string")je(this,kr,new URL(e,R_()));else throw new Error("Invalid URL")}catch{throw S_("An invalid or illegal string was specified")}je(this,Gr,gd({onEvent:we(this,zo),onRetry:we(this,Ho)})),je(this,dt,this.CONNECTING),je(this,Oa,3e3),je(this,Xs,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),je(this,Ws,(r=a==null?void 0:a.withCredentials)!=null?r:!1),Wt(this,kt,qo).call(this)}get readyState(){return we(this,dt)}get url(){return we(this,kr).href}get withCredentials(){return we(this,Ws)}get onerror(){return we(this,Wr)}set onerror(e){je(this,Wr,e)}get onmessage(){return we(this,Xr)}set onmessage(e){je(this,Xr,e)}get onopen(){return we(this,Ia)}set onopen(e){je(this,Ia,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(){we(this,Qr)&&clearTimeout(we(this,Qr)),we(this,dt)!==this.CLOSED&&(we(this,dr)&&we(this,dr).abort(),je(this,dt,this.CLOSED),je(this,dr,void 0))}}dt=new WeakMap,kr=new WeakMap,Jr=new WeakMap,Ws=new WeakMap,Xs=new WeakMap,Oa=new WeakMap,Qr=new WeakMap,Ca=new WeakMap,dr=new WeakMap,Gr=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Ia=new WeakMap,kt=new WeakSet,qo=function(){je(this,dt,this.CONNECTING),je(this,dr,new AbortController),we(this,Xs)(we(this,kr),Wt(this,kt,wd).call(this)).then(we(this,Uo)).catch(we(this,Vo))},Uo=new WeakMap,Vo=new WeakMap,wd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...we(this,Ca)?{"Last-Event-ID":we(this,Ca)}:void 0},cache:"no-store",signal:(t=we(this,dr))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},zo=new WeakMap,Ho=new WeakMap,Na=function(t,e){var a;we(this,dt)!==this.CLOSED&&je(this,dt,this.CLOSED);const s=new yd("error",{code:e,message:t});(a=we(this,Wr))==null||a.call(this,s),this.dispatchEvent(s)},Zo=function(t,e){var a;if(we(this,dt)===this.CLOSED)return;je(this,dt,this.CONNECTING);const s=new yd("error",{code:e,message:t});(a=we(this,Wr))==null||a.call(this,s),this.dispatchEvent(s),je(this,Qr,setTimeout(we(this,Ko),we(this,Oa)))},Ko=new WeakMap,Ys.CONNECTING=0,Ys.OPEN=1,Ys.CLOSED=2;function R_(){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 bd extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class k_{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 Rr(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,i)=>{this._eventSource=new Ys(this._url.href,{...this._eventSourceInit,fetch:async(o,c)=>{const l=await this._commonHeaders();l.set("Accept","text/event-stream");const u=await r(o,{...c,headers:l});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Gs(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var c;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}const l=new bd(o.code,o.message,o);i(l),(c=this.onerror)===null||c===void 0||c.call(this,l)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var c;const l=o;try{if(this._endpoint=new URL(l.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(c=this.onerror)===null||c===void 0||c.call(this,u),this.close();return}n()}),this._eventSource.onmessage=o=>{var c,l;const u=o;let d;try{d=Ea.parse(JSON.parse(u.data))}catch(y){(c=this.onerror)===null||c===void 0||c.call(this,y);return}(l=this.onmessage)===null||l===void 0||l.call(this,d)}})}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 Rr(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 i={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},o=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,i);if(!o.ok){if(o.status===401&&this._authProvider){if(this._resourceMetadataUrl=Gs(o),await Rr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const c=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${c}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class T_ extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=gd({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:a,onComment:s})},transform(n){r.feed(n)}})}}const O_={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class en extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class C_{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:O_}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let a;try{a=await Rr(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 i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);const o=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,{method:"GET",headers:i,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new en(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(i){throw(r=this.onerror)===null||r===void 0||r.call(this,i),i}}_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(i=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,a+1)})},n)}_handleSseStream(e,a,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:n}=a;let i;(async()=>{var c,l,u,d;try{const y=e.pipeThrough(new TextDecoderStream).pipeThrough(new T_).getReader();for(;;){const{value:f,done:m}=await y.read();if(m)break;if(f.id&&(i=f.id,r==null||r(f.id)),!f.event||f.event==="message")try{const p=Ea.parse(JSON.parse(f.data));n!==void 0&&ps(p)&&(p.id=n),(c=this.onmessage)===null||c===void 0||c.call(this,p)}catch(p){(l=this.onerror)===null||l===void 0||l.call(this,p)}}}catch(y){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${y}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:r,replayMessageId:n},0)}catch(f){(d=this.onerror)===null||d===void 0||d.call(this,new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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 Rr(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,i;try{const{resumptionToken:o,onresumptiontoken:c}=a||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ti(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 l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},d=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),y=d.headers.get("mcp-session-id");if(y&&(this._sessionId=y),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=Gs(d),await Rr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Rt;return this.send(e)}const h=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${h}`)}if(d.status===202){jc(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=d.headers.get("content-type");if(m)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:c},!1);else if(p!=null&&p.includes("application/json")){const h=await d.json(),v=Array.isArray(h)?h.map($=>Ea.parse($)):[Ea.parse(h)];for(const $ of v)(n=this.onmessage)===null||n===void 0||n.call(this,$)}else throw new en(-1,`Unexpected content type: ${p}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}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},i=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,n);if(!i.ok&&i.status!==405)throw new en(i.status,`Failed to terminate session: ${i.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 I_ extends Yi{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(vs,r=>this._oninitialize(r)),this.setNotificationHandler(gs,()=>{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=eo(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:Ei.includes(a)?a:Er,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"},or)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},Bi,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},Ji,a);if(s.action==="accept"&&s.content)try{const r=new rd,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ce(R.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ce?r:new Ce(R.ErrorCode.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},Wi,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 N_=Symbol("Let zodToJsonSchema decide on which parser to use"),Pd={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"},A_=t=>typeof t=="string"?{...Pd,name:t}:{...Pd,...t},j_=t=>{const e=A_(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 Ed(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function ke(t,e,a,s,r){t[e]=a,Ed(t,e,s,r)}const Sd=(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 ft(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Sd(e,t.currentPath):e.join("/")}}function D_(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)!==U.ZodAny&&(a.items=Re(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ke(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ke(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ke(a,"minItems",t.exactLength.value,t.exactLength.message,e),ke(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function x_(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?ke(a,"minimum",s.value,s.message,e):ke(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),ke(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ke(a,"maximum",s.value,s.message,e):ke(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),ke(a,"maximum",s.value,s.message,e));break;case"multipleOf":ke(a,"multipleOf",s.value,s.message,e);break}return a}function M_(){return{type:"boolean"}}function Rd(t,e){return Re(t.type._def,e)}const L_=(t,e)=>Re(t.innerType._def,e);function kd(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>kd(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 F_(t,e)}}const F_=(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":ke(a,"minimum",s.value,s.message,e);break;case"max":ke(a,"maximum",s.value,s.message,e);break}return a};function q_(t,e){return{...Re(t.innerType._def,e),default:t.defaultValue()}}function U_(t,e){return e.effectStrategy==="input"?Re(t.schema._def,e):ft(e)}function V_(t){return{type:"string",enum:Array.from(t.values)}}const z_=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function H_(t,e){const a=[Re(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Re(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(z_(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:o,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function Z_(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 Bo;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:()=>(Bo===void 0&&(Bo=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Bo),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":ke(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":ke(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":lt(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":lt(a,s.regex,s.message,e);break;case"cuid":lt(a,Tt.cuid,s.message,e);break;case"cuid2":lt(a,Tt.cuid2,s.message,e);break;case"startsWith":lt(a,RegExp(`^${Jo(s.value,e)}`),s.message,e);break;case"endsWith":lt(a,RegExp(`${Jo(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":ke(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),ke(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{lt(a,RegExp(Jo(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":lt(a,Tt.base64url,s.message,e);break;case"jwt":lt(a,Tt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&<(a,Tt.ipv4Cidr,s.message,e),s.version!=="v4"&<(a,Tt.ipv6Cidr,s.message,e);break}case"emoji":lt(a,Tt.emoji(),s.message,e);break;case"ulid":{lt(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":{ke(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{lt(a,Tt.base64,s.message,e);break}}break}case"nanoid":lt(a,Tt.nanoid,s.message,e)}return a}function Jo(t,e){return e.patternStrategy==="escape"?B_(t):t}const K_=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function B_(t){let e="";for(let a=0;a<t.length;a++)K_.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}}})):ke(t,"format",e,a,s)}function lt(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:Od(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):ke(t,"pattern",Od(e,s),a,s)}function Od(t,e){var c;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,i=!1,o=!1;for(let l=0;l<s.length;l++){if(n){r+=s[l],n=!1;continue}if(a.i){if(i){if(s[l].match(/[a-z]/)){o?(r+=s[l],r+=`${s[l-2]}-${s[l]}`.toUpperCase(),o=!1):s[l+1]==="-"&&((c=s[l+2])!=null&&c.match(/[a-z]/))?(r+=s[l],o=!0):r+=`${s[l]}${s[l].toUpperCase()}`;continue}}else if(s[l].match(/[a-z]/)){r+=`[${s[l]}${s[l].toUpperCase()}]`;continue}}if(a.m){if(s[l]==="^"){r+=`(^|(?<=[\r
|
|
13
|
-
]))`;continue}else if(s[l]==="$"){r+=`($|(?=[\r
|
|
14
|
-
]))`;continue}}if(a.s&&s[l]==="."){r+=i?`${s[l]}\r
|
|
15
|
-
`:`[${s[l]}\r
|
|
16
|
-
]`;continue}r+=s[l],s[l]==="\\"?n=!0:i&&s[l]==="]"?i=!1:!i&&s[l]==="["&&(i=!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 Cd(t,e){var s,r,n,i,o,c;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)===U.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,u)=>({...l,[u]:Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??ft(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Re(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)===U.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:l,...u}=Td(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===U.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((o=t.keyType)==null?void 0:o._def.typeName)===U.ZodBranded&&t.keyType._def.type._def.typeName===U.ZodString&&((c=t.keyType._def.type._def.checks)!=null&&c.length)){const{type:l,...u}=Rd(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function J_(t,e){if(e.mapStrategy==="record")return Cd(t,e);const a=Re(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ft(e),s=Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ft(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function Q_(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 G_(t){return t.target==="openAi"?void 0:{not:ft({...t,currentPath:[...t.currentPath,"not"]})}}function W_(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const tn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function X_(t,e){if(e.target==="openApi3")return Id(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in tn&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=tn[n._def.typeName];return i&&!r.includes(i)?[...r,i]: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 i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];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,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._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 Id(t,e)}const Id=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Re(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 Y_(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:tn[t.innerType._def.typeName],nullable:!0}:{type:[tn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Re(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Re(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function e0(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",Ed(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ke(a,"minimum",s.value,s.message,e):ke(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),ke(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ke(a,"maximum",s.value,s.message,e):ke(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),ke(a,"maximum",s.value,s.message,e));break;case"multipleOf":ke(a,"multipleOf",s.value,s.message,e);break}return a}function t0(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const o in n){let c=n[o];if(c===void 0||c._def===void 0)continue;let l=a0(c);l&&a&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);const u=Re(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(s.properties[o]=u,l||r.push(o))}r.length&&(s.required=r);const i=r0(t,e);return i!==void 0&&(s.additionalProperties=i),s}function r0(t,e){if(t.catchall._def.typeName!=="ZodNever")return Re(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 a0(t){try{return t.isOptional()}catch{return!0}}const s0=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Re(t.innerType._def,e);const a=Re(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ft(e)},a]}:ft(e)},n0=(t,e)=>{if(e.pipeStrategy==="input")return Re(t.in._def,e);if(e.pipeStrategy==="output")return Re(t.out._def,e);const a=Re(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Re(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function i0(t,e){return Re(t.type._def,e)}function o0(t,e){const s={type:"array",uniqueItems:!0,items:Re(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ke(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ke(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function l0(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Re(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Re(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Re(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function c0(t){return{not:ft(t)}}function u0(t){return ft(t)}const d0=(t,e)=>Re(t.innerType._def,e),f0=(t,e,a)=>{switch(e){case U.ZodString:return Td(t,a);case U.ZodNumber:return e0(t,a);case U.ZodObject:return t0(t,a);case U.ZodBigInt:return x_(t,a);case U.ZodBoolean:return M_();case U.ZodDate:return kd(t,a);case U.ZodUndefined:return c0(a);case U.ZodNull:return W_(a);case U.ZodArray:return D_(t,a);case U.ZodUnion:case U.ZodDiscriminatedUnion:return X_(t,a);case U.ZodIntersection:return H_(t,a);case U.ZodTuple:return l0(t,a);case U.ZodRecord:return Cd(t,a);case U.ZodLiteral:return Z_(t,a);case U.ZodEnum:return V_(t);case U.ZodNativeEnum:return Q_(t);case U.ZodNullable:return Y_(t,a);case U.ZodOptional:return s0(t,a);case U.ZodMap:return J_(t,a);case U.ZodSet:return o0(t,a);case U.ZodLazy:return()=>t.getter()._def;case U.ZodPromise:return i0(t,a);case U.ZodNaN:case U.ZodNever:return G_(a);case U.ZodEffects:return U_(t,a);case U.ZodAny:return ft(a);case U.ZodUnknown:return u0(a);case U.ZodDefault:return q_(t,a);case U.ZodBranded:return Rd(t,a);case U.ZodReadonly:return d0(t,a);case U.ZodCatch:return L_(t,a);case U.ZodPipeline:return n0(t,a);case U.ZodFunction:case U.ZodVoid:case U.ZodSymbol:return;default:return(s=>{})()}};function Re(t,e,a=!1){var o;const s=e.seen.get(t);if(e.override){const c=(o=e.override)==null?void 0:o.call(e,t,e,s,a);if(c!==N_)return c}if(s&&!a){const c=h0(s,e);if(c!==void 0)return c}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=f0(t,t.typeName,e),i=typeof n=="function"?Re(n(),e):n;if(i&&p0(t,e,i),e.postProcess){const c=e.postProcess(i,t,e);return r.jsonSchema=i,c}return r.jsonSchema=i,i}const h0=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Sd(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`),ft(e)):e.$refStrategy==="seen"?ft(e):void 0}},p0=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),Nd=(t,e)=>{const a=j_(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:Re(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,l]},!0)??ft(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Re(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??ft(a),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),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 o=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"?o.$schema="http://json-schema.org/draft-07/schema#":(a.target==="jsonSchema2019-09"||a.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),a.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};class m0{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 I_(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ts.shape.method.value),this.server.assertCanSetRequestHandler(Cs.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ts,()=>({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}):g0,annotations:a.annotations};return a.outputSchema&&(s.outputSchema=Nd(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Cs,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new Ce(R.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new Ce(R.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 Ce(R.ErrorCode.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${n.error.message}`);const i=n.data,o=s.callback;try{r=await Promise.resolve(o(i,a))}catch(c){r={content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(i){r={content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}}if(s.outputSchema&&!r.isError){if(!r.structuredContent)throw new Ce(R.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 Ce(R.ErrorCode.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Is.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Is,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 Ce(R.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 Ce(R.ErrorCode.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return rn;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof ka))return rn;const i=await r._def.complete(e.params.argument.value,e.params.context);return jd(i)}async handleResourceCompletion(e,a){const s=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===a.uri);if(!s){if(this._registeredResources[a.uri])return rn;throw new Ce(R.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return rn;const n=await r(e.params.argument.value,e.params.context);return jd(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler($s.shape.method.value),this.server.assertCanSetRequestHandler(ws.shape.method.value),this.server.assertCanSetRequestHandler(bs.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler($s,async(e,a)=>{const s=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),r=[];for(const n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;const i=await n.resourceTemplate.listCallback(a);for(const o of i.resources)r.push({...n.metadata,...o})}return{resources:[...s,...r]}}),this.server.setRequestHandler(ws,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(bs,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Resource ${s} disabled`);return r.readCallback(s,a)}for(const n of Object.values(this._registeredResourceTemplates)){const i=n.resourceTemplate.uriTemplate.match(s.toString());if(i)return n.readCallback(s,i,a)}throw new Ce(R.ErrorCode.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ps.shape.method.value),this.server.assertCanSetRequestHandler(Es.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?_0(a.argsSchema):void 0}))})),this.server.setRequestHandler(Es,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new Ce(R.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new Ce(R.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${r.error.message}`);const n=r.data,i=s.callback;return await Promise.resolve(i(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 i=this._createRegisteredResource(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,void 0,a,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}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 i={name:e,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==s&&(delete this._registeredResources[s],o.uri&&(this._registeredResources[o.uri]=i)),typeof o.name<"u"&&(i.name=o.name),typeof o.title<"u"&&(i.title=o.title),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[s]=i,i}_createRegisteredResourceTemplate(e,a,s,r,n){const i={resourceTemplate:s,title:a,metadata:r,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.template<"u"&&(i.resourceTemplate=o.template),typeof o.metadata<"u"&&(i.metadata=o.metadata),typeof o.callback<"u"&&(i.readCallback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,a,s,r,n){const i={title:a,description:s,argsSchema:r===void 0?void 0:H(r),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=i)),typeof o.title<"u"&&(i.title=o.title),typeof o.description<"u"&&(i.description=o.description),typeof o.argsSchema<"u"&&(i.argsSchema=H(o.argsSchema)),typeof o.callback<"u"&&(i.callback=o.callback),typeof o.enabled<"u"&&(i.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,a,s,r,n,i,o){const c={title:a,description:s,inputSchema:r===void 0?void 0:H(r),outputSchema:n===void 0?void 0:H(n),annotations:i,callback:o,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredTools[e],l.name&&(this._registeredTools[l.name]=c)),typeof l.title<"u"&&(c.title=l.title),typeof l.description<"u"&&(c.description=l.description),typeof l.paramsSchema<"u"&&(c.inputSchema=H(l.paramsSchema)),typeof l.callback<"u"&&(c.callback=l.callback),typeof l.annotations<"u"&&(c.annotations=l.annotations),typeof l.enabled<"u"&&(c.enabled=l.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const c=a[0];Ad(c)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!Ad(a[0])&&(i=a.shift())):typeof c=="object"&&c!==null&&(i=a.shift())}const o=a[0];return this._createRegisteredTool(e,void 0,s,r,n,i,o)}registerTool(e,a,s){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:r,description:n,inputSchema:i,outputSchema:o,annotations:c}=a;return this._createRegisteredTool(e,r,n,i,o,c,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],i=this._createRegisteredPrompt(e,void 0,s,r,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,a,s){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:r,description:n,argsSchema:i}=a,o=this._createRegisteredPrompt(e,r,n,i,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class v0{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new Gt(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 g0={type:"object",properties:{}};function Ad(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(y0)}function y0(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function _0(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function jd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const rn={completion:{values:[],hasMore:!1}};R.Ajv=sv,R.AudioContentSchema=ks,R.BaseMetadataSchema=Zr,R.BlobResourceContentsSchema=Mi,R.BooleanSchemaSchema=ru,R.CallToolRequestSchema=Cs,R.CallToolResultSchema=Os,R.CancelledNotificationSchema=ms,R.Client=a_,R.ClientCapabilitiesSchema=Nc,R.ClientNotificationSchema=Lv,R.ClientRequestSchema=Mv,R.ClientResultSchema=Fv,R.CompatibilityCallToolResultSchema=Dv,R.Completable=ka,R.CompleteRequestSchema=Is,R.CompleteResultSchema=Gi,R.ContentBlockSchema=zi,R.CreateMessageRequestSchema=tu,R.CreateMessageResultSchema=Bi,R.CursorSchema=Ri,R.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=Nv,R.DEFAULT_REQUEST_TIMEOUT_MSEC=pu,R.ElicitRequestSchema=ou,R.ElicitResultSchema=Ji,R.EmbeddedResourceSchema=zc,R.EmptyResultSchema=or,R.EnumSchemaSchema=nu,R.GetPromptRequestSchema=Es,R.GetPromptResultSchema=Hi,R.ImageContentSchema=Rs,R.ImplementationSchema=Ni,R.InitializeRequestSchema=vs,R.InitializeResultSchema=Ai,R.InitializedNotificationSchema=gs,R.JSONRPCErrorSchema=Ii,R.JSONRPCMessageSchema=Ea,R.JSONRPCNotificationSchema=Oi,R.JSONRPCRequestSchema=ki,R.JSONRPCResponseSchema=Ci,R.JSONRPC_VERSION=wa,R.LATEST_PROTOCOL_VERSION=Er,R.ListPromptsRequestSchema=Ps,R.ListPromptsResultSchema=Vi,R.ListResourceTemplatesRequestSchema=ws,R.ListResourceTemplatesResultSchema=qi,R.ListResourcesRequestSchema=$s,R.ListResourcesResultSchema=Fi,R.ListRootsRequestSchema=uu,R.ListRootsResultSchema=Wi,R.ListToolsRequestSchema=Ts,R.ListToolsResultSchema=Zi,R.LoggingLevelSchema=Ki,R.LoggingMessageNotificationSchema=Wc,R.McpError=Ce,R.McpServer=m0,R.ModelHintSchema=Xc,R.ModelPreferencesSchema=Yc,R.NotificationSchema=St,R.NumberSchemaSchema=su,R.PaginatedRequestSchema=Sa,R.PaginatedResultSchema=Ra,R.PingRequestSchema=ys,R.PrimitiveSchemaDefinitionSchema=iu,R.ProgressNotificationSchema=_s,R.ProgressSchema=Dc,R.ProgressTokenSchema=Si,R.PromptArgumentSchema=Uc,R.PromptListChangedNotificationSchema=Kc,R.PromptMessageSchema=Zc,R.PromptReferenceSchema=lu,R.PromptSchema=Vc,R.Protocol=Yi,R.ReadResourceRequestSchema=bs,R.ReadResourceResultSchema=Ui,R.RequestIdSchema=Pa,R.RequestSchema=ot,R.ResourceContentsSchema=ji,R.ResourceLinkSchema=Hc,R.ResourceListChangedNotificationSchema=Mc,R.ResourceReferenceSchema=xv,R.ResourceSchema=Li,R.ResourceTemplate=v0,R.ResourceTemplateReferenceSchema=Qi,R.ResourceTemplateSchema=xc,R.ResourceUpdatedNotificationSchema=qc,R.ResultSchema=ht,R.RootSchema=cu,R.RootsListChangedNotificationSchema=du,R.SSEClientTransport=k_,R.SUPPORTED_PROTOCOL_VERSIONS=Ei,R.SamplingMessageSchema=eu,R.ServerCapabilitiesSchema=Ac,R.ServerNotificationSchema=Uv,R.ServerRequestSchema=qv,R.ServerResultSchema=Vv,R.SetLevelRequestSchema=Gc,R.SseError=bd,R.StreamableHTTPClientTransport=C_,R.StreamableHTTPError=en,R.StringSchemaSchema=au,R.SubscribeRequestSchema=Lc,R.TextContentSchema=Ss,R.TextResourceContentsSchema=Di,R.ToolAnnotationsSchema=Bc,R.ToolListChangedNotificationSchema=Qc,R.ToolSchema=Jc,R.UnauthorizedError=Rt,R.UnsubscribeRequestSchema=Fc,R.UriTemplate=Gt,R.auth=Rr,R.buildDiscoveryUrls=ud,R.completable=Hv,R.discoverAuthorizationServerMetadata=dd,R.discoverOAuthMetadata=P_,R.discoverOAuthProtectedResourceMetadata=od,R.exchangeAuthorization=hd,R.extractResourceMetadataUrl=Gs,R.getDisplayName=Kv,R.isInitializeRequest=jv,R.isInitializedNotification=jc,R.isJSONRPCError=Ic,R.isJSONRPCNotification=Cc,R.isJSONRPCRequest=Ti,R.isJSONRPCResponse=ps,R.mergeCapabilities=eo,R.parseErrorResponse=Qs,R.refreshAuthorization=pd,R.registerClient=md,R.selectResourceURL=id,R.startAuthorization=fd,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|