@opentiny/next-sdk 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebMcpClient.ts +9 -37
- package/agent/AgentModelProvider.ts +56 -43
- package/agent/type.ts +2 -2
- package/agent/utils/getAISDKTools.ts +2 -2
- package/dist/WebMcpClient.d.ts +1 -4
- package/dist/WebMcpClient.js +9 -33
- package/dist/agent/AgentModelProvider.d.ts +21 -16
- package/dist/agent/AgentModelProvider.js +72 -51
- package/dist/agent/type.d.ts +2 -2
- package/dist/agent/utils/getAISDKTools.d.ts +2 -2
- package/dist/agent/utils/getAISDKTools.js +2 -2
- package/dist/index.es.dev.js +56 -57
- package/dist/index.es.js +4076 -4070
- package/dist/index.umd.dev.js +56 -57
- package/dist/index.umd.js +27 -27
- package/dist/remoter/createRemoter.js +1 -1
- package/dist/webagent.dev.js +48 -28
- package/dist/webagent.es.dev.js +48 -28
- package/dist/webagent.es.js +1617 -1602
- package/dist/webagent.js +21 -21
- package/dist/webmcp-full.dev.js +930 -987
- package/dist/webmcp-full.es.dev.js +930 -987
- package/dist/webmcp-full.es.js +1388 -1397
- package/dist/webmcp-full.js +7 -7
- package/dist/webmcp.dev.js +8 -29
- package/dist/webmcp.es.dev.js +8 -29
- package/dist/webmcp.es.js +432 -441
- package/dist/webmcp.js +1 -1
- package/package.json +1 -1
- package/remoter/createRemoter.ts +1 -1
- package/runtime.html +21 -80
package/dist/webmcp-full.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(Oe,wa){typeof exports=="object"&&typeof module<"u"?wa(exports):typeof define=="function"&&define.amd?define(["exports"],wa):(Oe=typeof globalThis<"u"?globalThis:Oe||self,wa(Oe.WebMCP={}))})(this,function(Oe){"use strict";var wa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={exports:{}},cc={},kt={},Hr={},ba={},ge={},$a={};(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(w){if(super(),!t.IDENTIFIER.test(w))throw new Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends e{constructor(w){super(),this._items=typeof w=="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((P,S)=>`${P}${S}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((P,S)=>(S instanceof a&&(P[S.str]=(P[S.str]||0)+1),P),{})}}t._Code=s,t.nil=new s("");function r(g,...w){const P=[g[0]];let S=0;for(;S<w.length;)o(P,w[S]),P.push(g[++S]);return new s(P)}t._=r;const n=new s("+");function i(g,...w){const P=[f(g[0])];let S=0;for(;S<w.length;)P.push(n),o(P,w[S]),P.push(n,f(g[++S]));return l(P),new s(P)}t.str=i;function o(g,w){w instanceof s?g.push(...w._items):w instanceof a?g.push(w):g.push(d(w))}t.addCodeArg=o;function l(g){let w=1;for(;w<g.length-1;){if(g[w]===n){const P=c(g[w-1],g[w+1]);if(P!==void 0){g.splice(w-1,3,P);continue}g[w++]="+"}w++}}function c(g,w){if(w==='""')return g;if(g==='""')return w;if(typeof g=="string")return w instanceof a||g[g.length-1]!=='"'?void 0:typeof w!="string"?`${g.slice(0,-1)}${w}"`:w[0]==='"'?g.slice(0,-1)+w.slice(1):void 0;if(typeof w=="string"&&w[0]==='"'&&!(g instanceof a))return`"${g}${w.slice(1)}`}function u(g,w){return w.emptyStr()?g:g.emptyStr()?w:i`${g}${w}`}t.strConcat=u;function d(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:f(Array.isArray(g)?g.join(","):g)}function v(g){return new s(f(g))}t.stringify=v;function f(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function m(g){return typeof g=="string"&&t.IDENTIFIER.test(g)?new s(`.${g}`):r`[${g}]`}t.getProperty=m;function p(g){if(typeof g=="string"&&t.IDENTIFIER.test(g))return new s(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}t.getEsmExportName=p;function h(g){return new s(g.toString())}t.regexpCode=h})($a);var Tn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=$a;class a extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var s;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class r{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=r;class n extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends r{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const v=this.toName(c),{prefix:f}=v,m=(d=u.key)!==null&&d!==void 0?d:u.ref;let p=this._values[f];if(p){const w=p.get(m);if(w)return w}else p=this._values[f]=new Map;p.set(m,v);const h=this._scope[f]||(this._scope[f]=[]),g=h.length;return h[g]=u.ref,v.setValue(u,{property:f,itemIndex:g}),v}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,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._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,v=>{if(v.value===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return v.value.code},u,d)}_reduceValues(c,u,d={},v){let f=e.nil;for(const m in c){const p=c[m];if(!p)continue;const h=d[m]=d[m]||new Map;p.forEach(g=>{if(h.has(g))return;h.set(g,s.Started);let w=u(g);if(w){const P=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${P} ${g} = ${w};${this.opts._n}`}else if(w=v==null?void 0:v(g))f=(0,e._)`${f}${w}${this.opts._n}`;else throw new a(g);h.set(g,s.Completed)})}return f}}t.ValueScope=o})(Tn),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=$a,a=Tn;var s=$a;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=Tn;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(_,b){return this}}class i extends n{constructor(_,b,O){super(),this.varKind=_,this.name=b,this.rhs=O}render({es5:_,_n:b}){const O=_?a.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${K};`+b}optimizeNames(_,b){if(_[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,_,b)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(_,b,O){super(),this.lhs=_,this.rhs=b,this.sideEffects=O}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,b){if(!(this.lhs instanceof e.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,_,b),this}get names(){const _=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(_,this.rhs)}}class l extends o{constructor(_,b,O,K){super(_,O,K),this.op=b}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class c extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class u extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class d extends n{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class v extends n{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,b){return this.code=M(this.code,_,b),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends n{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((b,O)=>b+O.render(_),"")}optimizeNodes(){const{nodes:_}=this;let b=_.length;for(;b--;){const O=_[b].optimizeNodes();Array.isArray(O)?_.splice(b,1,...O):O?_[b]=O:_.splice(b,1)}return _.length>0?this:void 0}optimizeNames(_,b){const{nodes:O}=this;let K=O.length;for(;K--;){const Q=O[K];Q.optimizeNames(_,b)||(te(_,Q.names),O.splice(K,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((_,b)=>H(_,b.names),{})}}class m extends f{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class p extends f{}class h extends m{}h.kind="else";class g extends m{constructor(_,b){super(b),this.condition=_}render(_){let b=`if(${this.condition})`+super.render(_);return this.else&&(b+="else "+this.else.render(_)),b}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let b=this.else;if(b){const O=b.optimizeNodes();b=this.else=Array.isArray(O)?new h(O):O}if(b)return _===!1?b instanceof g?b:b.nodes:this.nodes.length?this:new g(ye(_),b instanceof g?[b]:b.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,b){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(_,b),!!(super.optimizeNames(_,b)||this.else))return this.condition=M(this.condition,_,b),this}get names(){const _=super.names;return F(_,this.condition),this.else&&H(_,this.else.names),_}}g.kind="if";class w extends m{}w.kind="for";class P extends w{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,b){if(super.optimizeNames(_,b))return this.iteration=M(this.iteration,_,b),this}get names(){return H(super.names,this.iteration.names)}}class S extends w{constructor(_,b,O,K){super(),this.varKind=_,this.name=b,this.from=O,this.to=K}render(_){const b=_.es5?a.varKinds.var:this.varKind,{name:O,from:K,to:Q}=this;return`for(${b} ${O}=${K}; ${O}<${Q}; ${O}++)`+super.render(_)}get names(){const _=F(super.names,this.from);return F(_,this.to)}}class x extends w{constructor(_,b,O,K){super(),this.loop=_,this.varKind=b,this.name=O,this.iterable=K}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,b){if(super.optimizeNames(_,b))return this.iterable=M(this.iterable,_,b),this}get names(){return H(super.names,this.iterable.names)}}class A extends m{constructor(_,b,O){super(),this.name=_,this.args=b,this.async=O}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}A.kind="func";class z extends f{render(_){return"return "+super.render(_)}}z.kind="return";class U extends m{render(_){let b="try"+super.render(_);return this.catch&&(b+=this.catch.render(_)),this.finally&&(b+=this.finally.render(_)),b}optimizeNodes(){var _,b;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(_,b){var O,K;return super.optimizeNames(_,b),(O=this.catch)===null||O===void 0||O.optimizeNames(_,b),(K=this.finally)===null||K===void 0||K.optimizeNames(_,b),this}get names(){const _=super.names;return this.catch&&H(_,this.catch.names),this.finally&&H(_,this.finally.names),_}}class D extends m{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}D.kind="catch";class W extends m{render(_){return"finally"+super.render(_)}}W.kind="finally";class J{constructor(_,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
|
|
2
|
-
`:""},this._extScope=_,this._scope=new a.Scope({parent:_}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,b){const O=this._extScope.value(_,b);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}getScopeValue(_,b){return this._extScope.getValue(_,b)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,b,O,K){const Q=this._scope.toName(b);return O!==void 0&&K&&(this._constants[Q.str]=O),this._leafNode(new i(_,Q,O)),Q}const(_,b,O){return this._def(a.varKinds.const,_,b,O)}let(_,b,O){return this._def(a.varKinds.let,_,b,O)}var(_,b,O){return this._def(a.varKinds.var,_,b,O)}assign(_,b,O){return this._leafNode(new o(_,b,O))}add(_,b){return this._leafNode(new l(_,t.operators.ADD,b))}code(_){return typeof _=="function"?_():_!==e.nil&&this._leafNode(new v(_)),this}object(..._){const b=["{"];for(const[O,K]of _)b.length>1&&b.push(","),b.push(O),(O!==K||this.opts.es5)&&(b.push(":"),(0,e.addCodeArg)(b,K));return b.push("}"),new e._Code(b)}if(_,b,O){if(this._blockNode(new g(_)),b&&O)this.code(b).else().code(O).endIf();else if(b)this.code(b).endIf();else if(O)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new g(_))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(g,h)}_for(_,b){return this._blockNode(_),b&&this.code(b).endFor(),this}for(_,b){return this._for(new P(_),b)}forRange(_,b,O,K,Q=this.opts.es5?a.varKinds.var:a.varKinds.let){const fe=this._scope.toName(_);return this._for(new S(Q,fe,b,O),()=>K(fe))}forOf(_,b,O,K=a.varKinds.const){const Q=this._scope.toName(_);if(this.opts.es5){const fe=b instanceof e.Name?b:this.var("_arr",b);return this.forRange("_i",0,(0,e._)`${fe}.length`,ne=>{this.var(Q,(0,e._)`${fe}[${ne}]`),O(Q)})}return this._for(new x("of",K,Q,b),()=>O(Q))}forIn(_,b,O,K=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,e._)`Object.keys(${b})`,O);const Q=this._scope.toName(_);return this._for(new x("in",K,Q,b),()=>O(Q))}endFor(){return this._endBlockNode(w)}label(_){return this._leafNode(new c(_))}break(_){return this._leafNode(new u(_))}return(_){const b=new z;if(this._blockNode(b),this.code(_),b.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(z)}try(_,b,O){if(!b&&!O)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new U;if(this._blockNode(K),this.code(_),b){const Q=this.name("e");this._currNode=K.catch=new D(Q),b(Q)}return O&&(this._currNode=K.finally=new W,this.code(O)),this._endBlockNode(D,W)}throw(_){return this._leafNode(new d(_))}block(_,b){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(b),this}endBlock(_){const b=this._blockStarts.pop();if(b===void 0)throw new Error("CodeGen: not in self-balancing block");const O=this._nodes.length-b;if(O<0||_!==void 0&&O!==_)throw new Error(`CodeGen: wrong number of nodes: ${O} vs ${_} expected`);return this._nodes.length=b,this}func(_,b=e.nil,O,K){return this._blockNode(new A(_,b,O)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(A)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,b){const O=this._currNode;if(O instanceof _||b&&O instanceof b)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${b?`${_.kind}/${b.kind}`:_.kind}"`)}_elseNode(_){const b=this._currNode;if(!(b instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=b.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const b=this._nodes;b[b.length-1]=_}}t.CodeGen=J;function H(T,_){for(const b in _)T[b]=(T[b]||0)+(_[b]||0);return T}function F(T,_){return _ instanceof e._CodeOrName?H(T,_.names):T}function M(T,_,b){if(T instanceof e.Name)return O(T);if(!K(T))return T;return new e._Code(T._items.reduce((Q,fe)=>(fe instanceof e.Name&&(fe=O(fe)),fe instanceof e._Code?Q.push(...fe._items):Q.push(fe),Q),[]));function O(Q){const fe=b[Q.str];return fe===void 0||_[Q.str]!==1?Q:(delete _[Q.str],fe)}function K(Q){return Q instanceof e._Code&&Q._items.some(fe=>fe instanceof e.Name&&_[fe.str]===1&&b[fe.str]!==void 0)}}function te(T,_){for(const b in _)T[b]=(T[b]||0)-(_[b]||0)}function ye(T){return typeof T=="boolean"||typeof T=="number"||T===null?!T:(0,e._)`!${j(T)}`}t.not=ye;const ve=R(t.operators.AND);function be(...T){return T.reduce(ve)}t.and=be;const de=R(t.operators.OR);function N(...T){return T.reduce(de)}t.or=N;function R(T){return(_,b)=>_===e.nil?b:b===e.nil?_:(0,e._)`${j(_)} ${T} ${j(b)}`}function j(T){return T instanceof e.Name?T:(0,e._)`(${T})`}}(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 ke=ge,tf=$a;function rf(t){const e={};for(const a of t)e[a]=!0;return e}G.toHash=rf;function af(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(lc(t,e),!uc(e,t.self.RULES.all))}G.alwaysValidSchema=af;function lc(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]||mc(t,`unknown keyword: "${n}"`)}G.checkUnknownRules=lc;function uc(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}G.schemaHasRules=uc;function sf(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=sf;function nf({topSchemaRef:t,schemaPath:e},a,s,r){if(!r){if(typeof a=="number"||typeof a=="boolean")return a;if(typeof a=="string")return(0,ke._)`${a}`}return(0,ke._)`${t}${e}${(0,ke.getProperty)(s)}`}G.schemaRefOrVal=nf;function of(t){return dc(decodeURIComponent(t))}G.unescapeFragment=of;function cf(t){return encodeURIComponent(In(t))}G.escapeFragment=cf;function In(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=In;function dc(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=dc;function lf(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}G.eachItem=lf;function fc({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,i,o)=>{const l=i===void 0?n:i instanceof ke.Name?(n instanceof ke.Name?t(r,n,i):e(r,n,i),i):n instanceof ke.Name?(e(r,i,n),n):a(n,i);return o===ke.Name&&!(l instanceof ke.Name)?s(r,l):l}}G.mergeEvaluated={props:fc({mergeNames:(t,e,a)=>t.if((0,ke._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,ke._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,ke._)`${a} || {}`).code((0,ke._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,ke._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,ke._)`${a} || {}`),Cn(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:hc}),items:fc({mergeNames:(t,e,a)=>t.if((0,ke._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,ke._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,ke._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,ke._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function hc(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,ke._)`{}`);return e!==void 0&&Cn(t,a,e),a}G.evaluatedPropsToName=hc;function Cn(t,e,a){Object.keys(a).forEach(s=>t.assign((0,ke._)`${e}${(0,ke.getProperty)(s)}`,!0))}G.setEvaluated=Cn;const pc={};function uf(t,e){return t.scopeValue("func",{ref:e,code:pc[e.code]||(pc[e.code]=new tf._Code(e.code))})}G.useFunc=uf;var On;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(On||(G.Type=On={}));function df(t,e,a){if(t instanceof ke.Name){const s=e===On.Num;return a?s?(0,ke._)`"[" + ${t} + "]"`:(0,ke._)`"['" + ${t} + "']"`:s?(0,ke._)`"/" + ${t}`:(0,ke._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,ke.getProperty)(t).toString():"/"+In(t)}G.getErrorPath=df;function mc(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=mc;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});const nt=ge,ff={data:new nt.Name("data"),valCxt:new nt.Name("valCxt"),instancePath:new nt.Name("instancePath"),parentData:new nt.Name("parentData"),parentDataProperty:new nt.Name("parentDataProperty"),rootData:new nt.Name("rootData"),dynamicAnchors:new nt.Name("dynamicAnchors"),vErrors:new nt.Name("vErrors"),errors:new nt.Name("errors"),this:new nt.Name("this"),self:new nt.Name("self"),scope:new nt.Name("scope"),json:new nt.Name("json"),jsonPos:new nt.Name("jsonPos"),jsonLen:new nt.Name("jsonLen"),jsonPart:new nt.Name("jsonPart")};Ft.default=ff,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=Ft;t.keywordError={message:({keyword:h})=>(0,e.str)`must pass "${h}" keyword validation`},t.keyword$DataError={message:({keyword:h,schemaType:g})=>g?(0,e.str)`"${h}" keyword must be ${g} ($data)`:(0,e.str)`"${h}" keyword is invalid ($data)`};function r(h,g=t.keywordError,w,P){const{it:S}=h,{gen:x,compositeRule:A,allErrors:z}=S,U=d(h,g,w);P??(A||z)?l(x,U):c(S,(0,e._)`[${U}]`)}t.reportError=r;function n(h,g=t.keywordError,w){const{it:P}=h,{gen:S,compositeRule:x,allErrors:A}=P,z=d(h,g,w);l(S,z),x||A||c(P,s.default.vErrors)}t.reportExtraError=n;function i(h,g){h.assign(s.default.errors,g),h.if((0,e._)`${s.default.vErrors} !== null`,()=>h.if(g,()=>h.assign((0,e._)`${s.default.vErrors}.length`,g),()=>h.assign(s.default.vErrors,null)))}t.resetErrorsCount=i;function o({gen:h,keyword:g,schemaValue:w,data:P,errsCount:S,it:x}){if(S===void 0)throw new Error("ajv implementation error");const A=h.name("err");h.forRange("i",S,s.default.errors,z=>{h.const(A,(0,e._)`${s.default.vErrors}[${z}]`),h.if((0,e._)`${A}.instancePath === undefined`,()=>h.assign((0,e._)`${A}.instancePath`,(0,e.strConcat)(s.default.instancePath,x.errorPath))),h.assign((0,e._)`${A}.schemaPath`,(0,e.str)`${x.errSchemaPath}/${g}`),x.opts.verbose&&(h.assign((0,e._)`${A}.schema`,w),h.assign((0,e._)`${A}.data`,P))})}t.extendErrors=o;function l(h,g){const w=h.const("err",g);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${w}]`),(0,e._)`${s.default.vErrors}.push(${w})`),h.code((0,e._)`${s.default.errors}++`)}function c(h,g){const{gen:w,validateName:P,schemaEnv:S}=h;S.$async?w.throw((0,e._)`new ${h.ValidationError}(${g})`):(w.assign((0,e._)`${P}.errors`,g),w.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,g,w){const{createErrors:P}=h.it;return P===!1?(0,e._)`{}`:v(h,g,w)}function v(h,g,w={}){const{gen:P,it:S}=h,x=[f(S,w),m(h,w)];return p(h,g,x),P.object(...x)}function f({errorPath:h},{instancePath:g}){const w=g?(0,e.str)`${h}${(0,a.getErrorPath)(g,a.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,w)]}function m({keyword:h,it:{errSchemaPath:g}},{schemaPath:w,parentSchema:P}){let S=P?g:(0,e.str)`${g}/${h}`;return w&&(S=(0,e.str)`${S}${(0,a.getErrorPath)(w,a.Type.Str)}`),[u.schemaPath,S]}function p(h,{params:g,message:w},P){const{keyword:S,data:x,schemaValue:A,it:z}=h,{opts:U,propertyName:D,topSchemaRef:W,schemaPath:J}=z;P.push([u.keyword,S],[u.params,typeof g=="function"?g(h):g||(0,e._)`{}`]),U.messages&&P.push([u.message,typeof w=="function"?w(h):w]),U.verbose&&P.push([u.schema,A],[u.parentSchema,(0,e._)`${W}${J}`],[s.default.data,x]),D&&P.push([u.propertyName,D])}}(ba),Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.boolOrEmptySchema=Hr.topBoolOrEmptySchema=void 0;const hf=ba,pf=ge,mf=Ft,vf={message:"boolean schema is false"};function gf(t){const{gen:e,schema:a,validateName:s}=t;a===!1?vc(t,!1):typeof a=="object"&&a.$async===!0?e.return(mf.default.data):(e.assign((0,pf._)`${s}.errors`,null),e.return(!0))}Hr.topBoolOrEmptySchema=gf;function _f(t,e){const{gen:a,schema:s}=t;s===!1?(a.var(e,!1),vc(t)):a.var(e,!0)}Hr.boolOrEmptySchema=_f;function vc(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,hf.reportError)(r,vf,void 0,e)}var Xe={},xr={};Object.defineProperty(xr,"__esModule",{value:!0}),xr.getRules=xr.isJSONType=void 0;const yf=["string","number","integer","boolean","null","object","array"],wf=new Set(yf);function bf(t){return typeof t=="string"&&wf.has(t)}xr.isJSONType=bf;function $f(){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:{}}}xr.getRules=$f;var tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.shouldUseRule=tr.shouldUseGroup=tr.schemaHasRulesForType=void 0;function Pf({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&gc(t,s)}tr.schemaHasRulesForType=Pf;function gc(t,e){return e.rules.some(a=>_c(t,a))}tr.shouldUseGroup=gc;function _c(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))}tr.shouldUseRule=_c,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.reportTypeError=Xe.checkDataTypes=Xe.checkDataType=Xe.coerceAndCheckDataType=Xe.getJSONTypes=Xe.getSchemaTypes=Xe.DataType=void 0;const Ef=xr,Sf=tr,Rf=ba,pe=ge,yc=G;var Zr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Zr||(Xe.DataType=Zr={}));function kf(t){const e=wc(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}Xe.getSchemaTypes=kf;function wc(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Ef.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Xe.getJSONTypes=wc;function xf(t,e){const{gen:a,data:s,opts:r}=t,n=Tf(e,r.coerceTypes),i=e.length>0&&!(n.length===0&&e.length===1&&(0,Sf.schemaHasRulesForType)(t,e[0]));if(i){const o=An(e,s,r.strictNumbers,Zr.Wrong);a.if(o,()=>{n.length?If(t,e,n):jn(t)})}return i}Xe.coerceAndCheckDataType=xf;const bc=new Set(["string","number","integer","boolean","null"]);function Tf(t,e){return e?t.filter(a=>bc.has(a)||e==="array"&&a==="array"):[]}function If(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(An(e,r,n.strictNumbers),()=>s.assign(o,r))),s.if((0,pe._)`${o} !== undefined`);for(const c of a)(bc.has(c)||c==="array"&&n.coerceTypes==="array")&&l(c);s.else(),jn(t),s.endIf(),s.if((0,pe._)`${o} !== undefined`,()=>{s.assign(r,o),Cf(t,o)});function l(c){switch(c){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
|
|
1
|
+
(function(Oe,ya){typeof exports=="object"&&typeof module<"u"?ya(exports):typeof define=="function"&&define.amd?define(["exports"],ya):(Oe=typeof globalThis<"u"?globalThis:Oe||self,ya(Oe.WebMCP={}))})(this,function(Oe){"use strict";var ya=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kn={exports:{}},cc={},kt={},Hr={},ba={},ge={},wa={};(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(b){if(super(),!t.IDENTIFIER.test(b))throw new Error("CodeGen: name must be a valid identifier");this.str=b}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends e{constructor(b){super(),this._items=typeof b=="string"?[b]:b}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const b=this._items[0];return b===""||b==='""'}get str(){var b;return(b=this._str)!==null&&b!==void 0?b:this._str=this._items.reduce((P,S)=>`${P}${S}`,"")}get names(){var b;return(b=this._names)!==null&&b!==void 0?b:this._names=this._items.reduce((P,S)=>(S instanceof a&&(P[S.str]=(P[S.str]||0)+1),P),{})}}t._Code=s,t.nil=new s("");function r(v,...b){const P=[v[0]];let S=0;for(;S<b.length;)o(P,b[S]),P.push(v[++S]);return new s(P)}t._=r;const n=new s("+");function i(v,...b){const P=[f(v[0])];let S=0;for(;S<b.length;)P.push(n),o(P,b[S]),P.push(n,f(v[++S]));return l(P),new s(P)}t.str=i;function o(v,b){b instanceof s?v.push(...b._items):b instanceof a?v.push(b):v.push(d(b))}t.addCodeArg=o;function l(v){let b=1;for(;b<v.length-1;){if(v[b]===n){const P=c(v[b-1],v[b+1]);if(P!==void 0){v.splice(b-1,3,P);continue}v[b++]="+"}b++}}function c(v,b){if(b==='""')return v;if(v==='""')return b;if(typeof v=="string")return b instanceof a||v[v.length-1]!=='"'?void 0:typeof b!="string"?`${v.slice(0,-1)}${b}"`:b[0]==='"'?v.slice(0,-1)+b.slice(1):void 0;if(typeof b=="string"&&b[0]==='"'&&!(v instanceof a))return`"${v}${b.slice(1)}`}function u(v,b){return b.emptyStr()?v:v.emptyStr()?b:i`${v}${b}`}t.strConcat=u;function d(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:f(Array.isArray(v)?v.join(","):v)}function g(v){return new s(f(v))}t.stringify=g;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})(wa);var xn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=wa;class a extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var s;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class r{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=r;class n extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends r{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(c),{prefix:f}=g,m=(d=u.key)!==null&&d!==void 0?d:u.ref;let p=this._values[f];if(p){const b=p.get(m);if(b)return b}else p=this._values[f]=new Map;p.set(m,g);const h=this._scope[f]||(this._scope[f]=[]),v=h.length;return h[v]=u.ref,g.setValue(u,{property:f,itemIndex:v}),g}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,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._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},u,d)}_reduceValues(c,u,d={},g){let f=e.nil;for(const m in c){const p=c[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 b=u(v);if(b){const P=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${P} ${v} = ${b};${this.opts._n}`}else if(b=g==null?void 0:g(v))f=(0,e._)`${f}${b}${this.opts._n}`;else throw new a(v);h.set(v,s.Completed)})}return f}}t.ValueScope=o})(xn),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=wa,a=xn;var s=wa;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=xn;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(_,w){return this}}class i extends n{constructor(_,w,O){super(),this.varKind=_,this.name=w,this.rhs=O}render({es5:_,_n:w}){const O=_?a.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${O} ${this.name}${K};`+w}optimizeNames(_,w){if(_[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,_,w)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(_,w,O){super(),this.lhs=_,this.rhs=w,this.sideEffects=O}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,w){if(!(this.lhs instanceof e.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,_,w),this}get names(){const _=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(_,this.rhs)}}class l extends o{constructor(_,w,O,K){super(_,O,K),this.op=w}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class c extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class u extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class d extends n{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class g extends n{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,w){return this.code=M(this.code,_,w),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends n{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((w,O)=>w+O.render(_),"")}optimizeNodes(){const{nodes:_}=this;let w=_.length;for(;w--;){const O=_[w].optimizeNodes();Array.isArray(O)?_.splice(w,1,...O):O?_[w]=O:_.splice(w,1)}return _.length>0?this:void 0}optimizeNames(_,w){const{nodes:O}=this;let K=O.length;for(;K--;){const Q=O[K];Q.optimizeNames(_,w)||(te(_,Q.names),O.splice(K,1))}return O.length>0?this:void 0}get names(){return this.nodes.reduce((_,w)=>H(_,w.names),{})}}class m extends f{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class p extends f{}class h extends m{}h.kind="else";class v extends m{constructor(_,w){super(w),this.condition=_}render(_){let w=`if(${this.condition})`+super.render(_);return this.else&&(w+="else "+this.else.render(_)),w}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let w=this.else;if(w){const O=w.optimizeNodes();w=this.else=Array.isArray(O)?new h(O):O}if(w)return _===!1?w instanceof v?w:w.nodes:this.nodes.length?this:new v(ye(_),w instanceof v?[w]:w.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,w){var O;if(this.else=(O=this.else)===null||O===void 0?void 0:O.optimizeNames(_,w),!!(super.optimizeNames(_,w)||this.else))return this.condition=M(this.condition,_,w),this}get names(){const _=super.names;return F(_,this.condition),this.else&&H(_,this.else.names),_}}v.kind="if";class b extends m{}b.kind="for";class P extends b{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,w){if(super.optimizeNames(_,w))return this.iteration=M(this.iteration,_,w),this}get names(){return H(super.names,this.iteration.names)}}class S extends b{constructor(_,w,O,K){super(),this.varKind=_,this.name=w,this.from=O,this.to=K}render(_){const w=_.es5?a.varKinds.var:this.varKind,{name:O,from:K,to:Q}=this;return`for(${w} ${O}=${K}; ${O}<${Q}; ${O}++)`+super.render(_)}get names(){const _=F(super.names,this.from);return F(_,this.to)}}class x extends b{constructor(_,w,O,K){super(),this.loop=_,this.varKind=w,this.name=O,this.iterable=K}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,w){if(super.optimizeNames(_,w))return this.iterable=M(this.iterable,_,w),this}get names(){return H(super.names,this.iterable.names)}}class A extends m{constructor(_,w,O){super(),this.name=_,this.args=w,this.async=O}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}A.kind="func";class z extends f{render(_){return"return "+super.render(_)}}z.kind="return";class U extends m{render(_){let w="try"+super.render(_);return this.catch&&(w+=this.catch.render(_)),this.finally&&(w+=this.finally.render(_)),w}optimizeNodes(){var _,w;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(w=this.finally)===null||w===void 0||w.optimizeNodes(),this}optimizeNames(_,w){var O,K;return super.optimizeNames(_,w),(O=this.catch)===null||O===void 0||O.optimizeNames(_,w),(K=this.finally)===null||K===void 0||K.optimizeNames(_,w),this}get names(){const _=super.names;return this.catch&&H(_,this.catch.names),this.finally&&H(_,this.finally.names),_}}class D extends m{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}D.kind="catch";class W extends m{render(_){return"finally"+super.render(_)}}W.kind="finally";class J{constructor(_,w={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...w,_n:w.lines?`
|
|
2
|
+
`:""},this._extScope=_,this._scope=new a.Scope({parent:_}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,w){const O=this._extScope.value(_,w);return(this._values[O.prefix]||(this._values[O.prefix]=new Set)).add(O),O}getScopeValue(_,w){return this._extScope.getValue(_,w)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,w,O,K){const Q=this._scope.toName(w);return O!==void 0&&K&&(this._constants[Q.str]=O),this._leafNode(new i(_,Q,O)),Q}const(_,w,O){return this._def(a.varKinds.const,_,w,O)}let(_,w,O){return this._def(a.varKinds.let,_,w,O)}var(_,w,O){return this._def(a.varKinds.var,_,w,O)}assign(_,w,O){return this._leafNode(new o(_,w,O))}add(_,w){return this._leafNode(new l(_,t.operators.ADD,w))}code(_){return typeof _=="function"?_():_!==e.nil&&this._leafNode(new g(_)),this}object(..._){const w=["{"];for(const[O,K]of _)w.length>1&&w.push(","),w.push(O),(O!==K||this.opts.es5)&&(w.push(":"),(0,e.addCodeArg)(w,K));return w.push("}"),new e._Code(w)}if(_,w,O){if(this._blockNode(new v(_)),w&&O)this.code(w).else().code(O).endIf();else if(w)this.code(w).endIf();else if(O)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new v(_))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(v,h)}_for(_,w){return this._blockNode(_),w&&this.code(w).endFor(),this}for(_,w){return this._for(new P(_),w)}forRange(_,w,O,K,Q=this.opts.es5?a.varKinds.var:a.varKinds.let){const fe=this._scope.toName(_);return this._for(new S(Q,fe,w,O),()=>K(fe))}forOf(_,w,O,K=a.varKinds.const){const Q=this._scope.toName(_);if(this.opts.es5){const fe=w instanceof e.Name?w:this.var("_arr",w);return this.forRange("_i",0,(0,e._)`${fe}.length`,ne=>{this.var(Q,(0,e._)`${fe}[${ne}]`),O(Q)})}return this._for(new x("of",K,Q,w),()=>O(Q))}forIn(_,w,O,K=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,e._)`Object.keys(${w})`,O);const Q=this._scope.toName(_);return this._for(new x("in",K,Q,w),()=>O(Q))}endFor(){return this._endBlockNode(b)}label(_){return this._leafNode(new c(_))}break(_){return this._leafNode(new u(_))}return(_){const w=new z;if(this._blockNode(w),this.code(_),w.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(z)}try(_,w,O){if(!w&&!O)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new U;if(this._blockNode(K),this.code(_),w){const Q=this.name("e");this._currNode=K.catch=new D(Q),w(Q)}return O&&(this._currNode=K.finally=new W,this.code(O)),this._endBlockNode(D,W)}throw(_){return this._leafNode(new d(_))}block(_,w){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(w),this}endBlock(_){const w=this._blockStarts.pop();if(w===void 0)throw new Error("CodeGen: not in self-balancing block");const O=this._nodes.length-w;if(O<0||_!==void 0&&O!==_)throw new Error(`CodeGen: wrong number of nodes: ${O} vs ${_} expected`);return this._nodes.length=w,this}func(_,w=e.nil,O,K){return this._blockNode(new A(_,w,O)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(A)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,w){const O=this._currNode;if(O instanceof _||w&&O instanceof w)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${w?`${_.kind}/${w.kind}`:_.kind}"`)}_elseNode(_){const w=this._currNode;if(!(w instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=w.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const w=this._nodes;w[w.length-1]=_}}t.CodeGen=J;function H(T,_){for(const w in _)T[w]=(T[w]||0)+(_[w]||0);return T}function F(T,_){return _ instanceof e._CodeOrName?H(T,_.names):T}function M(T,_,w){if(T instanceof e.Name)return O(T);if(!K(T))return T;return new e._Code(T._items.reduce((Q,fe)=>(fe instanceof e.Name&&(fe=O(fe)),fe instanceof e._Code?Q.push(...fe._items):Q.push(fe),Q),[]));function O(Q){const fe=w[Q.str];return fe===void 0||_[Q.str]!==1?Q:(delete _[Q.str],fe)}function K(Q){return Q instanceof e._Code&&Q._items.some(fe=>fe instanceof e.Name&&_[fe.str]===1&&w[fe.str]!==void 0)}}function te(T,_){for(const w in _)T[w]=(T[w]||0)-(_[w]||0)}function ye(T){return typeof T=="boolean"||typeof T=="number"||T===null?!T:(0,e._)`!${j(T)}`}t.not=ye;const ve=R(t.operators.AND);function we(...T){return T.reduce(ve)}t.and=we;const de=R(t.operators.OR);function N(...T){return T.reduce(de)}t.or=N;function R(T){return(_,w)=>_===e.nil?w:w===e.nil?_:(0,e._)`${j(_)} ${T} ${j(w)}`}function j(T){return T instanceof e.Name?T:(0,e._)`(${T})`}}(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 ke=ge,tf=wa;function rf(t){const e={};for(const a of t)e[a]=!0;return e}G.toHash=rf;function af(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(lc(t,e),!uc(e,t.self.RULES.all))}G.alwaysValidSchema=af;function lc(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]||mc(t,`unknown keyword: "${n}"`)}G.checkUnknownRules=lc;function uc(t,e){if(typeof t=="boolean")return!t;for(const a in t)if(e[a])return!0;return!1}G.schemaHasRules=uc;function sf(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=sf;function nf({topSchemaRef:t,schemaPath:e},a,s,r){if(!r){if(typeof a=="number"||typeof a=="boolean")return a;if(typeof a=="string")return(0,ke._)`${a}`}return(0,ke._)`${t}${e}${(0,ke.getProperty)(s)}`}G.schemaRefOrVal=nf;function of(t){return dc(decodeURIComponent(t))}G.unescapeFragment=of;function cf(t){return encodeURIComponent(Tn(t))}G.escapeFragment=cf;function Tn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=Tn;function dc(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=dc;function lf(t,e){if(Array.isArray(t))for(const a of t)e(a);else e(t)}G.eachItem=lf;function fc({mergeNames:t,mergeToName:e,mergeValues:a,resultToName:s}){return(r,n,i,o)=>{const l=i===void 0?n:i instanceof ke.Name?(n instanceof ke.Name?t(r,n,i):e(r,n,i),i):n instanceof ke.Name?(e(r,i,n),n):a(n,i);return o===ke.Name&&!(l instanceof ke.Name)?s(r,l):l}}G.mergeEvaluated={props:fc({mergeNames:(t,e,a)=>t.if((0,ke._)`${a} !== true && ${e} !== undefined`,()=>{t.if((0,ke._)`${e} === true`,()=>t.assign(a,!0),()=>t.assign(a,(0,ke._)`${a} || {}`).code((0,ke._)`Object.assign(${a}, ${e})`))}),mergeToName:(t,e,a)=>t.if((0,ke._)`${a} !== true`,()=>{e===!0?t.assign(a,!0):(t.assign(a,(0,ke._)`${a} || {}`),In(t,a,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:hc}),items:fc({mergeNames:(t,e,a)=>t.if((0,ke._)`${a} !== true && ${e} !== undefined`,()=>t.assign(a,(0,ke._)`${e} === true ? true : ${a} > ${e} ? ${a} : ${e}`)),mergeToName:(t,e,a)=>t.if((0,ke._)`${a} !== true`,()=>t.assign(a,e===!0?!0:(0,ke._)`${a} > ${e} ? ${a} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function hc(t,e){if(e===!0)return t.var("props",!0);const a=t.var("props",(0,ke._)`{}`);return e!==void 0&&In(t,a,e),a}G.evaluatedPropsToName=hc;function In(t,e,a){Object.keys(a).forEach(s=>t.assign((0,ke._)`${e}${(0,ke.getProperty)(s)}`,!0))}G.setEvaluated=In;const pc={};function uf(t,e){return t.scopeValue("func",{ref:e,code:pc[e.code]||(pc[e.code]=new tf._Code(e.code))})}G.useFunc=uf;var Cn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Cn||(G.Type=Cn={}));function df(t,e,a){if(t instanceof ke.Name){const s=e===Cn.Num;return a?s?(0,ke._)`"[" + ${t} + "]"`:(0,ke._)`"['" + ${t} + "']"`:s?(0,ke._)`"/" + ${t}`:(0,ke._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,ke.getProperty)(t).toString():"/"+Tn(t)}G.getErrorPath=df;function mc(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=mc;var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});const nt=ge,ff={data:new nt.Name("data"),valCxt:new nt.Name("valCxt"),instancePath:new nt.Name("instancePath"),parentData:new nt.Name("parentData"),parentDataProperty:new nt.Name("parentDataProperty"),rootData:new nt.Name("rootData"),dynamicAnchors:new nt.Name("dynamicAnchors"),vErrors:new nt.Name("vErrors"),errors:new nt.Name("errors"),this:new nt.Name("this"),self:new nt.Name("self"),scope:new nt.Name("scope"),json:new nt.Name("json"),jsonPos:new nt.Name("jsonPos"),jsonLen:new nt.Name("jsonLen"),jsonPart:new nt.Name("jsonPart")};Ft.default=ff,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=Ft;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,b,P){const{it:S}=h,{gen:x,compositeRule:A,allErrors:z}=S,U=d(h,v,b);P??(A||z)?l(x,U):c(S,(0,e._)`[${U}]`)}t.reportError=r;function n(h,v=t.keywordError,b){const{it:P}=h,{gen:S,compositeRule:x,allErrors:A}=P,z=d(h,v,b);l(S,z),x||A||c(P,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:b,data:P,errsCount:S,it:x}){if(S===void 0)throw new Error("ajv implementation error");const A=h.name("err");h.forRange("i",S,s.default.errors,z=>{h.const(A,(0,e._)`${s.default.vErrors}[${z}]`),h.if((0,e._)`${A}.instancePath === undefined`,()=>h.assign((0,e._)`${A}.instancePath`,(0,e.strConcat)(s.default.instancePath,x.errorPath))),h.assign((0,e._)`${A}.schemaPath`,(0,e.str)`${x.errSchemaPath}/${v}`),x.opts.verbose&&(h.assign((0,e._)`${A}.schema`,b),h.assign((0,e._)`${A}.data`,P))})}t.extendErrors=o;function l(h,v){const b=h.const("err",v);h.if((0,e._)`${s.default.vErrors} === null`,()=>h.assign(s.default.vErrors,(0,e._)`[${b}]`),(0,e._)`${s.default.vErrors}.push(${b})`),h.code((0,e._)`${s.default.errors}++`)}function c(h,v){const{gen:b,validateName:P,schemaEnv:S}=h;S.$async?b.throw((0,e._)`new ${h.ValidationError}(${v})`):(b.assign((0,e._)`${P}.errors`,v),b.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,b){const{createErrors:P}=h.it;return P===!1?(0,e._)`{}`:g(h,v,b)}function g(h,v,b={}){const{gen:P,it:S}=h,x=[f(S,b),m(h,b)];return p(h,v,x),P.object(...x)}function f({errorPath:h},{instancePath:v}){const b=v?(0,e.str)`${h}${(0,a.getErrorPath)(v,a.Type.Str)}`:h;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,b)]}function m({keyword:h,it:{errSchemaPath:v}},{schemaPath:b,parentSchema:P}){let S=P?v:(0,e.str)`${v}/${h}`;return b&&(S=(0,e.str)`${S}${(0,a.getErrorPath)(b,a.Type.Str)}`),[u.schemaPath,S]}function p(h,{params:v,message:b},P){const{keyword:S,data:x,schemaValue:A,it:z}=h,{opts:U,propertyName:D,topSchemaRef:W,schemaPath:J}=z;P.push([u.keyword,S],[u.params,typeof v=="function"?v(h):v||(0,e._)`{}`]),U.messages&&P.push([u.message,typeof b=="function"?b(h):b]),U.verbose&&P.push([u.schema,A],[u.parentSchema,(0,e._)`${W}${J}`],[s.default.data,x]),D&&P.push([u.propertyName,D])}}(ba),Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.boolOrEmptySchema=Hr.topBoolOrEmptySchema=void 0;const hf=ba,pf=ge,mf=Ft,vf={message:"boolean schema is false"};function gf(t){const{gen:e,schema:a,validateName:s}=t;a===!1?vc(t,!1):typeof a=="object"&&a.$async===!0?e.return(mf.default.data):(e.assign((0,pf._)`${s}.errors`,null),e.return(!0))}Hr.topBoolOrEmptySchema=gf;function _f(t,e){const{gen:a,schema:s}=t;s===!1?(a.var(e,!1),vc(t)):a.var(e,!0)}Hr.boolOrEmptySchema=_f;function vc(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,hf.reportError)(r,vf,void 0,e)}var Xe={},xr={};Object.defineProperty(xr,"__esModule",{value:!0}),xr.getRules=xr.isJSONType=void 0;const yf=["string","number","integer","boolean","null","object","array"],bf=new Set(yf);function wf(t){return typeof t=="string"&&bf.has(t)}xr.isJSONType=wf;function $f(){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:{}}}xr.getRules=$f;var tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.shouldUseRule=tr.shouldUseGroup=tr.schemaHasRulesForType=void 0;function Pf({schema:t,self:e},a){const s=e.RULES.types[a];return s&&s!==!0&&gc(t,s)}tr.schemaHasRulesForType=Pf;function gc(t,e){return e.rules.some(a=>_c(t,a))}tr.shouldUseGroup=gc;function _c(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))}tr.shouldUseRule=_c,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.reportTypeError=Xe.checkDataTypes=Xe.checkDataType=Xe.coerceAndCheckDataType=Xe.getJSONTypes=Xe.getSchemaTypes=Xe.DataType=void 0;const Ef=xr,Sf=tr,Rf=ba,pe=ge,yc=G;var Zr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Zr||(Xe.DataType=Zr={}));function kf(t){const e=bc(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}Xe.getSchemaTypes=kf;function bc(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Ef.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Xe.getJSONTypes=bc;function xf(t,e){const{gen:a,data:s,opts:r}=t,n=Tf(e,r.coerceTypes),i=e.length>0&&!(n.length===0&&e.length===1&&(0,Sf.schemaHasRulesForType)(t,e[0]));if(i){const o=Nn(e,s,r.strictNumbers,Zr.Wrong);a.if(o,()=>{n.length?If(t,e,n):An(t)})}return i}Xe.coerceAndCheckDataType=xf;const wc=new Set(["string","number","integer","boolean","null"]);function Tf(t,e){return e?t.filter(a=>wc.has(a)||e==="array"&&a==="array"):[]}function If(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(Nn(e,r,n.strictNumbers),()=>s.assign(o,r))),s.if((0,pe._)`${o} !== undefined`);for(const c of a)(wc.has(c)||c==="array"&&n.coerceTypes==="array")&&l(c);s.else(),An(t),s.endIf(),s.if((0,pe._)`${o} !== undefined`,()=>{s.assign(r,o),Cf(t,o)});function l(c){switch(c){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
3
|
|| (${i} == "string" && ${r} && ${r} == +${r})`).assign(o,(0,pe._)`+${r}`);return;case"integer":s.elseIf((0,pe._)`${i} === "boolean" || ${r} === null
|
|
4
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 Cf({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,pe._)`${e} !== undefined`,()=>t.assign((0,pe._)`${e}[${a}]`,s))}function Nn(t,e,a,s=Zr.Correct){const r=s===Zr.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===Zr.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)}}Xe.checkDataType=Nn;function An(t,e,a,s){if(t.length===1)return Nn(t[0],e,a,s);let r;const n=(0,yc.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,Nn(i,e,a,s));return r}Xe.checkDataTypes=An;const Of={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,pe._)`{type: ${t}}`:(0,pe._)`{type: ${e}}`};function jn(t){const e=Nf(t);(0,Rf.reportError)(e,Of)}Xe.reportTypeError=jn;function Nf(t){const{gen:e,data:a,schema:s}=t,r=(0,yc.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var us={};Object.defineProperty(us,"__esModule",{value:!0}),us.assignDefaults=void 0;const Kr=ge,Af=G;function jf(t,e){const{properties:a,items:s}=t.schema;if(e==="object"&&a)for(const r in a)$c(t,r,a[r].default);else e==="array"&&Array.isArray(s)&&s.forEach((r,n)=>$c(t,n,r.default))}us.assignDefaults=jf;function $c(t,e,a){const{gen:s,compositeRule:r,data:n,opts:i}=t;if(a===void 0)return;const o=(0,Kr._)`${n}${(0,Kr.getProperty)(e)}`;if(r){(0,Af.checkStrictMode)(t,`default is ignored for: ${o}`);return}let l=(0,Kr._)`${o} === undefined`;i.useDefaults==="empty"&&(l=(0,Kr._)`${l} || ${o} === null || ${o} === ""`),s.if(l,(0,Kr._)`${o} = ${(0,Kr.stringify)(a)}`)}var qt={},_e={};Object.defineProperty(_e,"__esModule",{value:!0}),_e.validateUnion=_e.validateArray=_e.usePattern=_e.callValidateCode=_e.schemaProperties=_e.allSchemaProperties=_e.noPropertyInData=_e.propertyInData=_e.isOwnProperty=_e.hasPropFunc=_e.reportMissingProp=_e.checkMissingProp=_e.checkReportMissingProp=void 0;const Ne=ge,Dn=G,fr=Ft,Df=G;function Mf(t,e){const{gen:a,data:s,it:r}=t;a.if(Ln(a,s,e,r.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ne._)`${e}`},!0),t.error()})}_e.checkReportMissingProp=Mf;function Lf({gen:t,data:e,it:{opts:a}},s,r){return(0,Ne.or)(...s.map(n=>(0,Ne.and)(Ln(t,e,n,a.ownProperties),(0,Ne._)`${r} = ${n}`)))}_e.checkMissingProp=Lf;function Ff(t,e){t.setParams({missingProperty:e},!0),t.error()}_e.reportMissingProp=Ff;function Pc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}_e.hasPropFunc=Pc;function Mn(t,e,a){return(0,Ne._)`${Pc(t)}.call(${e}, ${a})`}_e.isOwnProperty=Mn;function qf(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} !== undefined`;return s?(0,Ne._)`${r} && ${Mn(t,e,a)}`:r}_e.propertyInData=qf;function Ln(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} === undefined`;return s?(0,Ne.or)(r,(0,Ne.not)(Mn(t,e,a))):r}_e.noPropertyInData=Ln;function Ec(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}_e.allSchemaProperties=Ec;function Uf(t,e){return Ec(e).filter(a=>!(0,Dn.alwaysValidSchema)(t,e[a]))}_e.schemaProperties=Uf;function Vf({schemaCode:t,data:e,it:{gen:a,topSchemaRef:s,schemaPath:r,errorPath:n},it:i},o,l,c){const u=c?(0,Ne._)`${t}, ${e}, ${s}${r}`:e,d=[[fr.default.instancePath,(0,Ne.strConcat)(fr.default.instancePath,n)],[fr.default.parentData,i.parentData],[fr.default.parentDataProperty,i.parentDataProperty],[fr.default.rootData,fr.default.rootData]];i.opts.dynamicRef&&d.push([fr.default.dynamicAnchors,fr.default.dynamicAnchors]);const v=(0,Ne._)`${u}, ${a.object(...d)}`;return l!==Ne.nil?(0,Ne._)`${o}.call(${l}, ${v})`:(0,Ne._)`${o}(${v})`}_e.callValidateCode=Vf;const zf=(0,Ne._)`new RegExp`;function Hf({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"?zf:(0,Df.useFunc)(t,r)}(${a}, ${s})`})}_e.usePattern=Hf;function Zf(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 l=e.const("len",(0,Ne._)`${a}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:Dn.Type.Num},n),e.if((0,Ne.not)(n),o)})}}_e.validateArray=Zf;function Kf(t){const{gen:e,schema:a,keyword:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(l=>(0,Dn.alwaysValidSchema)(r,l))&&!r.opts.unevaluated)return;const i=e.let("valid",!1),o=e.name("_valid");e.block(()=>a.forEach((l,c)=>{const u=t.subschema({keyword:s,schemaProp:c,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))}_e.validateUnion=Kf,Object.defineProperty(qt,"__esModule",{value:!0}),qt.validateKeywordUsage=qt.validSchemaType=qt.funcKeywordCode=qt.macroKeywordCode=void 0;const lt=ge,Tr=Ft,Bf=_e,Wf=ba;function Jf(t,e){const{gen:a,keyword:s,schema:r,parentSchema:n,it:i}=t,o=e.macro.call(i.self,r,n,i),l=Rc(a,s,o);i.opts.validateSchema!==!1&&i.self.validateSchema(o,!0);const c=a.name("valid");t.subschema({schema:o,schemaPath:lt.nil,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}qt.macroKeywordCode=Jf;function Qf(t,e){var a;const{gen:s,keyword:r,schema:n,parentSchema:i,$data:o,it:l}=t;Yf(l,e);const c=!o&&e.compile?e.compile.call(l.self,n,i,l):e.validate,u=Rc(s,r,c),d=s.let("valid");t.block$data(d,v),t.ok((a=e.valid)!==null&&a!==void 0?a:d);function v(){if(e.errors===!1)p(),e.modifying&&Sc(t),h(()=>t.error());else{const g=e.async?f():m();e.modifying&&Sc(t),h(()=>Gf(t,g))}}function f(){const g=s.let("ruleErrs",null);return s.try(()=>p((0,lt._)`await `),w=>s.assign(d,!1).if((0,lt._)`${w} instanceof ${l.ValidationError}`,()=>s.assign(g,(0,lt._)`${w}.errors`),()=>s.throw(w))),g}function m(){const g=(0,lt._)`${u}.errors`;return s.assign(g,null),p(lt.nil),g}function p(g=e.async?(0,lt._)`await `:lt.nil){const w=l.opts.passContext?Tr.default.this:Tr.default.self,P=!("compile"in e&&!o||e.schema===!1);s.assign(d,(0,lt._)`${g}${(0,Bf.callValidateCode)(t,u,w,P)}`,e.modifying)}function h(g){var w;s.if((0,lt.not)((w=e.valid)!==null&&w!==void 0?w:d),g)}}qt.funcKeywordCode=Qf;function Sc(t){const{gen:e,data:a,it:s}=t;e.if(s.parentData,()=>e.assign(a,(0,lt._)`${s.parentData}[${s.parentDataProperty}]`))}function Gf(t,e){const{gen:a}=t;a.if((0,lt._)`Array.isArray(${e})`,()=>{a.assign(Tr.default.vErrors,(0,lt._)`${Tr.default.vErrors} === null ? ${e} : ${Tr.default.vErrors}.concat(${e})`).assign(Tr.default.errors,(0,lt._)`${Tr.default.vErrors}.length`),(0,Wf.extendErrors)(t)},()=>t.error())}function Yf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Rc(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,lt.stringify)(a)})}function Xf(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")}qt.validSchemaType=Xf;function eh({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 l=`keyword "${n}" value is invalid at path "${s}": `+a.errorsText(r.validateSchema.errors);if(e.validateSchema==="log")a.logger.error(l);else throw new Error(l)}}qt.validateKeywordUsage=eh;var hr={};Object.defineProperty(hr,"__esModule",{value:!0}),hr.extendSubschemaMode=hr.extendSubschemaData=hr.getSubschema=void 0;const Ut=ge,kc=G;function th(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,Ut._)`${t.schemaPath}${(0,Ut.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:o[a],schemaPath:(0,Ut._)`${t.schemaPath}${(0,Ut.getProperty)(e)}${(0,Ut.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,kc.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')}hr.getSubschema=th;function rh(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:c,dataPathArr:u,opts:d}=e,v=o.let("data",(0,Ut._)`${e.data}${(0,Ut.getProperty)(a)}`,!0);l(v),t.errorPath=(0,Ut.str)`${c}${(0,kc.getErrorPath)(a,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ut._)`${a}`,t.dataPathArr=[...u,t.parentDataProperty]}if(r!==void 0){const c=r instanceof Ut.Name?r:o.let("data",r,!0);l(c),i!==void 0&&(t.propertyName=i)}n&&(t.dataTypes=n);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}hr.extendSubschemaData=rh;function ah(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}hr.extendSubschemaMode=ah;var rt={},Pa=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},xc={exports:{}},pr=xc.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(){};ds(e,s,r,t,"",t)};pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},pr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},pr.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 ds(t,e,a,s,r,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in pr.arrayKeywords)for(var v=0;v<d.length;v++)ds(t,e,a,d[v],r+"/"+u+"/"+v,n,r,u,s,v)}else if(u in pr.propsKeywords){if(d&&typeof d=="object")for(var f in d)ds(t,e,a,d[f],r+"/"+u+"/"+sh(f),n,r,u,s,f)}else(u in pr.keywords||t.allKeys&&!(u in pr.skipKeywords))&&ds(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,l,c)}}function sh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var nh=xc.exports;Object.defineProperty(rt,"__esModule",{value:!0}),rt.getSchemaRefs=rt.resolveUrl=rt.normalizeId=rt._getFullPath=rt.getFullPath=rt.inlineRef=void 0;const ih=G,oh=Pa,ch=nh,lh=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function uh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Fn(t):e?Tc(t)<=e:!1}rt.inlineRef=uh;const dh=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Fn(t){for(const e in t){if(dh.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(Fn)||typeof a=="object"&&Fn(a))return!0}return!1}function Tc(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!lh.has(a)&&(typeof t[a]=="object"&&(0,ih.eachItem)(t[a],s=>e+=Tc(s)),e===1/0))return 1/0}return e}function Ic(t,e="",a){a!==!1&&(e=Br(e));const s=t.parse(e);return Cc(t,s)}rt.getFullPath=Ic;function Cc(t,e){return t.serialize(e).split("#")[0]+"#"}rt._getFullPath=Cc;const fh=/#\/?$/;function Br(t){return t?t.replace(fh,""):""}rt.normalizeId=Br;function hh(t,e,a){return a=Br(a),t.resolve(e,a)}rt.resolveUrl=hh;const ph=/^[a-z_][-a-z0-9._]*$/i;function mh(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=Br(t[a]||e),n={"":r},i=Ic(s,r,!1),o={},l=new Set;return ch(t,{allKeys:!0},(d,v,f,m)=>{if(m===void 0)return;const p=i+v;let h=n[m];typeof d[a]=="string"&&(h=g.call(this,d[a])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),n[v]=h;function g(P){const S=this.opts.uriResolver.resolve;if(P=Br(h?S(h,P):P),l.has(P))throw u(P);l.add(P);let x=this.refs[P];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?c(d,x.schema,P):P!==Br(p)&&(P[0]==="#"?(c(d,o[P],P),o[P]=d):this.refs[P]=p),P}function w(P){if(typeof P=="string"){if(!ph.test(P))throw new Error(`invalid anchor "${P}"`);g.call(this,`#${P}`)}}}),o;function c(d,v,f){if(v!==void 0&&!oh(d,v))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}rt.getSchemaRefs=mh,Object.defineProperty(kt,"__esModule",{value:!0}),kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;const Oc=Hr,Nc=Xe,qn=tr,fs=Xe,vh=us,Ea=qt,Un=hr,re=ge,oe=Ft,gh=rt,rr=G,Sa=ba;function _h(t){if(Mc(t)&&(Lc(t),Dc(t))){bh(t);return}Ac(t,()=>(0,Oc.topBoolOrEmptySchema)(t))}kt.validateFunctionCode=_h;function Ac({gen:t,validateName:e,schema:a,schemaEnv:s,opts:r},n){r.code.es5?t.func(e,(0,re._)`${oe.default.data}, ${oe.default.valCxt}`,s.$async,()=>{t.code((0,re._)`"use strict"; ${jc(a,r)}`),wh(t,r),t.code(n)}):t.func(e,(0,re._)`${oe.default.data}, ${yh(r)}`,s.$async,()=>t.code(jc(a,r)).code(n))}function yh(t){return(0,re._)`{${oe.default.instancePath}="", ${oe.default.parentData}, ${oe.default.parentDataProperty}, ${oe.default.rootData}=${oe.default.data}${t.dynamicRef?(0,re._)`, ${oe.default.dynamicAnchors}={}`:re.nil}}={}`}function wh(t,e){t.if(oe.default.valCxt,()=>{t.var(oe.default.instancePath,(0,re._)`${oe.default.valCxt}.${oe.default.instancePath}`),t.var(oe.default.parentData,(0,re._)`${oe.default.valCxt}.${oe.default.parentData}`),t.var(oe.default.parentDataProperty,(0,re._)`${oe.default.valCxt}.${oe.default.parentDataProperty}`),t.var(oe.default.rootData,(0,re._)`${oe.default.valCxt}.${oe.default.rootData}`),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`${oe.default.valCxt}.${oe.default.dynamicAnchors}`)},()=>{t.var(oe.default.instancePath,(0,re._)`""`),t.var(oe.default.parentData,(0,re._)`undefined`),t.var(oe.default.parentDataProperty,(0,re._)`undefined`),t.var(oe.default.rootData,oe.default.data),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`{}`)})}function bh(t){const{schema:e,opts:a,gen:s}=t;Ac(t,()=>{a.$comment&&e.$comment&&qc(t),Rh(t),s.let(oe.default.vErrors,null),s.let(oe.default.errors,0),a.unevaluated&&$h(t),Fc(t),Th(t)})}function $h(t){const{gen:e,validateName:a}=t;t.evaluated=e.const("evaluated",(0,re._)`${a}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function jc(t,e){const a=typeof t=="object"&&t[e.schemaId];return a&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${a} */`:re.nil}function Ph(t,e){if(Mc(t)&&(Lc(t),Dc(t))){Eh(t,e);return}(0,Oc.boolOrEmptySchema)(t,e)}function Dc({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 Mc(t){return typeof t.schema!="boolean"}function Eh(t,e){const{schema:a,gen:s,opts:r}=t;r.$comment&&a.$comment&&qc(t),kh(t),xh(t);const n=s.const("_errs",oe.default.errors);Fc(t,n),s.var(e,(0,re._)`${n} === ${oe.default.errors}`)}function Lc(t){(0,rr.checkUnknownRules)(t),Sh(t)}function Fc(t,e){if(t.opts.jtd)return Uc(t,[],!1,e);const a=(0,Nc.getSchemaTypes)(t.schema),s=(0,Nc.coerceAndCheckDataType)(t,a);Uc(t,a,!s,e)}function Sh(t){const{schema:e,errSchemaPath:a,opts:s,self:r}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,rr.schemaHasRulesButRef)(e,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function Rh(t){const{schema:e,opts:a}=t;e.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,rr.checkStrictMode)(t,"default is ignored in the schema root")}function kh(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,gh.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function xh(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function qc({gen:t,schemaEnv:e,schema:a,errSchemaPath:s,opts:r}){const n=a.$comment;if(r.$comment===!0)t.code((0,re._)`${oe.default.self}.logger.log(${n})`);else if(typeof r.$comment=="function"){const i=(0,re.str)`${s}/$comment`,o=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${oe.default.self}.opts.$comment(${n}, ${i}, ${o}.schema)`)}}function Th(t){const{gen:e,schemaEnv:a,validateName:s,ValidationError:r,opts:n}=t;a.$async?e.if((0,re._)`${oe.default.errors} === 0`,()=>e.return(oe.default.data),()=>e.throw((0,re._)`new ${r}(${oe.default.vErrors})`)):(e.assign((0,re._)`${s}.errors`,oe.default.vErrors),n.unevaluated&&Ih(t),e.return((0,re._)`${oe.default.errors} === 0`))}function Ih({gen:t,evaluated:e,props:a,items:s}){a instanceof re.Name&&t.assign((0,re._)`${e}.props`,a),s instanceof re.Name&&t.assign((0,re._)`${e}.items`,s)}function Uc(t,e,a,s){const{gen:r,schema:n,data:i,allErrors:o,opts:l,self:c}=t,{RULES:u}=c;if(n.$ref&&(l.ignoreKeywordsWithRef||!(0,rr.schemaHasRulesButRef)(n,u))){r.block(()=>Zc(t,"$ref",u.all.$ref.definition));return}l.jtd||Ch(t,e),r.block(()=>{for(const v of u.rules)d(v);d(u.post)});function d(v){(0,qn.shouldUseGroup)(n,v)&&(v.type?(r.if((0,fs.checkDataType)(v.type,i,l.strictNumbers)),Vc(t,v),e.length===1&&e[0]===v.type&&a&&(r.else(),(0,fs.reportTypeError)(t)),r.endIf()):Vc(t,v),o||r.if((0,re._)`${oe.default.errors} === ${s||0}`))}}function Vc(t,e){const{gen:a,schema:s,opts:{useDefaults:r}}=t;r&&(0,vh.assignDefaults)(t,e.type),a.block(()=>{for(const n of e.rules)(0,qn.shouldUseRule)(s,n)&&Zc(t,n.keyword,n.definition,e.type)})}function Ch(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Oh(t,e),t.opts.allowUnionTypes||Nh(t,e),Ah(t,t.dataTypes))}function Oh(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(a=>{zc(t.dataTypes,a)||Vn(t,`type "${a}" not allowed by context "${t.dataTypes.join(",")}"`)}),Dh(t,e)}}function Nh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Vn(t,"use allowUnionTypes to allow union type keyword")}function Ah(t,e){const a=t.self.RULES.all;for(const s in a){const r=a[s];if(typeof r=="object"&&(0,qn.shouldUseRule)(t.schema,r)){const{type:n}=r.definition;n.length&&!n.some(i=>jh(e,i))&&Vn(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function jh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function zc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Dh(t,e){const a=[];for(const s of t.dataTypes)zc(e,s)?a.push(s):e.includes("integer")&&s==="number"&&a.push("integer");t.dataTypes=a}function Vn(t,e){const a=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${a}" (strictTypes)`,(0,rr.checkStrictMode)(t,e,t.opts.strictTypes)}class Hc{constructor(e,a,s){if((0,Ea.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,rr.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",Kc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Ea.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",oe.default.errors))}result(e,a,s){this.failResult((0,re.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,re.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,re._)`${a} !== undefined && (${(0,re.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?Sa.reportExtraError:Sa.reportError)(this,this.def.error,a)}$dataError(){(0,Sa.reportError)(this,this.def.$dataError||Sa.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Sa.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=re.nil){this.gen.block(()=>{this.check$data(e,s),a()})}check$data(e=re.nil,a=re.nil){if(!this.$data)return;const{gen:s,schemaCode:r,schemaType:n,def:i}=this;s.if((0,re.or)((0,re._)`${r} === undefined`,a)),e!==re.nil&&s.assign(e,!0),(n.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:a,schemaType:s,def:r,it:n}=this;return(0,re.or)(i(),o());function i(){if(s.length){if(!(a instanceof re.Name))throw new Error("ajv implementation error");const l=Array.isArray(s)?s:[s];return(0,re._)`${(0,fs.checkDataTypes)(l,a,n.opts.strictNumbers,fs.DataType.Wrong)}`}return re.nil}function o(){if(r.validateSchema){const l=e.scopeValue("validate$data",{ref:r.validateSchema});return(0,re._)`!${l}(${a})`}return re.nil}}subschema(e,a){const s=(0,Un.getSubschema)(this.it,e);(0,Un.extendSubschemaData)(s,this.it,e),(0,Un.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return Ph(r,a),r}mergeEvaluated(e,a){const{it:s,gen:r}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=rr.mergeEvaluated.props(r,e.props,s.props,a)),s.items!==!0&&e.items!==void 0&&(s.items=rr.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,re.Name)),!0}}kt.KeywordCxt=Hc;function Zc(t,e,a,s){const r=new Hc(t,a,e);"code"in a?a.code(r,s):r.$data&&a.validate?(0,Ea.funcKeywordCode)(r,a):"macro"in a?(0,Ea.macroKeywordCode)(r,a):(a.compile||a.validate)&&(0,Ea.funcKeywordCode)(r,a)}const Mh=/^\/(?:[^~]|~0|~1)*$/,Lh=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Kc(t,{dataLevel:e,dataNames:a,dataPathArr:s}){let r,n;if(t==="")return oe.default.rootData;if(t[0]==="/"){if(!Mh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);r=t,n=oe.default.rootData}else{const c=Lh.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+c[1];if(r=c[2],r==="#"){if(u>=e)throw new Error(l("property/index",u));return s[e-u]}if(u>e)throw new Error(l("data",u));if(n=a[e-u],!r)return n}let i=n;const o=r.split("/");for(const c of o)c&&(n=(0,re._)`${n}${(0,re.getProperty)((0,rr.unescapeJsonPointer)(c))}`,i=(0,re._)`${i} && ${n}`);return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}kt.getData=Kc;var Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});let Fh=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ra.default=Fh;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});const zn=rt;let qh=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,zn.resolveUrl)(e,a,s),this.missingSchema=(0,zn.normalizeId)((0,zn.getFullPath)(e,this.missingRef))}};Wr.default=qh;var ft={};Object.defineProperty(ft,"__esModule",{value:!0}),ft.resolveSchema=ft.getCompilingSchema=ft.resolveRef=ft.compileSchema=ft.SchemaEnv=void 0;const xt=ge,Uh=Ra,Ir=Ft,Tt=rt,Bc=G,Vh=kt;class hs{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,Tt.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={}}}ft.SchemaEnv=hs;function Hn(t){const e=Wc.call(this,t);if(e)return e;const a=(0,Tt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:r}=this.opts.code,{ownProperties:n}=this.opts,i=new xt.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let o;t.$async&&(o=i.scopeValue("Error",{ref:Uh.default,code:(0,xt._)`require("ajv/dist/runtime/validation_error").default`}));const l=i.scopeName("validate");t.validateName=l;const c={gen:i,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[xt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,xt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:xt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xt._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,Vh.validateFunctionCode)(c),i.optimize(this.opts.code.optimize);const d=i.toString();u=`${i.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const f=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){const{props:m,items:p}=c;f.evaluated={props:m instanceof xt.Name?void 0:m,items:p instanceof xt.Name?void 0:p,dynamicProps:m instanceof xt.Name,dynamicItems:p instanceof xt.Name},f.source&&(f.source.evaluated=(0,xt.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)}}ft.compileSchema=Hn;function zh(t,e,a){var s;a=(0,Tt.resolveUrl)(this.opts.uriResolver,e,a);const r=t.refs[a];if(r)return r;let n=Kh.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 hs({schema:i,schemaId:o,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=Hh.call(this,n)}ft.resolveRef=zh;function Hh(t){return(0,Tt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Hn.call(this,t)}function Wc(t){for(const e of this._compilations)if(Zh(e,t))return e}ft.getCompilingSchema=Wc;function Zh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Kh(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||ps.call(this,t,e)}function ps(t,e){const a=this.opts.uriResolver.parse(e),s=(0,Tt._getFullPath)(this.opts.uriResolver,a);let r=(0,Tt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===r)return Zn.call(this,a,t);const n=(0,Tt.normalizeId)(s),i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const o=ps.call(this,t,i);return typeof(o==null?void 0:o.schema)!="object"?void 0:Zn.call(this,a,o)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||Hn.call(this,i),n===(0,Tt.normalizeId)(e)){const{schema:o}=i,{schemaId:l}=this.opts,c=o[l];return c&&(r=(0,Tt.resolveUrl)(this.opts.uriResolver,r,c)),new hs({schema:o,schemaId:l,root:t,baseId:r})}return Zn.call(this,a,i)}}ft.resolveSchema=ps;const Bh=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zn(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 l=a[(0,Bc.unescapeFragment)(o)];if(l===void 0)return;a=l;const c=typeof a=="object"&&a[this.opts.schemaId];!Bh.has(o)&&c&&(e=(0,Tt.resolveUrl)(this.opts.uriResolver,e,c))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,Bc.schemaHasRulesButRef)(a,this.RULES)){const o=(0,Tt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=ps.call(this,s,o)}const{schemaId:i}=this.opts;if(n=n||new hs({schema:a,schemaId:i,root:s,baseId:e}),n.schema!==n.root.schema)return n}const Wh={$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 Kn={},ms={exports:{}},Jh={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:Qh}=Jh,Gh=/^(?:(?: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 Jc(t){if(Yc(t,".")<3)return{host:t,isIPV4:!1};const e=t.match(Gh)||[],[a]=e;return a?{host:Xh(a,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function Qc(t,e=!1){let a="",s=!0;for(const r of t){if(Qh[r]===void 0)return;r!=="0"&&s===!0&&(s=!1),s||(a+=r)}return e&&a.length===0&&(a="0"),a}function Yh(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,i=!1,o=!1;function l(){if(r.length){if(n===!1){const c=Qc(r);if(c!==void 0)s.push(c);else return a.error=!0,!1}r.length=0}return!0}for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(o=!0),!l())break;if(e++,s.push(":"),e>7){a.error=!0;break}c-1>=0&&t[c-1]===":"&&(i=!0);continue}else if(u==="%"){if(!l())break;n=!0}else{r.push(u);continue}}return r.length&&(n?a.zone=r.join(""):o?s.push(r.join("")):s.push(Qc(r))),a.address=s.join(""),a}function Gc(t){if(Yc(t,":")<2)return{host:t,isIPV6:!1};const e=Yh(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 Xh(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 Yc(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}const Xc=/^\.\.?\//u,el=/^\/\.(?:\/|$)/u,tl=/^\/\.\.(?:\/|$)/u,ep=/^\/?(?:.|\n)*?(?=\/|$)/u;function tp(t){const e=[];for(;t.length;)if(t.match(Xc))t=t.replace(Xc,"");else if(t.match(el))t=t.replace(el,"/");else if(t.match(tl))t=t.replace(tl,"/"),e.pop();else if(t==="."||t==="..")t="";else{const a=t.match(ep);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 rp(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 ap(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=Jc(a);if(s.isIPV4)a=s.host;else{const r=Gc(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 sp={recomposeAuthority:ap,normalizeComponentEncoding:rp,removeDotSegments:tp,normalizeIPv4:Jc,normalizeIPv6:Gc};const np=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,ip=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function rl(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function al(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function sl(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 op(t){return t.secure=rl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function cp(t){if((t.port===(rl(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 lp(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(ip);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=Bn[r];t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function up(t,e){const a=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),r=`${a}:${e.nid||s}`,n=Bn[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 dp(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!np.test(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function fp(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const nl={scheme:"http",domainHost:!0,parse:al,serialize:sl},hp={scheme:"https",domainHost:nl.domainHost,parse:al,serialize:sl},vs={scheme:"ws",domainHost:!0,parse:op,serialize:cp},pp={scheme:"wss",domainHost:vs.domainHost,parse:vs.parse,serialize:vs.serialize},Bn={http:nl,https:hp,ws:vs,wss:pp,urn:{scheme:"urn",parse:lp,serialize:up,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:dp,serialize:fp,skipNormalize:!0}};var mp=Bn;const{normalizeIPv6:vp,normalizeIPv4:gp,removeDotSegments:ka,recomposeAuthority:_p,normalizeComponentEncoding:gs}=sp,Wn=mp;function yp(t,e){return typeof t=="string"?t=Vt(ar(t,e),e):typeof t=="object"&&(t=ar(Vt(t,e),e)),t}function wp(t,e,a){const s=Object.assign({scheme:"null"},a),r=il(ar(t,s),ar(e,s),s,!0);return Vt(r,{...s,skipEscape:!0})}function il(t,e,a,s){const r={};return s||(t=ar(Vt(t,a),a),e=ar(Vt(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=ka(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=ka(e.path||""),r.query=e.query):(e.path?(e.path.charAt(0)==="/"?r.path=ka(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=ka(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 bp(t,e,a){return typeof t=="string"?(t=unescape(t),t=Vt(gs(ar(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=Vt(gs(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Vt(gs(ar(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=Vt(gs(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Vt(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=Wn[(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=_p(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=ka(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 $p=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function Pp(t){let e=0;for(let a=0,s=t.length;a<s;++a)if(e=t.charCodeAt(a),e>126||$p[e])return!0;return!1}const Ep=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ar(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(Ep);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 l=gp(s.host);if(l.isIPV4===!1){const c=vp(l.host);s.host=c.host.toLowerCase(),n=c.isIPV6}else s.host=l.host,n=!0}s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",a.reference&&a.reference!=="suffix"&&a.reference!==s.reference&&(s.error=s.error||"URI is not a "+a.reference+" reference.");const o=Wn[(a.scheme||s.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!o||!o.unicodeSupport)&&s.host&&(a.domainHost||o&&o.domainHost)&&n===!1&&Pp(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(l){s.error=s.error||"Host's domain name can not be converted to ASCII: "+l}(!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 Jn={SCHEMES:Wn,normalize:yp,resolve:wp,resolveComponents:il,equal:bp,serialize:Vt,parse:ar};ms.exports=Jn,ms.exports.default=Jn,ms.exports.fastUri=Jn;var Sp=ms.exports;Object.defineProperty(Kn,"__esModule",{value:!0});const ol=Sp;ol.code='require("ajv/dist/runtime/uri").default',Kn.default=ol,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=kt;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=Ra,r=Wr,n=xr,i=ft,o=ge,l=rt,c=Xe,u=G,d=Wh,v=Kn,f=(N,R)=>new RegExp(N,R);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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},w=200;function P(N){var R,j,T,_,b,O,K,Q,fe,ne,he,ct,Ke,Te,Pt,Ge,Qt,Lt,ze,Et,lr,qe,Ue,tt,Rr;const ur=N.strict,qr=(R=N.code)===null||R===void 0?void 0:R.optimize,En=qr===!0||qr===void 0?1:qr||0,St=(T=(j=N.code)===null||j===void 0?void 0:j.regExp)!==null&&T!==void 0?T:f,Ur=(_=N.uriResolver)!==null&&_!==void 0?_:v.default;return{strictSchema:(O=(b=N.strictSchema)!==null&&b!==void 0?b:ur)!==null&&O!==void 0?O:!0,strictNumbers:(Q=(K=N.strictNumbers)!==null&&K!==void 0?K:ur)!==null&&Q!==void 0?Q:!0,strictTypes:(ne=(fe=N.strictTypes)!==null&&fe!==void 0?fe:ur)!==null&&ne!==void 0?ne:"log",strictTuples:(ct=(he=N.strictTuples)!==null&&he!==void 0?he:ur)!==null&&ct!==void 0?ct:"log",strictRequired:(Te=(Ke=N.strictRequired)!==null&&Ke!==void 0?Ke:ur)!==null&&Te!==void 0?Te:!1,code:N.code?{...N.code,optimize:En,regExp:St}:{optimize:En,regExp:St},loopRequired:(Pt=N.loopRequired)!==null&&Pt!==void 0?Pt:w,loopEnum:(Ge=N.loopEnum)!==null&&Ge!==void 0?Ge:w,meta:(Qt=N.meta)!==null&&Qt!==void 0?Qt:!0,messages:(Lt=N.messages)!==null&&Lt!==void 0?Lt:!0,inlineRefs:(ze=N.inlineRefs)!==null&&ze!==void 0?ze:!0,schemaId:(Et=N.schemaId)!==null&&Et!==void 0?Et:"$id",addUsedSchema:(lr=N.addUsedSchema)!==null&&lr!==void 0?lr:!0,validateSchema:(qe=N.validateSchema)!==null&&qe!==void 0?qe:!0,validateFormats:(Ue=N.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(tt=N.unicodeRegExp)!==null&&tt!==void 0?tt:!0,int32range:(Rr=N.int32range)!==null&&Rr!==void 0?Rr:!0,uriResolver:Ur}}class S{constructor(R={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,R=this.opts={...R,...P(R)};const{es5:j,lines:T}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:p,es5:j,lines:T}),this.logger=H(R.logger);const _=R.validateFormats;R.validateFormats=!1,this.RULES=(0,n.getRules)(),x.call(this,h,R,"NOT SUPPORTED"),x.call(this,g,R,"DEPRECATED","warn"),this._metaOpts=W.call(this),R.formats&&U.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),R.keywords&&D.call(this,R.keywords),typeof R.meta=="object"&&this.addMetaSchema(R.meta),z.call(this),R.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:R,meta:j,schemaId:T}=this.opts;let _=d;T==="id"&&(_={...d},_.id=_.$id,delete _.$id),j&&R&&this.addMetaSchema(_,_[T],!1)}defaultMeta(){const{meta:R,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof R=="object"?R[j]||R:void 0}validate(R,j){let T;if(typeof R=="string"){if(T=this.getSchema(R),!T)throw new Error(`no schema with key or ref "${R}"`)}else T=this.compile(R);const _=T(j);return"$async"in T||(this.errors=T.errors),_}compile(R,j){const T=this._addSchema(R,j);return T.validate||this._compileSchemaEnv(T)}compileAsync(R,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:T}=this.opts;return _.call(this,R,j);async function _(ne,he){await b.call(this,ne.$schema);const ct=this._addSchema(ne,he);return ct.validate||O.call(this,ct)}async function b(ne){ne&&!this.getSchema(ne)&&await _.call(this,{$ref:ne},!0)}async function O(ne){try{return this._compileSchemaEnv(ne)}catch(he){if(!(he instanceof r.default))throw he;return K.call(this,he),await Q.call(this,he.missingSchema),O.call(this,ne)}}function K({missingSchema:ne,missingRef:he}){if(this.refs[ne])throw new Error(`AnySchema ${ne} is loaded but ${he} cannot be resolved`)}async function Q(ne){const he=await fe.call(this,ne);this.refs[ne]||await b.call(this,he.$schema),this.refs[ne]||this.addSchema(he,ne,j)}async function fe(ne){const he=this._loading[ne];if(he)return he;try{return await(this._loading[ne]=T(ne))}finally{delete this._loading[ne]}}}addSchema(R,j,T,_=this.opts.validateSchema){if(Array.isArray(R)){for(const O of R)this.addSchema(O,void 0,T,_);return this}let b;if(typeof R=="object"){const{schemaId:O}=this.opts;if(b=R[O],b!==void 0&&typeof b!="string")throw new Error(`schema ${O} must be string`)}return j=(0,l.normalizeId)(j||b),this._checkUnique(j),this.schemas[j]=this._addSchema(R,T,j,_,!0),this}addMetaSchema(R,j,T=this.opts.validateSchema){return this.addSchema(R,j,!0,T),this}validateSchema(R,j){if(typeof R=="boolean")return!0;let T;if(T=R.$schema,T!==void 0&&typeof T!="string")throw new Error("$schema must be a string");if(T=T||this.opts.defaultMeta||this.defaultMeta(),!T)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(T,R);if(!_&&j){const b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw new Error(b)}return _}getSchema(R){let j;for(;typeof(j=A.call(this,R))=="string";)R=j;if(j===void 0){const{schemaId:T}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:T});if(j=i.resolveSchema.call(this,_,R),!j)return;this.refs[R]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(R){if(R instanceof RegExp)return this._removeAllSchemas(this.schemas,R),this._removeAllSchemas(this.refs,R),this;switch(typeof R){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=A.call(this,R);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[R],delete this.refs[R],this}case"object":{const j=R;this._cache.delete(j);let T=R[this.opts.schemaId];return T&&(T=(0,l.normalizeId)(T),delete this.schemas[T],delete this.refs[T]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(R){for(const j of R)this.addKeyword(j);return this}addKeyword(R,j){let T;if(typeof R=="string")T=R,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=T);else if(typeof R=="object"&&j===void 0){if(j=R,T=j.keyword,Array.isArray(T)&&!T.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M.call(this,T,j),!j)return(0,u.eachItem)(T,b=>te.call(this,b)),this;ve.call(this,j);const _={...j,type:(0,c.getJSONTypes)(j.type),schemaType:(0,c.getJSONTypes)(j.schemaType)};return(0,u.eachItem)(T,_.type.length===0?b=>te.call(this,b,_):b=>_.type.forEach(O=>te.call(this,b,_,O))),this}getKeyword(R){const j=this.RULES.all[R];return typeof j=="object"?j.definition:!!j}removeKeyword(R){const{RULES:j}=this;delete j.keywords[R],delete j.all[R];for(const T of j.rules){const _=T.rules.findIndex(b=>b.keyword===R);_>=0&&T.rules.splice(_,1)}return this}addFormat(R,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[R]=j,this}errorsText(R=this.errors,{separator:j=", ",dataVar:T="data"}={}){return!R||R.length===0?"No errors":R.map(_=>`${T}${_.instancePath} ${_.message}`).reduce((_,b)=>_+j+b)}$dataMetaSchema(R,j){const T=this.RULES.all;R=JSON.parse(JSON.stringify(R));for(const _ of j){const b=_.split("/").slice(1);let O=R;for(const K of b)O=O[K];for(const K in T){const Q=T[K];if(typeof Q!="object")continue;const{$data:fe}=Q.definition,ne=O[K];fe&&ne&&(O[K]=de(ne))}}return R}_removeAllSchemas(R,j){for(const T in R){const _=R[T];(!j||j.test(T))&&(typeof _=="string"?delete R[T]:_&&!_.meta&&(this._cache.delete(_.schema),delete R[T]))}}_addSchema(R,j,T,_=this.opts.validateSchema,b=this.opts.addUsedSchema){let O;const{schemaId:K}=this.opts;if(typeof R=="object")O=R[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof R!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(R);if(Q!==void 0)return Q;T=(0,l.normalizeId)(O||T);const fe=l.getSchemaRefs.call(this,R,T);return Q=new i.SchemaEnv({schema:R,schemaId:K,meta:j,baseId:T,localRefs:fe}),this._cache.set(Q.schema,Q),b&&!T.startsWith("#")&&(T&&this._checkUnique(T),this.refs[T]=Q),_&&this.validateSchema(R,!0),Q}_checkUnique(R){if(this.schemas[R]||this.refs[R])throw new Error(`schema with key or id "${R}" already exists`)}_compileSchemaEnv(R){if(R.meta?this._compileMetaSchema(R):i.compileSchema.call(this,R),!R.validate)throw new Error("ajv implementation error");return R.validate}_compileMetaSchema(R){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,R)}finally{this.opts=j}}}S.ValidationError=s.default,S.MissingRefError=r.default,t.default=S;function x(N,R,j,T="error"){for(const _ in N){const b=_;b in R&&this.logger[T](`${j}: option ${_}. ${N[b]}`)}}function A(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function z(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const R in N)this.addSchema(N[R],R)}function U(){for(const N in this.opts.formats){const R=this.opts.formats[N];R&&this.addFormat(N,R)}}function D(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const R in N){const j=N[R];j.keyword||(j.keyword=R),this.addKeyword(j)}}function W(){const N={...this.opts};for(const R of m)delete N[R];return N}const J={log(){},warn(){},error(){}};function H(N){if(N===!1)return J;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function M(N,R){const{RULES:j}=this;if((0,u.eachItem)(N,T=>{if(j.keywords[T])throw new Error(`Keyword ${T} is already defined`);if(!F.test(T))throw new Error(`Keyword ${T} has invalid name`)}),!!R&&R.$data&&!("code"in R||"validate"in R))throw new Error('$data keyword must have "code" or "validate" function')}function te(N,R,j){var T;const _=R==null?void 0:R.post;if(j&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:b}=this;let O=_?b.post:b.rules.find(({type:Q})=>Q===j);if(O||(O={type:j,rules:[]},b.rules.push(O)),b.keywords[N]=!0,!R)return;const K={keyword:N,definition:{...R,type:(0,c.getJSONTypes)(R.type),schemaType:(0,c.getJSONTypes)(R.schemaType)}};R.before?ye.call(this,O,K,R.before):O.rules.push(K),b.all[N]=K,(T=R.implements)===null||T===void 0||T.forEach(Q=>this.addKeyword(Q))}function ye(N,R,j){const T=N.rules.findIndex(_=>_.keyword===j);T>=0?N.rules.splice(T,0,R):(N.rules.push(R),this.logger.warn(`rule ${j} is not defined`))}function ve(N){let{metaSchema:R}=N;R!==void 0&&(N.$data&&this.opts.$data&&(R=de(R)),N.validateSchema=this.compile(R,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function de(N){return{anyOf:[N,be]}}}(cc);var Qn={},Gn={},Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});const Rp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Yn.default=Rp;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.callRef=Cr.getValidate=void 0;const kp=Wr,cl=_e,ht=ge,Jr=Ft,ll=ft,_s=G,xp={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:i,opts:o,self:l}=s,{root:c}=n;if((a==="#"||a==="#/")&&r===c.baseId)return d();const u=ll.resolveRef.call(l,c,r,a);if(u===void 0)throw new kp.default(s.opts.uriResolver,r,a);if(u instanceof ll.SchemaEnv)return v(u);return f(u);function d(){if(n===c)return ys(t,i,n,n.$async);const m=e.scopeValue("root",{ref:c});return ys(t,(0,ht._)`${m}.validate`,c,c.$async)}function v(m){const p=ul(t,m);ys(t,p,m,m.$async)}function f(m){const p=e.scopeValue("schema",o.code.source===!0?{ref:m,code:(0,ht.stringify)(m)}:{ref:m}),h=e.name("valid"),g=t.subschema({schema:m,dataTypes:[],schemaPath:ht.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(g),t.ok(h)}}};function ul(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,ht._)`${a.scopeValue("wrapper",{ref:e})}.validate`}Cr.getValidate=ul;function ys(t,e,a,s){const{gen:r,it:n}=t,{allErrors:i,schemaEnv:o,opts:l}=n,c=l.passContext?Jr.default.this:ht.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,ht._)`await ${(0,cl.callValidateCode)(t,e,c)}`),f(e),i||r.assign(m,!0)},p=>{r.if((0,ht._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),v(p),i||r.assign(m,!1)}),t.ok(m)}function d(){t.result((0,cl.callValidateCode)(t,e,c),()=>f(e),()=>v(e))}function v(m){const p=(0,ht._)`${m}.errors`;r.assign(Jr.default.vErrors,(0,ht._)`${Jr.default.vErrors} === null ? ${p} : ${Jr.default.vErrors}.concat(${p})`),r.assign(Jr.default.errors,(0,ht._)`${Jr.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=_s.mergeEvaluated.props(r,h.props,n.props));else{const g=r.var("props",(0,ht._)`${m}.evaluated.props`);n.props=_s.mergeEvaluated.props(r,g,n.props,ht.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=_s.mergeEvaluated.items(r,h.items,n.items));else{const g=r.var("items",(0,ht._)`${m}.evaluated.items`);n.items=_s.mergeEvaluated.items(r,g,n.items,ht.Name)}}}Cr.callRef=ys,Cr.default=xp,Object.defineProperty(Gn,"__esModule",{value:!0});const Tp=Yn,Ip=Cr,Cp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Tp.default,Ip.default];Gn.default=Cp;var Xn={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});const ws=ge,mr=ws.operators,bs={maximum:{okStr:"<=",ok:mr.LTE,fail:mr.GT},minimum:{okStr:">=",ok:mr.GTE,fail:mr.LT},exclusiveMaximum:{okStr:"<",ok:mr.LT,fail:mr.GTE},exclusiveMinimum:{okStr:">",ok:mr.GT,fail:mr.LTE}},Op={message:({keyword:t,schemaCode:e})=>(0,ws.str)`must be ${bs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ws._)`{comparison: ${bs[t].okStr}, limit: ${e}}`},Np={keyword:Object.keys(bs),type:"number",schemaType:"number",$data:!0,error:Op,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,ws._)`${a} ${bs[e].fail} ${s} || isNaN(${a})`)}};ei.default=Np;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});const xa=ge,Ap={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,xa.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,xa._)`{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,xa._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${n}`:(0,xa._)`${i} !== parseInt(${i})`;t.fail$data((0,xa._)`(${s} === 0 || (${i} = ${a}/${s}, ${o}))`)}};ti.default=Ap;var ri={},ai={};Object.defineProperty(ai,"__esModule",{value:!0});function dl(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}ai.default=dl,dl.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(ri,"__esModule",{value:!0});const Or=ge,jp=G,Dp=ai,Mp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,Or.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,Or._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?Or.operators.GT:Or.operators.LT,i=r.opts.unicode===!1?(0,Or._)`${a}.length`:(0,Or._)`${(0,jp.useFunc)(t.gen,Dp.default)}(${a})`;t.fail$data((0,Or._)`${i} ${n} ${s}`)}};ri.default=Mp;var si={};Object.defineProperty(si,"__esModule",{value:!0});const Lp=_e,$s=ge,Fp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,$s.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,$s._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,i=n.opts.unicodeRegExp?"u":"",o=a?(0,$s._)`(new RegExp(${r}, ${i}))`:(0,Lp.usePattern)(t,s);t.fail$data((0,$s._)`!${o}.test(${e})`)}};si.default=Fp;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const Ta=ge,qp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,Ta.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,Ta._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?Ta.operators.GT:Ta.operators.LT;t.fail$data((0,Ta._)`Object.keys(${a}).length ${r} ${s}`)}};ni.default=qp;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const Ia=_e,Ca=ge,Up=G,Vp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,Ca.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ca._)`{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 l=a.length>=o.loopRequired;if(i.allErrors?c():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,g=`required property "${p}" is not defined at "${h}" (strictRequired)`;(0,Up.checkStrictMode)(i,g,i.opts.strictRequired)}}function c(){if(l||n)t.block$data(Ca.nil,d);else for(const f of a)(0,Ia.checkReportMissingProp)(t,f)}function u(){const f=e.let("missing");if(l||n){const m=e.let("valid",!0);t.block$data(m,()=>v(f,m)),t.ok(m)}else e.if((0,Ia.checkMissingProp)(t,a,f)),(0,Ia.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",s,f=>{t.setParams({missingProperty:f}),e.if((0,Ia.noPropertyInData)(e,r,f,o.ownProperties),()=>t.error())})}function v(f,m){t.setParams({missingProperty:f}),e.forOf(f,s,()=>{e.assign(m,(0,Ia.propertyInData)(e,r,f,o.ownProperties)),e.if((0,Ca.not)(m),()=>{t.error(),e.break()})},Ca.nil)}}};ii.default=Vp;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});const Oa=ge,zp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,Oa.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,Oa._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?Oa.operators.GT:Oa.operators.LT;t.fail$data((0,Oa._)`${a}.length ${r} ${s}`)}};oi.default=zp;var ci={},Na={};Object.defineProperty(Na,"__esModule",{value:!0});const fl=Pa;fl.code='require("ajv/dist/runtime/equal").default',Na.default=fl,Object.defineProperty(ci,"__esModule",{value:!0});const li=Xe,at=ge,Hp=G,Zp=Na,Kp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,at.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,at._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:i,it:o}=t;if(!s&&!r)return;const l=e.let("valid"),c=n.items?(0,li.getSchemaTypes)(n.items):[];t.block$data(l,u,(0,at._)`${i} === false`),t.ok(l);function u(){const m=e.let("i",(0,at._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(l,!0),e.if((0,at._)`${m} > 1`,()=>(d()?v:f)(m,p))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function v(m,p){const h=e.name("item"),g=(0,li.checkDataTypes)(c,h,o.opts.strictNumbers,li.DataType.Wrong),w=e.const("indices",(0,at._)`{}`);e.for((0,at._)`;${m}--;`,()=>{e.let(h,(0,at._)`${a}[${m}]`),e.if(g,(0,at._)`continue`),c.length>1&&e.if((0,at._)`typeof ${h} == "string"`,(0,at._)`${h} += "_"`),e.if((0,at._)`typeof ${w}[${h}] == "number"`,()=>{e.assign(p,(0,at._)`${w}[${h}]`),t.error(),e.assign(l,!1).break()}).code((0,at._)`${w}[${h}] = ${m}`)})}function f(m,p){const h=(0,Hp.useFunc)(e,Zp.default),g=e.name("outer");e.label(g).for((0,at._)`;${m}--;`,()=>e.for((0,at._)`${p} = ${m}; ${p}--;`,()=>e.if((0,at._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};ci.default=Kp;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});const di=ge,Bp=G,Wp=Na,Jp={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,di._)`{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,di._)`!${(0,Bp.useFunc)(e,Wp.default)}(${a}, ${r})`):t.fail((0,di._)`${n} !== ${a}`)}};ui.default=Jp;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});const Aa=ge,Qp=G,Gp=Na,Yp={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Aa._)`{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 l;const c=()=>l??(l=(0,Qp.useFunc)(e,Gp.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,Aa.or)(...r.map((m,p)=>v(f,p)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",n,f=>e.if((0,Aa._)`${c()}(${a}, ${f})`,()=>e.assign(u,!0).break()))}function v(f,m){const p=r[m];return typeof p=="object"&&p!==null?(0,Aa._)`${c()}(${a}, ${f}[${m}])`:(0,Aa._)`${a} === ${p}`}}};fi.default=Yp,Object.defineProperty(Xn,"__esModule",{value:!0});const Xp=ei,em=ti,tm=ri,rm=si,am=ni,sm=ii,nm=oi,im=ci,om=ui,cm=fi,lm=[Xp.default,em.default,tm.default,rm.default,am.default,sm.default,nm.default,im.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},om.default,cm.default];Xn.default=lm;var hi={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.validateAdditionalItems=void 0;const Nr=ge,pi=G,um={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Nr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nr._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,pi.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}hl(t,s)}};function hl(t,e){const{gen:a,schema:s,data:r,keyword:n,it:i}=t;i.items=!0;const o=a.const("len",(0,Nr._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,Nr._)`${o} <= ${e.length}`);else if(typeof s=="object"&&!(0,pi.alwaysValidSchema)(i,s)){const c=a.var("valid",(0,Nr._)`${o} <= ${e.length}`);a.if((0,Nr.not)(c),()=>l(c)),t.ok(c)}function l(c){a.forRange("i",e.length,o,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:pi.Type.Num},c),i.allErrors||a.if((0,Nr.not)(c),()=>a.break())})}}Qr.validateAdditionalItems=hl,Qr.default=um;var mi={},Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.validateTuple=void 0;const pl=ge,Ps=G,dm=_e,fm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return ml(t,"additionalItems",e);a.items=!0,!(0,Ps.alwaysValidSchema)(a,e)&&t.ok((0,dm.validateArray)(t))}};function ml(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=Ps.mergeEvaluated.items(s,a.length,o.items));const l=s.name("valid"),c=s.const("len",(0,pl._)`${n}.length`);a.forEach((d,v)=>{(0,Ps.alwaysValidSchema)(o,d)||(s.if((0,pl._)`${c} > ${v}`,()=>t.subschema({keyword:i,schemaProp:v,dataProp:v},l)),t.ok(l))});function u(d){const{opts:v,errSchemaPath:f}=o,m=a.length,p=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(v.strictTuples&&!p){const h=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Ps.checkStrictMode)(o,h,v.strictTuples)}}}Gr.validateTuple=ml,Gr.default=fm,Object.defineProperty(mi,"__esModule",{value:!0});const hm=Gr,pm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,hm.validateTuple)(t,"items")};mi.default=pm;var vi={};Object.defineProperty(vi,"__esModule",{value:!0});const vl=ge,mm=G,vm=_e,gm=Qr,_m={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,vl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,vl._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,mm.alwaysValidSchema)(s,e)&&(r?(0,gm.validateAdditionalItems)(t,r):t.ok((0,vm.validateArray)(t)))}};vi.default=_m;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const wt=ge,Es=G,ym={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,wt.str)`must contain at least ${t} valid item(s)`:(0,wt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,wt._)`{minContains: ${t}}`:(0,wt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let i,o;const{minContains:l,maxContains:c}=s;n.opts.next?(i=l===void 0?1:l,o=c):i=1;const u=e.const("len",(0,wt._)`${r}.length`);if(t.setParams({min:i,max:o}),o===void 0&&i===0){(0,Es.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&i>o){(0,Es.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Es.alwaysValidSchema)(n,a)){let p=(0,wt._)`${u} >= ${i}`;o!==void 0&&(p=(0,wt._)`${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,wt._)`${r}.length > 0`,v)):(e.let(d,!1),v()),t.result(d,()=>t.reset());function v(){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,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Es.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,wt._)`${p}++`),o===void 0?e.if((0,wt._)`${p} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,wt._)`${p} > ${o}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,wt._)`${p} >= ${i}`,()=>e.assign(d,!0)))}}};gi.default=ym;var gl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ge,a=G,s=_e;t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const d=c===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:d}})=>(0,e._)`{property: ${l},
|
|
5
|
+
|| ${i} === "boolean" || ${r} === null`).assign(o,(0,pe._)`[${r}]`)}}}function Cf({gen:t,parentData:e,parentDataProperty:a},s){t.if((0,pe._)`${e} !== undefined`,()=>t.assign((0,pe._)`${e}[${a}]`,s))}function On(t,e,a,s=Zr.Correct){const r=s===Zr.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===Zr.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)}}Xe.checkDataType=On;function Nn(t,e,a,s){if(t.length===1)return On(t[0],e,a,s);let r;const n=(0,yc.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,On(i,e,a,s));return r}Xe.checkDataTypes=Nn;const Of={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,pe._)`{type: ${t}}`:(0,pe._)`{type: ${e}}`};function An(t){const e=Nf(t);(0,Rf.reportError)(e,Of)}Xe.reportTypeError=An;function Nf(t){const{gen:e,data:a,schema:s}=t,r=(0,yc.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:a,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:t}}var cs={};Object.defineProperty(cs,"__esModule",{value:!0}),cs.assignDefaults=void 0;const Kr=ge,Af=G;function jf(t,e){const{properties:a,items:s}=t.schema;if(e==="object"&&a)for(const r in a)$c(t,r,a[r].default);else e==="array"&&Array.isArray(s)&&s.forEach((r,n)=>$c(t,n,r.default))}cs.assignDefaults=jf;function $c(t,e,a){const{gen:s,compositeRule:r,data:n,opts:i}=t;if(a===void 0)return;const o=(0,Kr._)`${n}${(0,Kr.getProperty)(e)}`;if(r){(0,Af.checkStrictMode)(t,`default is ignored for: ${o}`);return}let l=(0,Kr._)`${o} === undefined`;i.useDefaults==="empty"&&(l=(0,Kr._)`${l} || ${o} === null || ${o} === ""`),s.if(l,(0,Kr._)`${o} = ${(0,Kr.stringify)(a)}`)}var qt={},_e={};Object.defineProperty(_e,"__esModule",{value:!0}),_e.validateUnion=_e.validateArray=_e.usePattern=_e.callValidateCode=_e.schemaProperties=_e.allSchemaProperties=_e.noPropertyInData=_e.propertyInData=_e.isOwnProperty=_e.hasPropFunc=_e.reportMissingProp=_e.checkMissingProp=_e.checkReportMissingProp=void 0;const Ne=ge,jn=G,fr=Ft,Df=G;function Mf(t,e){const{gen:a,data:s,it:r}=t;a.if(Mn(a,s,e,r.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ne._)`${e}`},!0),t.error()})}_e.checkReportMissingProp=Mf;function Lf({gen:t,data:e,it:{opts:a}},s,r){return(0,Ne.or)(...s.map(n=>(0,Ne.and)(Mn(t,e,n,a.ownProperties),(0,Ne._)`${r} = ${n}`)))}_e.checkMissingProp=Lf;function Ff(t,e){t.setParams({missingProperty:e},!0),t.error()}_e.reportMissingProp=Ff;function Pc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ne._)`Object.prototype.hasOwnProperty`})}_e.hasPropFunc=Pc;function Dn(t,e,a){return(0,Ne._)`${Pc(t)}.call(${e}, ${a})`}_e.isOwnProperty=Dn;function qf(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} !== undefined`;return s?(0,Ne._)`${r} && ${Dn(t,e,a)}`:r}_e.propertyInData=qf;function Mn(t,e,a,s){const r=(0,Ne._)`${e}${(0,Ne.getProperty)(a)} === undefined`;return s?(0,Ne.or)(r,(0,Ne.not)(Dn(t,e,a))):r}_e.noPropertyInData=Mn;function Ec(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}_e.allSchemaProperties=Ec;function Uf(t,e){return Ec(e).filter(a=>!(0,jn.alwaysValidSchema)(t,e[a]))}_e.schemaProperties=Uf;function Vf({schemaCode:t,data:e,it:{gen:a,topSchemaRef:s,schemaPath:r,errorPath:n},it:i},o,l,c){const u=c?(0,Ne._)`${t}, ${e}, ${s}${r}`:e,d=[[fr.default.instancePath,(0,Ne.strConcat)(fr.default.instancePath,n)],[fr.default.parentData,i.parentData],[fr.default.parentDataProperty,i.parentDataProperty],[fr.default.rootData,fr.default.rootData]];i.opts.dynamicRef&&d.push([fr.default.dynamicAnchors,fr.default.dynamicAnchors]);const g=(0,Ne._)`${u}, ${a.object(...d)}`;return l!==Ne.nil?(0,Ne._)`${o}.call(${l}, ${g})`:(0,Ne._)`${o}(${g})`}_e.callValidateCode=Vf;const zf=(0,Ne._)`new RegExp`;function Hf({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"?zf:(0,Df.useFunc)(t,r)}(${a}, ${s})`})}_e.usePattern=Hf;function Zf(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 l=e.const("len",(0,Ne._)`${a}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:s,dataProp:c,dataPropType:jn.Type.Num},n),e.if((0,Ne.not)(n),o)})}}_e.validateArray=Zf;function Kf(t){const{gen:e,schema:a,keyword:s,it:r}=t;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(l=>(0,jn.alwaysValidSchema)(r,l))&&!r.opts.unevaluated)return;const i=e.let("valid",!1),o=e.name("_valid");e.block(()=>a.forEach((l,c)=>{const u=t.subschema({keyword:s,schemaProp:c,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))}_e.validateUnion=Kf,Object.defineProperty(qt,"__esModule",{value:!0}),qt.validateKeywordUsage=qt.validSchemaType=qt.funcKeywordCode=qt.macroKeywordCode=void 0;const lt=ge,Tr=Ft,Bf=_e,Wf=ba;function Jf(t,e){const{gen:a,keyword:s,schema:r,parentSchema:n,it:i}=t,o=e.macro.call(i.self,r,n,i),l=Rc(a,s,o);i.opts.validateSchema!==!1&&i.self.validateSchema(o,!0);const c=a.name("valid");t.subschema({schema:o,schemaPath:lt.nil,errSchemaPath:`${i.errSchemaPath}/${s}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}qt.macroKeywordCode=Jf;function Qf(t,e){var a;const{gen:s,keyword:r,schema:n,parentSchema:i,$data:o,it:l}=t;Yf(l,e);const c=!o&&e.compile?e.compile.call(l.self,n,i,l):e.validate,u=Rc(s,r,c),d=s.let("valid");t.block$data(d,g),t.ok((a=e.valid)!==null&&a!==void 0?a:d);function g(){if(e.errors===!1)p(),e.modifying&&Sc(t),h(()=>t.error());else{const v=e.async?f():m();e.modifying&&Sc(t),h(()=>Gf(t,v))}}function f(){const v=s.let("ruleErrs",null);return s.try(()=>p((0,lt._)`await `),b=>s.assign(d,!1).if((0,lt._)`${b} instanceof ${l.ValidationError}`,()=>s.assign(v,(0,lt._)`${b}.errors`),()=>s.throw(b))),v}function m(){const v=(0,lt._)`${u}.errors`;return s.assign(v,null),p(lt.nil),v}function p(v=e.async?(0,lt._)`await `:lt.nil){const b=l.opts.passContext?Tr.default.this:Tr.default.self,P=!("compile"in e&&!o||e.schema===!1);s.assign(d,(0,lt._)`${v}${(0,Bf.callValidateCode)(t,u,b,P)}`,e.modifying)}function h(v){var b;s.if((0,lt.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}qt.funcKeywordCode=Qf;function Sc(t){const{gen:e,data:a,it:s}=t;e.if(s.parentData,()=>e.assign(a,(0,lt._)`${s.parentData}[${s.parentDataProperty}]`))}function Gf(t,e){const{gen:a}=t;a.if((0,lt._)`Array.isArray(${e})`,()=>{a.assign(Tr.default.vErrors,(0,lt._)`${Tr.default.vErrors} === null ? ${e} : ${Tr.default.vErrors}.concat(${e})`).assign(Tr.default.errors,(0,lt._)`${Tr.default.vErrors}.length`),(0,Wf.extendErrors)(t)},()=>t.error())}function Yf({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Rc(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,lt.stringify)(a)})}function Xf(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")}qt.validSchemaType=Xf;function eh({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 l=`keyword "${n}" value is invalid at path "${s}": `+a.errorsText(r.validateSchema.errors);if(e.validateSchema==="log")a.logger.error(l);else throw new Error(l)}}qt.validateKeywordUsage=eh;var hr={};Object.defineProperty(hr,"__esModule",{value:!0}),hr.extendSubschemaMode=hr.extendSubschemaData=hr.getSubschema=void 0;const Ut=ge,kc=G;function th(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,Ut._)`${t.schemaPath}${(0,Ut.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:o[a],schemaPath:(0,Ut._)`${t.schemaPath}${(0,Ut.getProperty)(e)}${(0,Ut.getProperty)(a)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,kc.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')}hr.getSubschema=th;function rh(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:c,dataPathArr:u,opts:d}=e,g=o.let("data",(0,Ut._)`${e.data}${(0,Ut.getProperty)(a)}`,!0);l(g),t.errorPath=(0,Ut.str)`${c}${(0,kc.getErrorPath)(a,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ut._)`${a}`,t.dataPathArr=[...u,t.parentDataProperty]}if(r!==void 0){const c=r instanceof Ut.Name?r:o.let("data",r,!0);l(c),i!==void 0&&(t.propertyName=i)}n&&(t.dataTypes=n);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}hr.extendSubschemaData=rh;function ah(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}hr.extendSubschemaMode=ah;var rt={},$a=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},xc={exports:{}},pr=xc.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(){};ls(e,s,r,t,"",t)};pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},pr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},pr.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 ls(t,e,a,s,r,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in pr.arrayKeywords)for(var g=0;g<d.length;g++)ls(t,e,a,d[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in pr.propsKeywords){if(d&&typeof d=="object")for(var f in d)ls(t,e,a,d[f],r+"/"+u+"/"+sh(f),n,r,u,s,f)}else(u in pr.keywords||t.allKeys&&!(u in pr.skipKeywords))&&ls(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,l,c)}}function sh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var nh=xc.exports;Object.defineProperty(rt,"__esModule",{value:!0}),rt.getSchemaRefs=rt.resolveUrl=rt.normalizeId=rt._getFullPath=rt.getFullPath=rt.inlineRef=void 0;const ih=G,oh=$a,ch=nh,lh=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function uh(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Ln(t):e?Tc(t)<=e:!1}rt.inlineRef=uh;const dh=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ln(t){for(const e in t){if(dh.has(e))return!0;const a=t[e];if(Array.isArray(a)&&a.some(Ln)||typeof a=="object"&&Ln(a))return!0}return!1}function Tc(t){let e=0;for(const a in t){if(a==="$ref")return 1/0;if(e++,!lh.has(a)&&(typeof t[a]=="object"&&(0,ih.eachItem)(t[a],s=>e+=Tc(s)),e===1/0))return 1/0}return e}function Ic(t,e="",a){a!==!1&&(e=Br(e));const s=t.parse(e);return Cc(t,s)}rt.getFullPath=Ic;function Cc(t,e){return t.serialize(e).split("#")[0]+"#"}rt._getFullPath=Cc;const fh=/#\/?$/;function Br(t){return t?t.replace(fh,""):""}rt.normalizeId=Br;function hh(t,e,a){return a=Br(a),t.resolve(e,a)}rt.resolveUrl=hh;const ph=/^[a-z_][-a-z0-9._]*$/i;function mh(t,e){if(typeof t=="boolean")return{};const{schemaId:a,uriResolver:s}=this.opts,r=Br(t[a]||e),n={"":r},i=Ic(s,r,!1),o={},l=new Set;return ch(t,{allKeys:!0},(d,g,f,m)=>{if(m===void 0)return;const p=i+g;let h=n[m];typeof d[a]=="string"&&(h=v.call(this,d[a])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),n[g]=h;function v(P){const S=this.opts.uriResolver.resolve;if(P=Br(h?S(h,P):P),l.has(P))throw u(P);l.add(P);let x=this.refs[P];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?c(d,x.schema,P):P!==Br(p)&&(P[0]==="#"?(c(d,o[P],P),o[P]=d):this.refs[P]=p),P}function b(P){if(typeof P=="string"){if(!ph.test(P))throw new Error(`invalid anchor "${P}"`);v.call(this,`#${P}`)}}}),o;function c(d,g,f){if(g!==void 0&&!oh(d,g))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}rt.getSchemaRefs=mh,Object.defineProperty(kt,"__esModule",{value:!0}),kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;const Oc=Hr,Nc=Xe,Fn=tr,us=Xe,vh=cs,Pa=qt,qn=hr,re=ge,oe=Ft,gh=rt,rr=G,Ea=ba;function _h(t){if(Mc(t)&&(Lc(t),Dc(t))){wh(t);return}Ac(t,()=>(0,Oc.topBoolOrEmptySchema)(t))}kt.validateFunctionCode=_h;function Ac({gen:t,validateName:e,schema:a,schemaEnv:s,opts:r},n){r.code.es5?t.func(e,(0,re._)`${oe.default.data}, ${oe.default.valCxt}`,s.$async,()=>{t.code((0,re._)`"use strict"; ${jc(a,r)}`),bh(t,r),t.code(n)}):t.func(e,(0,re._)`${oe.default.data}, ${yh(r)}`,s.$async,()=>t.code(jc(a,r)).code(n))}function yh(t){return(0,re._)`{${oe.default.instancePath}="", ${oe.default.parentData}, ${oe.default.parentDataProperty}, ${oe.default.rootData}=${oe.default.data}${t.dynamicRef?(0,re._)`, ${oe.default.dynamicAnchors}={}`:re.nil}}={}`}function bh(t,e){t.if(oe.default.valCxt,()=>{t.var(oe.default.instancePath,(0,re._)`${oe.default.valCxt}.${oe.default.instancePath}`),t.var(oe.default.parentData,(0,re._)`${oe.default.valCxt}.${oe.default.parentData}`),t.var(oe.default.parentDataProperty,(0,re._)`${oe.default.valCxt}.${oe.default.parentDataProperty}`),t.var(oe.default.rootData,(0,re._)`${oe.default.valCxt}.${oe.default.rootData}`),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`${oe.default.valCxt}.${oe.default.dynamicAnchors}`)},()=>{t.var(oe.default.instancePath,(0,re._)`""`),t.var(oe.default.parentData,(0,re._)`undefined`),t.var(oe.default.parentDataProperty,(0,re._)`undefined`),t.var(oe.default.rootData,oe.default.data),e.dynamicRef&&t.var(oe.default.dynamicAnchors,(0,re._)`{}`)})}function wh(t){const{schema:e,opts:a,gen:s}=t;Ac(t,()=>{a.$comment&&e.$comment&&qc(t),Rh(t),s.let(oe.default.vErrors,null),s.let(oe.default.errors,0),a.unevaluated&&$h(t),Fc(t),Th(t)})}function $h(t){const{gen:e,validateName:a}=t;t.evaluated=e.const("evaluated",(0,re._)`${a}.evaluated`),e.if((0,re._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,re._)`${t.evaluated}.props`,(0,re._)`undefined`)),e.if((0,re._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,re._)`${t.evaluated}.items`,(0,re._)`undefined`))}function jc(t,e){const a=typeof t=="object"&&t[e.schemaId];return a&&(e.code.source||e.code.process)?(0,re._)`/*# sourceURL=${a} */`:re.nil}function Ph(t,e){if(Mc(t)&&(Lc(t),Dc(t))){Eh(t,e);return}(0,Oc.boolOrEmptySchema)(t,e)}function Dc({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 Mc(t){return typeof t.schema!="boolean"}function Eh(t,e){const{schema:a,gen:s,opts:r}=t;r.$comment&&a.$comment&&qc(t),kh(t),xh(t);const n=s.const("_errs",oe.default.errors);Fc(t,n),s.var(e,(0,re._)`${n} === ${oe.default.errors}`)}function Lc(t){(0,rr.checkUnknownRules)(t),Sh(t)}function Fc(t,e){if(t.opts.jtd)return Uc(t,[],!1,e);const a=(0,Nc.getSchemaTypes)(t.schema),s=(0,Nc.coerceAndCheckDataType)(t,a);Uc(t,a,!s,e)}function Sh(t){const{schema:e,errSchemaPath:a,opts:s,self:r}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,rr.schemaHasRulesButRef)(e,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function Rh(t){const{schema:e,opts:a}=t;e.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,rr.checkStrictMode)(t,"default is ignored in the schema root")}function kh(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,gh.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function xh(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function qc({gen:t,schemaEnv:e,schema:a,errSchemaPath:s,opts:r}){const n=a.$comment;if(r.$comment===!0)t.code((0,re._)`${oe.default.self}.logger.log(${n})`);else if(typeof r.$comment=="function"){const i=(0,re.str)`${s}/$comment`,o=t.scopeValue("root",{ref:e.root});t.code((0,re._)`${oe.default.self}.opts.$comment(${n}, ${i}, ${o}.schema)`)}}function Th(t){const{gen:e,schemaEnv:a,validateName:s,ValidationError:r,opts:n}=t;a.$async?e.if((0,re._)`${oe.default.errors} === 0`,()=>e.return(oe.default.data),()=>e.throw((0,re._)`new ${r}(${oe.default.vErrors})`)):(e.assign((0,re._)`${s}.errors`,oe.default.vErrors),n.unevaluated&&Ih(t),e.return((0,re._)`${oe.default.errors} === 0`))}function Ih({gen:t,evaluated:e,props:a,items:s}){a instanceof re.Name&&t.assign((0,re._)`${e}.props`,a),s instanceof re.Name&&t.assign((0,re._)`${e}.items`,s)}function Uc(t,e,a,s){const{gen:r,schema:n,data:i,allErrors:o,opts:l,self:c}=t,{RULES:u}=c;if(n.$ref&&(l.ignoreKeywordsWithRef||!(0,rr.schemaHasRulesButRef)(n,u))){r.block(()=>Zc(t,"$ref",u.all.$ref.definition));return}l.jtd||Ch(t,e),r.block(()=>{for(const g of u.rules)d(g);d(u.post)});function d(g){(0,Fn.shouldUseGroup)(n,g)&&(g.type?(r.if((0,us.checkDataType)(g.type,i,l.strictNumbers)),Vc(t,g),e.length===1&&e[0]===g.type&&a&&(r.else(),(0,us.reportTypeError)(t)),r.endIf()):Vc(t,g),o||r.if((0,re._)`${oe.default.errors} === ${s||0}`))}}function Vc(t,e){const{gen:a,schema:s,opts:{useDefaults:r}}=t;r&&(0,vh.assignDefaults)(t,e.type),a.block(()=>{for(const n of e.rules)(0,Fn.shouldUseRule)(s,n)&&Zc(t,n.keyword,n.definition,e.type)})}function Ch(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Oh(t,e),t.opts.allowUnionTypes||Nh(t,e),Ah(t,t.dataTypes))}function Oh(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(a=>{zc(t.dataTypes,a)||Un(t,`type "${a}" not allowed by context "${t.dataTypes.join(",")}"`)}),Dh(t,e)}}function Nh(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Un(t,"use allowUnionTypes to allow union type keyword")}function Ah(t,e){const a=t.self.RULES.all;for(const s in a){const r=a[s];if(typeof r=="object"&&(0,Fn.shouldUseRule)(t.schema,r)){const{type:n}=r.definition;n.length&&!n.some(i=>jh(e,i))&&Un(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function jh(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function zc(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Dh(t,e){const a=[];for(const s of t.dataTypes)zc(e,s)?a.push(s):e.includes("integer")&&s==="number"&&a.push("integer");t.dataTypes=a}function Un(t,e){const a=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${a}" (strictTypes)`,(0,rr.checkStrictMode)(t,e,t.opts.strictTypes)}class Hc{constructor(e,a,s){if((0,Pa.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,rr.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",Kc(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Pa.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",oe.default.errors))}result(e,a,s){this.failResult((0,re.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,re.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,re._)`${a} !== undefined && (${(0,re.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?Ea.reportExtraError:Ea.reportError)(this,this.def.error,a)}$dataError(){(0,Ea.reportError)(this,this.def.$dataError||Ea.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ea.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=re.nil){this.gen.block(()=>{this.check$data(e,s),a()})}check$data(e=re.nil,a=re.nil){if(!this.$data)return;const{gen:s,schemaCode:r,schemaType:n,def:i}=this;s.if((0,re.or)((0,re._)`${r} === undefined`,a)),e!==re.nil&&s.assign(e,!0),(n.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==re.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:a,schemaType:s,def:r,it:n}=this;return(0,re.or)(i(),o());function i(){if(s.length){if(!(a instanceof re.Name))throw new Error("ajv implementation error");const l=Array.isArray(s)?s:[s];return(0,re._)`${(0,us.checkDataTypes)(l,a,n.opts.strictNumbers,us.DataType.Wrong)}`}return re.nil}function o(){if(r.validateSchema){const l=e.scopeValue("validate$data",{ref:r.validateSchema});return(0,re._)`!${l}(${a})`}return re.nil}}subschema(e,a){const s=(0,qn.getSubschema)(this.it,e);(0,qn.extendSubschemaData)(s,this.it,e),(0,qn.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return Ph(r,a),r}mergeEvaluated(e,a){const{it:s,gen:r}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=rr.mergeEvaluated.props(r,e.props,s.props,a)),s.items!==!0&&e.items!==void 0&&(s.items=rr.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,re.Name)),!0}}kt.KeywordCxt=Hc;function Zc(t,e,a,s){const r=new Hc(t,a,e);"code"in a?a.code(r,s):r.$data&&a.validate?(0,Pa.funcKeywordCode)(r,a):"macro"in a?(0,Pa.macroKeywordCode)(r,a):(a.compile||a.validate)&&(0,Pa.funcKeywordCode)(r,a)}const Mh=/^\/(?:[^~]|~0|~1)*$/,Lh=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Kc(t,{dataLevel:e,dataNames:a,dataPathArr:s}){let r,n;if(t==="")return oe.default.rootData;if(t[0]==="/"){if(!Mh.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);r=t,n=oe.default.rootData}else{const c=Lh.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+c[1];if(r=c[2],r==="#"){if(u>=e)throw new Error(l("property/index",u));return s[e-u]}if(u>e)throw new Error(l("data",u));if(n=a[e-u],!r)return n}let i=n;const o=r.split("/");for(const c of o)c&&(n=(0,re._)`${n}${(0,re.getProperty)((0,rr.unescapeJsonPointer)(c))}`,i=(0,re._)`${i} && ${n}`);return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}kt.getData=Kc;var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});let Fh=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Sa.default=Fh;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});const Vn=rt;let qh=class extends Error{constructor(e,a,s,r){super(r||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,Vn.resolveUrl)(e,a,s),this.missingSchema=(0,Vn.normalizeId)((0,Vn.getFullPath)(e,this.missingRef))}};Wr.default=qh;var ft={};Object.defineProperty(ft,"__esModule",{value:!0}),ft.resolveSchema=ft.getCompilingSchema=ft.resolveRef=ft.compileSchema=ft.SchemaEnv=void 0;const xt=ge,Uh=Sa,Ir=Ft,Tt=rt,Bc=G,Vh=kt;class ds{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,Tt.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={}}}ft.SchemaEnv=ds;function zn(t){const e=Wc.call(this,t);if(e)return e;const a=(0,Tt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:r}=this.opts.code,{ownProperties:n}=this.opts,i=new xt.CodeGen(this.scope,{es5:s,lines:r,ownProperties:n});let o;t.$async&&(o=i.scopeValue("Error",{ref:Uh.default,code:(0,xt._)`require("ajv/dist/runtime/validation_error").default`}));const l=i.scopeName("validate");t.validateName=l;const c={gen:i,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[xt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,xt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:o,schema:t.schema,schemaEnv:t,rootId:a,baseId:t.baseId||a,schemaPath:xt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xt._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(t),(0,Vh.validateFunctionCode)(c),i.optimize(this.opts.code.optimize);const d=i.toString();u=`${i.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));const f=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){const{props:m,items:p}=c;f.evaluated={props:m instanceof xt.Name?void 0:m,items:p instanceof xt.Name?void 0:p,dynamicProps:m instanceof xt.Name,dynamicItems:p instanceof xt.Name},f.source&&(f.source.evaluated=(0,xt.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)}}ft.compileSchema=zn;function zh(t,e,a){var s;a=(0,Tt.resolveUrl)(this.opts.uriResolver,e,a);const r=t.refs[a];if(r)return r;let n=Kh.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 ds({schema:i,schemaId:o,root:t,baseId:e}))}if(n!==void 0)return t.refs[a]=Hh.call(this,n)}ft.resolveRef=zh;function Hh(t){return(0,Tt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:zn.call(this,t)}function Wc(t){for(const e of this._compilations)if(Zh(e,t))return e}ft.getCompilingSchema=Wc;function Zh(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Kh(t,e){let a;for(;typeof(a=this.refs[e])=="string";)e=a;return a||this.schemas[e]||fs.call(this,t,e)}function fs(t,e){const a=this.opts.uriResolver.parse(e),s=(0,Tt._getFullPath)(this.opts.uriResolver,a);let r=(0,Tt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===r)return Hn.call(this,a,t);const n=(0,Tt.normalizeId)(s),i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const o=fs.call(this,t,i);return typeof(o==null?void 0:o.schema)!="object"?void 0:Hn.call(this,a,o)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||zn.call(this,i),n===(0,Tt.normalizeId)(e)){const{schema:o}=i,{schemaId:l}=this.opts,c=o[l];return c&&(r=(0,Tt.resolveUrl)(this.opts.uriResolver,r,c)),new ds({schema:o,schemaId:l,root:t,baseId:r})}return Hn.call(this,a,i)}}ft.resolveSchema=fs;const Bh=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hn(t,{baseId:e,schema:a,root:s}){var r;if(((r=t.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(const o of t.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const l=a[(0,Bc.unescapeFragment)(o)];if(l===void 0)return;a=l;const c=typeof a=="object"&&a[this.opts.schemaId];!Bh.has(o)&&c&&(e=(0,Tt.resolveUrl)(this.opts.uriResolver,e,c))}let n;if(typeof a!="boolean"&&a.$ref&&!(0,Bc.schemaHasRulesButRef)(a,this.RULES)){const o=(0,Tt.resolveUrl)(this.opts.uriResolver,e,a.$ref);n=fs.call(this,s,o)}const{schemaId:i}=this.opts;if(n=n||new ds({schema:a,schemaId:i,root:s,baseId:e}),n.schema!==n.root.schema)return n}const Wh={$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 Zn={},hs={exports:{}},Jh={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:Qh}=Jh,Gh=/^(?:(?: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 Jc(t){if(Yc(t,".")<3)return{host:t,isIPV4:!1};const e=t.match(Gh)||[],[a]=e;return a?{host:Xh(a,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function Qc(t,e=!1){let a="",s=!0;for(const r of t){if(Qh[r]===void 0)return;r!=="0"&&s===!0&&(s=!1),s||(a+=r)}return e&&a.length===0&&(a="0"),a}function Yh(t){let e=0;const a={error:!1,address:"",zone:""},s=[],r=[];let n=!1,i=!1,o=!1;function l(){if(r.length){if(n===!1){const c=Qc(r);if(c!==void 0)s.push(c);else return a.error=!0,!1}r.length=0}return!0}for(let c=0;c<t.length;c++){const u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(o=!0),!l())break;if(e++,s.push(":"),e>7){a.error=!0;break}c-1>=0&&t[c-1]===":"&&(i=!0);continue}else if(u==="%"){if(!l())break;n=!0}else{r.push(u);continue}}return r.length&&(n?a.zone=r.join(""):o?s.push(r.join("")):s.push(Qc(r))),a.address=s.join(""),a}function Gc(t){if(Yc(t,":")<2)return{host:t,isIPV6:!1};const e=Yh(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 Xh(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 Yc(t,e){let a=0;for(let s=0;s<t.length;s++)t[s]===e&&a++;return a}const Xc=/^\.\.?\//u,el=/^\/\.(?:\/|$)/u,tl=/^\/\.\.(?:\/|$)/u,ep=/^\/?(?:.|\n)*?(?=\/|$)/u;function tp(t){const e=[];for(;t.length;)if(t.match(Xc))t=t.replace(Xc,"");else if(t.match(el))t=t.replace(el,"/");else if(t.match(tl))t=t.replace(tl,"/"),e.pop();else if(t==="."||t==="..")t="";else{const a=t.match(ep);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 rp(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 ap(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=Jc(a);if(s.isIPV4)a=s.host;else{const r=Gc(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 sp={recomposeAuthority:ap,normalizeComponentEncoding:rp,removeDotSegments:tp,normalizeIPv4:Jc,normalizeIPv6:Gc};const np=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,ip=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function rl(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function al(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function sl(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 op(t){return t.secure=rl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function cp(t){if((t.port===(rl(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 lp(t,e){if(!t.path)return t.error="URN can not be parsed",t;const a=t.path.match(ip);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 up(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 dp(t,e){const a=t;return a.uuid=a.nss,a.nss=void 0,!e.tolerant&&(!a.uuid||!np.test(a.uuid))&&(a.error=a.error||"UUID is not valid."),a}function fp(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const nl={scheme:"http",domainHost:!0,parse:al,serialize:sl},hp={scheme:"https",domainHost:nl.domainHost,parse:al,serialize:sl},ps={scheme:"ws",domainHost:!0,parse:op,serialize:cp},pp={scheme:"wss",domainHost:ps.domainHost,parse:ps.parse,serialize:ps.serialize},Kn={http:nl,https:hp,ws:ps,wss:pp,urn:{scheme:"urn",parse:lp,serialize:up,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:dp,serialize:fp,skipNormalize:!0}};var mp=Kn;const{normalizeIPv6:vp,normalizeIPv4:gp,removeDotSegments:Ra,recomposeAuthority:_p,normalizeComponentEncoding:ms}=sp,Bn=mp;function yp(t,e){return typeof t=="string"?t=Vt(ar(t,e),e):typeof t=="object"&&(t=ar(Vt(t,e),e)),t}function bp(t,e,a){const s=Object.assign({scheme:"null"},a),r=il(ar(t,s),ar(e,s),s,!0);return Vt(r,{...s,skipEscape:!0})}function il(t,e,a,s){const r={};return s||(t=ar(Vt(t,a),a),e=ar(Vt(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=Ra(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=Ra(e.path||""),r.query=e.query):(e.path?(e.path.charAt(0)==="/"?r.path=Ra(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=Ra(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 wp(t,e,a){return typeof t=="string"?(t=unescape(t),t=Vt(ms(ar(t,a),!0),{...a,skipEscape:!0})):typeof t=="object"&&(t=Vt(ms(t,!0),{...a,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Vt(ms(ar(e,a),!0),{...a,skipEscape:!0})):typeof e=="object"&&(e=Vt(ms(e,!0),{...a,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Vt(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=Bn[(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=_p(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=Ra(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 $p=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function Pp(t){let e=0;for(let a=0,s=t.length;a<s;++a)if(e=t.charCodeAt(a),e>126||$p[e])return!0;return!1}const Ep=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ar(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(Ep);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 l=gp(s.host);if(l.isIPV4===!1){const c=vp(l.host);s.host=c.host.toLowerCase(),n=c.isIPV6}else s.host=l.host,n=!0}s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",a.reference&&a.reference!=="suffix"&&a.reference!==s.reference&&(s.error=s.error||"URI is not a "+a.reference+" reference.");const o=Bn[(a.scheme||s.scheme||"").toLowerCase()];if(!a.unicodeSupport&&(!o||!o.unicodeSupport)&&s.host&&(a.domainHost||o&&o.domainHost)&&n===!1&&Pp(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(l){s.error=s.error||"Host's domain name can not be converted to ASCII: "+l}(!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 Wn={SCHEMES:Bn,normalize:yp,resolve:bp,resolveComponents:il,equal:wp,serialize:Vt,parse:ar};hs.exports=Wn,hs.exports.default=Wn,hs.exports.fastUri=Wn;var Sp=hs.exports;Object.defineProperty(Zn,"__esModule",{value:!0});const ol=Sp;ol.code='require("ajv/dist/runtime/uri").default',Zn.default=ol,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=kt;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=Sa,r=Wr,n=xr,i=ft,o=ge,l=rt,c=Xe,u=G,d=Wh,g=Zn,f=(N,R)=>new RegExp(N,R);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.'},b=200;function P(N){var R,j,T,_,w,O,K,Q,fe,ne,he,ct,Ke,Te,Pt,Ge,Qt,Lt,ze,Et,lr,qe,Ue,tt,Rr;const ur=N.strict,qr=(R=N.code)===null||R===void 0?void 0:R.optimize,Pn=qr===!0||qr===void 0?1:qr||0,St=(T=(j=N.code)===null||j===void 0?void 0:j.regExp)!==null&&T!==void 0?T:f,Ur=(_=N.uriResolver)!==null&&_!==void 0?_:g.default;return{strictSchema:(O=(w=N.strictSchema)!==null&&w!==void 0?w:ur)!==null&&O!==void 0?O:!0,strictNumbers:(Q=(K=N.strictNumbers)!==null&&K!==void 0?K:ur)!==null&&Q!==void 0?Q:!0,strictTypes:(ne=(fe=N.strictTypes)!==null&&fe!==void 0?fe:ur)!==null&&ne!==void 0?ne:"log",strictTuples:(ct=(he=N.strictTuples)!==null&&he!==void 0?he:ur)!==null&&ct!==void 0?ct:"log",strictRequired:(Te=(Ke=N.strictRequired)!==null&&Ke!==void 0?Ke:ur)!==null&&Te!==void 0?Te:!1,code:N.code?{...N.code,optimize:Pn,regExp:St}:{optimize:Pn,regExp:St},loopRequired:(Pt=N.loopRequired)!==null&&Pt!==void 0?Pt:b,loopEnum:(Ge=N.loopEnum)!==null&&Ge!==void 0?Ge:b,meta:(Qt=N.meta)!==null&&Qt!==void 0?Qt:!0,messages:(Lt=N.messages)!==null&&Lt!==void 0?Lt:!0,inlineRefs:(ze=N.inlineRefs)!==null&&ze!==void 0?ze:!0,schemaId:(Et=N.schemaId)!==null&&Et!==void 0?Et:"$id",addUsedSchema:(lr=N.addUsedSchema)!==null&&lr!==void 0?lr:!0,validateSchema:(qe=N.validateSchema)!==null&&qe!==void 0?qe:!0,validateFormats:(Ue=N.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(tt=N.unicodeRegExp)!==null&&tt!==void 0?tt:!0,int32range:(Rr=N.int32range)!==null&&Rr!==void 0?Rr:!0,uriResolver:Ur}}class S{constructor(R={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,R=this.opts={...R,...P(R)};const{es5:j,lines:T}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:p,es5:j,lines:T}),this.logger=H(R.logger);const _=R.validateFormats;R.validateFormats=!1,this.RULES=(0,n.getRules)(),x.call(this,h,R,"NOT SUPPORTED"),x.call(this,v,R,"DEPRECATED","warn"),this._metaOpts=W.call(this),R.formats&&U.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),R.keywords&&D.call(this,R.keywords),typeof R.meta=="object"&&this.addMetaSchema(R.meta),z.call(this),R.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:R,meta:j,schemaId:T}=this.opts;let _=d;T==="id"&&(_={...d},_.id=_.$id,delete _.$id),j&&R&&this.addMetaSchema(_,_[T],!1)}defaultMeta(){const{meta:R,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof R=="object"?R[j]||R:void 0}validate(R,j){let T;if(typeof R=="string"){if(T=this.getSchema(R),!T)throw new Error(`no schema with key or ref "${R}"`)}else T=this.compile(R);const _=T(j);return"$async"in T||(this.errors=T.errors),_}compile(R,j){const T=this._addSchema(R,j);return T.validate||this._compileSchemaEnv(T)}compileAsync(R,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:T}=this.opts;return _.call(this,R,j);async function _(ne,he){await w.call(this,ne.$schema);const ct=this._addSchema(ne,he);return ct.validate||O.call(this,ct)}async function w(ne){ne&&!this.getSchema(ne)&&await _.call(this,{$ref:ne},!0)}async function O(ne){try{return this._compileSchemaEnv(ne)}catch(he){if(!(he instanceof r.default))throw he;return K.call(this,he),await Q.call(this,he.missingSchema),O.call(this,ne)}}function K({missingSchema:ne,missingRef:he}){if(this.refs[ne])throw new Error(`AnySchema ${ne} is loaded but ${he} cannot be resolved`)}async function Q(ne){const he=await fe.call(this,ne);this.refs[ne]||await w.call(this,he.$schema),this.refs[ne]||this.addSchema(he,ne,j)}async function fe(ne){const he=this._loading[ne];if(he)return he;try{return await(this._loading[ne]=T(ne))}finally{delete this._loading[ne]}}}addSchema(R,j,T,_=this.opts.validateSchema){if(Array.isArray(R)){for(const O of R)this.addSchema(O,void 0,T,_);return this}let w;if(typeof R=="object"){const{schemaId:O}=this.opts;if(w=R[O],w!==void 0&&typeof w!="string")throw new Error(`schema ${O} must be string`)}return j=(0,l.normalizeId)(j||w),this._checkUnique(j),this.schemas[j]=this._addSchema(R,T,j,_,!0),this}addMetaSchema(R,j,T=this.opts.validateSchema){return this.addSchema(R,j,!0,T),this}validateSchema(R,j){if(typeof R=="boolean")return!0;let T;if(T=R.$schema,T!==void 0&&typeof T!="string")throw new Error("$schema must be a string");if(T=T||this.opts.defaultMeta||this.defaultMeta(),!T)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(T,R);if(!_&&j){const w="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(w);else throw new Error(w)}return _}getSchema(R){let j;for(;typeof(j=A.call(this,R))=="string";)R=j;if(j===void 0){const{schemaId:T}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:T});if(j=i.resolveSchema.call(this,_,R),!j)return;this.refs[R]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(R){if(R instanceof RegExp)return this._removeAllSchemas(this.schemas,R),this._removeAllSchemas(this.refs,R),this;switch(typeof R){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=A.call(this,R);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[R],delete this.refs[R],this}case"object":{const j=R;this._cache.delete(j);let T=R[this.opts.schemaId];return T&&(T=(0,l.normalizeId)(T),delete this.schemas[T],delete this.refs[T]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(R){for(const j of R)this.addKeyword(j);return this}addKeyword(R,j){let T;if(typeof R=="string")T=R,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=T);else if(typeof R=="object"&&j===void 0){if(j=R,T=j.keyword,Array.isArray(T)&&!T.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M.call(this,T,j),!j)return(0,u.eachItem)(T,w=>te.call(this,w)),this;ve.call(this,j);const _={...j,type:(0,c.getJSONTypes)(j.type),schemaType:(0,c.getJSONTypes)(j.schemaType)};return(0,u.eachItem)(T,_.type.length===0?w=>te.call(this,w,_):w=>_.type.forEach(O=>te.call(this,w,_,O))),this}getKeyword(R){const j=this.RULES.all[R];return typeof j=="object"?j.definition:!!j}removeKeyword(R){const{RULES:j}=this;delete j.keywords[R],delete j.all[R];for(const T of j.rules){const _=T.rules.findIndex(w=>w.keyword===R);_>=0&&T.rules.splice(_,1)}return this}addFormat(R,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[R]=j,this}errorsText(R=this.errors,{separator:j=", ",dataVar:T="data"}={}){return!R||R.length===0?"No errors":R.map(_=>`${T}${_.instancePath} ${_.message}`).reduce((_,w)=>_+j+w)}$dataMetaSchema(R,j){const T=this.RULES.all;R=JSON.parse(JSON.stringify(R));for(const _ of j){const w=_.split("/").slice(1);let O=R;for(const K of w)O=O[K];for(const K in T){const Q=T[K];if(typeof Q!="object")continue;const{$data:fe}=Q.definition,ne=O[K];fe&&ne&&(O[K]=de(ne))}}return R}_removeAllSchemas(R,j){for(const T in R){const _=R[T];(!j||j.test(T))&&(typeof _=="string"?delete R[T]:_&&!_.meta&&(this._cache.delete(_.schema),delete R[T]))}}_addSchema(R,j,T,_=this.opts.validateSchema,w=this.opts.addUsedSchema){let O;const{schemaId:K}=this.opts;if(typeof R=="object")O=R[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof R!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(R);if(Q!==void 0)return Q;T=(0,l.normalizeId)(O||T);const fe=l.getSchemaRefs.call(this,R,T);return Q=new i.SchemaEnv({schema:R,schemaId:K,meta:j,baseId:T,localRefs:fe}),this._cache.set(Q.schema,Q),w&&!T.startsWith("#")&&(T&&this._checkUnique(T),this.refs[T]=Q),_&&this.validateSchema(R,!0),Q}_checkUnique(R){if(this.schemas[R]||this.refs[R])throw new Error(`schema with key or id "${R}" already exists`)}_compileSchemaEnv(R){if(R.meta?this._compileMetaSchema(R):i.compileSchema.call(this,R),!R.validate)throw new Error("ajv implementation error");return R.validate}_compileMetaSchema(R){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,R)}finally{this.opts=j}}}S.ValidationError=s.default,S.MissingRefError=r.default,t.default=S;function x(N,R,j,T="error"){for(const _ in N){const w=_;w in R&&this.logger[T](`${j}: option ${_}. ${N[w]}`)}}function A(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function z(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const R in N)this.addSchema(N[R],R)}function U(){for(const N in this.opts.formats){const R=this.opts.formats[N];R&&this.addFormat(N,R)}}function D(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const R in N){const j=N[R];j.keyword||(j.keyword=R),this.addKeyword(j)}}function W(){const N={...this.opts};for(const R of m)delete N[R];return N}const J={log(){},warn(){},error(){}};function H(N){if(N===!1)return J;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function M(N,R){const{RULES:j}=this;if((0,u.eachItem)(N,T=>{if(j.keywords[T])throw new Error(`Keyword ${T} is already defined`);if(!F.test(T))throw new Error(`Keyword ${T} has invalid name`)}),!!R&&R.$data&&!("code"in R||"validate"in R))throw new Error('$data keyword must have "code" or "validate" function')}function te(N,R,j){var T;const _=R==null?void 0:R.post;if(j&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:w}=this;let O=_?w.post:w.rules.find(({type:Q})=>Q===j);if(O||(O={type:j,rules:[]},w.rules.push(O)),w.keywords[N]=!0,!R)return;const K={keyword:N,definition:{...R,type:(0,c.getJSONTypes)(R.type),schemaType:(0,c.getJSONTypes)(R.schemaType)}};R.before?ye.call(this,O,K,R.before):O.rules.push(K),w.all[N]=K,(T=R.implements)===null||T===void 0||T.forEach(Q=>this.addKeyword(Q))}function ye(N,R,j){const T=N.rules.findIndex(_=>_.keyword===j);T>=0?N.rules.splice(T,0,R):(N.rules.push(R),this.logger.warn(`rule ${j} is not defined`))}function ve(N){let{metaSchema:R}=N;R!==void 0&&(N.$data&&this.opts.$data&&(R=de(R)),N.validateSchema=this.compile(R,!0))}const we={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function de(N){return{anyOf:[N,we]}}}(cc);var Jn={},Qn={},Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});const Rp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Gn.default=Rp;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.callRef=Cr.getValidate=void 0;const kp=Wr,cl=_e,ht=ge,Jr=Ft,ll=ft,vs=G,xp={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:a,it:s}=t,{baseId:r,schemaEnv:n,validateName:i,opts:o,self:l}=s,{root:c}=n;if((a==="#"||a==="#/")&&r===c.baseId)return d();const u=ll.resolveRef.call(l,c,r,a);if(u===void 0)throw new kp.default(s.opts.uriResolver,r,a);if(u instanceof ll.SchemaEnv)return g(u);return f(u);function d(){if(n===c)return gs(t,i,n,n.$async);const m=e.scopeValue("root",{ref:c});return gs(t,(0,ht._)`${m}.validate`,c,c.$async)}function g(m){const p=ul(t,m);gs(t,p,m,m.$async)}function f(m){const p=e.scopeValue("schema",o.code.source===!0?{ref:m,code:(0,ht.stringify)(m)}:{ref:m}),h=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:ht.nil,topSchemaRef:p,errSchemaPath:a},h);t.mergeEvaluated(v),t.ok(h)}}};function ul(t,e){const{gen:a}=t;return e.validate?a.scopeValue("validate",{ref:e.validate}):(0,ht._)`${a.scopeValue("wrapper",{ref:e})}.validate`}Cr.getValidate=ul;function gs(t,e,a,s){const{gen:r,it:n}=t,{allErrors:i,schemaEnv:o,opts:l}=n,c=l.passContext?Jr.default.this:ht.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,ht._)`await ${(0,cl.callValidateCode)(t,e,c)}`),f(e),i||r.assign(m,!0)},p=>{r.if((0,ht._)`!(${p} instanceof ${n.ValidationError})`,()=>r.throw(p)),g(p),i||r.assign(m,!1)}),t.ok(m)}function d(){t.result((0,cl.callValidateCode)(t,e,c),()=>f(e),()=>g(e))}function g(m){const p=(0,ht._)`${m}.errors`;r.assign(Jr.default.vErrors,(0,ht._)`${Jr.default.vErrors} === null ? ${p} : ${Jr.default.vErrors}.concat(${p})`),r.assign(Jr.default.errors,(0,ht._)`${Jr.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=vs.mergeEvaluated.props(r,h.props,n.props));else{const v=r.var("props",(0,ht._)`${m}.evaluated.props`);n.props=vs.mergeEvaluated.props(r,v,n.props,ht.Name)}if(n.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(n.items=vs.mergeEvaluated.items(r,h.items,n.items));else{const v=r.var("items",(0,ht._)`${m}.evaluated.items`);n.items=vs.mergeEvaluated.items(r,v,n.items,ht.Name)}}}Cr.callRef=gs,Cr.default=xp,Object.defineProperty(Qn,"__esModule",{value:!0});const Tp=Gn,Ip=Cr,Cp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Tp.default,Ip.default];Qn.default=Cp;var Yn={},Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});const _s=ge,mr=_s.operators,ys={maximum:{okStr:"<=",ok:mr.LTE,fail:mr.GT},minimum:{okStr:">=",ok:mr.GTE,fail:mr.LT},exclusiveMaximum:{okStr:"<",ok:mr.LT,fail:mr.GTE},exclusiveMinimum:{okStr:">",ok:mr.GT,fail:mr.LTE}},Op={message:({keyword:t,schemaCode:e})=>(0,_s.str)`must be ${ys[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,_s._)`{comparison: ${ys[t].okStr}, limit: ${e}}`},Np={keyword:Object.keys(ys),type:"number",schemaType:"number",$data:!0,error:Op,code(t){const{keyword:e,data:a,schemaCode:s}=t;t.fail$data((0,_s._)`${a} ${ys[e].fail} ${s} || isNaN(${a})`)}};Xn.default=Np;var ei={};Object.defineProperty(ei,"__esModule",{value:!0});const ka=ge,Ap={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>(0,ka.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ka._)`{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,ka._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${n}`:(0,ka._)`${i} !== parseInt(${i})`;t.fail$data((0,ka._)`(${s} === 0 || (${i} = ${a}/${s}, ${o}))`)}};ei.default=Ap;var ti={},ri={};Object.defineProperty(ri,"__esModule",{value:!0});function dl(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}ri.default=dl,dl.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(ti,"__esModule",{value:!0});const Or=ge,jp=G,Dp=ri,Mp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxLength"?"more":"fewer";return(0,Or.str)`must NOT have ${a} than ${e} characters`},params:({schemaCode:t})=>(0,Or._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s,it:r}=t,n=e==="maxLength"?Or.operators.GT:Or.operators.LT,i=r.opts.unicode===!1?(0,Or._)`${a}.length`:(0,Or._)`${(0,jp.useFunc)(t.gen,Dp.default)}(${a})`;t.fail$data((0,Or._)`${i} ${n} ${s}`)}};ti.default=Mp;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});const Lp=_e,bs=ge,Fp={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,bs.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,bs._)`{pattern: ${t}}`},code(t){const{data:e,$data:a,schema:s,schemaCode:r,it:n}=t,i=n.opts.unicodeRegExp?"u":"",o=a?(0,bs._)`(new RegExp(${r}, ${i}))`:(0,Lp.usePattern)(t,s);t.fail$data((0,bs._)`!${o}.test(${e})`)}};ai.default=Fp;var si={};Object.defineProperty(si,"__esModule",{value:!0});const xa=ge,qp={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxProperties"?"more":"fewer";return(0,xa.str)`must NOT have ${a} than ${e} properties`},params:({schemaCode:t})=>(0,xa._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxProperties"?xa.operators.GT:xa.operators.LT;t.fail$data((0,xa._)`Object.keys(${a}).length ${r} ${s}`)}};si.default=qp;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});const Ta=_e,Ia=ge,Up=G,Vp={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>(0,Ia.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ia._)`{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 l=a.length>=o.loopRequired;if(i.allErrors?c():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,Up.checkStrictMode)(i,v,i.opts.strictRequired)}}function c(){if(l||n)t.block$data(Ia.nil,d);else for(const f of a)(0,Ta.checkReportMissingProp)(t,f)}function u(){const f=e.let("missing");if(l||n){const m=e.let("valid",!0);t.block$data(m,()=>g(f,m)),t.ok(m)}else e.if((0,Ta.checkMissingProp)(t,a,f)),(0,Ta.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",s,f=>{t.setParams({missingProperty:f}),e.if((0,Ta.noPropertyInData)(e,r,f,o.ownProperties),()=>t.error())})}function g(f,m){t.setParams({missingProperty:f}),e.forOf(f,s,()=>{e.assign(m,(0,Ta.propertyInData)(e,r,f,o.ownProperties)),e.if((0,Ia.not)(m),()=>{t.error(),e.break()})},Ia.nil)}}};ni.default=Vp;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});const Ca=ge,zp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const a=t==="maxItems"?"more":"fewer";return(0,Ca.str)`must NOT have ${a} than ${e} items`},params:({schemaCode:t})=>(0,Ca._)`{limit: ${t}}`},code(t){const{keyword:e,data:a,schemaCode:s}=t,r=e==="maxItems"?Ca.operators.GT:Ca.operators.LT;t.fail$data((0,Ca._)`${a}.length ${r} ${s}`)}};ii.default=zp;var oi={},Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});const fl=$a;fl.code='require("ajv/dist/runtime/equal").default',Oa.default=fl,Object.defineProperty(oi,"__esModule",{value:!0});const ci=Xe,at=ge,Hp=G,Zp=Oa,Kp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>(0,at.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,at._)`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:a,$data:s,schema:r,parentSchema:n,schemaCode:i,it:o}=t;if(!s&&!r)return;const l=e.let("valid"),c=n.items?(0,ci.getSchemaTypes)(n.items):[];t.block$data(l,u,(0,at._)`${i} === false`),t.ok(l);function u(){const m=e.let("i",(0,at._)`${a}.length`),p=e.let("j");t.setParams({i:m,j:p}),e.assign(l,!0),e.if((0,at._)`${m} > 1`,()=>(d()?g:f)(m,p))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function g(m,p){const h=e.name("item"),v=(0,ci.checkDataTypes)(c,h,o.opts.strictNumbers,ci.DataType.Wrong),b=e.const("indices",(0,at._)`{}`);e.for((0,at._)`;${m}--;`,()=>{e.let(h,(0,at._)`${a}[${m}]`),e.if(v,(0,at._)`continue`),c.length>1&&e.if((0,at._)`typeof ${h} == "string"`,(0,at._)`${h} += "_"`),e.if((0,at._)`typeof ${b}[${h}] == "number"`,()=>{e.assign(p,(0,at._)`${b}[${h}]`),t.error(),e.assign(l,!1).break()}).code((0,at._)`${b}[${h}] = ${m}`)})}function f(m,p){const h=(0,Hp.useFunc)(e,Zp.default),v=e.name("outer");e.label(v).for((0,at._)`;${m}--;`,()=>e.for((0,at._)`${p} = ${m}; ${p}--;`,()=>e.if((0,at._)`${h}(${a}[${m}], ${a}[${p}])`,()=>{t.error(),e.assign(l,!1).break(v)})))}}};oi.default=Kp;var li={};Object.defineProperty(li,"__esModule",{value:!0});const ui=ge,Bp=G,Wp=Oa,Jp={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>(0,ui._)`{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,ui._)`!${(0,Bp.useFunc)(e,Wp.default)}(${a}, ${r})`):t.fail((0,ui._)`${n} !== ${a}`)}};li.default=Jp;var di={};Object.defineProperty(di,"__esModule",{value:!0});const Na=ge,Qp=G,Gp=Oa,Yp={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Na._)`{allowedValues: ${t}}`},code(t){const{gen:e,data:a,$data:s,schema:r,schemaCode:n,it:i}=t;if(!s&&r.length===0)throw new Error("enum must have non-empty array");const o=r.length>=i.opts.loopEnum;let l;const c=()=>l??(l=(0,Qp.useFunc)(e,Gp.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,Na.or)(...r.map((m,p)=>g(f,p)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",n,f=>e.if((0,Na._)`${c()}(${a}, ${f})`,()=>e.assign(u,!0).break()))}function g(f,m){const p=r[m];return typeof p=="object"&&p!==null?(0,Na._)`${c()}(${a}, ${f}[${m}])`:(0,Na._)`${a} === ${p}`}}};di.default=Yp,Object.defineProperty(Yn,"__esModule",{value:!0});const Xp=Xn,em=ei,tm=ti,rm=ai,am=si,sm=ni,nm=ii,im=oi,om=li,cm=di,lm=[Xp.default,em.default,tm.default,rm.default,am.default,sm.default,nm.default,im.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},om.default,cm.default];Yn.default=lm;var fi={},Qr={};Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.validateAdditionalItems=void 0;const Nr=ge,hi=G,um={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,Nr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nr._)`{limit: ${t}}`},code(t){const{parentSchema:e,it:a}=t,{items:s}=e;if(!Array.isArray(s)){(0,hi.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}hl(t,s)}};function hl(t,e){const{gen:a,schema:s,data:r,keyword:n,it:i}=t;i.items=!0;const o=a.const("len",(0,Nr._)`${r}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,Nr._)`${o} <= ${e.length}`);else if(typeof s=="object"&&!(0,hi.alwaysValidSchema)(i,s)){const c=a.var("valid",(0,Nr._)`${o} <= ${e.length}`);a.if((0,Nr.not)(c),()=>l(c)),t.ok(c)}function l(c){a.forRange("i",e.length,o,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:hi.Type.Num},c),i.allErrors||a.if((0,Nr.not)(c),()=>a.break())})}}Qr.validateAdditionalItems=hl,Qr.default=um;var pi={},Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.validateTuple=void 0;const pl=ge,ws=G,dm=_e,fm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:a}=t;if(Array.isArray(e))return ml(t,"additionalItems",e);a.items=!0,!(0,ws.alwaysValidSchema)(a,e)&&t.ok((0,dm.validateArray)(t))}};function ml(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=ws.mergeEvaluated.items(s,a.length,o.items));const l=s.name("valid"),c=s.const("len",(0,pl._)`${n}.length`);a.forEach((d,g)=>{(0,ws.alwaysValidSchema)(o,d)||(s.if((0,pl._)`${c} > ${g}`,()=>t.subschema({keyword:i,schemaProp:g,dataProp:g},l)),t.ok(l))});function u(d){const{opts:g,errSchemaPath:f}=o,m=a.length,p=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(g.strictTuples&&!p){const h=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,ws.checkStrictMode)(o,h,g.strictTuples)}}}Gr.validateTuple=ml,Gr.default=fm,Object.defineProperty(pi,"__esModule",{value:!0});const hm=Gr,pm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,hm.validateTuple)(t,"items")};pi.default=pm;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});const vl=ge,mm=G,vm=_e,gm=Qr,_m={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>(0,vl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,vl._)`{limit: ${t}}`},code(t){const{schema:e,parentSchema:a,it:s}=t,{prefixItems:r}=a;s.items=!0,!(0,mm.alwaysValidSchema)(s,e)&&(r?(0,gm.validateAdditionalItems)(t,r):t.ok((0,vm.validateArray)(t)))}};mi.default=_m;var vi={};Object.defineProperty(vi,"__esModule",{value:!0});const bt=ge,$s=G,ym={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>e===void 0?(0,bt.str)`must contain at least ${t} valid item(s)`:(0,bt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,bt._)`{minContains: ${t}}`:(0,bt._)`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:a,parentSchema:s,data:r,it:n}=t;let i,o;const{minContains:l,maxContains:c}=s;n.opts.next?(i=l===void 0?1:l,o=c):i=1;const u=e.const("len",(0,bt._)`${r}.length`);if(t.setParams({min:i,max:o}),o===void 0&&i===0){(0,$s.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&i>o){(0,$s.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,$s.alwaysValidSchema)(n,a)){let p=(0,bt._)`${u} >= ${i}`;o!==void 0&&(p=(0,bt._)`${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,bt._)`${r}.length > 0`,g)):(e.let(d,!1),g()),t.result(d,()=>t.reset());function g(){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:$s.Type.Num,compositeRule:!0},p),h()})}function m(p){e.code((0,bt._)`${p}++`),o===void 0?e.if((0,bt._)`${p} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,bt._)`${p} > ${o}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,bt._)`${p} >= ${i}`,()=>e.assign(d,!0)))}}};vi.default=ym;var gl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=ge,a=G,s=_e;t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const d=c===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:d}})=>(0,e._)`{property: ${l},
|
|
6
6
|
missingProperty: ${d},
|
|
7
7
|
depsCount: ${c},
|
|
8
|
-
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=n(l);i(l,c),o(l,u)}};function n({schema:l}){const c={},u={};for(const d in l){if(d==="__proto__")continue;const v=Array.isArray(l[d])?c:u;v[d]=l[d]}return[c,u]}function i(l,c=l.schema){const{gen:u,data:d,it:v}=l;if(Object.keys(c).length===0)return;const f=u.let("missing");for(const m in c){const p=c[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,d,m,v.opts.ownProperties);l.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),v.allErrors?u.if(h,()=>{for(const g of p)(0,s.checkReportMissingProp)(l,g)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(l,p,f)})`),(0,s.reportMissingProp)(l,f),u.else())}}t.validatePropertyDeps=i;function o(l,c=l.schema){const{gen:u,data:d,keyword:v,it:f}=l,m=u.name("valid");for(const p in c)(0,a.alwaysValidSchema)(f,c[p])||(u.if((0,s.propertyInData)(u,d,p,f.opts.ownProperties),()=>{const h=l.subschema({keyword:v,schemaProp:p},m);l.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),l.ok(m))}t.validateSchemaDeps=o,t.default=r})(gl);var _i={};Object.defineProperty(_i,"__esModule",{value:!0});const _l=ge,wm=G,bm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,_l._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,wm.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,_l.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};_i.default=bm;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});const Rs=_e,It=ge,$m=Ft,ks=G,Pm={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,It._)`{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:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&(0,ks.alwaysValidSchema)(i,a))return;const c=(0,Rs.allSchemaProperties)(s.properties),u=(0,Rs.allSchemaProperties)(s.patternProperties);d(),t.ok((0,It._)`${n} === ${$m.default.errors}`);function d(){e.forIn("key",r,h=>{!c.length&&!u.length?m(h):e.if(v(h),()=>m(h))})}function v(h){let g;if(c.length>8){const w=(0,ks.schemaRefOrVal)(i,s.properties,"properties");g=(0,Rs.isOwnProperty)(e,w,h)}else c.length?g=(0,It.or)(...c.map(w=>(0,It._)`${h} === ${w}`)):g=It.nil;return u.length&&(g=(0,It.or)(g,...u.map(w=>(0,It._)`${(0,Rs.usePattern)(t,w)}.test(${h})`))),(0,It.not)(g)}function f(h){e.code((0,It._)`delete ${r}[${h}]`)}function m(h){if(l.removeAdditional==="all"||l.removeAdditional&&a===!1){f(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),o||e.break();return}if(typeof a=="object"&&!(0,ks.alwaysValidSchema)(i,a)){const g=e.name("valid");l.removeAdditional==="failing"?(p(h,g,!1),e.if((0,It.not)(g),()=>{t.reset(),f(h)})):(p(h,g),o||e.if((0,It.not)(g),()=>e.break()))}}function p(h,g,w){const P={keyword:"additionalProperties",dataProp:h,dataPropType:ks.Type.Str};w===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,g)}}};Ss.default=Pm;var yi={};Object.defineProperty(yi,"__esModule",{value:!0});const Em=kt,yl=_e,wi=G,wl=Ss,Sm={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&&wl.default.code(new Em.KeywordCxt(n,wl.default,"additionalProperties"));const i=(0,yl.allSchemaProperties)(a);for(const d of i)n.definedProperties.add(d);n.opts.unevaluated&&i.length&&n.props!==!0&&(n.props=wi.mergeEvaluated.props(e,(0,wi.toHash)(i),n.props));const o=i.filter(d=>!(0,wi.alwaysValidSchema)(n,a[d]));if(o.length===0)return;const l=e.name("valid");for(const d of o)c(d)?u(d):(e.if((0,yl.propertyInData)(e,r,d,n.opts.ownProperties)),u(d),n.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return n.opts.useDefaults&&!n.compositeRule&&a[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};yi.default=Sm;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});const bl=_e,xs=ge,$l=G,Pl=G,Rm={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,bl.allSchemaProperties)(a),l=o.filter(p=>(0,$l.alwaysValidSchema)(n,a[p]));if(o.length===0||l.length===o.length&&(!n.opts.unevaluated||n.props===!0))return;const c=i.strictSchema&&!i.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof xs.Name)&&(n.props=(0,Pl.evaluatedPropsToName)(e,n.props));const{props:d}=n;v();function v(){for(const p of o)c&&f(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function f(p){for(const h in c)new RegExp(p).test(h)&&(0,$l.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,xs._)`${(0,bl.usePattern)(t,p)}.test(${h})`,()=>{const g=l.includes(p);g||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:Pl.Type.Str},u),n.opts.unevaluated&&d!==!0?e.assign((0,xs._)`${d}[${h}]`,!0):!g&&!n.allErrors&&e.if((0,xs.not)(u),()=>e.break())})})}}};bi.default=Rm;var $i={};Object.defineProperty($i,"__esModule",{value:!0});const km=G,xm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,km.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"}};$i.default=xm;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});const Tm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:_e.validateUnion,error:{message:"must match a schema in anyOf"}};Pi.default=Tm;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});const Ts=ge,Im=G,Cm={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),l=e.name("_valid");t.setParams({passing:o}),e.block(c),t.result(i,()=>t.reset(),()=>t.error(!0));function c(){n.forEach((u,d)=>{let v;(0,Im.alwaysValidSchema)(r,u)?e.var(l,!0):v=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Ts._)`${l} && ${i}`).assign(i,!1).assign(o,(0,Ts._)`[${o}, ${d}]`).else(),e.if(l,()=>{e.assign(i,!0),e.assign(o,d),v&&t.mergeEvaluated(v,Ts.Name)})})}}};Ei.default=Cm;var Si={};Object.defineProperty(Si,"__esModule",{value:!0});const Om=G,Nm={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,Om.alwaysValidSchema)(s,n))return;const o=t.subschema({keyword:"allOf",schemaProp:i},r);t.ok(r),t.mergeEvaluated(o)})}};Si.default=Nm;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});const Is=ge,El=G,Am={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,Is.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Is._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,El.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=Sl(s,"then"),n=Sl(s,"else");if(!r&&!n)return;const i=e.let("valid",!0),o=e.name("_valid");if(l(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(o,c("then",u),c("else",u))}else r?e.if(o,c("then")):e.if((0,Is.not)(o),c("else"));t.pass(i,()=>t.error(!0));function l(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);t.mergeEvaluated(u)}function c(u,d){return()=>{const v=t.subschema({keyword:u},o);e.assign(i,o),t.mergeValidEvaluated(v,i),d?e.assign(d,(0,Is._)`${u}`):t.setParams({ifClause:u})}}}};function Sl(t,e){const a=t.schema[e];return a!==void 0&&!(0,El.alwaysValidSchema)(t,a)}Ri.default=Am;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});const jm=G,Dm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,jm.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};ki.default=Dm,Object.defineProperty(hi,"__esModule",{value:!0});const Mm=Qr,Lm=mi,Fm=Gr,qm=vi,Um=gi,Vm=gl,zm=_i,Hm=Ss,Zm=yi,Km=bi,Bm=$i,Wm=Pi,Jm=Ei,Qm=Si,Gm=Ri,Ym=ki;function Xm(t=!1){const e=[Bm.default,Wm.default,Jm.default,Qm.default,Gm.default,Ym.default,zm.default,Hm.default,Vm.default,Zm.default,Km.default];return t?e.push(Lm.default,qm.default):e.push(Mm.default,Fm.default),e.push(Um.default),e}hi.default=Xm;var xi={},Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});const He=ge,ev={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,He.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,He._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:i,it:o}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=o;if(!l.validateFormats)return;r?v():f();function v(){const m=a.scopeValue("formats",{ref:d.formats,code:l.code.formats}),p=a.const("fDef",(0,He._)`${m}[${i}]`),h=a.let("fType"),g=a.let("format");a.if((0,He._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,He._)`${p}.type || "string"`).assign(g,(0,He._)`${p}.validate`),()=>a.assign(h,(0,He._)`"string"`).assign(g,p)),t.fail$data((0,He.or)(w(),P()));function w(){return l.strictSchema===!1?He.nil:(0,He._)`${i} && !${g}`}function P(){const S=u.$async?(0,He._)`(${p}.async ? await ${g}(${s}) : ${g}(${s}))`:(0,He._)`${g}(${s})`,x=(0,He._)`(typeof ${g} == "function" ? ${S} : ${g}.test(${s}))`;return(0,He._)`${g} && ${g} !== true && ${h} === ${e} && !${x}`}}function f(){const m=d.formats[n];if(!m){w();return}if(m===!0)return;const[p,h,g]=P(m);p===e&&t.pass(S());function w(){if(l.strictSchema===!1){d.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${n}" ignored in schema at path "${c}"`}}function P(x){const A=x instanceof RegExp?(0,He.regexpCode)(x):l.code.formats?(0,He._)`${l.code.formats}${(0,He.getProperty)(n)}`:void 0,z=a.scopeValue("formats",{key:n,ref:x,code:A});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,He._)`${z}.validate`]:["string",x,z]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,He._)`await ${g}(${s})`}return typeof h=="function"?(0,He._)`${g}(${s})`:(0,He._)`${g}.test(${s})`}}}};Ti.default=ev,Object.defineProperty(xi,"__esModule",{value:!0});const tv=[Ti.default];xi.default=tv;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.contentVocabulary=Yr.metadataVocabulary=void 0,Yr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Yr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Qn,"__esModule",{value:!0});const rv=Gn,av=Xn,sv=hi,nv=xi,Rl=Yr,iv=[rv.default,av.default,(0,sv.default)(),nv.default,Rl.metadataVocabulary,Rl.contentVocabulary];Qn.default=iv;var Ii={},Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.DiscrError=void 0;var kl;(function(t){t.Tag="tag",t.Mapping="mapping"})(kl||(Cs.DiscrError=kl={})),Object.defineProperty(Ii,"__esModule",{value:!0});const Xr=ge,Ci=Cs,xl=ft,ov=Wr,cv=G,lv={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Ci.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,Xr._)`{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 l=e.let("valid",!1),c=e.const("tag",(0,Xr._)`${a}${(0,Xr.getProperty)(o)}`);e.if((0,Xr._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:Ci.DiscrError.Tag,tag:c,tagName:o})),t.ok(l);function u(){const f=v();e.if(!1);for(const m in f)e.elseIf((0,Xr._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:Ci.DiscrError.Mapping,tag:c,tagName:o}),e.endIf()}function d(f){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(p,Xr.Name),m}function v(){var f;const m={},p=g(r);let h=!0;for(let S=0;S<i.length;S++){let x=i[S];if(x!=null&&x.$ref&&!(0,cv.schemaHasRulesButRef)(x,n.self.RULES)){const z=x.$ref;if(x=xl.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,z),x instanceof xl.SchemaEnv&&(x=x.schema),x===void 0)throw new ov.default(n.opts.uriResolver,n.baseId,z)}const A=(f=x==null?void 0:x.properties)===null||f===void 0?void 0:f[o];if(typeof A!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);h=h&&(p||g(x)),w(A,S)}if(!h)throw new Error(`discriminator: "${o}" must be required`);return m;function g({required:S}){return Array.isArray(S)&&S.includes(o)}function w(S,x){if(S.const)P(S.const,x);else if(S.enum)for(const A of S.enum)P(A,x);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function P(S,x){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${o}" values must be unique strings`);m[S]=x}}}};Ii.default=lv;const uv={$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=cc,s=Qn,r=Ii,n=uv,i=["/properties"],o="http://json-schema.org/draft-07/schema";class l extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const m=this.opts.$data?this.$dataMetaSchema(n,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=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=kt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.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=Ra;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var v=Wr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(xn,xn.exports);var dv=xn.exports;const fv=oc(dv);var Pe;(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})(Pe||(Pe={}));var Oi;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Oi||(Oi={}));const Y=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=t=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(t)?Y.array:t===null?Y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Y.promise:typeof Map<"u"&&t instanceof Map?Y.map:typeof Set<"u"&&t instanceof Set?Y.set:typeof Date<"u"&&t instanceof Date?Y.date:Y.object;default:return Y.unknown}},q=Pe.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"]),hv=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class _t 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,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(a(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof _t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.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()}}_t.create=t=>new _t(t);const ea=(t,e)=>{let a;switch(t.code){case q.invalid_type:t.received===Y.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,Pe.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:a=`Unrecognized key(s) in object: ${Pe.joinValues(t.keys,", ")}`;break;case q.invalid_union:a="Invalid input";break;case q.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Pe.joinValues(t.options)}`;break;case q.invalid_enum_value:a=`Invalid enum value. Expected ${Pe.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}"`:Pe.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,Pe.assertNever(t)}return{message:a}};let Tl=ea;function pv(t){Tl=t}function Os(){return Tl}const Ns=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 l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},mv=[];function B(t,e){const a=Os(),s=Ns({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===ea?void 0:ea].filter(r=>!!r)});t.common.issues.push(s)}class it{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const s=[];for(const r of a){if(r.status==="aborted")return ie;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 it.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 ie;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 ie=Object.freeze({status:"aborted"}),ta=t=>({status:"dirty",value:t}),ut=t=>({status:"valid",value:t}),Ni=t=>t.status==="aborted",Ai=t=>t.status==="dirty",Ar=t=>t.status==="valid",ja=t=>typeof Promise<"u"&&t instanceof Promise;var ee;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ee||(ee={}));class zt{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 Il=(t,e)=>{if(Ar(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 _t(t.common.issues);return this._error=a,this._error}}};function ue(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:l}=t;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??a??o.defaultError}},description:r}}class me{get description(){return this._def.description}_getType(e){return sr(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(ja(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const s=this.safeParse(e,a);if(s.success)return s.data;throw s.error}safeParse(e,a){const s={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Il(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:sr(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return Ar(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=>Ar(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:sr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(ja(r)?r:Promise.resolve(r));return Il(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(l=>l?!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 Nt({schema:this,typeName:V.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Zt.create(this,this._def)}nullable(){return yr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return na.create(this,this._def)}or(e){return Fa.create([this,e],this._def)}and(e){return qa.create(this,e,this._def)}transform(e){return new Nt({...ue(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new Za({...ue(this._def),innerType:this,defaultValue:a,typeName:V.ZodDefault})}brand(){return new Mi({typeName:V.ZodBranded,type:this,...ue(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new Ka({...ue(this._def),innerType:this,catchValue:a,typeName:V.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return Ba.create(this,e)}readonly(){return Wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vv=/^c[^\s-]{8,}$/i,gv=/^[0-9a-z]+$/,_v=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yv=/^[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,wv=/^[a-z0-9_-]{21}$/i,bv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$v=/^[-+]?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)?)??$/,Pv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ev="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ji;const Sv=/^(?:(?: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])$/,Rv=/^(?:(?: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])$/,kv=/^(([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]))$/,xv=/^(([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])$/,Tv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Iv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cl="((\\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])))",Cv=new RegExp(`^${Cl}$`);function Ol(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 Ov(t){return new RegExp(`^${Ol(t)}$`)}function Nl(t){let e=`${Cl}T${Ol(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 Nv(t,e){return!!((e==="v4"||!e)&&Sv.test(t)||(e==="v6"||!e)&&kv.test(t))}function Av(t,e){if(!bv.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 jv(t,e){return!!((e==="v4"||!e)&&Rv.test(t)||(e==="v6"||!e)&&xv.test(t))}class Ct extends me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.string,received:n.parsedType}),ie}const s=new it;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),B(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),B(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?B(r,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&B(r,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Pv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"email",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")ji||(ji=new RegExp(Ev,"u")),ji.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"emoji",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")yv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"uuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")wv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"nanoid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")vv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")gv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid2",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")_v.test(e.data)||(r=this._getOrReturnCtx(e,r),B(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),B(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),B(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),B(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),B(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),B(r,{code:q.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Nl(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Cv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ov(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?$v.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"duration",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Nv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"ip",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Av(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"jwt",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?jv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cidr",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Tv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Iv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64url",code:q.invalid_string,message:n.message}),s.dirty()):Pe.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,...ee.errToObj(s)})}_addCheck(e){return new Ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ee.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,...ee.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,...ee.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ee.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...ee.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...ee.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...ee.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...ee.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...ee.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...ee.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...ee.errToObj(a)})}nonempty(e){return this.min(1,ee.errToObj(e))}trim(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ct({...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}}Ct.create=t=>new Ct({checks:[],typeName:V.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});function Dv(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 vr extends me{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)!==Y.number){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.number,received:n.parsedType}),ie}let s;const r=new it;for(const n of this._def.checks)n.kind==="int"?Pe.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),B(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),B(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),B(s,{code:q.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Dv(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),B(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),B(s,{code:q.not_finite,message:n.message}),r.dirty()):Pe.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,ee.toString(a))}gt(e,a){return this.setLimit("min",e,!1,ee.toString(a))}lte(e,a){return this.setLimit("max",e,!0,ee.toString(a))}lt(e,a){return this.setLimit("max",e,!1,ee.toString(a))}setLimit(e,a,s,r){return new vr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:ee.toString(r)}]})}_addCheck(e){return new vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ee.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:ee.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ee.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"&&Pe.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)}}vr.create=t=>new vr({checks:[],typeName:V.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class gr extends me{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)!==Y.bigint)return this._getInvalidInput(e);let s;const r=new it;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),B(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),B(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),B(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Pe.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return B(a,{code:q.invalid_type,expected:Y.bigint,received:a.parsedType}),ie}gte(e,a){return this.setLimit("min",e,!0,ee.toString(a))}gt(e,a){return this.setLimit("min",e,!1,ee.toString(a))}lte(e,a){return this.setLimit("max",e,!0,ee.toString(a))}lt(e,a){return this.setLimit("max",e,!1,ee.toString(a))}setLimit(e,a,s,r){return new gr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:ee.toString(r)}]})}_addCheck(e){return new gr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:ee.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}}gr.create=t=>new gr({checks:[],typeName:V.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});class Da extends me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.boolean,received:s.parsedType}),ie}return ut(e.data)}}Da.create=t=>new Da({typeName:V.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class jr extends me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.date,received:n.parsedType}),ie}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_date}),ie}const s=new it;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),B(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),B(r,{code:q.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Pe.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jr({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:ee.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:ee.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}}jr.create=t=>new jr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:V.ZodDate,...ue(t)});class As extends me{_parse(e){if(this._getType(e)!==Y.symbol){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.symbol,received:s.parsedType}),ie}return ut(e.data)}}As.create=t=>new As({typeName:V.ZodSymbol,...ue(t)});class Ma extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.undefined,received:s.parsedType}),ie}return ut(e.data)}}Ma.create=t=>new Ma({typeName:V.ZodUndefined,...ue(t)});class La extends me{_parse(e){if(this._getType(e)!==Y.null){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.null,received:s.parsedType}),ie}return ut(e.data)}}La.create=t=>new La({typeName:V.ZodNull,...ue(t)});class ra extends me{constructor(){super(...arguments),this._any=!0}_parse(e){return ut(e.data)}}ra.create=t=>new ra({typeName:V.ZodAny,...ue(t)});class Dr extends me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ut(e.data)}}Dr.create=t=>new Dr({typeName:V.ZodUnknown,...ue(t)});class nr extends me{_parse(e){const a=this._getOrReturnCtx(e);return B(a,{code:q.invalid_type,expected:Y.never,received:a.parsedType}),ie}}nr.create=t=>new nr({typeName:V.ZodNever,...ue(t)});class js extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.void,received:s.parsedType}),ie}return ut(e.data)}}js.create=t=>new js({typeName:V.ZodVoid,...ue(t)});class Ot extends me{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==Y.array)return B(a,{code:q.invalid_type,expected:Y.array,received:a.parsedType}),ie;if(r.exactLength!==null){const i=a.data.length>r.exactLength.value,o=a.data.length<r.exactLength.value;(i||o)&&(B(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&&(B(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&&(B(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 zt(a,i,a.path,o)))).then(i=>it.mergeArray(s,i));const n=[...a.data].map((i,o)=>r.type._parseSync(new zt(a,i,a.path,o)));return it.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new Ot({...this._def,minLength:{value:e,message:ee.toString(a)}})}max(e,a){return new Ot({...this._def,maxLength:{value:e,message:ee.toString(a)}})}length(e,a){return new Ot({...this._def,exactLength:{value:e,message:ee.toString(a)}})}nonempty(e){return this.min(1,e)}}Ot.create=(t,e)=>new Ot({type:t,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...ue(e)});function aa(t){if(t instanceof Fe){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Zt.create(aa(s))}return new Fe({...t._def,shape:()=>e})}else return t instanceof Ot?new Ot({...t._def,type:aa(t.element)}):t instanceof Zt?Zt.create(aa(t.unwrap())):t instanceof yr?yr.create(aa(t.unwrap())):t instanceof Ht?Ht.create(t.items.map(e=>aa(e))):t}class Fe extends me{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=Pe.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==Y.object){const c=this._getOrReturnCtx(e);return B(c,{code:q.invalid_type,expected:Y.object,received:c.parsedType}),ie}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof nr&&this._def.unknownKeys==="strip"))for(const c in r.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const u=n[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new zt(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof nr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(B(r,{code:q.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new zt(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,v=await u.value;c.push({key:d,value:v,alwaysSet:u.alwaysSet})}return c}).then(c=>it.mergeObjectSync(s,c)):it.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return ee.errToObj,new Fe({...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:ee.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Fe({...this._def,unknownKeys:"strip"})}passthrough(){return new Fe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Fe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Fe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:V.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Fe({...this._def,catchall:e})}pick(e){const a={};for(const s of Pe.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Fe({...this._def,shape:()=>a})}omit(e){const a={};for(const s of Pe.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Fe({...this._def,shape:()=>a})}deepPartial(){return aa(this)}partial(e){const a={};for(const s of Pe.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Fe({...this._def,shape:()=>a})}required(e){const a={};for(const s of Pe.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Zt;)n=n._def.innerType;a[s]=n}return new Fe({...this._def,shape:()=>a})}keyof(){return Al(Pe.objectKeys(this.shape))}}Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:nr.create(),typeName:V.ZodObject,...ue(e)}),Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:nr.create(),typeName:V.ZodObject,...ue(e)}),Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:nr.create(),typeName:V.ZodObject,...ue(e)});class Fa extends me{_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 _t(o.ctx.common.issues));return B(a,{code:q.invalid_union,unionErrors:i}),ie}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 l of s){const c={...a,common:{...a.common,issues:[]},parent:null},u=l._parseSync({data:a.data,path:a.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(l=>new _t(l));return B(a,{code:q.invalid_union,unionErrors:o}),ie}}get options(){return this._def.options}}Fa.create=(t,e)=>new Fa({options:t,typeName:V.ZodUnion,...ue(e)});const ir=t=>t instanceof Va?ir(t.schema):t instanceof Nt?ir(t.innerType()):t instanceof za?[t.value]:t instanceof _r?t.options:t instanceof Ha?Pe.objectValues(t.enum):t instanceof Za?ir(t._def.innerType):t instanceof Ma?[void 0]:t instanceof La?[null]:t instanceof Zt?[void 0,...ir(t.unwrap())]:t instanceof yr?[null,...ir(t.unwrap())]:t instanceof Mi||t instanceof Wa?ir(t.unwrap()):t instanceof Ka?ir(t._def.innerType):[];class Ds extends me{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.object)return B(a,{code:q.invalid_type,expected:Y.object,received:a.parsedType}),ie;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}):(B(a,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),ie)}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=ir(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 Ds({typeName:V.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,...ue(s)})}}function Di(t,e){const a=sr(t),s=sr(e);if(t===e)return{valid:!0,data:t};if(a===Y.object&&s===Y.object){const r=Pe.objectKeys(e),n=Pe.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const l=Di(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(a===Y.array&&s===Y.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],l=Di(i,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return a===Y.date&&s===Y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class qa extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(Ni(n)||Ni(i))return ie;const o=Di(n.value,i.value);return o.valid?((Ai(n)||Ai(i))&&a.dirty(),{status:a.value,value:o.data}):(B(s,{code:q.invalid_intersection_types}),ie)};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}))}}qa.create=(t,e,a)=>new qa({left:t,right:e,typeName:V.ZodIntersection,...ue(a)});class Ht extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.array)return B(s,{code:q.invalid_type,expected:Y.array,received:s.parsedType}),ie;if(s.data.length<this._def.items.length)return B(s,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&s.data.length>this._def.items.length&&(B(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 l=this._def.items[o]||this._def.rest;return l?l._parse(new zt(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>it.mergeArray(a,i)):it.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new Ht({...this._def,rest:e})}}Ht.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:t,typeName:V.ZodTuple,rest:null,...ue(e)})};class Ua extends me{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!==Y.object)return B(s,{code:q.invalid_type,expected:Y.object,received:s.parsedType}),ie;const r=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:n._parse(new zt(s,o,s.path,o)),value:i._parse(new zt(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?it.mergeObjectAsync(a,r):it.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof me?new Ua({keyType:e,valueType:a,typeName:V.ZodRecord,...ue(s)}):new Ua({keyType:Ct.create(),valueType:e,typeName:V.ZodRecord,...ue(a)})}}class Ms extends me{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!==Y.map)return B(s,{code:q.invalid_type,expected:Y.map,received:s.parsedType}),ie;const r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,l],c)=>({key:r._parse(new zt(s,o,s.path,[c,"key"])),value:n._parse(new zt(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}}}}Ms.create=(t,e,a)=>new Ms({valueType:e,keyType:t,typeName:V.ZodMap,...ue(a)});class Mr extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.set)return B(s,{code:q.invalid_type,expected:Y.set,received:s.parsedType}),ie;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(B(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&&(B(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(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ie;u.status==="dirty"&&a.dirty(),c.add(u.value)}return{status:a.value,value:c}}const o=[...s.data.values()].map((l,c)=>n._parse(new zt(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,a){return new Mr({...this._def,minSize:{value:e,message:ee.toString(a)}})}max(e,a){return new Mr({...this._def,maxSize:{value:e,message:ee.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Mr.create=(t,e)=>new Mr({valueType:t,minSize:null,maxSize:null,typeName:V.ZodSet,...ue(e)});class sa extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.function)return B(a,{code:q.invalid_type,expected:Y.function,received:a.parsedType}),ie;function s(o,l){return Ns({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Os(),ea].filter(c=>!!c),issueData:{code:q.invalid_arguments,argumentsError:l}})}function r(o,l){return Ns({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Os(),ea].filter(c=>!!c),issueData:{code:q.invalid_return_type,returnTypeError:l}})}const n={errorMap:a.common.contextualErrorMap},i=a.data;if(this._def.returns instanceof na){const o=this;return ut(async function(...l){const c=new _t([]),u=await o._def.args.parseAsync(l,n).catch(f=>{throw c.addIssue(s(l,f)),c}),d=await Reflect.apply(i,this,u);return await o._def.returns._def.type.parseAsync(d,n).catch(f=>{throw c.addIssue(r(d,f)),c})})}else{const o=this;return ut(function(...l){const c=o._def.args.safeParse(l,n);if(!c.success)throw new _t([s(l,c.error)]);const u=Reflect.apply(i,this,c.data),d=o._def.returns.safeParse(u,n);if(!d.success)throw new _t([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sa({...this._def,args:Ht.create(e).rest(Dr.create())})}returns(e){return new sa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,s){return new sa({args:e||Ht.create([]).rest(Dr.create()),returns:a||Dr.create(),typeName:V.ZodFunction,...ue(s)})}}class Va extends me{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})}}Va.create=(t,e)=>new Va({getter:t,typeName:V.ZodLazy,...ue(e)});class za extends me{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return B(a,{received:a.data,code:q.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}za.create=(t,e)=>new za({value:t,typeName:V.ZodLiteral,...ue(e)});function Al(t,e){return new _r({values:t,typeName:V.ZodEnum,...ue(e)})}class _r extends me{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return B(a,{expected:Pe.joinValues(s),received:a.parsedType,code:q.invalid_type}),ie}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 B(a,{received:a.data,code:q.invalid_enum_value,options:s}),ie}return ut(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 _r.create(e,{...this._def,...a})}exclude(e,a=this._def){return _r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}_r.create=Al;class Ha extends me{_parse(e){const a=Pe.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Y.string&&s.parsedType!==Y.number){const r=Pe.objectValues(a);return B(s,{expected:Pe.joinValues(r),received:s.parsedType,code:q.invalid_type}),ie}if(this._cache||(this._cache=new Set(Pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Pe.objectValues(a);return B(s,{received:s.data,code:q.invalid_enum_value,options:r}),ie}return ut(e.data)}get enum(){return this._def.values}}Ha.create=(t,e)=>new Ha({values:t,typeName:V.ZodNativeEnum,...ue(e)});class na extends me{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.promise&&a.common.async===!1)return B(a,{code:q.invalid_type,expected:Y.promise,received:a.parsedType}),ie;const s=a.parsedType===Y.promise?a.data:Promise.resolve(a.data);return ut(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}na.create=(t,e)=>new na({type:t,typeName:V.ZodPromise,...ue(e)});class Nt extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.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=>{B(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 ie;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?ie:l.status==="dirty"||a.value==="dirty"?ta(l.value):l});{if(a.value==="aborted")return ie;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?ie:o.status==="dirty"||a.value==="dirty"?ta(o.value):o}}if(r.type==="refinement"){const i=o=>{const l=r.refinement(o,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?ie:(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"?ie:(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(!Ar(i))return ie;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=>Ar(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:a.value,value:o})):ie);Pe.assertNever(r)}}Nt.create=(t,e,a)=>new Nt({schema:t,typeName:V.ZodEffects,effect:e,...ue(a)}),Nt.createWithPreprocess=(t,e,a)=>new Nt({schema:e,effect:{type:"preprocess",transform:t},typeName:V.ZodEffects,...ue(a)});class Zt extends me{_parse(e){return this._getType(e)===Y.undefined?ut(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zt.create=(t,e)=>new Zt({innerType:t,typeName:V.ZodOptional,...ue(e)});class yr extends me{_parse(e){return this._getType(e)===Y.null?ut(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yr.create=(t,e)=>new yr({innerType:t,typeName:V.ZodNullable,...ue(e)});class Za extends me{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===Y.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}Za.create=(t,e)=>new Za({innerType:t,typeName:V.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});class Ka extends me{_parse(e){const{ctx:a}=this._processInputParams(e),s={...a,common:{...a.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ja(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new _t(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new _t(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ka.create=(t,e)=>new Ka({innerType:t,typeName:V.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});class Ls extends me{_parse(e){if(this._getType(e)!==Y.nan){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.nan,received:s.parsedType}),ie}return{status:"valid",value:e.data}}}Ls.create=t=>new Ls({typeName:V.ZodNaN,...ue(t)});const Mv=Symbol("zod_brand");class Mi extends me{_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 Ba extends me{_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"?ie:n.status==="dirty"?(a.dirty(),ta(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"?ie: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 Ba({in:e,out:a,typeName:V.ZodPipeline})}}class Wa extends me{_parse(e){const a=this._def.innerType._parse(e),s=r=>(Ar(r)&&(r.value=Object.freeze(r.value)),r);return ja(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}Wa.create=(t,e)=>new Wa({innerType:t,typeName:V.ZodReadonly,...ue(e)});function jl(t,e){const a=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof a=="string"?{message:a}:a}function Dl(t,e={},a){return t?ra.create().superRefine((s,r)=>{const n=t(s);if(n instanceof Promise)return n.then(i=>{if(!i){const o=jl(e,s),l=o.fatal??a??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!n){const i=jl(e,s),o=i.fatal??a??!0;r.addIssue({code:"custom",...i,fatal:o})}}):ra.create()}const Lv={object:Fe.lazycreate};var V;(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"})(V||(V={}));const Fv=(t,e={message:`Input not instance of ${t.name}`})=>Dl(a=>a instanceof t,e),k=Ct.create,Je=vr.create,qv=Ls.create,Uv=gr.create,Ze=Da.create,Vv=jr.create,zv=As.create,Hv=Ma.create,Zv=La.create,Ml=ra.create,ia=Dr.create,Kv=nr.create,Bv=js.create,X=Ot.create,Z=Fe.create,Wv=Fe.strictCreate,ot=Fa.create,Ll=Ds.create,Jv=qa.create,Qv=Ht.create,oa=Ua.create,Gv=Ms.create,Yv=Mr.create,Xv=sa.create,eg=Va.create,le=za.create,Kt=_r.create,tg=Ha.create,rg=na.create,Fl=Nt.create,L=Zt.create,ag=yr.create,sg=Nt.createWithPreprocess,ng=Ba.create,ig=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Mv,DIRTY:ta,EMPTY_PATH:mv,INVALID:ie,NEVER:ie,OK:ut,ParseStatus:it,Schema:me,ZodAny:ra,ZodArray:Ot,ZodBigInt:gr,ZodBoolean:Da,ZodBranded:Mi,ZodCatch:Ka,ZodDate:jr,ZodDefault:Za,ZodDiscriminatedUnion:Ds,ZodEffects:Nt,ZodEnum:_r,ZodError:_t,get ZodFirstPartyTypeKind(){return V},ZodFunction:sa,ZodIntersection:qa,ZodIssueCode:q,ZodLazy:Va,ZodLiteral:za,ZodMap:Ms,ZodNaN:Ls,ZodNativeEnum:Ha,ZodNever:nr,ZodNull:La,ZodNullable:yr,ZodNumber:vr,ZodObject:Fe,ZodOptional:Zt,ZodParsedType:Y,ZodPipeline:Ba,ZodPromise:na,ZodReadonly:Wa,ZodRecord:Ua,ZodSchema:me,ZodSet:Mr,ZodString:Ct,ZodSymbol:As,ZodTransformer:Nt,ZodTuple:Ht,ZodType:me,ZodUndefined:Ma,ZodUnion:Fa,ZodUnknown:Dr,ZodVoid:js,addIssueToContext:B,any:Ml,array:X,bigint:Uv,boolean:Ze,coerce:{string:t=>Ct.create({...t,coerce:!0}),number:t=>vr.create({...t,coerce:!0}),boolean:t=>Da.create({...t,coerce:!0}),bigint:t=>gr.create({...t,coerce:!0}),date:t=>jr.create({...t,coerce:!0})},custom:Dl,date:Vv,datetimeRegex:Nl,defaultErrorMap:ea,discriminatedUnion:Ll,effect:Fl,enum:Kt,function:Xv,getErrorMap:Os,getParsedType:sr,instanceof:Fv,intersection:Jv,isAborted:Ni,isAsync:ja,isDirty:Ai,isValid:Ar,late:Lv,lazy:eg,literal:le,makeIssue:Ns,map:Gv,nan:qv,nativeEnum:tg,never:Kv,null:Zv,nullable:ag,number:Je,object:Z,get objectUtil(){return Oi},oboolean:()=>Ze().optional(),onumber:()=>Je().optional(),optional:L,ostring:()=>k().optional(),pipeline:ng,preprocess:sg,promise:rg,quotelessJson:hv,record:oa,set:Yv,setErrorMap:pv,strictObject:Wv,string:k,symbol:zv,transformer:Fl,tuple:Qv,undefined:Hv,union:ot,unknown:ia,get util(){return Pe},void:Bv},Symbol.toStringTag,{value:"Module"})),Ja="2025-06-18",ql=[Ja,"2025-03-26","2024-11-05","2024-10-07"],Fs="2.0",Ul=ot([k(),Je().int()]),Vl=k(),og=Z({progressToken:L(Ul)}).passthrough(),bt=Z({_meta:L(og)}).passthrough(),pt=Z({method:k(),params:L(bt)}),Qa=Z({_meta:L(Z({}).passthrough())}).passthrough(),Bt=Z({method:k(),params:L(Qa)}),$t=Z({_meta:L(Z({}).passthrough())}).passthrough(),qs=ot([k(),Je().int()]),zl=Z({jsonrpc:le(Fs),id:qs}).merge(pt).strict(),Hl=t=>zl.safeParse(t).success,Zl=Z({jsonrpc:le(Fs)}).merge(Bt).strict(),cg=t=>Zl.safeParse(t).success,Kl=Z({jsonrpc:le(Fs),id:qs,result:$t}).strict(),Li=t=>Kl.safeParse(t).success;var Ie;(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"})(Ie||(Ie={}));const Bl=Z({jsonrpc:le(Fs),id:qs,error:Z({code:Je().int(),message:k(),data:L(ia())})}).strict(),lg=t=>Bl.safeParse(t).success,ca=ot([zl,Zl,Kl,Bl]),wr=$t.strict(),Fi=Bt.extend({method:le("notifications/cancelled"),params:Qa.extend({requestId:qs,reason:k().optional()})}),Ga=Z({name:k(),title:L(k())}).passthrough(),Wl=Ga.extend({version:k()}),ug=Z({experimental:L(Z({}).passthrough()),sampling:L(Z({}).passthrough()),elicitation:L(Z({}).passthrough()),roots:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),Jl=pt.extend({method:le("initialize"),params:bt.extend({protocolVersion:k(),capabilities:ug,clientInfo:Wl})}),dg=Z({experimental:L(Z({}).passthrough()),logging:L(Z({}).passthrough()),completions:L(Z({}).passthrough()),prompts:L(Z({listChanged:L(Ze())}).passthrough()),resources:L(Z({subscribe:L(Ze()),listChanged:L(Ze())}).passthrough()),tools:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),Ql=$t.extend({protocolVersion:k(),capabilities:dg,serverInfo:Wl,instructions:L(k())}),qi=Bt.extend({method:le("notifications/initialized")}),fg=t=>qi.safeParse(t).success,Ui=pt.extend({method:le("ping")}),hg=Z({progress:Je(),total:L(Je()),message:L(k())}).passthrough(),Vi=Bt.extend({method:le("notifications/progress"),params:Qa.merge(hg).extend({progressToken:Ul})}),Us=pt.extend({params:bt.extend({cursor:L(Vl)}).optional()}),Vs=$t.extend({nextCursor:L(Vl)}),Gl=Z({uri:k(),mimeType:L(k()),_meta:L(Z({}).passthrough())}).passthrough(),Yl=Gl.extend({text:k()}),zi=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xl=Gl.extend({blob:zi}),eu=Ga.extend({uri:k(),description:L(k()),mimeType:L(k()),_meta:L(Z({}).passthrough())}),pg=Ga.extend({uriTemplate:k(),description:L(k()),mimeType:L(k()),_meta:L(Z({}).passthrough())}),zs=Us.extend({method:le("resources/list")}),tu=Vs.extend({resources:X(eu)}),Hi=Us.extend({method:le("resources/templates/list")}),ru=Vs.extend({resourceTemplates:X(pg)}),Zi=pt.extend({method:le("resources/read"),params:bt.extend({uri:k()})}),au=$t.extend({contents:X(ot([Yl,Xl]))}),su=Bt.extend({method:le("notifications/resources/list_changed")}),nu=pt.extend({method:le("resources/subscribe"),params:bt.extend({uri:k()})}),iu=pt.extend({method:le("resources/unsubscribe"),params:bt.extend({uri:k()})}),ou=Bt.extend({method:le("notifications/resources/updated"),params:Qa.extend({uri:k()})}),mg=Z({name:k(),description:L(k()),required:L(Ze())}).passthrough(),vg=Ga.extend({description:L(k()),arguments:L(X(mg)),_meta:L(Z({}).passthrough())}),Ki=Us.extend({method:le("prompts/list")}),cu=Vs.extend({prompts:X(vg)}),Bi=pt.extend({method:le("prompts/get"),params:bt.extend({name:k(),arguments:L(oa(k()))})}),Wi=Z({type:le("text"),text:k(),_meta:L(Z({}).passthrough())}).passthrough(),Ji=Z({type:le("image"),data:zi,mimeType:k(),_meta:L(Z({}).passthrough())}).passthrough(),Qi=Z({type:le("audio"),data:zi,mimeType:k(),_meta:L(Z({}).passthrough())}).passthrough(),gg=Z({type:le("resource"),resource:ot([Yl,Xl]),_meta:L(Z({}).passthrough())}).passthrough(),_g=eu.extend({type:le("resource_link")}),lu=ot([Wi,Ji,Qi,_g,gg]),yg=Z({role:Kt(["user","assistant"]),content:lu}).passthrough(),uu=$t.extend({description:L(k()),messages:X(yg)}),du=Bt.extend({method:le("notifications/prompts/list_changed")}),wg=Z({title:L(k()),readOnlyHint:L(Ze()),destructiveHint:L(Ze()),idempotentHint:L(Ze()),openWorldHint:L(Ze())}).passthrough(),bg=Ga.extend({description:L(k()),inputSchema:Z({type:le("object"),properties:L(Z({}).passthrough()),required:L(X(k()))}).passthrough(),outputSchema:L(Z({type:le("object"),properties:L(Z({}).passthrough()),required:L(X(k()))}).passthrough()),annotations:L(wg),_meta:L(Z({}).passthrough())}),Gi=Us.extend({method:le("tools/list")}),fu=Vs.extend({tools:X(bg)}),Hs=$t.extend({content:X(lu).default([]),structuredContent:Z({}).passthrough().optional(),isError:L(Ze())});Hs.or($t.extend({toolResult:ia()}));const Yi=pt.extend({method:le("tools/call"),params:bt.extend({name:k(),arguments:L(oa(ia()))})}),hu=Bt.extend({method:le("notifications/tools/list_changed")}),pu=Kt(["debug","info","notice","warning","error","critical","alert","emergency"]),Xi=pt.extend({method:le("logging/setLevel"),params:bt.extend({level:pu})}),mu=Bt.extend({method:le("notifications/message"),params:Qa.extend({level:pu,logger:L(k()),data:ia()})}),$g=Z({name:k().optional()}).passthrough(),Pg=Z({hints:L(X($g)),costPriority:L(Je().min(0).max(1)),speedPriority:L(Je().min(0).max(1)),intelligencePriority:L(Je().min(0).max(1))}).passthrough(),Eg=Z({role:Kt(["user","assistant"]),content:ot([Wi,Ji,Qi])}).passthrough(),vu=pt.extend({method:le("sampling/createMessage"),params:bt.extend({messages:X(Eg),systemPrompt:L(k()),includeContext:L(Kt(["none","thisServer","allServers"])),temperature:L(Je()),maxTokens:Je().int(),stopSequences:L(X(k())),metadata:L(Z({}).passthrough()),modelPreferences:L(Pg)})}),eo=$t.extend({model:k(),stopReason:L(Kt(["endTurn","stopSequence","maxTokens"]).or(k())),role:Kt(["user","assistant"]),content:Ll("type",[Wi,Ji,Qi])}),Sg=Z({type:le("boolean"),title:L(k()),description:L(k()),default:L(Ze())}).passthrough(),Rg=Z({type:le("string"),title:L(k()),description:L(k()),minLength:L(Je()),maxLength:L(Je()),format:L(Kt(["email","uri","date","date-time"]))}).passthrough(),kg=Z({type:Kt(["number","integer"]),title:L(k()),description:L(k()),minimum:L(Je()),maximum:L(Je())}).passthrough(),xg=Z({type:le("string"),title:L(k()),description:L(k()),enum:X(k()),enumNames:L(X(k()))}).passthrough(),Tg=ot([Sg,Rg,kg,xg]),gu=pt.extend({method:le("elicitation/create"),params:bt.extend({message:k(),requestedSchema:Z({type:le("object"),properties:oa(k(),Tg),required:L(X(k()))}).passthrough()})}),to=$t.extend({action:Kt(["accept","decline","cancel"]),content:L(oa(k(),ia()))}),Ig=Z({type:le("ref/resource"),uri:k()}).passthrough(),Cg=Z({type:le("ref/prompt"),name:k()}).passthrough(),ro=pt.extend({method:le("completion/complete"),params:bt.extend({ref:ot([Cg,Ig]),argument:Z({name:k(),value:k()}).passthrough(),context:L(Z({arguments:L(oa(k(),k()))}))})}),_u=$t.extend({completion:Z({values:X(k()).max(100),total:L(Je().int()),hasMore:L(Ze())}).passthrough()}),Og=Z({uri:k().startsWith("file://"),name:L(k()),_meta:L(Z({}).passthrough())}).passthrough(),yu=pt.extend({method:le("roots/list")}),ao=$t.extend({roots:X(Og)}),wu=Bt.extend({method:le("notifications/roots/list_changed")});ot([Ui,Jl,ro,Xi,Bi,Ki,zs,Hi,Zi,nu,iu,Yi,Gi]),ot([Fi,Vi,qi,wu]),ot([wr,eo,to,ao]),ot([Ui,vu,gu,yu]),ot([Fi,Vi,mu,ou,su,hu,du]),ot([wr,Ql,_u,uu,cu,tu,ru,au,Hs,fu]);class Ae extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const Ng=6e4;class bu{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(Fi,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(Vi,a=>{this._onprogress(a)}),this.setRequestHandler(Ui,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 Ae(Ie.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=l=>{i==null||i(l),this._onerror(l)};const o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(l,c)=>{o==null||o(l,c),Li(l)||lg(l)?this._onresponse(l):Hl(l)?this._onrequest(l,c):cg(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;const a=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new Ae(Ie.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:Ie.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const c={signal:l.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,v)=>this.request(u,d,{...v,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,c)).then(u=>{var d;if(!l.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,v;if(!l.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:Ie.InternalError,message:(v=u.message)!==null&&v!==void 0?v:"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(l){i(l);return}n(s)}_onresponse(e){const a=Number(e.id),s=this._responseHandlers.get(a);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),Li(e))s(e);else{const r=new Ae(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,l)=>{var c,u,d,v,f,m;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=s==null?void 0:s.signal)===null||u===void 0||u.throwIfAborted();const p=this._requestMessageId++,h={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),h.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:p}});const g=S=>{var x;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(x=this._transport)===null||x===void 0||x.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),l(S)};this._responseHandlers.set(p,S=>{var x;if(!(!((x=s==null?void 0:s.signal)===null||x===void 0)&&x.aborted)){if(S instanceof Error)return l(S);try{const A=a.parse(S.result);o(A)}catch(A){l(A)}}}),(v=s==null?void 0:s.signal)===null||v===void 0||v.addEventListener("abort",()=>{var S;g((S=s==null?void 0:s.signal)===null||S===void 0?void 0:S.reason)});const w=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:Ng,P=()=>g(new Ae(Ie.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(p,w,s==null?void 0:s.maxTotalTimeout,P,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(p),l(S)})})}async notification(e,a){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,a).catch(u=>this._onerror(u))});return}const 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 $u(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 so={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)})(wa,function(a){function s(){for(var $=arguments.length,y=Array($),E=0;E<$;E++)y[E]=arguments[E];if(y.length>1){y[0]=y[0].slice(0,-1);for(var C=y.length-1,I=1;I<C;++I)y[I]=y[I].slice(1,-1);return y[C]=y[C].slice(1),y.join("")}else return y[0]}function r($){return"(?:"+$+")"}function n($){return $===void 0?"undefined":$===null?"null":Object.prototype.toString.call($).split(" ").pop().split("]").shift().toLowerCase()}function i($){return $.toUpperCase()}function o($){return $!=null?$ instanceof Array?$:typeof $.length!="number"||$.split||$.setInterval||$.call?[$]:Array.prototype.slice.call($):[]}function l($,y){var E=$;if(y)for(var C in y)E[C]=y[C];return E}function c($){var y="[A-Za-z]",E="[0-9]",C=s(E,"[A-Fa-f]"),I=r(r("%[EFef]"+C+"%"+C+C+"%"+C+C)+"|"+r("%[89A-Fa-f]"+C+"%"+C+C)+"|"+r("%"+C+C)),ae="[\\:\\/\\?\\#\\[\\]\\@]",se="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=s(ae,se),je=$?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Be=$?"[\\uE000-\\uF8FF]":"[]",$e=s(y,E,"[\\-\\.\\_\\~]",je);r(y+s(y,E,"[\\+\\-\\.]")+"*"),r(r(I+"|"+s($e,se,"[\\:]"))+"*");var Ce=r(r("25[0-5]")+"|"+r("2[0-4]"+E)+"|"+r("1"+E+E)+"|"+r("0?[1-9]"+E)+"|0?0?"+E),We=r(Ce+"\\."+Ce+"\\."+Ce+"\\."+Ce),ce=r(C+"{1,4}"),Me=r(r(ce+"\\:"+ce)+"|"+We),Ye=r(r(ce+"\\:")+"{6}"+Me),Le=r("\\:\\:"+r(ce+"\\:")+"{5}"+Me),kr=r(r(ce)+"?\\:\\:"+r(ce+"\\:")+"{4}"+Me),Yt=r(r(r(ce+"\\:")+"{0,1}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{3}"+Me),Xt=r(r(r(ce+"\\:")+"{0,2}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{2}"+Me),ya=r(r(r(ce+"\\:")+"{0,3}"+ce)+"?\\:\\:"+ce+"\\:"+Me),Vr=r(r(r(ce+"\\:")+"{0,4}"+ce)+"?\\:\\:"+Me),Rt=r(r(r(ce+"\\:")+"{0,5}"+ce)+"?\\:\\:"+ce),er=r(r(r(ce+"\\:")+"{0,6}"+ce)+"?\\:\\:"),zr=r([Ye,Le,kr,Yt,Xt,ya,Vr,Rt,er].join("|")),dr=r(r($e+"|"+I)+"+");r("[vV]"+C+"+\\."+s($e,se,"[\\:]")+"+"),r(r(I+"|"+s($e,se))+"*");var cs=r(I+"|"+s($e,se,"[\\:\\@]"));return r(r(I+"|"+s($e,se,"[\\@]"))+"+"),r(r(cs+"|"+s("[\\/\\?]",Be))+"*"),{NOT_SCHEME:new RegExp(s("[^]",y,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",$e,se),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",$e,se),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",$e,se),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",$e,se),"g"),NOT_QUERY:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]",Be),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",$e,se),"g"),UNRESERVED:new RegExp($e,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",$e,Ee),"g"),PCT_ENCODED:new RegExp(I,"g"),IPV4ADDRESS:new RegExp("^("+We+")$"),IPV6ADDRESS:new RegExp("^\\[?("+zr+")"+r(r("\\%25|\\%(?!"+C+"{2})")+"("+dr+")")+"?\\]?$")}}var u=c(!1),d=c(!0),v=function(){function $(y,E){var C=[],I=!0,ae=!1,se=void 0;try{for(var Ee=y[Symbol.iterator](),je;!(I=(je=Ee.next()).done)&&(C.push(je.value),!(E&&C.length===E));I=!0);}catch(Be){ae=!0,se=Be}finally{try{!I&&Ee.return&&Ee.return()}finally{if(ae)throw se}}return C}return function(y,E){if(Array.isArray(y))return y;if(Symbol.iterator in Object(y))return $(y,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function($){if(Array.isArray($)){for(var y=0,E=Array($.length);y<$.length;y++)E[y]=$[y];return E}else return Array.from($)},m=2147483647,p=36,h=1,g=26,w=38,P=700,S=72,x=128,A="-",z=/^xn--/,U=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=p-h,H=Math.floor,F=String.fromCharCode;function M($){throw new RangeError(W[$])}function te($,y){for(var E=[],C=$.length;C--;)E[C]=y($[C]);return E}function ye($,y){var E=$.split("@"),C="";E.length>1&&(C=E[0]+"@",$=E[1]),$=$.replace(D,".");var I=$.split("."),ae=te(I,y).join(".");return C+ae}function ve($){for(var y=[],E=0,C=$.length;E<C;){var I=$.charCodeAt(E++);if(I>=55296&&I<=56319&&E<C){var ae=$.charCodeAt(E++);(ae&64512)==56320?y.push(((I&1023)<<10)+(ae&1023)+65536):(y.push(I),E--)}else y.push(I)}return y}var be=function(y){return String.fromCodePoint.apply(String,f(y))},de=function(y){return y-48<10?y-22:y-65<26?y-65:y-97<26?y-97:p},N=function(y,E){return y+22+75*(y<26)-((E!=0)<<5)},R=function(y,E,C){var I=0;for(y=C?H(y/P):y>>1,y+=H(y/E);y>J*g>>1;I+=p)y=H(y/J);return H(I+(J+1)*y/(y+w))},j=function(y){var E=[],C=y.length,I=0,ae=x,se=S,Ee=y.lastIndexOf(A);Ee<0&&(Ee=0);for(var je=0;je<Ee;++je)y.charCodeAt(je)>=128&&M("not-basic"),E.push(y.charCodeAt(je));for(var Be=Ee>0?Ee+1:0;Be<C;){for(var $e=I,Ce=1,We=p;;We+=p){Be>=C&&M("invalid-input");var ce=de(y.charCodeAt(Be++));(ce>=p||ce>H((m-I)/Ce))&&M("overflow"),I+=ce*Ce;var Me=We<=se?h:We>=se+g?g:We-se;if(ce<Me)break;var Ye=p-Me;Ce>H(m/Ye)&&M("overflow"),Ce*=Ye}var Le=E.length+1;se=R(I-$e,Le,$e==0),H(I/Le)>m-ae&&M("overflow"),ae+=H(I/Le),I%=Le,E.splice(I++,0,ae)}return String.fromCodePoint.apply(String,E)},T=function(y){var E=[];y=ve(y);var C=y.length,I=x,ae=0,se=S,Ee=!0,je=!1,Be=void 0;try{for(var $e=y[Symbol.iterator](),Ce;!(Ee=(Ce=$e.next()).done);Ee=!0){var We=Ce.value;We<128&&E.push(F(We))}}catch(ls){je=!0,Be=ls}finally{try{!Ee&&$e.return&&$e.return()}finally{if(je)throw Be}}var ce=E.length,Me=ce;for(ce&&E.push(A);Me<C;){var Ye=m,Le=!0,kr=!1,Yt=void 0;try{for(var Xt=y[Symbol.iterator](),ya;!(Le=(ya=Xt.next()).done);Le=!0){var Vr=ya.value;Vr>=I&&Vr<Ye&&(Ye=Vr)}}catch(ls){kr=!0,Yt=ls}finally{try{!Le&&Xt.return&&Xt.return()}finally{if(kr)throw Yt}}var Rt=Me+1;Ye-I>H((m-ae)/Rt)&&M("overflow"),ae+=(Ye-I)*Rt,I=Ye;var er=!0,zr=!1,dr=void 0;try{for(var cs=y[Symbol.iterator](),Gd;!(er=(Gd=cs.next()).done);er=!0){var Yd=Gd.value;if(Yd<I&&++ae>m&&M("overflow"),Yd==I){for(var Sn=ae,Rn=p;;Rn+=p){var kn=Rn<=se?h:Rn>=se+g?g:Rn-se;if(Sn<kn)break;var Xd=Sn-kn,ef=p-kn;E.push(F(N(kn+Xd%ef,0))),Sn=H(Xd/ef)}E.push(F(N(Sn,0))),se=R(ae,Rt,Me==ce),ae=0,++Me}}}catch(ls){zr=!0,dr=ls}finally{try{!er&&cs.return&&cs.return()}finally{if(zr)throw dr}}++ae,++I}return E.join("")},_=function(y){return ye(y,function(E){return z.test(E)?j(E.slice(4).toLowerCase()):E})},b=function(y){return ye(y,function(E){return U.test(E)?"xn--"+T(E):E})},O={version:"2.1.0",ucs2:{decode:ve,encode:be},decode:j,encode:T,toASCII:b,toUnicode:_},K={};function Q($){var y=$.charCodeAt(0),E=void 0;return y<16?E="%0"+y.toString(16).toUpperCase():y<128?E="%"+y.toString(16).toUpperCase():y<2048?E="%"+(y>>6|192).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase():E="%"+(y>>12|224).toString(16).toUpperCase()+"%"+(y>>6&63|128).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase(),E}function fe($){for(var y="",E=0,C=$.length;E<C;){var I=parseInt($.substr(E+1,2),16);if(I<128)y+=String.fromCharCode(I),E+=3;else if(I>=194&&I<224){if(C-E>=6){var ae=parseInt($.substr(E+4,2),16);y+=String.fromCharCode((I&31)<<6|ae&63)}else y+=$.substr(E,6);E+=6}else if(I>=224){if(C-E>=9){var se=parseInt($.substr(E+4,2),16),Ee=parseInt($.substr(E+7,2),16);y+=String.fromCharCode((I&15)<<12|(se&63)<<6|Ee&63)}else y+=$.substr(E,9);E+=9}else y+=$.substr(E,3),E+=3}return y}function ne($,y){function E(C){var I=fe(C);return I.match(y.UNRESERVED)?I:C}return $.scheme&&($.scheme=String($.scheme).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_SCHEME,"")),$.userinfo!==void 0&&($.userinfo=String($.userinfo).replace(y.PCT_ENCODED,E).replace(y.NOT_USERINFO,Q).replace(y.PCT_ENCODED,i)),$.host!==void 0&&($.host=String($.host).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_HOST,Q).replace(y.PCT_ENCODED,i)),$.path!==void 0&&($.path=String($.path).replace(y.PCT_ENCODED,E).replace($.scheme?y.NOT_PATH:y.NOT_PATH_NOSCHEME,Q).replace(y.PCT_ENCODED,i)),$.query!==void 0&&($.query=String($.query).replace(y.PCT_ENCODED,E).replace(y.NOT_QUERY,Q).replace(y.PCT_ENCODED,i)),$.fragment!==void 0&&($.fragment=String($.fragment).replace(y.PCT_ENCODED,E).replace(y.NOT_FRAGMENT,Q).replace(y.PCT_ENCODED,i)),$}function he($){return $.replace(/^0*(.*)/,"$1")||"0"}function ct($,y){var E=$.match(y.IPV4ADDRESS)||[],C=v(E,2),I=C[1];return I?I.split(".").map(he).join("."):$}function Ke($,y){var E=$.match(y.IPV6ADDRESS)||[],C=v(E,3),I=C[1],ae=C[2];if(I){for(var se=I.toLowerCase().split("::").reverse(),Ee=v(se,2),je=Ee[0],Be=Ee[1],$e=Be?Be.split(":").map(he):[],Ce=je.split(":").map(he),We=y.IPV4ADDRESS.test(Ce[Ce.length-1]),ce=We?7:8,Me=Ce.length-ce,Ye=Array(ce),Le=0;Le<ce;++Le)Ye[Le]=$e[Le]||Ce[Me+Le]||"";We&&(Ye[ce-1]=ct(Ye[ce-1],y));var kr=Ye.reduce(function(Rt,er,zr){if(!er||er==="0"){var dr=Rt[Rt.length-1];dr&&dr.index+dr.length===zr?dr.length++:Rt.push({index:zr,length:1})}return Rt},[]),Yt=kr.sort(function(Rt,er){return er.length-Rt.length})[0],Xt=void 0;if(Yt&&Yt.length>1){var ya=Ye.slice(0,Yt.index),Vr=Ye.slice(Yt.index+Yt.length);Xt=ya.join(":")+"::"+Vr.join(":")}else Xt=Ye.join(":");return ae&&(Xt+="%"+ae),Xt}else return $}var Te=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Pt="".match(/(){0}/)[1]===void 0;function Ge($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},C=y.iri!==!1?d:u;y.reference==="suffix"&&($=(y.scheme?y.scheme+":":"")+"//"+$);var I=$.match(Te);if(I){Pt?(E.scheme=I[1],E.userinfo=I[3],E.host=I[4],E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=I[7],E.fragment=I[8],isNaN(E.port)&&(E.port=I[5])):(E.scheme=I[1]||void 0,E.userinfo=$.indexOf("@")!==-1?I[3]:void 0,E.host=$.indexOf("//")!==-1?I[4]:void 0,E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=$.indexOf("?")!==-1?I[7]:void 0,E.fragment=$.indexOf("#")!==-1?I[8]:void 0,isNaN(E.port)&&(E.port=$.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),E.host&&(E.host=Ke(ct(E.host,C),C)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",y.reference&&y.reference!=="suffix"&&y.reference!==E.reference&&(E.error=E.error||"URI is not a "+y.reference+" reference.");var ae=K[(y.scheme||E.scheme||"").toLowerCase()];if(!y.unicodeSupport&&(!ae||!ae.unicodeSupport)){if(E.host&&(y.domainHost||ae&&ae.domainHost))try{E.host=O.toASCII(E.host.replace(C.PCT_ENCODED,fe).toLowerCase())}catch(se){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+se}ne(E,u)}else ne(E,C);ae&&ae.parse&&ae.parse(E,y)}else E.error=E.error||"URI can not be parsed.";return E}function Qt($,y){var E=y.iri!==!1?d:u,C=[];return $.userinfo!==void 0&&(C.push($.userinfo),C.push("@")),$.host!==void 0&&C.push(Ke(ct(String($.host),E),E).replace(E.IPV6ADDRESS,function(I,ae,se){return"["+ae+(se?"%25"+se:"")+"]"})),(typeof $.port=="number"||typeof $.port=="string")&&(C.push(":"),C.push(String($.port))),C.length?C.join(""):void 0}var Lt=/^\.\.?\//,ze=/^\/\.(\/|$)/,Et=/^\/\.\.(\/|$)/,lr=/^\/?(?:.|\n)*?(?=\/|$)/;function qe($){for(var y=[];$.length;)if($.match(Lt))$=$.replace(Lt,"");else if($.match(ze))$=$.replace(ze,"/");else if($.match(Et))$=$.replace(Et,"/"),y.pop();else if($==="."||$==="..")$="";else{var E=$.match(lr);if(E){var C=E[0];$=$.slice(C.length),y.push(C)}else throw new Error("Unexpected dot segment condition")}return y.join("")}function Ue($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=y.iri?d:u,C=[],I=K[(y.scheme||$.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize($,y),$.host&&!E.IPV6ADDRESS.test($.host)){if(y.domainHost||I&&I.domainHost)try{$.host=y.iri?O.toUnicode($.host):O.toASCII($.host.replace(E.PCT_ENCODED,fe).toLowerCase())}catch(Ee){$.error=$.error||"Host's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}ne($,E),y.reference!=="suffix"&&$.scheme&&(C.push($.scheme),C.push(":"));var ae=Qt($,y);if(ae!==void 0&&(y.reference!=="suffix"&&C.push("//"),C.push(ae),$.path&&$.path.charAt(0)!=="/"&&C.push("/")),$.path!==void 0){var se=$.path;!y.absolutePath&&(!I||!I.absolutePath)&&(se=qe(se)),ae===void 0&&(se=se.replace(/^\/\//,"/%2F")),C.push(se)}return $.query!==void 0&&(C.push("?"),C.push($.query)),$.fragment!==void 0&&(C.push("#"),C.push($.fragment)),C.join("")}function tt($,y){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=arguments[3],I={};return C||($=Ge(Ue($,E),E),y=Ge(Ue(y,E),E)),E=E||{},!E.tolerant&&y.scheme?(I.scheme=y.scheme,I.userinfo=y.userinfo,I.host=y.host,I.port=y.port,I.path=qe(y.path||""),I.query=y.query):(y.userinfo!==void 0||y.host!==void 0||y.port!==void 0?(I.userinfo=y.userinfo,I.host=y.host,I.port=y.port,I.path=qe(y.path||""),I.query=y.query):(y.path?(y.path.charAt(0)==="/"?I.path=qe(y.path):(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path?I.path="/"+y.path:$.path?I.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+y.path:I.path=y.path,I.path=qe(I.path)),I.query=y.query):(I.path=$.path,y.query!==void 0?I.query=y.query:I.query=$.query),I.userinfo=$.userinfo,I.host=$.host,I.port=$.port),I.scheme=$.scheme),I.fragment=y.fragment,I}function Rr($,y,E){var C=l({scheme:"null"},E);return Ue(tt(Ge($,C),Ge(y,C),C,!0),C)}function ur($,y){return typeof $=="string"?$=Ue(Ge($,y),y):n($)==="object"&&($=Ge(Ue($,y),y)),$}function qr($,y,E){return typeof $=="string"?$=Ue(Ge($,E),E):n($)==="object"&&($=Ue($,E)),typeof y=="string"?y=Ue(Ge(y,E),E):n(y)==="object"&&(y=Ue(y,E)),$===y}function En($,y){return $&&$.toString().replace(!y||!y.iri?u.ESCAPE:d.ESCAPE,Q)}function St($,y){return $&&$.toString().replace(!y||!y.iri?u.PCT_ENCODED:d.PCT_ENCODED,fe)}var Ur={scheme:"http",domainHost:!0,parse:function(y,E){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y},serialize:function(y,E){var C=String(y.scheme).toLowerCase()==="https";return(y.port===(C?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}},zd={scheme:"https",domainHost:Ur.domainHost,parse:Ur.parse,serialize:Ur.serialize};function Hd($){return typeof $.secure=="boolean"?$.secure:String($.scheme).toLowerCase()==="wss"}var os={scheme:"ws",domainHost:!0,parse:function(y,E){var C=y;return C.secure=Hd(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C},serialize:function(y,E){if((y.port===(Hd(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){var C=y.resourceName.split("?"),I=v(C,2),ae=I[0],se=I[1];y.path=ae&&ae!=="/"?ae:void 0,y.query=se,y.resourceName=void 0}return y.fragment=void 0,y}},Zd={scheme:"wss",domainHost:os.domainHost,parse:os.parse,serialize:os.serialize},Gw={},Kd="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Gt="[0-9A-Fa-f]",Yw=r(r("%[EFef]"+Gt+"%"+Gt+Gt+"%"+Gt+Gt)+"|"+r("%[89A-Fa-f]"+Gt+"%"+Gt+Gt)+"|"+r("%"+Gt+Gt)),Xw="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",eb="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",tb=s(eb,'[\\"\\\\]'),rb="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ab=new RegExp(Kd,"g"),_a=new RegExp(Yw,"g"),sb=new RegExp(s("[^]",Xw,"[\\.]",'[\\"]',tb),"g"),Bd=new RegExp(s("[^]",Kd,rb),"g"),nb=Bd;function ic($){var y=fe($);return y.match(ab)?y:$}var Wd={scheme:"mailto",parse:function(y,E){var C=y,I=C.to=C.path?C.path.split(","):[];if(C.path=void 0,C.query){for(var ae=!1,se={},Ee=C.query.split("&"),je=0,Be=Ee.length;je<Be;++je){var $e=Ee[je].split("=");switch($e[0]){case"to":for(var Ce=$e[1].split(","),We=0,ce=Ce.length;We<ce;++We)I.push(Ce[We]);break;case"subject":C.subject=St($e[1],E);break;case"body":C.body=St($e[1],E);break;default:ae=!0,se[St($e[0],E)]=St($e[1],E);break}}ae&&(C.headers=se)}C.query=void 0;for(var Me=0,Ye=I.length;Me<Ye;++Me){var Le=I[Me].split("@");if(Le[0]=St(Le[0]),E.unicodeSupport)Le[1]=St(Le[1],E).toLowerCase();else try{Le[1]=O.toASCII(St(Le[1],E).toLowerCase())}catch(kr){C.error=C.error||"Email address's domain name can not be converted to ASCII via punycode: "+kr}I[Me]=Le.join("@")}return C},serialize:function(y,E){var C=y,I=o(y.to);if(I){for(var ae=0,se=I.length;ae<se;++ae){var Ee=String(I[ae]),je=Ee.lastIndexOf("@"),Be=Ee.slice(0,je).replace(_a,ic).replace(_a,i).replace(sb,Q),$e=Ee.slice(je+1);try{$e=E.iri?O.toUnicode($e):O.toASCII(St($e,E).toLowerCase())}catch(Me){C.error=C.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Me}I[ae]=Be+"@"+$e}C.path=I.join(",")}var Ce=y.headers=y.headers||{};y.subject&&(Ce.subject=y.subject),y.body&&(Ce.body=y.body);var We=[];for(var ce in Ce)Ce[ce]!==Gw[ce]&&We.push(ce.replace(_a,ic).replace(_a,i).replace(Bd,Q)+"="+Ce[ce].replace(_a,ic).replace(_a,i).replace(nb,Q));return We.length&&(C.query=We.join("&")),C}},ib=/^([^\:]+)\:(.*)/,Jd={scheme:"urn",parse:function(y,E){var C=y.path&&y.path.match(ib),I=y;if(C){var ae=E.scheme||I.scheme||"urn",se=C[1].toLowerCase(),Ee=C[2],je=ae+":"+(E.nid||se),Be=K[je];I.nid=se,I.nss=Ee,I.path=void 0,Be&&(I=Be.parse(I,E))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(y,E){var C=E.scheme||y.scheme||"urn",I=y.nid,ae=C+":"+(E.nid||I),se=K[ae];se&&(y=se.serialize(y,E));var Ee=y,je=y.nss;return Ee.path=(I||E.nid)+":"+je,Ee}},ob=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Qd={scheme:"urn:uuid",parse:function(y,E){var C=y;return C.uuid=C.nss,C.nss=void 0,!E.tolerant&&(!C.uuid||!C.uuid.match(ob))&&(C.error=C.error||"UUID is not valid."),C},serialize:function(y,E){var C=y;return C.nss=(y.uuid||"").toLowerCase(),C}};K[Ur.scheme]=Ur,K[zd.scheme]=zd,K[os.scheme]=os,K[Zd.scheme]=Zd,K[Wd.scheme]=Wd,K[Jd.scheme]=Jd,K[Qd.scheme]=Qd,a.SCHEMES=K,a.pctEncChar=Q,a.pctDecChars=fe,a.parse=Ge,a.removeDotSegments=qe,a.serialize=Ue,a.resolveComponents=tt,a.resolve=Rr,a.normalize=ur,a.equal=qr,a.escapeComponent=En,a.unescapeComponent=St,Object.defineProperty(a,"__esModule",{value:!0})})})(so,so.exports);var Ag=so.exports,jg=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},la={copy:Dg,checkDataType:no,checkDataTypes:Mg,coerceToTypes:Lg,toHash:io,getProperty:oo,escapeQuotes:co,equal:Pa,ucs2length:jg,varOccurences:Ug,varReplace:Vg,schemaHasRules:zg,schemaHasRulesExcept:Hg,schemaUnknownRules:Zg,toQuotedString:lo,getPathExpr:Kg,getPath:Bg,getData:Qg,unescapeFragment:Gg,unescapeJsonPointer:fo,escapeFragment:Yg,escapeJsonPointer:uo};function Dg(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function no(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 Mg(t,e,a){switch(t.length){case 1:return no(t[0],e,a,!0);default:var s="",r=io(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?" && ":"")+no(n,e,a,!0);return s}}var Pu=io(["string","number","integer","boolean","null"]);function Lg(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(Pu[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(Pu[e])return[e];if(t==="array"&&e==="array")return["array"]}}function io(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var Fg=/^[a-z$_][a-z$_0-9]*$/i,qg=/'|\\/g;function oo(t){return typeof t=="number"?"["+t+"]":Fg.test(t)?"."+t:"['"+co(t)+"']"}function co(t){return t.replace(qg,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Ug(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function Vg(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function zg(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function Hg(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function Zg(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function lo(t){return"'"+co(t)+"'"}function Kg(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Eu(t,r)}function Bg(t,e,a){var s=lo(a?"/"+uo(e):oo(e));return Eu(t,s)}var Wg=/^\/(?:[^~]|~0|~1)*$/,Jg=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qg(t,e,a){var s,r,n,i;if(t==="")return"rootData";if(t[0]=="/"){if(!Wg.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(i=t.match(Jg),!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,l=r.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(n+=oo(fo(u)),o+=" && "+n)}return o}function Eu(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Gg(t){return fo(decodeURIComponent(t))}function Yg(t){return encodeURIComponent(uo(t))}function uo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function fo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var Xg=la,Su=e_;function e_(t){Xg.copy(t,this)}var Ru={exports:{}},br=Ru.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(){};Zs(e,s,r,t,"",t)};br.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},br.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},br.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},br.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 Zs(t,e,a,s,r,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in br.arrayKeywords)for(var v=0;v<d.length;v++)Zs(t,e,a,d[v],r+"/"+u+"/"+v,n,r,u,s,v)}else if(u in br.propsKeywords){if(d&&typeof d=="object")for(var f in d)Zs(t,e,a,d[f],r+"/"+u+"/"+t_(f),n,r,u,s,f)}else(u in br.keywords||t.allKeys&&!(u in br.skipKeywords))&&Zs(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,l,c)}}function t_(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var r_=Ru.exports,Ya=Ag,ku=Pa,Ks=la,Bs=Su,a_=r_,ho=$r;$r.normalizeId=Pr,$r.fullPath=Js,$r.url=Qs,$r.ids=c_,$r.inlineRef=po,$r.schema=Ws;function $r(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return $r.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof Bs)return po(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ws.call(this,e,a),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Bs?i=n.validate||t.call(this,n.schema,e,void 0,o):n!==void 0&&(i=po(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,o)),i}function Ws(t,e){var a=Ya.parse(e),s=Tu(a),r=Js(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=Pr(s),i=this._refs[n];if(typeof i=="string")return s_.call(this,t,i,a);if(i instanceof Bs)i.validate||this._compile(i),t=i;else if(i=this._schemas[n],i instanceof Bs){if(i.validate||this._compile(i),n==Pr(e))return{schema:i,root:t,baseId:r};t=i}else return;if(!t.schema)return;r=Js(this._getId(t.schema))}return xu.call(this,a,r,t.schema,t)}function s_(t,e,a){var s=Ws.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var i=this._getId(r);return i&&(n=Qs(n,i)),xu.call(this,a,n,r,t)}}var n_=Ks.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function xu(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=Ks.unescapeFragment(i),a=a[i],a===void 0)break;var o;if(!n_[i]&&(o=this._getId(a),o&&(e=Qs(e,o)),a.$ref)){var l=Qs(e,a.$ref),c=Ws.call(this,s,l);c&&(a=c.schema,s=c.root,e=c.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var i_=Ks.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function po(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return mo(t);if(e)return vo(t)<=e}function mo(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!mo(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!mo(e)))return!1;return!0}function vo(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+=vo(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(i_[r])e++;else if(a=t[r],typeof a=="object"&&(e+=vo(a)+1),e==1/0)return 1/0}return e}function Js(t,e){e!==!1&&(t=Pr(t));var a=Ya.parse(t);return Tu(a)}function Tu(t){return Ya.serialize(t).split("#")[0]+"#"}var o_=/#\/?$/;function Pr(t){return t?t.replace(o_,""):""}function Qs(t,e){return e=Pr(e),Ya.resolve(t,e)}function c_(t){var e=Pr(this._getId(t)),a={"":e},s={"":Js(e,!1)},r={},n=this;return a_(t,{allKeys:!0},function(i,o,l,c,u,d,v){if(o!==""){var f=n._getId(i),m=a[c],p=s[c]+"/"+u;if(v!==void 0&&(p+="/"+(typeof v=="number"?v:Ks.escapeFragment(v))),typeof f=="string"){f=m=Pr(m?Ya.resolve(m,f):f);var h=n._refs[f];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!ku(i,h.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=Pr(p))if(f[0]=="#"){if(r[f]&&!ku(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 go=ho,_o={Validation:Iu(l_),MissingRef:Iu(yo)};function l_(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}yo.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function yo(t,e,a){this.message=a||yo.message(t,e),this.missingRef=go.url(t,e),this.missingSchema=go.normalizeId(go.fullPath(this.missingRef))}function Iu(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Cu=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,l){var c={key:o,value:i[o]},u={key:l,value:i[l]};return n(c,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,l;if(Array.isArray(i)){for(l="[",o=0;o<i.length;o++)o&&(l+=","),l+=n(i[o])||"null";return l+"]"}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 c=r.push(i)-1,u=Object.keys(i).sort(s&&s(i));for(l="",o=0;o<u.length;o++){var d=u[o],v=n(i[d]);v&&(l&&(l+=","),l+=JSON.stringify(d)+":"+v)}return r.splice(c,1),"{"+l+"}"}}(t)},Ou=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 l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",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,v=e.schema[a],f=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,x=!e.opts.allErrors,U,p="data"+(d||""),S="valid"+u;if(e.schema===!1){e.isTop?x=!0:r+=" var "+S+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"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 g=r;r=h.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+S+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var w=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 P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,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 S="valid"+u,x=!e.opts.allErrors,A="",z="",U,D=e.schema.type,W=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(W?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],W=!0)),W&&D.length==1&&(D=D[0],W=!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")),D){if(e.opts.coerceTypes)var J=e.util.coerceToTypes(e.opts.coerceTypes,D);var H=e.RULES.types[D];if(J||W||H===!0||H&&!ze(H)){var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",f=e.schemaPath+".type",m=e.errSchemaPath+"/type",F=W?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[F](D,p,e.opts.strictNumbers,!0)+") { ",J){var M="dataType"+u,te="coerced"+u;r+=" var "+M+" = typeof "+p+"; var "+te+" = 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)+") "+te+" = "+p+"; } "),r+=" if ("+te+" !== undefined) ; ";var ye=J;if(ye)for(var ve,be=-1,de=ye.length-1;be<de;)ve=ye[be+=1],ve=="string"?r+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+te+" = '' + "+p+"; else if ("+p+" === null) "+te+" = ''; ":ve=="number"||ve=="integer"?(r+=" else if ("+M+" == 'boolean' || "+p+" === null || ("+M+" == 'string' && "+p+" && "+p+" == +"+p+" ",ve=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+te+" = +"+p+"; "):ve=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+te+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+te+" = true; ":ve=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+te+" = null; ":e.opts.coerceTypes=="array"&&ve=="array"&&(r+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+p+" == null) "+te+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var g=r;r=h.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+te+" !== undefined) { ";var N=d?"data"+(d-1||""):"parentData",R=d?e.dataPathArr[d]:"parentDataProperty";r+=" "+p+" = "+te+"; ",d||(r+="if ("+N+" !== undefined)"),r+=" "+N+"["+R+"] = "+te+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var g=r;r=h.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",x&&(r+=" } if (errors === ",w?r+="0":r+="errs_"+u,r+=") { ",z+="}");else{var j=e.RULES;if(j){for(var H,T=-1,_=j.length-1;T<_;)if(H=j[T+=1],ze(H)){if(H.type&&(r+=" if ("+e.util.checkDataType(H.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(H.type=="object"&&e.schema.properties){var v=e.schema.properties,b=Object.keys(v),O=b;if(O)for(var K,Q=-1,fe=O.length-1;Q<fe;){K=O[Q+=1];var ne=v[K];if(ne.default!==void 0){var he=p+e.util.getProperty(K);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ne.default)+" ":r+=" "+JSON.stringify(ne.default)+" ",r+="; "}}}else if(H.type=="array"&&Array.isArray(e.schema.items)){var ct=e.schema.items;if(ct){for(var ne,be=-1,Ke=ct.length-1;be<Ke;)if(ne=ct[be+=1],ne.default!==void 0){var he=p+"["+be+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ne.default)+" ":r+=" "+JSON.stringify(ne.default)+" ",r+="; "}}}}var Te=H.rules;if(Te){for(var Pt,Ge=-1,Qt=Te.length-1;Ge<Qt;)if(Pt=Te[Ge+=1],Et(Pt)){var Lt=Pt.code(e,Pt.keyword,H.type);Lt&&(r+=" "+Lt+" ",x&&(A+="}"))}}if(x&&(r+=" "+A+" ",A=""),H.type&&(r+=" } ",D&&D===H.type&&!J)){r+=" else { ";var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var g=r;r=h.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}x&&(r+=" if (errors === ",w?r+="0":r+="errs_"+u,r+=") { ",z+="}")}}}x&&(r+=" "+z+" "),w?(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 "+S+" = errors === errs_"+u+";";function ze(qe){for(var Ue=qe.rules,tt=0;tt<Ue.length;tt++)if(Et(Ue[tt]))return!0}function Et(qe){return e.schema[qe.keyword]!==void 0||qe.implements&&lr(qe)}function lr(qe){for(var Ue=qe.implements,tt=0;tt<Ue.length;tt++)if(e.schema[Ue[tt]]!==void 0)return!0}return r},Gs=ho,Ys=la,Nu=_o,u_=Cu,Au=Ou,d_=Ys.ucs2length,f_=Pa,h_=Nu.Validation,p_=wo;function wo(t,e,a,s){var r=this,n=this._opts,i=[void 0],o={},l=[],c={},u=[],d={},v=[];e=e||{schema:t,refVal:i,refs:o};var f=m_.call(this,t,e,s),m=this._compilations[f.index];if(f.compiling)return m.callValidate=P;var p=this._formats,h=this.RULES;try{var g=S(t,e,a,s);m.validate=g;var w=m.callValidate;return w&&(w.schema=g.schema,w.errors=null,w.refs=g.refs,w.refVal=g.refVal,w.root=g.root,w.$async=g.$async,n.sourceCode&&(w.source=g.source)),g}finally{v_.call(this,t,e,s)}function P(){var F=m.validate,M=F.apply(this,arguments);return P.errors=F.errors,M}function S(F,M,te,ye){var ve=!M||M&&M.schema==F;if(M.schema!=e.schema)return wo.call(r,F,M,te,ye);var be=F.$async===!0,de=Au({isTop:!0,schema:F,isRoot:ve,baseId:ye,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Nu.MissingRef,RULES:h,validate:Au,util:Ys,resolve:Gs,resolveRef:x,usePattern:W,useDefault:J,useCustomRule:H,opts:n,formats:p,logger:r.logger,self:r});de=Xs(i,y_)+Xs(l,g_)+Xs(u,__)+Xs(v,w_)+de,n.processCode&&(de=n.processCode(de,F));var N;try{var R=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",de);N=R(r,h,p,e,i,u,v,f_,d_,h_),i[0]=N}catch(j){throw r.logger.error("Error compiling schema, function code:",de),j}return N.schema=F,N.errors=null,N.refs=o,N.refVal=i,N.root=ve?N:M,be&&(N.$async=!0),n.sourceCode===!0&&(N.source={code:de,patterns:l,defaults:u}),N}function x(F,M,te){M=Gs.url(F,M);var ye=o[M],ve,be;if(ye!==void 0)return ve=i[ye],be="refVal["+ye+"]",D(ve,be);if(!te&&e.refs){var de=e.refs[M];if(de!==void 0)return ve=e.refVal[de],be=A(M,ve),D(ve,be)}be=A(M);var N=Gs.call(r,S,e,M);if(N===void 0){var R=a&&a[M];R&&(N=Gs.inlineRef(R,n.inlineRefs)?R:wo.call(r,R,e,a,F))}if(N===void 0)z(M);else return U(M,N),D(N,be)}function A(F,M){var te=i.length;return i[te]=M,o[F]=te,"refVal"+te}function z(F){delete o[F]}function U(F,M){var te=o[F];i[te]=M}function D(F,M){return typeof F=="object"||typeof F=="boolean"?{code:M,schema:F,inline:!0}:{code:M,$async:F&&!!F.$async}}function W(F){var M=c[F];return M===void 0&&(M=c[F]=l.length,l[M]=F),"pattern"+M}function J(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return Ys.toQuotedString(F);case"object":if(F===null)return"null";var M=u_(F),te=d[M];return te===void 0&&(te=d[M]=u.length,u[te]=F),"default"+te}}function H(F,M,te,ye){if(r._opts.validateSchema!==!1){var ve=F.definition.dependencies;if(ve&&!ve.every(function(O){return Object.prototype.hasOwnProperty.call(te,O)}))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 N="keyword schema is invalid: "+r.errorsText(be.errors);if(r._opts.validateSchema=="log")r.logger.error(N);else throw new Error(N)}}}var R=F.definition.compile,j=F.definition.inline,T=F.definition.macro,_;if(R)_=R.call(r,M,te,ye);else if(T)_=T.call(r,M,te,ye),n.validateSchema!==!1&&r.validateSchema(_,!0);else if(j)_=j.call(r,ye,F.keyword,M,te);else if(_=F.definition.validate,!_)return;if(_===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var b=v.length;return v[b]=_,{code:"customRule"+b,validate:_}}}function m_(t,e,a){var s=ju.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 v_(t,e,a){var s=ju.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function ju(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 g_(t,e){return"var pattern"+t+" = new RegExp("+Ys.toQuotedString(e[t])+");"}function __(t){return"var default"+t+" = defaults["+t+"];"}function y_(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function w_(t){return"var customRule"+t+" = customRules["+t+"];"}function Xs(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var Du={exports:{}},en=Du.exports=function(){this._cache={}};en.prototype.put=function(e,a){this._cache[e]=a},en.prototype.get=function(e){return this._cache[e]},en.prototype.del=function(e){delete this._cache[e]},en.prototype.clear=function(){this._cache={}};var b_=Du.exports,$_=la,P_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,E_=[0,31,28,31,30,31,30,31,31,30,31,30,31],S_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Mu=/^(?=.{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,R_=/^(?:[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,k_=/^(?:[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,Lu=/^(?:(?:[^\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,Fu=/^(?:(?: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,qu=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Uu=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Vu=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,zu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,x_=tn;function tn(t){return t=t=="full"?"full":"fast",$_.copy(tn[t])}tn.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":Lu,url:Fu,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:Mu,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:Ku,uuid:qu,"json-pointer":Uu,"json-pointer-uri-fragment":Vu,"relative-json-pointer":zu},tn.full={date:Hu,time:Zu,"date-time":C_,uri:N_,"uri-reference":k_,"uri-template":Lu,url:Fu,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:Mu,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:Ku,uuid:qu,"json-pointer":Uu,"json-pointer-uri-fragment":Vu,"relative-json-pointer":zu};function T_(t){return t%4===0&&(t%100!==0||t%400===0)}function Hu(t){var e=t.match(P_);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&T_(a)?29:E_[s])}function Zu(t,e){var a=t.match(S_);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 I_=/t|\s/i;function C_(t){var e=t.split(I_);return e.length==2&&Hu(e[0])&&Zu(e[1],!0)}var O_=/\/|:/;function N_(t){return O_.test(t)&&R_.test(t)}var A_=/[^\\]\\Z/;function Ku(t){if(A_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var j_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,u="data"+(i||""),d="valid"+n,v,f;if(o=="#"||o=="#/")e.isRoot?(v=e.async,f="validate"):(v=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(l)+" , 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 g=r;r=h.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,p)}else if(m.inline){var w=e.util.copy(e);w.level++;var P="valid"+w.level;w.schema=m.schema,w.schemaPath="",w.errSchemaPath=o;var S=e.validate(w).replace(/validate\.schema/g,m.code);r+=" "+S+" ",c&&(r+=" if ("+P+") { ")}else v=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 x=i?"data"+(i-1||""):"parentData",A=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+x+" , "+A+", rootData) ";var z=r;if(r=h.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+d+"; "),r+=" try { await "+z+"; ",c&&(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; ",c&&(r+=" "+d+" = false; "),r+=" } ",c&&(r+=" if ("+d+") { ")}else r+=" if (!"+z+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r},D_=function(e,a,s){var r=" ",n=e.schema[a],i=e.schemaPath+e.util.getProperty(a),o=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var d="valid"+c.level,v=c.baseId,f=!0,m=n;if(m)for(var p,h=-1,g=m.length-1;h<g;)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,c.schema=p,c.schemaPath=i+"["+h+"]",c.errSchemaPath=o+"/"+h,r+=" "+e.validate(c)+" ",c.baseId=v,l&&(r+=" if ("+d+") { ",u+="}"));return l&&(f?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},M_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,g=o.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(g){var w=m.baseId;r+=" var "+f+" = errors; var "+v+" = false; ";var P=e.compositeRule;e.compositeRule=m.compositeRule=!0;var S=o;if(S)for(var x,A=-1,z=S.length-1;A<z;)x=S[A+=1],m.schema=x,m.schemaPath=l+"["+A+"]",m.errSchemaPath=c+"/"+A,r+=" "+e.validate(m)+" ",m.baseId=w,r+=" "+v+" = "+v+" || "+h+"; if (!"+v+") { ",p+="}";e.compositeRule=m.compositeRule=P,r+=" "+p+" if (!"+v+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},L_=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},F_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="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"+l+";"),r+="var "+v+" = equal("+d+", schema"+n+"); if (!"+v+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},q_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,g="i"+n,w=m.dataLevel=e.dataLevel+1,P="data"+w,S=e.baseId,x=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 "+v+";",x){var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+h+" = false; for (var "+g+" = 0; "+g+" < "+d+".length; "+g+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var z=d+"["+g+"]";m.dataPathArr[w]=g;var U=e.validate(m);m.baseId=S,e.util.varOccurences(U,P)<2?r+=" "+e.util.varReplace(U,P,z)+" ":r+=" var "+P+" = "+z+"; "+U+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=A,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+d+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var W=r;return r=D.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+W+"]); ":r+=" validate.errors = ["+W+"]; return false; ":r+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",x&&(r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},U_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h={},g={},w=e.opts.ownProperties;for(A in o)if(A!="__proto__"){var P=o[A],S=Array.isArray(P)?g:h;S[A]=P}r+="var "+v+" = errors;";var x=e.errorPath;r+="var missing"+n+";";for(var A in g)if(S=g[A],S.length){if(r+=" if ( "+d+e.util.getProperty(A)+" !== undefined ",w&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),u){r+=" && ( ";var z=S;if(z)for(var U,D=-1,W=z.length-1;D<W;){U=z[D+=1],D&&(r+=" || ");var J=e.util.getProperty(U),H=d+J;r+=" ( ( "+H+" === undefined ",w&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:J)+") ) "}r+=")) { ";var F="missing"+n,M="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,F,!0):x+" + "+F);var te=te||[];te.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",S.length==1?r+="property "+e.util.escapeQuotes(S[0]):r+="properties "+e.util.escapeQuotes(S.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var ye=r;r=te.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+ye+"]); ":r+=" validate.errors = ["+ye+"]; return false; ":r+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var ve=S;if(ve)for(var U,be=-1,de=ve.length-1;be<de;){U=ve[be+=1];var J=e.util.getProperty(U),M=e.util.escapeQuotes(U),H=d+J;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,U,e.opts.jsonPointers)),r+=" if ( "+H+" === undefined ",w&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",S.length==1?r+="property "+e.util.escapeQuotes(S[0]):r+="properties "+e.util.escapeQuotes(S.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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=x;var N=f.baseId;for(var A in h){var P=h[A];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+p+" = true; if ( "+d+e.util.getProperty(A)+" !== undefined ",w&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),r+=") { ",f.schema=P,f.schemaPath=l+e.util.getProperty(A),f.errSchemaPath=c+"/"+e.util.escapeFragment(A),r+=" "+e.validate(f)+" ",f.baseId=N,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+v+" == errors) {"),r},V_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="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"+l+";"),r+="var "+v+";",f&&(r+=" if (schema"+n+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+n+")) "+v+" = false; else {"),r+=""+v+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+d+", "+p+"["+m+"])) { "+v+" = true; break; }",f&&(r+=" } "),r+=" if (!"+v+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var g=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",u&&(r+=" else { "),r},z_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var v=e.opts.$data&&o&&o.$data,f;v?(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(v){var h="format"+n,g="isObject"+n,w="formatType"+n;r+=" var "+h+" = formats["+f+"]; var "+g+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+w+" = "+g+" && "+h+".type || 'string'; if ("+g+") { ",e.async&&(r+=" var async"+n+" = "+h+".async; "),r+=" "+h+" = "+h+".validate; } if ( ",v&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+f+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),r+=") || "),r+=" ("+h+" && "+w+" == '"+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 g=typeof h=="object"&&!(h instanceof RegExp)&&h.validate,w=g&&h.type||"string";if(g){var P=h.async===!0;h=h.validate}if(w!=s)return u&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var S="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+S+"("+d+"))) { "}else{r+=" if (! ";var S="formats"+e.util.getProperty(o);g&&(S+=".validate"),typeof h=="function"?r+=" "+S+"("+d+") ":r+=" "+S+".test("+d+") ",r+=") { "}}var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",v?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,v?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var A=r;return r=x.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},H_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="valid"+n,f="errs__"+n,m=e.util.copy(e);m.level++;var p="valid"+m.level,h=e.schema.then,g=e.schema.else,w=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),P=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),S=m.baseId;if(w||P){var x;m.createErrors=!1,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+f+" = errors; var "+v+" = true; ";var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=S,m.createErrors=!0,r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=A,w?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=S,r+=" "+v+" = "+p+"; ",w&&P?(x="ifClause"+n,r+=" var "+x+" = 'then'; "):x="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+p+") { ",P&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=S,r+=" "+v+" = "+p+"; ",w&&P?(x="ifClause"+n,r+=" var "+x+" = 'else'; "):x="'else'",r+=" } "),r+=" if (!"+v+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+x+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+x+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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},Z_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,g="i"+n,w=m.dataLevel=e.dataLevel+1,P="data"+w,S=e.baseId;if(r+="var "+f+" = errors;var "+v+";",Array.isArray(o)){var x=e.schema.additionalItems;if(x===!1){r+=" "+v+" = "+d+".length <= "+o.length+"; ";var A=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+v+") { ";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , 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 U=r;r=z.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=A,u&&(p+="}",r+=" else { ")}var D=o;if(D){for(var W,J=-1,H=D.length-1;J<H;)if(W=D[J+=1],e.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:e.util.schemaHasRules(W,e.RULES.all)){r+=" "+h+" = true; if ("+d+".length > "+J+") { ";var F=d+"["+J+"]";m.schema=W,m.schemaPath=l+"["+J+"]",m.errSchemaPath=c+"/"+J,m.errorPath=e.util.getPathExpr(e.errorPath,J,e.opts.jsonPointers,!0),m.dataPathArr[w]=J;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof x=="object"&&(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=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+h+" = true; if ("+d+".length > "+o.length+") { for (var "+g+" = "+o.length+"; "+g+" < "+d+".length; "+g+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var F=d+"["+g+"]";m.dataPathArr[w]=g;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+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=l,m.errSchemaPath=c,r+=" for (var "+g+" = 0; "+g+" < "+d+".length; "+g+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var F=d+"["+g+"]";m.dataPathArr[w]=g;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+f+" == errors) {"),r},Bu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,S,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;v?(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],g=e.opts.$data&&h&&h.$data,w=m?"<":">",P=m?">":"<",S=void 0;if(!(v||typeof o=="number"||o===void 0))throw new Error(a+" must be number");if(!(g||h===void 0||typeof h=="number"||typeof h=="boolean"))throw new Error(p+" must be number or boolean");if(g){var x=e.util.getData(h.$data,i,e.dataPathArr),A="exclusive"+n,z="exclType"+n,U="exclIsNumber"+n,D="op"+n,W="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+x+"; ",x="schemaExcl"+n,r+=" var "+A+"; var "+z+" = typeof "+x+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var S=p,J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(S||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else if ( ",v&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+z+" == 'number' ? ( ("+A+" = "+f+" === undefined || "+x+" "+w+"= "+f+") ? "+d+" "+P+"= "+x+" : "+d+" "+P+" "+f+" ) : ( ("+A+" = "+x+" === true) ? "+d+" "+P+"= "+f+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { var op"+n+" = "+A+" ? '"+w+"' : '"+w+"='; ",o===void 0&&(S=p,c=e.errSchemaPath+"/"+p,f=x,v=g)}else{var U=typeof h=="number",W=w;if(U&&v){var D="'"+W+"'";r+=" if ( ",v&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" ( "+f+" === undefined || "+h+" "+w+"= "+f+" ? "+d+" "+P+"= "+h+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { "}else{U&&o===void 0?(A=!0,S=p,c=e.errSchemaPath+"/"+p,f=h,P+="="):(U&&(f=Math[m?"min":"max"](h,o)),h===(U?f:!0)?(A=!0,S=p,c=e.errSchemaPath+"/"+p,P+="="):(A=!1,W+="="));var D="'"+W+"'";r+=" if ( ",v&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+d+" "+P+" "+f+" || "+d+" !== "+d+") { "}}S=S||a;var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+D+", limit: "+f+", exclusive: "+A+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+W+" ",v?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;return r=J.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},Wu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;if(v?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(v||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",v&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",v?r+="' + "+f+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var g=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Ju=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;if(v?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(v||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",v&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",v?r+="' + "+f+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var g=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},Qu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;if(v?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(v||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",v&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",v?r+="' + "+f+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var g=r;return r=h.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",u&&(r+=" else { "),r},K_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;if(v?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(v||typeof o=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",v&&(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+=" ) ",v&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",v?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l: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},B_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="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=l,f.errSchemaPath=c,r+=" var "+v+" = 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 g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var w=r;r=g.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},W_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,g=m.baseId,w="prevValid"+n,P="passingSchemas"+n;r+="var "+f+" = errors , "+w+" = false , "+v+" = false , "+P+" = null; ";var S=e.compositeRule;e.compositeRule=m.compositeRule=!0;var x=o;if(x)for(var A,z=-1,U=x.length-1;z<U;)A=x[z+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(m.schema=A,m.schemaPath=l+"["+z+"]",m.errSchemaPath=c+"/"+z,r+=" "+e.validate(m)+" ",m.baseId=g):r+=" var "+h+" = true; ",z&&(r+=" if ("+h+" && "+w+") { "+v+" = false; "+P+" = ["+P+", "+z+"]; } else { ",p+="}"),r+=" if ("+h+") { "+v+" = "+w+" = true; "+P+" = "+z+"; }";return e.compositeRule=m.compositeRule=S,r+=""+p+"if (!"+v+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},J_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v=e.opts.$data&&o&&o.$data,f;v?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=v?"(new RegExp("+f+"))":e.usePattern(o);r+="if ( ",v&&(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(c)+" , params: { pattern: ",v?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,v?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",v?r+="validate.schema"+l: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},Q_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h="key"+n,g="idx"+n,w=f.dataLevel=e.dataLevel+1,P="data"+w,S="dataProperties"+n,x=Object.keys(o||{}).filter(be),A=e.schema.patternProperties||{},z=Object.keys(A).filter(be),U=e.schema.additionalProperties,D=x.length||z.length,W=U===!1,J=typeof U=="object"&&Object.keys(U).length,H=e.opts.removeAdditional,F=W||J||H,M=e.opts.ownProperties,te=e.baseId,ye=e.schema.required;if(ye&&!(e.opts.$data&&ye.$data)&&ye.length<e.opts.loopRequired)var ve=e.util.toHash(ye);function be(qr){return qr!=="__proto__"}if(r+="var "+v+" = errors;var "+p+" = true;",M&&(r+=" var "+S+" = undefined;"),F){if(M?r+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+g+"=0; "+g+"<"+S+".length; "+g+"++) { var "+h+" = "+S+"["+g+"]; ":r+=" for (var "+h+" in "+d+") { ",D){if(r+=" var isAdditional"+n+" = !(false ",x.length)if(x.length>8)r+=" || validate.schema"+l+".hasOwnProperty("+h+") ";else{var de=x;if(de)for(var N,R=-1,j=de.length-1;R<j;)N=de[R+=1],r+=" || "+h+" == "+e.util.toQuotedString(N)+" "}if(z.length){var T=z;if(T)for(var _,b=-1,O=T.length-1;b<O;)_=T[b+=1],r+=" || "+e.usePattern(_)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(H=="all")r+=" delete "+d+"["+h+"]; ";else{var K=e.errorPath,Q="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),W)if(H)r+=" delete "+d+"["+h+"]; ";else{r+=" "+p+" = false; ";var fe=c;c=e.errSchemaPath+"/additionalProperties";var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , 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=ne.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++; ",c=fe,u&&(r+=" break; ")}else if(J)if(H=="failing"){r+=" var "+v+" = errors; ";var ct=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=U,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 Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",r+=" if (!"+p+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+h+"]; } ",e.compositeRule=f.compositeRule=ct}else{f.schema=U,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 Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=K}D&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var Pt=e.opts.useDefaults&&!e.compositeRule;if(x.length){var Ge=x;if(Ge)for(var N,Qt=-1,Lt=Ge.length-1;Qt<Lt;){N=Ge[Qt+=1];var ze=o[N];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){var Et=e.util.getProperty(N),Ke=d+Et,lr=Pt&&ze.default!==void 0;f.schema=ze,f.schemaPath=l+Et,f.errSchemaPath=c+"/"+e.util.escapeFragment(N),f.errorPath=e.util.getPath(e.errorPath,N,e.opts.jsonPointers),f.dataPathArr[w]=e.util.toQuotedString(N);var Te=e.validate(f);if(f.baseId=te,e.util.varOccurences(Te,P)<2){Te=e.util.varReplace(Te,P,Ke);var qe=Ke}else{var qe=P;r+=" var "+P+" = "+Ke+"; "}if(lr)r+=" "+Te+" ";else{if(ve&&ve[N]){r+=" if ( "+qe+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=") { "+p+" = false; ";var K=e.errorPath,fe=c,Ue=e.util.escapeQuotes(N);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(K,N,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ue+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Ue+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var he=r;r=ne.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++; ",c=fe,e.errorPath=K,r+=" } else { "}else u?(r+=" if ( "+qe+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+qe+" !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=" ) { ");r+=" "+Te+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(z.length){var tt=z;if(tt)for(var _,Rr=-1,ur=tt.length-1;Rr<ur;){_=tt[Rr+=1];var ze=A[_];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){f.schema=ze,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_),M?r+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+g+"=0; "+g+"<"+S+".length; "+g+"++) { var "+h+" = "+S+"["+g+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" if ("+e.usePattern(_)+".test("+h+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ke=d+"["+h+"]";f.dataPathArr[w]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+v+" == errors) {"),r},G_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level;if(r+="var "+v+" = 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=l,f.errSchemaPath=c;var h="key"+n,g="idx"+n,w="i"+n,P="' + "+h+" + '",S=f.dataLevel=e.dataLevel+1,x="data"+S,A="dataProperties"+n,z=e.opts.ownProperties,U=e.baseId;z&&(r+=" var "+A+" = undefined; "),z?r+=" "+A+" = "+A+" || Object.keys("+d+"); for (var "+g+"=0; "+g+"<"+A+".length; "+g+"++) { var "+h+" = "+A+"["+g+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" var startErrs"+n+" = errors; ";var D=h,W=e.compositeRule;e.compositeRule=f.compositeRule=!0;var J=e.validate(f);f.baseId=U,e.util.varOccurences(J,x)<2?r+=" "+e.util.varReplace(J,x,D)+" ":r+=" var "+x+" = "+D+"; "+J+" ",e.compositeRule=f.compositeRule=W,r+=" if (!"+p+") { for (var "+w+"=startErrs"+n+"; "+w+"<errors; "+w+"++) { vErrors["+w+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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 ("+v+" == errors) {"),r},Y_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="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 g,w=-1,P=h.length-1;w<P;){g=h[w+=1];var S=e.schema.properties[g];S&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(p[p.length]=g)}}else var p=o;if(f||p.length){var x=e.errorPath,A=f||p.length>=e.opts.loopRequired,z=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",A){f||(r+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,e.opts.jsonPointers)),r+=" var "+v+" = true; ",f&&(r+=" if (schema"+n+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+n+")) "+v+" = false; else {"),r+=" for (var "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { "+v+" = "+d+"["+m+"["+U+"]] !== undefined ",z&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),r+="; if (!"+v+") break; } ",f&&(r+=" } "),r+=" if (!"+v+") { ";var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else { "}else{r+=" if ( ";var F=p;if(F)for(var M,U=-1,te=F.length-1;U<te;){M=F[U+=1],U&&(r+=" || ");var ye=e.util.getProperty(M),ve=d+ye;r+=" ( ( "+ve+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:ye)+") ) "}r+=") { ";var D="missing"+n,W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,D,!0):x+" + "+D);var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else { "}else if(A){f||(r+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,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(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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 "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { if ("+d+"["+m+"["+U+"]] === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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,N=be.length-1;de<N;){M=be[de+=1];var ye=e.util.getProperty(M),W=e.util.escapeQuotes(M),ve=d+ye;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,M,e.opts.jsonPointers)),r+=" if ( "+ve+" === undefined ",z&&(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(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=x}else u&&(r+=" if (true) {");return r},X_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),v="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 "+v+"; if ("+m+" === false || "+m+" === undefined) "+v+" = true; else if (typeof "+m+" != 'boolean') "+v+" = false; else { "),r+=" var i = "+d+".length , "+v+" = 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])) { "+v+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var g="checkDataType"+(h?"s":"");r+=" if ("+e.util[g](p,"item",e.opts.strictNumbers,!0)+") continue; ",h&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",f&&(r+=" } "),r+=" if (!"+v+") { ";var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",f?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var P=r;r=w.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},ey={$ref:j_,allOf:D_,anyOf:M_,$comment:L_,const:F_,contains:q_,dependencies:U_,enum:V_,format:z_,if:H_,items:Z_,maximum:Bu,minimum:Bu,maxItems:Wu,minItems:Wu,maxLength:Ju,minLength:Ju,maxProperties:Qu,minProperties:Qu,multipleOf:K_,not:B_,oneOf:W_,pattern:J_,properties:Q_,propertyNames:G_,required:Y_,uniqueItems:X_,validate:Ou},Gu=ey,bo=la.toHash,ty=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=bo(a),e.types=bo(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var l=Object.keys(i)[0];o=i[l],i=l,o.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(i);var c=e.all[i]={keyword:i,code:Gu[i],implements:o};return c}),e.all.$comment={keyword:"$comment",code:Gu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=bo(a.concat(s)),e.custom={},e},Yu=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],ry=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<Yu.length;n++){var i=Yu[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},ay=_o.MissingRef,sy=Xu;function Xu(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 l=o.$schema;return l&&!s.getSchema(l)?Xu.call(s,{$ref:l},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(c){if(c instanceof ay)return l(c);throw c}function l(c){var u=c.missingSchema;if(f(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var d=s._loadingSchemas[u];return d||(d=s._loadingSchemas[u]=s._opts.loadSchema(u),d.then(v,v)),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 v(){delete s._loadingSchemas[u]}function f(m){return s._refs[m]||s._schemas[m]}}}}var ny=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d,v="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 g=this,w="definition"+n,P=g.definition,S="",x,A,z,U,D;if(p&&P.$data){D="keywordValidate"+n;var W=P.validateSchema;r+=" var "+w+" = RULES.custom['"+a+"'].definition; var "+D+" = "+w+".validate;"}else{if(U=e.useCustomRule(g,o,e.schema,e),!U)return;h="validate.schema"+l,D=U.code,x=P.compile,A=P.inline,z=P.macro}var J=D+".errors",H="i"+n,F="ruleErr"+n,M=P.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(A||z||(r+=""+J+" = null;"),r+="var "+m+" = errors;var "+f+";",p&&P.$data&&(S+="}",r+=" if ("+h+" === undefined) { "+f+" = true; } else { ",W&&(S+="}",r+=" "+f+" = "+w+".validateSchema("+h+"); if ("+f+") { ")),A)P.statements?r+=" "+U.validate+" ":r+=" "+f+" = "+U.validate+"; ";else if(z){var te=e.util.copy(e),S="";te.level++;var ye="valid"+te.level;te.schema=U.validate,te.schemaPath="";var ve=e.compositeRule;e.compositeRule=te.compositeRule=!0;var be=e.validate(te).replace(/validate\.schema/g,D);e.compositeRule=te.compositeRule=ve,r+=" "+be}else{var de=de||[];de.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",x||P.schema===!1?r+=" , "+v+" ":r+=" , "+h+" , "+v+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var N=i?"data"+(i-1||""):"parentData",R=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+N+" , "+R+" , rootData ) ";var j=r;r=de.pop(),P.errors===!1?(r+=" "+f+" = ",M&&(r+="await "),r+=""+j+"; "):M?(J="customErrors"+n,r+=" var "+J+" = null; try { "+f+" = await "+j+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+J+" = e.errors; else throw e; } "):r+=" "+J+" = null; "+f+" = "+j+"; "}if(P.modifying&&(r+=" if ("+N+") "+v+" = "+N+"["+R+"];"),r+=""+S,P.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",z?r+=""+ye:r+=""+f):r+=" "+!P.valid+" ",r+=") { ",d=g.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(c)+" , params: { keyword: '"+g.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";var T=r;r=de.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _=r;r=de.pop(),A?P.errors?P.errors!="full"&&(r+=" for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+v+"; "),r+=" } "):P.errors===!1?r+=" "+_+" ":(r+=" if ("+m+" == errors) { "+_+" } else { for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+v+"; "),r+=" } } "):z?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+g.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+_+" ":(r+=" if (Array.isArray("+J+")) { if (vErrors === null) vErrors = "+J+"; else vErrors = vErrors.concat("+J+"); errors = vErrors.length; for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+v+"; "),r+=" } } else { "+_+" } "),r+=" } ",u&&(r+=" else { ")}return r};const ed={$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 td=ed,iy={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:td.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:td.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"}]}}},oy=/^[a-z_$][a-z0-9_$-]*$/i,cy=ny,ly=iy,uy={add:dy,get:fy,remove:hy,validate:$o};function dy(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!oy.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,l,c){for(var u,d=0;d<a.length;d++){var v=a[d];if(v.type==l){u=v;break}}u||(u={type:l,rules:[]},a.push(u));var f={keyword:o,definition:c,custom:!0,code:cy,implements:c.implements};u.rules.push(f),a.custom[o]=f}return this}function fy(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function hy(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(ly,!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 py={$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 rd=p_,Lr=ho,my=b_,ad=Su,vy=Cu,gy=x_,_y=ty,sd=ry,nd=la,yy=Ve;Ve.prototype.validate=by,Ve.prototype.compile=$y,Ve.prototype.addSchema=Py,Ve.prototype.addMetaSchema=Ey,Ve.prototype.validateSchema=Sy,Ve.prototype.getSchema=ky,Ve.prototype.removeSchema=Ty,Ve.prototype.addFormat=My,Ve.prototype.errorsText=Dy,Ve.prototype._addSchema=Iy,Ve.prototype._compile=Cy,Ve.prototype.compileAsync=sy;var rn=uy;Ve.prototype.addKeyword=rn.add,Ve.prototype.getKeyword=rn.get,Ve.prototype.removeKeyword=rn.remove,Ve.prototype.validateKeyword=rn.validate;var id=_o;Ve.ValidationError=id.Validation,Ve.MissingRefError=id.MissingRef,Ve.$dataMetaSchema=sd;var an="http://json-schema.org/draft-07/schema",od=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],wy=["/properties"];function Ve(t){if(!(this instanceof Ve))return new Ve(t);t=this._opts=nd.copy(t)||{},zy(this),this._schemas={},this._refs={},this._fragments={},this._formats=gy(t.format),this._cache=t.cache||new my,this._loadingSchemas={},this._compilations=[],this.RULES=_y(),this._getId=Oy(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=vy),this._metaOpts=Vy(this),t.formats&&qy(this),t.keywords&&Uy(this),Ly(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Fy(this)}function by(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 $y(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function Py(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=Lr.normalizeId(e||n),ld(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function Ey(t,e,a){return this.addSchema(t,e,a,!0),this}function Sy(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||Ry(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 Ry(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(an)?an:void 0,t._opts.defaultMeta}function ky(t){var e=cd(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return xy(this,t)}}function xy(t,e){var a=Lr.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,i=rd.call(t,s,r,void 0,n);return t._fragments[e]=new ad({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function cd(t,e){return e=Lr.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Ty(t){if(t instanceof RegExp)return sn(this,this._schemas,t),sn(this,this._refs,t),this;switch(typeof t){case"undefined":return sn(this,this._schemas),sn(this,this._refs),this._cache.clear(),this;case"string":var e=cd(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=Lr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function sn(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 Iy(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=Lr.normalizeId(this._getId(t));o&&s&&ld(this,o);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=o&&o==Lr.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=Lr.ids.call(this,t),d=new ad({id:o,schema:t,localRefs:u,cacheKey:n,meta:a});return o[0]!="#"&&s&&(this._refs[o]=d),this._cache.put(n,d),l&&c&&this.validateSchema(t,!0),d}function Cy(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=rd.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 Oy(t){switch(t.schemaId){case"auto":return jy;case"id":return Ny;default:return Ay}}function Ny(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Ay(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 Dy(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 My(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Ly(t){var e;if(t._opts.$data&&(e=py,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=ed;t._opts.$data&&(a=sd(a,wy)),t.addMetaSchema(a,an,!0),t._refs["http://json-schema.org/schema"]=an}}function Fy(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 qy(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function Uy(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function ld(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Vy(t){for(var e=nd.copy(t._opts),a=0;a<od.length;a++)delete e[od[a]];return e}function zy(t){var e=t._opts.logger;if(e===!1)t.logger={log:Po,warn:Po,error:Po};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 Po(){}const ud=oc(yy);class Xa extends bu{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 ud}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=$u(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:Ja,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ql,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!ql.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"},wr,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},_u,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},wr,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},uu,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},cu,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},tu,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},ru,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},au,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},wr,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},wr,a)}async callTool(e,a=Hs,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 Ae(Ie.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new Ae(Ie.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof Ae?i:new Ae(Ie.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},fu,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}class dd 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 Eo(t){}function fd(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=Eo,onError:a=Eo,onRetry:s=Eo,onComment:r}=t;let n="",i=!0,o,l="",c="";function u(p){const h=i?p.replace(/^\xEF\xBB\xBF/,""):p,[g,w]=Hy(`${n}${h}`);for(const P of g)d(P);n=w,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 g=p.slice(0,h),w=p[h+1]===" "?2:1,P=p.slice(h+w);v(g,P,p);return}v(p,"",p)}function v(p,h,g){switch(p){case"event":c=h;break;case"data":l=`${l}${h}
|
|
9
|
-
`;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new dd(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:
|
|
8
|
+
deps: ${u}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=n(l);i(l,c),o(l,u)}};function n({schema:l}){const c={},u={};for(const d in l){if(d==="__proto__")continue;const g=Array.isArray(l[d])?c:u;g[d]=l[d]}return[c,u]}function i(l,c=l.schema){const{gen:u,data:d,it:g}=l;if(Object.keys(c).length===0)return;const f=u.let("missing");for(const m in c){const p=c[m];if(p.length===0)continue;const h=(0,s.propertyInData)(u,d,m,g.opts.ownProperties);l.setParams({property:m,depsCount:p.length,deps:p.join(", ")}),g.allErrors?u.if(h,()=>{for(const v of p)(0,s.checkReportMissingProp)(l,v)}):(u.if((0,e._)`${h} && (${(0,s.checkMissingProp)(l,p,f)})`),(0,s.reportMissingProp)(l,f),u.else())}}t.validatePropertyDeps=i;function o(l,c=l.schema){const{gen:u,data:d,keyword:g,it:f}=l,m=u.name("valid");for(const p in c)(0,a.alwaysValidSchema)(f,c[p])||(u.if((0,s.propertyInData)(u,d,p,f.opts.ownProperties),()=>{const h=l.subschema({keyword:g,schemaProp:p},m);l.mergeValidEvaluated(h,m)},()=>u.var(m,!0)),l.ok(m))}t.validateSchemaDeps=o,t.default=r})(gl);var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const _l=ge,bm=G,wm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>(0,_l._)`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:a,data:s,it:r}=t;if((0,bm.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,_l.not)(n),()=>{t.error(!0),r.allErrors||e.break()})}),t.ok(n)}};gi.default=wm;var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});const Es=_e,It=ge,$m=Ft,Ss=G,Pm={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>(0,It._)`{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:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&(0,Ss.alwaysValidSchema)(i,a))return;const c=(0,Es.allSchemaProperties)(s.properties),u=(0,Es.allSchemaProperties)(s.patternProperties);d(),t.ok((0,It._)`${n} === ${$m.default.errors}`);function d(){e.forIn("key",r,h=>{!c.length&&!u.length?m(h):e.if(g(h),()=>m(h))})}function g(h){let v;if(c.length>8){const b=(0,Ss.schemaRefOrVal)(i,s.properties,"properties");v=(0,Es.isOwnProperty)(e,b,h)}else c.length?v=(0,It.or)(...c.map(b=>(0,It._)`${h} === ${b}`)):v=It.nil;return u.length&&(v=(0,It.or)(v,...u.map(b=>(0,It._)`${(0,Es.usePattern)(t,b)}.test(${h})`))),(0,It.not)(v)}function f(h){e.code((0,It._)`delete ${r}[${h}]`)}function m(h){if(l.removeAdditional==="all"||l.removeAdditional&&a===!1){f(h);return}if(a===!1){t.setParams({additionalProperty:h}),t.error(),o||e.break();return}if(typeof a=="object"&&!(0,Ss.alwaysValidSchema)(i,a)){const v=e.name("valid");l.removeAdditional==="failing"?(p(h,v,!1),e.if((0,It.not)(v),()=>{t.reset(),f(h)})):(p(h,v),o||e.if((0,It.not)(v),()=>e.break()))}}function p(h,v,b){const P={keyword:"additionalProperties",dataProp:h,dataPropType:Ss.Type.Str};b===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,v)}}};Ps.default=Pm;var _i={};Object.defineProperty(_i,"__esModule",{value:!0});const Em=kt,yl=_e,yi=G,bl=Ps,Sm={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&&bl.default.code(new Em.KeywordCxt(n,bl.default,"additionalProperties"));const i=(0,yl.allSchemaProperties)(a);for(const d of i)n.definedProperties.add(d);n.opts.unevaluated&&i.length&&n.props!==!0&&(n.props=yi.mergeEvaluated.props(e,(0,yi.toHash)(i),n.props));const o=i.filter(d=>!(0,yi.alwaysValidSchema)(n,a[d]));if(o.length===0)return;const l=e.name("valid");for(const d of o)c(d)?u(d):(e.if((0,yl.propertyInData)(e,r,d,n.opts.ownProperties)),u(d),n.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return n.opts.useDefaults&&!n.compositeRule&&a[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};_i.default=Sm;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});const wl=_e,Rs=ge,$l=G,Pl=G,Rm={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,wl.allSchemaProperties)(a),l=o.filter(p=>(0,$l.alwaysValidSchema)(n,a[p]));if(o.length===0||l.length===o.length&&(!n.opts.unevaluated||n.props===!0))return;const c=i.strictSchema&&!i.allowMatchingProperties&&r.properties,u=e.name("valid");n.props!==!0&&!(n.props instanceof Rs.Name)&&(n.props=(0,Pl.evaluatedPropsToName)(e,n.props));const{props:d}=n;g();function g(){for(const p of o)c&&f(p),n.allErrors?m(p):(e.var(u,!0),m(p),e.if(u))}function f(p){for(const h in c)new RegExp(p).test(h)&&(0,$l.checkStrictMode)(n,`property ${h} matches pattern ${p} (use allowMatchingProperties)`)}function m(p){e.forIn("key",s,h=>{e.if((0,Rs._)`${(0,wl.usePattern)(t,p)}.test(${h})`,()=>{const v=l.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:h,dataPropType:Pl.Type.Str},u),n.opts.unevaluated&&d!==!0?e.assign((0,Rs._)`${d}[${h}]`,!0):!v&&!n.allErrors&&e.if((0,Rs.not)(u),()=>e.break())})})}}};bi.default=Rm;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});const km=G,xm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:a,it:s}=t;if((0,km.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"}};wi.default=xm;var $i={};Object.defineProperty($i,"__esModule",{value:!0});const Tm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:_e.validateUnion,error:{message:"must match a schema in anyOf"}};$i.default=Tm;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});const ks=ge,Im=G,Cm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ks._)`{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),l=e.name("_valid");t.setParams({passing:o}),e.block(c),t.result(i,()=>t.reset(),()=>t.error(!0));function c(){n.forEach((u,d)=>{let g;(0,Im.alwaysValidSchema)(r,u)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,ks._)`${l} && ${i}`).assign(i,!1).assign(o,(0,ks._)`[${o}, ${d}]`).else(),e.if(l,()=>{e.assign(i,!0),e.assign(o,d),g&&t.mergeEvaluated(g,ks.Name)})})}}};Pi.default=Cm;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});const Om=G,Nm={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,Om.alwaysValidSchema)(s,n))return;const o=t.subschema({keyword:"allOf",schemaProp:i},r);t.ok(r),t.mergeEvaluated(o)})}};Ei.default=Nm;var Si={};Object.defineProperty(Si,"__esModule",{value:!0});const xs=ge,El=G,Am={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>(0,xs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,xs._)`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:a,it:s}=t;a.then===void 0&&a.else===void 0&&(0,El.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const r=Sl(s,"then"),n=Sl(s,"else");if(!r&&!n)return;const i=e.let("valid",!0),o=e.name("_valid");if(l(),t.reset(),r&&n){const u=e.let("ifClause");t.setParams({ifClause:u}),e.if(o,c("then",u),c("else",u))}else r?e.if(o,c("then")):e.if((0,xs.not)(o),c("else"));t.pass(i,()=>t.error(!0));function l(){const u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);t.mergeEvaluated(u)}function c(u,d){return()=>{const g=t.subschema({keyword:u},o);e.assign(i,o),t.mergeValidEvaluated(g,i),d?e.assign(d,(0,xs._)`${u}`):t.setParams({ifClause:u})}}}};function Sl(t,e){const a=t.schema[e];return a!==void 0&&!(0,El.alwaysValidSchema)(t,a)}Si.default=Am;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});const jm=G,Dm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:a}){e.if===void 0&&(0,jm.checkStrictMode)(a,`"${t}" without "if" is ignored`)}};Ri.default=Dm,Object.defineProperty(fi,"__esModule",{value:!0});const Mm=Qr,Lm=pi,Fm=Gr,qm=mi,Um=vi,Vm=gl,zm=gi,Hm=Ps,Zm=_i,Km=bi,Bm=wi,Wm=$i,Jm=Pi,Qm=Ei,Gm=Si,Ym=Ri;function Xm(t=!1){const e=[Bm.default,Wm.default,Jm.default,Qm.default,Gm.default,Ym.default,zm.default,Hm.default,Vm.default,Zm.default,Km.default];return t?e.push(Lm.default,qm.default):e.push(Mm.default,Fm.default),e.push(Um.default),e}fi.default=Xm;var ki={},xi={};Object.defineProperty(xi,"__esModule",{value:!0});const He=ge,ev={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>(0,He.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,He._)`{format: ${t}}`},code(t,e){const{gen:a,data:s,$data:r,schema:n,schemaCode:i,it:o}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=o;if(!l.validateFormats)return;r?g():f();function g(){const m=a.scopeValue("formats",{ref:d.formats,code:l.code.formats}),p=a.const("fDef",(0,He._)`${m}[${i}]`),h=a.let("fType"),v=a.let("format");a.if((0,He._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>a.assign(h,(0,He._)`${p}.type || "string"`).assign(v,(0,He._)`${p}.validate`),()=>a.assign(h,(0,He._)`"string"`).assign(v,p)),t.fail$data((0,He.or)(b(),P()));function b(){return l.strictSchema===!1?He.nil:(0,He._)`${i} && !${v}`}function P(){const S=u.$async?(0,He._)`(${p}.async ? await ${v}(${s}) : ${v}(${s}))`:(0,He._)`${v}(${s})`,x=(0,He._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${s}))`;return(0,He._)`${v} && ${v} !== true && ${h} === ${e} && !${x}`}}function f(){const m=d.formats[n];if(!m){b();return}if(m===!0)return;const[p,h,v]=P(m);p===e&&t.pass(S());function b(){if(l.strictSchema===!1){d.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${n}" ignored in schema at path "${c}"`}}function P(x){const A=x instanceof RegExp?(0,He.regexpCode)(x):l.code.formats?(0,He._)`${l.code.formats}${(0,He.getProperty)(n)}`:void 0,z=a.scopeValue("formats",{key:n,ref:x,code:A});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,He._)`${z}.validate`]:["string",x,z]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,He._)`await ${v}(${s})`}return typeof h=="function"?(0,He._)`${v}(${s})`:(0,He._)`${v}.test(${s})`}}}};xi.default=ev,Object.defineProperty(ki,"__esModule",{value:!0});const tv=[xi.default];ki.default=tv;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.contentVocabulary=Yr.metadataVocabulary=void 0,Yr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Yr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Jn,"__esModule",{value:!0});const rv=Qn,av=Yn,sv=fi,nv=ki,Rl=Yr,iv=[rv.default,av.default,(0,sv.default)(),nv.default,Rl.metadataVocabulary,Rl.contentVocabulary];Jn.default=iv;var Ti={},Ts={};Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.DiscrError=void 0;var kl;(function(t){t.Tag="tag",t.Mapping="mapping"})(kl||(Ts.DiscrError=kl={})),Object.defineProperty(Ti,"__esModule",{value:!0});const Xr=ge,Ii=Ts,xl=ft,ov=Wr,cv=G,lv={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===Ii.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:a}})=>(0,Xr._)`{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 l=e.let("valid",!1),c=e.const("tag",(0,Xr._)`${a}${(0,Xr.getProperty)(o)}`);e.if((0,Xr._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:Ii.DiscrError.Tag,tag:c,tagName:o})),t.ok(l);function u(){const f=g();e.if(!1);for(const m in f)e.elseIf((0,Xr._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:Ii.DiscrError.Mapping,tag:c,tagName:o}),e.endIf()}function d(f){const m=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(p,Xr.Name),m}function g(){var f;const m={},p=v(r);let h=!0;for(let S=0;S<i.length;S++){let x=i[S];if(x!=null&&x.$ref&&!(0,cv.schemaHasRulesButRef)(x,n.self.RULES)){const z=x.$ref;if(x=xl.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,z),x instanceof xl.SchemaEnv&&(x=x.schema),x===void 0)throw new ov.default(n.opts.uriResolver,n.baseId,z)}const A=(f=x==null?void 0:x.properties)===null||f===void 0?void 0:f[o];if(typeof A!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);h=h&&(p||v(x)),b(A,S)}if(!h)throw new Error(`discriminator: "${o}" must be required`);return m;function v({required:S}){return Array.isArray(S)&&S.includes(o)}function b(S,x){if(S.const)P(S.const,x);else if(S.enum)for(const A of S.enum)P(A,x);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function P(S,x){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${o}" values must be unique strings`);m[S]=x}}}};Ti.default=lv;const uv={$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=cc,s=Jn,r=Ti,n=uv,i=["/properties"],o="http://json-schema.org/draft-07/schema";class l extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const m=this.opts.$data?this.$dataMetaSchema(n,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=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=kt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.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=Sa;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var g=Wr;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(kn,kn.exports);var dv=kn.exports;const fv=oc(dv);var Pe;(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})(Pe||(Pe={}));var Ci;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ci||(Ci={}));const Y=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=t=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(t)?Y.array:t===null?Y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Y.promise:typeof Map<"u"&&t instanceof Map?Y.map:typeof Set<"u"&&t instanceof Set?Y.set:typeof Date<"u"&&t instanceof Date?Y.date:Y.object;default:return Y.unknown}},q=Pe.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"]),hv=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class _t 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,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(a(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof _t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.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()}}_t.create=t=>new _t(t);const ea=(t,e)=>{let a;switch(t.code){case q.invalid_type:t.received===Y.undefined?a="Required":a=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,Pe.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:a=`Unrecognized key(s) in object: ${Pe.joinValues(t.keys,", ")}`;break;case q.invalid_union:a="Invalid input";break;case q.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Pe.joinValues(t.options)}`;break;case q.invalid_enum_value:a=`Invalid enum value. Expected ${Pe.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}"`:Pe.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,Pe.assertNever(t)}return{message:a}};let Tl=ea;function pv(t){Tl=t}function Is(){return Tl}const Cs=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 l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},mv=[];function B(t,e){const a=Is(),s=Cs({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===ea?void 0:ea].filter(r=>!!r)});t.common.issues.push(s)}class it{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const s=[];for(const r of a){if(r.status==="aborted")return ie;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 it.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 ie;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 ie=Object.freeze({status:"aborted"}),ta=t=>({status:"dirty",value:t}),ut=t=>({status:"valid",value:t}),Oi=t=>t.status==="aborted",Ni=t=>t.status==="dirty",Ar=t=>t.status==="valid",Aa=t=>typeof Promise<"u"&&t instanceof Promise;var ee;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ee||(ee={}));class zt{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 Il=(t,e)=>{if(Ar(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 _t(t.common.issues);return this._error=a,this._error}}};function ue(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:l}=t;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??a??o.defaultError}},description:r}}class me{get description(){return this._def.description}_getType(e){return sr(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Aa(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:sr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Il(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:sr(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:a});return Ar(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=>Ar(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:sr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(Aa(r)?r:Promise.resolve(r));return Il(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(l=>l?!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 Nt({schema:this,typeName:V.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Zt.create(this,this._def)}nullable(){return yr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return na.create(this,this._def)}or(e){return La.create([this,e],this._def)}and(e){return Fa.create(this,e,this._def)}transform(e){return new Nt({...ue(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new Ha({...ue(this._def),innerType:this,defaultValue:a,typeName:V.ZodDefault})}brand(){return new Di({typeName:V.ZodBranded,type:this,...ue(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new Za({...ue(this._def),innerType:this,catchValue:a,typeName:V.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return Ka.create(this,e)}readonly(){return Ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vv=/^c[^\s-]{8,}$/i,gv=/^[0-9a-z]+$/,_v=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yv=/^[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,bv=/^[a-z0-9_-]{21}$/i,wv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$v=/^[-+]?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)?)??$/,Pv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ev="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ai;const Sv=/^(?:(?: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])$/,Rv=/^(?:(?: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])$/,kv=/^(([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]))$/,xv=/^(([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])$/,Tv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Iv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cl="((\\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])))",Cv=new RegExp(`^${Cl}$`);function Ol(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 Ov(t){return new RegExp(`^${Ol(t)}$`)}function Nl(t){let e=`${Cl}T${Ol(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 Nv(t,e){return!!((e==="v4"||!e)&&Sv.test(t)||(e==="v6"||!e)&&kv.test(t))}function Av(t,e){if(!wv.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 jv(t,e){return!!((e==="v4"||!e)&&Rv.test(t)||(e==="v6"||!e)&&xv.test(t))}class Ct extends me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.string,received:n.parsedType}),ie}const s=new it;let r;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),B(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),B(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?B(r,{code:q.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&B(r,{code:q.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Pv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"email",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Ai||(Ai=new RegExp(Ev,"u")),Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"emoji",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")yv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"uuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")bv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"nanoid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")vv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")gv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cuid2",code:q.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")_v.test(e.data)||(r=this._getOrReturnCtx(e,r),B(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),B(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),B(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),B(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),B(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),B(r,{code:q.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Nl(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Cv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ov(n).test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{code:q.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?$v.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"duration",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Nv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"ip",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Av(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"jwt",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?jv(e.data,n.version)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"cidr",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Tv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64",code:q.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Iv.test(e.data)||(r=this._getOrReturnCtx(e,r),B(r,{validation:"base64url",code:q.invalid_string,message:n.message}),s.dirty()):Pe.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,...ee.errToObj(s)})}_addCheck(e){return new Ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ee.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,...ee.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,...ee.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ee.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...ee.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...ee.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...ee.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...ee.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...ee.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...ee.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...ee.errToObj(a)})}nonempty(e){return this.min(1,ee.errToObj(e))}trim(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ct({...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}}Ct.create=t=>new Ct({checks:[],typeName:V.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});function Dv(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 vr extends me{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)!==Y.number){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.number,received:n.parsedType}),ie}let s;const r=new it;for(const n of this._def.checks)n.kind==="int"?Pe.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),B(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),B(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),B(s,{code:q.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Dv(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),B(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),B(s,{code:q.not_finite,message:n.message}),r.dirty()):Pe.assertNever(n);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,ee.toString(a))}gt(e,a){return this.setLimit("min",e,!1,ee.toString(a))}lte(e,a){return this.setLimit("max",e,!0,ee.toString(a))}lt(e,a){return this.setLimit("max",e,!1,ee.toString(a))}setLimit(e,a,s,r){return new vr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:ee.toString(r)}]})}_addCheck(e){return new vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ee.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:ee.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ee.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"&&Pe.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)}}vr.create=t=>new vr({checks:[],typeName:V.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class gr extends me{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)!==Y.bigint)return this._getInvalidInput(e);let s;const r=new it;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),B(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),B(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),B(s,{code:q.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Pe.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return B(a,{code:q.invalid_type,expected:Y.bigint,received:a.parsedType}),ie}gte(e,a){return this.setLimit("min",e,!0,ee.toString(a))}gt(e,a){return this.setLimit("min",e,!1,ee.toString(a))}lte(e,a){return this.setLimit("max",e,!0,ee.toString(a))}lt(e,a){return this.setLimit("max",e,!1,ee.toString(a))}setLimit(e,a,s,r){return new gr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:s,message:ee.toString(r)}]})}_addCheck(e){return new gr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:ee.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}}gr.create=t=>new gr({checks:[],typeName:V.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ue(t)});class ja extends me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.boolean,received:s.parsedType}),ie}return ut(e.data)}}ja.create=t=>new ja({typeName:V.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ue(t)});class jr extends me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_type,expected:Y.date,received:n.parsedType}),ie}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return B(n,{code:q.invalid_date}),ie}const s=new it;let r;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),B(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),B(r,{code:q.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Pe.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jr({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:ee.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:ee.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}}jr.create=t=>new jr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:V.ZodDate,...ue(t)});class Os extends me{_parse(e){if(this._getType(e)!==Y.symbol){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.symbol,received:s.parsedType}),ie}return ut(e.data)}}Os.create=t=>new Os({typeName:V.ZodSymbol,...ue(t)});class Da extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.undefined,received:s.parsedType}),ie}return ut(e.data)}}Da.create=t=>new Da({typeName:V.ZodUndefined,...ue(t)});class Ma extends me{_parse(e){if(this._getType(e)!==Y.null){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.null,received:s.parsedType}),ie}return ut(e.data)}}Ma.create=t=>new Ma({typeName:V.ZodNull,...ue(t)});class ra extends me{constructor(){super(...arguments),this._any=!0}_parse(e){return ut(e.data)}}ra.create=t=>new ra({typeName:V.ZodAny,...ue(t)});class Dr extends me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ut(e.data)}}Dr.create=t=>new Dr({typeName:V.ZodUnknown,...ue(t)});class nr extends me{_parse(e){const a=this._getOrReturnCtx(e);return B(a,{code:q.invalid_type,expected:Y.never,received:a.parsedType}),ie}}nr.create=t=>new nr({typeName:V.ZodNever,...ue(t)});class Ns extends me{_parse(e){if(this._getType(e)!==Y.undefined){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.void,received:s.parsedType}),ie}return ut(e.data)}}Ns.create=t=>new Ns({typeName:V.ZodVoid,...ue(t)});class Ot extends me{_parse(e){const{ctx:a,status:s}=this._processInputParams(e),r=this._def;if(a.parsedType!==Y.array)return B(a,{code:q.invalid_type,expected:Y.array,received:a.parsedType}),ie;if(r.exactLength!==null){const i=a.data.length>r.exactLength.value,o=a.data.length<r.exactLength.value;(i||o)&&(B(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&&(B(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&&(B(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 zt(a,i,a.path,o)))).then(i=>it.mergeArray(s,i));const n=[...a.data].map((i,o)=>r.type._parseSync(new zt(a,i,a.path,o)));return it.mergeArray(s,n)}get element(){return this._def.type}min(e,a){return new Ot({...this._def,minLength:{value:e,message:ee.toString(a)}})}max(e,a){return new Ot({...this._def,maxLength:{value:e,message:ee.toString(a)}})}length(e,a){return new Ot({...this._def,exactLength:{value:e,message:ee.toString(a)}})}nonempty(e){return this.min(1,e)}}Ot.create=(t,e)=>new Ot({type:t,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...ue(e)});function aa(t){if(t instanceof Fe){const e={};for(const a in t.shape){const s=t.shape[a];e[a]=Zt.create(aa(s))}return new Fe({...t._def,shape:()=>e})}else return t instanceof Ot?new Ot({...t._def,type:aa(t.element)}):t instanceof Zt?Zt.create(aa(t.unwrap())):t instanceof yr?yr.create(aa(t.unwrap())):t instanceof Ht?Ht.create(t.items.map(e=>aa(e))):t}class Fe extends me{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=Pe.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==Y.object){const c=this._getOrReturnCtx(e);return B(c,{code:q.invalid_type,expected:Y.object,received:c.parsedType}),ie}const{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof nr&&this._def.unknownKeys==="strip"))for(const c in r.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const u=n[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new zt(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof nr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(B(r,{code:q.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new zt(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,g=await u.value;c.push({key:d,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>it.mergeObjectSync(s,c)):it.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return ee.errToObj,new Fe({...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:ee.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Fe({...this._def,unknownKeys:"strip"})}passthrough(){return new Fe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Fe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Fe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:V.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Fe({...this._def,catchall:e})}pick(e){const a={};for(const s of Pe.objectKeys(e))e[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new Fe({...this._def,shape:()=>a})}omit(e){const a={};for(const s of Pe.objectKeys(this.shape))e[s]||(a[s]=this.shape[s]);return new Fe({...this._def,shape:()=>a})}deepPartial(){return aa(this)}partial(e){const a={};for(const s of Pe.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?a[s]=r:a[s]=r.optional()}return new Fe({...this._def,shape:()=>a})}required(e){const a={};for(const s of Pe.objectKeys(this.shape))if(e&&!e[s])a[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Zt;)n=n._def.innerType;a[s]=n}return new Fe({...this._def,shape:()=>a})}keyof(){return Al(Pe.objectKeys(this.shape))}}Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:nr.create(),typeName:V.ZodObject,...ue(e)}),Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:nr.create(),typeName:V.ZodObject,...ue(e)}),Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:nr.create(),typeName:V.ZodObject,...ue(e)});class La extends me{_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 _t(o.ctx.common.issues));return B(a,{code:q.invalid_union,unionErrors:i}),ie}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 l of s){const c={...a,common:{...a.common,issues:[]},parent:null},u=l._parseSync({data:a.data,path:a.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!n&&(n={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(n)return a.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(l=>new _t(l));return B(a,{code:q.invalid_union,unionErrors:o}),ie}}get options(){return this._def.options}}La.create=(t,e)=>new La({options:t,typeName:V.ZodUnion,...ue(e)});const ir=t=>t instanceof Ua?ir(t.schema):t instanceof Nt?ir(t.innerType()):t instanceof Va?[t.value]:t instanceof _r?t.options:t instanceof za?Pe.objectValues(t.enum):t instanceof Ha?ir(t._def.innerType):t instanceof Da?[void 0]:t instanceof Ma?[null]:t instanceof Zt?[void 0,...ir(t.unwrap())]:t instanceof yr?[null,...ir(t.unwrap())]:t instanceof Di||t instanceof Ba?ir(t.unwrap()):t instanceof Za?ir(t._def.innerType):[];class As extends me{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.object)return B(a,{code:q.invalid_type,expected:Y.object,received:a.parsedType}),ie;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}):(B(a,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),ie)}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=ir(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 As({typeName:V.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,...ue(s)})}}function ji(t,e){const a=sr(t),s=sr(e);if(t===e)return{valid:!0,data:t};if(a===Y.object&&s===Y.object){const r=Pe.objectKeys(e),n=Pe.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const l=ji(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(a===Y.array&&s===Y.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],l=ji(i,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return a===Y.date&&s===Y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Fa extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e),r=(n,i)=>{if(Oi(n)||Oi(i))return ie;const o=ji(n.value,i.value);return o.valid?((Ni(n)||Ni(i))&&a.dirty(),{status:a.value,value:o.data}):(B(s,{code:q.invalid_intersection_types}),ie)};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}))}}Fa.create=(t,e,a)=>new Fa({left:t,right:e,typeName:V.ZodIntersection,...ue(a)});class Ht extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.array)return B(s,{code:q.invalid_type,expected:Y.array,received:s.parsedType}),ie;if(s.data.length<this._def.items.length)return B(s,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&s.data.length>this._def.items.length&&(B(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 l=this._def.items[o]||this._def.rest;return l?l._parse(new zt(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>it.mergeArray(a,i)):it.mergeArray(a,n)}get items(){return this._def.items}rest(e){return new Ht({...this._def,rest:e})}}Ht.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:t,typeName:V.ZodTuple,rest:null,...ue(e)})};class qa extends me{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!==Y.object)return B(s,{code:q.invalid_type,expected:Y.object,received:s.parsedType}),ie;const r=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:n._parse(new zt(s,o,s.path,o)),value:i._parse(new zt(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?it.mergeObjectAsync(a,r):it.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,s){return a instanceof me?new qa({keyType:e,valueType:a,typeName:V.ZodRecord,...ue(s)}):new qa({keyType:Ct.create(),valueType:e,typeName:V.ZodRecord,...ue(a)})}}class js extends me{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!==Y.map)return B(s,{code:q.invalid_type,expected:Y.map,received:s.parsedType}),ie;const r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,l],c)=>({key:r._parse(new zt(s,o,s.path,[c,"key"])),value:n._parse(new zt(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ie;(c.status==="dirty"||u.status==="dirty")&&a.dirty(),o.set(c.value,u.value)}return{status:a.value,value:o}}}}js.create=(t,e,a)=>new js({valueType:e,keyType:t,typeName:V.ZodMap,...ue(a)});class Mr extends me{_parse(e){const{status:a,ctx:s}=this._processInputParams(e);if(s.parsedType!==Y.set)return B(s,{code:q.invalid_type,expected:Y.set,received:s.parsedType}),ie;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(B(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&&(B(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(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ie;u.status==="dirty"&&a.dirty(),c.add(u.value)}return{status:a.value,value:c}}const o=[...s.data.values()].map((l,c)=>n._parse(new zt(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,a){return new Mr({...this._def,minSize:{value:e,message:ee.toString(a)}})}max(e,a){return new Mr({...this._def,maxSize:{value:e,message:ee.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Mr.create=(t,e)=>new Mr({valueType:t,minSize:null,maxSize:null,typeName:V.ZodSet,...ue(e)});class sa extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.function)return B(a,{code:q.invalid_type,expected:Y.function,received:a.parsedType}),ie;function s(o,l){return Cs({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Is(),ea].filter(c=>!!c),issueData:{code:q.invalid_arguments,argumentsError:l}})}function r(o,l){return Cs({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Is(),ea].filter(c=>!!c),issueData:{code:q.invalid_return_type,returnTypeError:l}})}const n={errorMap:a.common.contextualErrorMap},i=a.data;if(this._def.returns instanceof na){const o=this;return ut(async function(...l){const c=new _t([]),u=await o._def.args.parseAsync(l,n).catch(f=>{throw c.addIssue(s(l,f)),c}),d=await Reflect.apply(i,this,u);return await o._def.returns._def.type.parseAsync(d,n).catch(f=>{throw c.addIssue(r(d,f)),c})})}else{const o=this;return ut(function(...l){const c=o._def.args.safeParse(l,n);if(!c.success)throw new _t([s(l,c.error)]);const u=Reflect.apply(i,this,c.data),d=o._def.returns.safeParse(u,n);if(!d.success)throw new _t([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sa({...this._def,args:Ht.create(e).rest(Dr.create())})}returns(e){return new sa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,s){return new sa({args:e||Ht.create([]).rest(Dr.create()),returns:a||Dr.create(),typeName:V.ZodFunction,...ue(s)})}}class Ua extends me{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})}}Ua.create=(t,e)=>new Ua({getter:t,typeName:V.ZodLazy,...ue(e)});class Va extends me{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return B(a,{received:a.data,code:q.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:e.data}}get value(){return this._def.value}}Va.create=(t,e)=>new Va({value:t,typeName:V.ZodLiteral,...ue(e)});function Al(t,e){return new _r({values:t,typeName:V.ZodEnum,...ue(e)})}class _r extends me{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),s=this._def.values;return B(a,{expected:Pe.joinValues(s),received:a.parsedType,code:q.invalid_type}),ie}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 B(a,{received:a.data,code:q.invalid_enum_value,options:s}),ie}return ut(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 _r.create(e,{...this._def,...a})}exclude(e,a=this._def){return _r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...a})}}_r.create=Al;class za extends me{_parse(e){const a=Pe.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Y.string&&s.parsedType!==Y.number){const r=Pe.objectValues(a);return B(s,{expected:Pe.joinValues(r),received:s.parsedType,code:q.invalid_type}),ie}if(this._cache||(this._cache=new Set(Pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Pe.objectValues(a);return B(s,{received:s.data,code:q.invalid_enum_value,options:r}),ie}return ut(e.data)}get enum(){return this._def.values}}za.create=(t,e)=>new za({values:t,typeName:V.ZodNativeEnum,...ue(e)});class na extends me{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Y.promise&&a.common.async===!1)return B(a,{code:q.invalid_type,expected:Y.promise,received:a.parsedType}),ie;const s=a.parsedType===Y.promise?a.data:Promise.resolve(a.data);return ut(s.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}na.create=(t,e)=>new na({type:t,typeName:V.ZodPromise,...ue(e)});class Nt extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.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=>{B(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 ie;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?ie:l.status==="dirty"||a.value==="dirty"?ta(l.value):l});{if(a.value==="aborted")return ie;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?ie:o.status==="dirty"||a.value==="dirty"?ta(o.value):o}}if(r.type==="refinement"){const i=o=>{const l=r.refinement(o,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?ie:(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"?ie:(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(!Ar(i))return ie;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=>Ar(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:a.value,value:o})):ie);Pe.assertNever(r)}}Nt.create=(t,e,a)=>new Nt({schema:t,typeName:V.ZodEffects,effect:e,...ue(a)}),Nt.createWithPreprocess=(t,e,a)=>new Nt({schema:e,effect:{type:"preprocess",transform:t},typeName:V.ZodEffects,...ue(a)});class Zt extends me{_parse(e){return this._getType(e)===Y.undefined?ut(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zt.create=(t,e)=>new Zt({innerType:t,typeName:V.ZodOptional,...ue(e)});class yr extends me{_parse(e){return this._getType(e)===Y.null?ut(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yr.create=(t,e)=>new yr({innerType:t,typeName:V.ZodNullable,...ue(e)});class Ha extends me{_parse(e){const{ctx:a}=this._processInputParams(e);let s=a.data;return a.parsedType===Y.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}Ha.create=(t,e)=>new Ha({innerType:t,typeName:V.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});class Za extends me{_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 Aa(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new _t(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new _t(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Za.create=(t,e)=>new Za({innerType:t,typeName:V.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});class Ds extends me{_parse(e){if(this._getType(e)!==Y.nan){const s=this._getOrReturnCtx(e);return B(s,{code:q.invalid_type,expected:Y.nan,received:s.parsedType}),ie}return{status:"valid",value:e.data}}}Ds.create=t=>new Ds({typeName:V.ZodNaN,...ue(t)});const Mv=Symbol("zod_brand");class Di extends me{_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 Ka extends me{_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"?ie:n.status==="dirty"?(a.dirty(),ta(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"?ie: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 Ka({in:e,out:a,typeName:V.ZodPipeline})}}class Ba extends me{_parse(e){const a=this._def.innerType._parse(e),s=r=>(Ar(r)&&(r.value=Object.freeze(r.value)),r);return Aa(a)?a.then(r=>s(r)):s(a)}unwrap(){return this._def.innerType}}Ba.create=(t,e)=>new Ba({innerType:t,typeName:V.ZodReadonly,...ue(e)});function jl(t,e){const a=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof a=="string"?{message:a}:a}function Dl(t,e={},a){return t?ra.create().superRefine((s,r)=>{const n=t(s);if(n instanceof Promise)return n.then(i=>{if(!i){const o=jl(e,s),l=o.fatal??a??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!n){const i=jl(e,s),o=i.fatal??a??!0;r.addIssue({code:"custom",...i,fatal:o})}}):ra.create()}const Lv={object:Fe.lazycreate};var V;(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"})(V||(V={}));const Fv=(t,e={message:`Input not instance of ${t.name}`})=>Dl(a=>a instanceof t,e),k=Ct.create,Je=vr.create,qv=Ds.create,Uv=gr.create,Ze=ja.create,Vv=jr.create,zv=Os.create,Hv=Da.create,Zv=Ma.create,Ml=ra.create,ia=Dr.create,Kv=nr.create,Bv=Ns.create,X=Ot.create,Z=Fe.create,Wv=Fe.strictCreate,ot=La.create,Ll=As.create,Jv=Fa.create,Qv=Ht.create,oa=qa.create,Gv=js.create,Yv=Mr.create,Xv=sa.create,eg=Ua.create,le=Va.create,Kt=_r.create,tg=za.create,rg=na.create,Fl=Nt.create,L=Zt.create,ag=yr.create,sg=Nt.createWithPreprocess,ng=Ka.create,ig=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Mv,DIRTY:ta,EMPTY_PATH:mv,INVALID:ie,NEVER:ie,OK:ut,ParseStatus:it,Schema:me,ZodAny:ra,ZodArray:Ot,ZodBigInt:gr,ZodBoolean:ja,ZodBranded:Di,ZodCatch:Za,ZodDate:jr,ZodDefault:Ha,ZodDiscriminatedUnion:As,ZodEffects:Nt,ZodEnum:_r,ZodError:_t,get ZodFirstPartyTypeKind(){return V},ZodFunction:sa,ZodIntersection:Fa,ZodIssueCode:q,ZodLazy:Ua,ZodLiteral:Va,ZodMap:js,ZodNaN:Ds,ZodNativeEnum:za,ZodNever:nr,ZodNull:Ma,ZodNullable:yr,ZodNumber:vr,ZodObject:Fe,ZodOptional:Zt,ZodParsedType:Y,ZodPipeline:Ka,ZodPromise:na,ZodReadonly:Ba,ZodRecord:qa,ZodSchema:me,ZodSet:Mr,ZodString:Ct,ZodSymbol:Os,ZodTransformer:Nt,ZodTuple:Ht,ZodType:me,ZodUndefined:Da,ZodUnion:La,ZodUnknown:Dr,ZodVoid:Ns,addIssueToContext:B,any:Ml,array:X,bigint:Uv,boolean:Ze,coerce:{string:t=>Ct.create({...t,coerce:!0}),number:t=>vr.create({...t,coerce:!0}),boolean:t=>ja.create({...t,coerce:!0}),bigint:t=>gr.create({...t,coerce:!0}),date:t=>jr.create({...t,coerce:!0})},custom:Dl,date:Vv,datetimeRegex:Nl,defaultErrorMap:ea,discriminatedUnion:Ll,effect:Fl,enum:Kt,function:Xv,getErrorMap:Is,getParsedType:sr,instanceof:Fv,intersection:Jv,isAborted:Oi,isAsync:Aa,isDirty:Ni,isValid:Ar,late:Lv,lazy:eg,literal:le,makeIssue:Cs,map:Gv,nan:qv,nativeEnum:tg,never:Kv,null:Zv,nullable:ag,number:Je,object:Z,get objectUtil(){return Ci},oboolean:()=>Ze().optional(),onumber:()=>Je().optional(),optional:L,ostring:()=>k().optional(),pipeline:ng,preprocess:sg,promise:rg,quotelessJson:hv,record:oa,set:Yv,setErrorMap:pv,strictObject:Wv,string:k,symbol:zv,transformer:Fl,tuple:Qv,undefined:Hv,union:ot,unknown:ia,get util(){return Pe},void:Bv},Symbol.toStringTag,{value:"Module"})),Wa="2025-06-18",ql=[Wa,"2025-03-26","2024-11-05","2024-10-07"],Ms="2.0",Ul=ot([k(),Je().int()]),Vl=k(),og=Z({progressToken:L(Ul)}).passthrough(),wt=Z({_meta:L(og)}).passthrough(),pt=Z({method:k(),params:L(wt)}),Ja=Z({_meta:L(Z({}).passthrough())}).passthrough(),Bt=Z({method:k(),params:L(Ja)}),$t=Z({_meta:L(Z({}).passthrough())}).passthrough(),Ls=ot([k(),Je().int()]),zl=Z({jsonrpc:le(Ms),id:Ls}).merge(pt).strict(),Hl=t=>zl.safeParse(t).success,Zl=Z({jsonrpc:le(Ms)}).merge(Bt).strict(),cg=t=>Zl.safeParse(t).success,Kl=Z({jsonrpc:le(Ms),id:Ls,result:$t}).strict(),Mi=t=>Kl.safeParse(t).success;var Ie;(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"})(Ie||(Ie={}));const Bl=Z({jsonrpc:le(Ms),id:Ls,error:Z({code:Je().int(),message:k(),data:L(ia())})}).strict(),lg=t=>Bl.safeParse(t).success,ca=ot([zl,Zl,Kl,Bl]),br=$t.strict(),Li=Bt.extend({method:le("notifications/cancelled"),params:Ja.extend({requestId:Ls,reason:k().optional()})}),Qa=Z({name:k(),title:L(k())}).passthrough(),Wl=Qa.extend({version:k()}),ug=Z({experimental:L(Z({}).passthrough()),sampling:L(Z({}).passthrough()),elicitation:L(Z({}).passthrough()),roots:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),Jl=pt.extend({method:le("initialize"),params:wt.extend({protocolVersion:k(),capabilities:ug,clientInfo:Wl})}),dg=Z({experimental:L(Z({}).passthrough()),logging:L(Z({}).passthrough()),completions:L(Z({}).passthrough()),prompts:L(Z({listChanged:L(Ze())}).passthrough()),resources:L(Z({subscribe:L(Ze()),listChanged:L(Ze())}).passthrough()),tools:L(Z({listChanged:L(Ze())}).passthrough())}).passthrough(),Ql=$t.extend({protocolVersion:k(),capabilities:dg,serverInfo:Wl,instructions:L(k())}),Fi=Bt.extend({method:le("notifications/initialized")}),fg=t=>Fi.safeParse(t).success,qi=pt.extend({method:le("ping")}),hg=Z({progress:Je(),total:L(Je()),message:L(k())}).passthrough(),Ui=Bt.extend({method:le("notifications/progress"),params:Ja.merge(hg).extend({progressToken:Ul})}),Fs=pt.extend({params:wt.extend({cursor:L(Vl)}).optional()}),qs=$t.extend({nextCursor:L(Vl)}),Gl=Z({uri:k(),mimeType:L(k()),_meta:L(Z({}).passthrough())}).passthrough(),Yl=Gl.extend({text:k()}),Vi=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xl=Gl.extend({blob:Vi}),eu=Qa.extend({uri:k(),description:L(k()),mimeType:L(k()),_meta:L(Z({}).passthrough())}),pg=Qa.extend({uriTemplate:k(),description:L(k()),mimeType:L(k()),_meta:L(Z({}).passthrough())}),Us=Fs.extend({method:le("resources/list")}),tu=qs.extend({resources:X(eu)}),zi=Fs.extend({method:le("resources/templates/list")}),ru=qs.extend({resourceTemplates:X(pg)}),Hi=pt.extend({method:le("resources/read"),params:wt.extend({uri:k()})}),au=$t.extend({contents:X(ot([Yl,Xl]))}),su=Bt.extend({method:le("notifications/resources/list_changed")}),nu=pt.extend({method:le("resources/subscribe"),params:wt.extend({uri:k()})}),iu=pt.extend({method:le("resources/unsubscribe"),params:wt.extend({uri:k()})}),ou=Bt.extend({method:le("notifications/resources/updated"),params:Ja.extend({uri:k()})}),mg=Z({name:k(),description:L(k()),required:L(Ze())}).passthrough(),vg=Qa.extend({description:L(k()),arguments:L(X(mg)),_meta:L(Z({}).passthrough())}),Zi=Fs.extend({method:le("prompts/list")}),cu=qs.extend({prompts:X(vg)}),Ki=pt.extend({method:le("prompts/get"),params:wt.extend({name:k(),arguments:L(oa(k()))})}),Bi=Z({type:le("text"),text:k(),_meta:L(Z({}).passthrough())}).passthrough(),Wi=Z({type:le("image"),data:Vi,mimeType:k(),_meta:L(Z({}).passthrough())}).passthrough(),Ji=Z({type:le("audio"),data:Vi,mimeType:k(),_meta:L(Z({}).passthrough())}).passthrough(),gg=Z({type:le("resource"),resource:ot([Yl,Xl]),_meta:L(Z({}).passthrough())}).passthrough(),_g=eu.extend({type:le("resource_link")}),lu=ot([Bi,Wi,Ji,_g,gg]),yg=Z({role:Kt(["user","assistant"]),content:lu}).passthrough(),uu=$t.extend({description:L(k()),messages:X(yg)}),du=Bt.extend({method:le("notifications/prompts/list_changed")}),bg=Z({title:L(k()),readOnlyHint:L(Ze()),destructiveHint:L(Ze()),idempotentHint:L(Ze()),openWorldHint:L(Ze())}).passthrough(),wg=Qa.extend({description:L(k()),inputSchema:Z({type:le("object"),properties:L(Z({}).passthrough()),required:L(X(k()))}).passthrough(),outputSchema:L(Z({type:le("object"),properties:L(Z({}).passthrough()),required:L(X(k()))}).passthrough()),annotations:L(bg),_meta:L(Z({}).passthrough())}),Qi=Fs.extend({method:le("tools/list")}),fu=qs.extend({tools:X(wg)}),Vs=$t.extend({content:X(lu).default([]),structuredContent:Z({}).passthrough().optional(),isError:L(Ze())});Vs.or($t.extend({toolResult:ia()}));const Gi=pt.extend({method:le("tools/call"),params:wt.extend({name:k(),arguments:L(oa(ia()))})}),hu=Bt.extend({method:le("notifications/tools/list_changed")}),pu=Kt(["debug","info","notice","warning","error","critical","alert","emergency"]),Yi=pt.extend({method:le("logging/setLevel"),params:wt.extend({level:pu})}),mu=Bt.extend({method:le("notifications/message"),params:Ja.extend({level:pu,logger:L(k()),data:ia()})}),$g=Z({name:k().optional()}).passthrough(),Pg=Z({hints:L(X($g)),costPriority:L(Je().min(0).max(1)),speedPriority:L(Je().min(0).max(1)),intelligencePriority:L(Je().min(0).max(1))}).passthrough(),Eg=Z({role:Kt(["user","assistant"]),content:ot([Bi,Wi,Ji])}).passthrough(),vu=pt.extend({method:le("sampling/createMessage"),params:wt.extend({messages:X(Eg),systemPrompt:L(k()),includeContext:L(Kt(["none","thisServer","allServers"])),temperature:L(Je()),maxTokens:Je().int(),stopSequences:L(X(k())),metadata:L(Z({}).passthrough()),modelPreferences:L(Pg)})}),Xi=$t.extend({model:k(),stopReason:L(Kt(["endTurn","stopSequence","maxTokens"]).or(k())),role:Kt(["user","assistant"]),content:Ll("type",[Bi,Wi,Ji])}),Sg=Z({type:le("boolean"),title:L(k()),description:L(k()),default:L(Ze())}).passthrough(),Rg=Z({type:le("string"),title:L(k()),description:L(k()),minLength:L(Je()),maxLength:L(Je()),format:L(Kt(["email","uri","date","date-time"]))}).passthrough(),kg=Z({type:Kt(["number","integer"]),title:L(k()),description:L(k()),minimum:L(Je()),maximum:L(Je())}).passthrough(),xg=Z({type:le("string"),title:L(k()),description:L(k()),enum:X(k()),enumNames:L(X(k()))}).passthrough(),Tg=ot([Sg,Rg,kg,xg]),gu=pt.extend({method:le("elicitation/create"),params:wt.extend({message:k(),requestedSchema:Z({type:le("object"),properties:oa(k(),Tg),required:L(X(k()))}).passthrough()})}),eo=$t.extend({action:Kt(["accept","decline","cancel"]),content:L(oa(k(),ia()))}),Ig=Z({type:le("ref/resource"),uri:k()}).passthrough(),Cg=Z({type:le("ref/prompt"),name:k()}).passthrough(),to=pt.extend({method:le("completion/complete"),params:wt.extend({ref:ot([Cg,Ig]),argument:Z({name:k(),value:k()}).passthrough(),context:L(Z({arguments:L(oa(k(),k()))}))})}),_u=$t.extend({completion:Z({values:X(k()).max(100),total:L(Je().int()),hasMore:L(Ze())}).passthrough()}),Og=Z({uri:k().startsWith("file://"),name:L(k()),_meta:L(Z({}).passthrough())}).passthrough(),yu=pt.extend({method:le("roots/list")}),ro=$t.extend({roots:X(Og)}),bu=Bt.extend({method:le("notifications/roots/list_changed")});ot([qi,Jl,to,Yi,Ki,Zi,Us,zi,Hi,nu,iu,Gi,Qi]),ot([Li,Ui,Fi,bu]),ot([br,Xi,eo,ro]),ot([qi,vu,gu,yu]),ot([Li,Ui,mu,ou,su,hu,du]),ot([br,Ql,_u,uu,cu,tu,ru,au,Vs,fu]);class Ae extends Error{constructor(e,a,s){super(`MCP error ${e}: ${a}`),this.code=e,this.data=s,this.name="McpError"}}const Ng=6e4;class wu{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(Li,a=>{const s=this._requestHandlerAbortControllers.get(a.params.requestId);s==null||s.abort(a.params.reason)}),this.setNotificationHandler(Ui,a=>{this._onprogress(a)}),this.setRequestHandler(qi,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 Ae(Ie.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=l=>{i==null||i(l),this._onerror(l)};const o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(l,c)=>{o==null||o(l,c),Mi(l)||lg(l)?this._onresponse(l):Hl(l)?this._onrequest(l,c):cg(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var e;const a=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const s=new Ae(Ie.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:Ie.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const c={signal:l.signal,sessionId:(n=this._transport)===null||n===void 0?void 0:n.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,g)=>this.request(u,d,{...g,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,c)).then(u=>{var d;if(!l.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,g;if(!l.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:Ie.InternalError,message:(g=u.message)!==null&&g!==void 0?g:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:a,...s}=e.params,r=Number(a),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){i(l);return}n(s)}_onresponse(e){const a=Number(e.id),s=this._responseHandlers.get(a);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),Mi(e))s(e);else{const r=new Ae(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,l)=>{var c,u,d,g,f,m;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=s==null?void 0:s.signal)===null||u===void 0||u.throwIfAborted();const p=this._requestMessageId++,h={...e,jsonrpc:"2.0",id:p};s!=null&&s.onprogress&&(this._progressHandlers.set(p,s.onprogress),h.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:p}});const v=S=>{var x;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(x=this._transport)===null||x===void 0||x.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),l(S)};this._responseHandlers.set(p,S=>{var x;if(!(!((x=s==null?void 0:s.signal)===null||x===void 0)&&x.aborted)){if(S instanceof Error)return l(S);try{const A=a.parse(S.result);o(A)}catch(A){l(A)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var S;v((S=s==null?void 0:s.signal)===null||S===void 0?void 0:S.reason)});const b=(f=s==null?void 0:s.timeout)!==null&&f!==void 0?f:Ng,P=()=>v(new Ae(Ie.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(p,b,s==null?void 0:s.maxTotalTimeout,P,(m=s==null?void 0:s.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(h,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(p),l(S)})})}async notification(e,a){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(a!=null&&a.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,a).catch(u=>this._onerror(u))});return}const 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 $u(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 ao={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)})(ya,function(a){function s(){for(var $=arguments.length,y=Array($),E=0;E<$;E++)y[E]=arguments[E];if(y.length>1){y[0]=y[0].slice(0,-1);for(var C=y.length-1,I=1;I<C;++I)y[I]=y[I].slice(1,-1);return y[C]=y[C].slice(1),y.join("")}else return y[0]}function r($){return"(?:"+$+")"}function n($){return $===void 0?"undefined":$===null?"null":Object.prototype.toString.call($).split(" ").pop().split("]").shift().toLowerCase()}function i($){return $.toUpperCase()}function o($){return $!=null?$ instanceof Array?$:typeof $.length!="number"||$.split||$.setInterval||$.call?[$]:Array.prototype.slice.call($):[]}function l($,y){var E=$;if(y)for(var C in y)E[C]=y[C];return E}function c($){var y="[A-Za-z]",E="[0-9]",C=s(E,"[A-Fa-f]"),I=r(r("%[EFef]"+C+"%"+C+C+"%"+C+C)+"|"+r("%[89A-Fa-f]"+C+"%"+C+C)+"|"+r("%"+C+C)),ae="[\\:\\/\\?\\#\\[\\]\\@]",se="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=s(ae,se),je=$?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Be=$?"[\\uE000-\\uF8FF]":"[]",$e=s(y,E,"[\\-\\.\\_\\~]",je);r(y+s(y,E,"[\\+\\-\\.]")+"*"),r(r(I+"|"+s($e,se,"[\\:]"))+"*");var Ce=r(r("25[0-5]")+"|"+r("2[0-4]"+E)+"|"+r("1"+E+E)+"|"+r("0?[1-9]"+E)+"|0?0?"+E),We=r(Ce+"\\."+Ce+"\\."+Ce+"\\."+Ce),ce=r(C+"{1,4}"),Me=r(r(ce+"\\:"+ce)+"|"+We),Ye=r(r(ce+"\\:")+"{6}"+Me),Le=r("\\:\\:"+r(ce+"\\:")+"{5}"+Me),kr=r(r(ce)+"?\\:\\:"+r(ce+"\\:")+"{4}"+Me),Yt=r(r(r(ce+"\\:")+"{0,1}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{3}"+Me),Xt=r(r(r(ce+"\\:")+"{0,2}"+ce)+"?\\:\\:"+r(ce+"\\:")+"{2}"+Me),_a=r(r(r(ce+"\\:")+"{0,3}"+ce)+"?\\:\\:"+ce+"\\:"+Me),Vr=r(r(r(ce+"\\:")+"{0,4}"+ce)+"?\\:\\:"+Me),Rt=r(r(r(ce+"\\:")+"{0,5}"+ce)+"?\\:\\:"+ce),er=r(r(r(ce+"\\:")+"{0,6}"+ce)+"?\\:\\:"),zr=r([Ye,Le,kr,Yt,Xt,_a,Vr,Rt,er].join("|")),dr=r(r($e+"|"+I)+"+");r("[vV]"+C+"+\\."+s($e,se,"[\\:]")+"+"),r(r(I+"|"+s($e,se))+"*");var is=r(I+"|"+s($e,se,"[\\:\\@]"));return r(r(I+"|"+s($e,se,"[\\@]"))+"+"),r(r(is+"|"+s("[\\/\\?]",Be))+"*"),{NOT_SCHEME:new RegExp(s("[^]",y,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(s("[^\\%\\:]",$e,se),"g"),NOT_HOST:new RegExp(s("[^\\%\\[\\]\\:]",$e,se),"g"),NOT_PATH:new RegExp(s("[^\\%\\/\\:\\@]",$e,se),"g"),NOT_PATH_NOSCHEME:new RegExp(s("[^\\%\\/\\@]",$e,se),"g"),NOT_QUERY:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]",Be),"g"),NOT_FRAGMENT:new RegExp(s("[^\\%]",$e,se,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(s("[^]",$e,se),"g"),UNRESERVED:new RegExp($e,"g"),OTHER_CHARS:new RegExp(s("[^\\%]",$e,Ee),"g"),PCT_ENCODED:new RegExp(I,"g"),IPV4ADDRESS:new RegExp("^("+We+")$"),IPV6ADDRESS:new RegExp("^\\[?("+zr+")"+r(r("\\%25|\\%(?!"+C+"{2})")+"("+dr+")")+"?\\]?$")}}var u=c(!1),d=c(!0),g=function(){function $(y,E){var C=[],I=!0,ae=!1,se=void 0;try{for(var Ee=y[Symbol.iterator](),je;!(I=(je=Ee.next()).done)&&(C.push(je.value),!(E&&C.length===E));I=!0);}catch(Be){ae=!0,se=Be}finally{try{!I&&Ee.return&&Ee.return()}finally{if(ae)throw se}}return C}return function(y,E){if(Array.isArray(y))return y;if(Symbol.iterator in Object(y))return $(y,E);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function($){if(Array.isArray($)){for(var y=0,E=Array($.length);y<$.length;y++)E[y]=$[y];return E}else return Array.from($)},m=2147483647,p=36,h=1,v=26,b=38,P=700,S=72,x=128,A="-",z=/^xn--/,U=/[^\0-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,W={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=p-h,H=Math.floor,F=String.fromCharCode;function M($){throw new RangeError(W[$])}function te($,y){for(var E=[],C=$.length;C--;)E[C]=y($[C]);return E}function ye($,y){var E=$.split("@"),C="";E.length>1&&(C=E[0]+"@",$=E[1]),$=$.replace(D,".");var I=$.split("."),ae=te(I,y).join(".");return C+ae}function ve($){for(var y=[],E=0,C=$.length;E<C;){var I=$.charCodeAt(E++);if(I>=55296&&I<=56319&&E<C){var ae=$.charCodeAt(E++);(ae&64512)==56320?y.push(((I&1023)<<10)+(ae&1023)+65536):(y.push(I),E--)}else y.push(I)}return y}var we=function(y){return String.fromCodePoint.apply(String,f(y))},de=function(y){return y-48<10?y-22:y-65<26?y-65:y-97<26?y-97:p},N=function(y,E){return y+22+75*(y<26)-((E!=0)<<5)},R=function(y,E,C){var I=0;for(y=C?H(y/P):y>>1,y+=H(y/E);y>J*v>>1;I+=p)y=H(y/J);return H(I+(J+1)*y/(y+b))},j=function(y){var E=[],C=y.length,I=0,ae=x,se=S,Ee=y.lastIndexOf(A);Ee<0&&(Ee=0);for(var je=0;je<Ee;++je)y.charCodeAt(je)>=128&&M("not-basic"),E.push(y.charCodeAt(je));for(var Be=Ee>0?Ee+1:0;Be<C;){for(var $e=I,Ce=1,We=p;;We+=p){Be>=C&&M("invalid-input");var ce=de(y.charCodeAt(Be++));(ce>=p||ce>H((m-I)/Ce))&&M("overflow"),I+=ce*Ce;var Me=We<=se?h:We>=se+v?v:We-se;if(ce<Me)break;var Ye=p-Me;Ce>H(m/Ye)&&M("overflow"),Ce*=Ye}var Le=E.length+1;se=R(I-$e,Le,$e==0),H(I/Le)>m-ae&&M("overflow"),ae+=H(I/Le),I%=Le,E.splice(I++,0,ae)}return String.fromCodePoint.apply(String,E)},T=function(y){var E=[];y=ve(y);var C=y.length,I=x,ae=0,se=S,Ee=!0,je=!1,Be=void 0;try{for(var $e=y[Symbol.iterator](),Ce;!(Ee=(Ce=$e.next()).done);Ee=!0){var We=Ce.value;We<128&&E.push(F(We))}}catch(os){je=!0,Be=os}finally{try{!Ee&&$e.return&&$e.return()}finally{if(je)throw Be}}var ce=E.length,Me=ce;for(ce&&E.push(A);Me<C;){var Ye=m,Le=!0,kr=!1,Yt=void 0;try{for(var Xt=y[Symbol.iterator](),_a;!(Le=(_a=Xt.next()).done);Le=!0){var Vr=_a.value;Vr>=I&&Vr<Ye&&(Ye=Vr)}}catch(os){kr=!0,Yt=os}finally{try{!Le&&Xt.return&&Xt.return()}finally{if(kr)throw Yt}}var Rt=Me+1;Ye-I>H((m-ae)/Rt)&&M("overflow"),ae+=(Ye-I)*Rt,I=Ye;var er=!0,zr=!1,dr=void 0;try{for(var is=y[Symbol.iterator](),Gd;!(er=(Gd=is.next()).done);er=!0){var Yd=Gd.value;if(Yd<I&&++ae>m&&M("overflow"),Yd==I){for(var En=ae,Sn=p;;Sn+=p){var Rn=Sn<=se?h:Sn>=se+v?v:Sn-se;if(En<Rn)break;var Xd=En-Rn,ef=p-Rn;E.push(F(N(Rn+Xd%ef,0))),En=H(Xd/ef)}E.push(F(N(En,0))),se=R(ae,Rt,Me==ce),ae=0,++Me}}}catch(os){zr=!0,dr=os}finally{try{!er&&is.return&&is.return()}finally{if(zr)throw dr}}++ae,++I}return E.join("")},_=function(y){return ye(y,function(E){return z.test(E)?j(E.slice(4).toLowerCase()):E})},w=function(y){return ye(y,function(E){return U.test(E)?"xn--"+T(E):E})},O={version:"2.1.0",ucs2:{decode:ve,encode:we},decode:j,encode:T,toASCII:w,toUnicode:_},K={};function Q($){var y=$.charCodeAt(0),E=void 0;return y<16?E="%0"+y.toString(16).toUpperCase():y<128?E="%"+y.toString(16).toUpperCase():y<2048?E="%"+(y>>6|192).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase():E="%"+(y>>12|224).toString(16).toUpperCase()+"%"+(y>>6&63|128).toString(16).toUpperCase()+"%"+(y&63|128).toString(16).toUpperCase(),E}function fe($){for(var y="",E=0,C=$.length;E<C;){var I=parseInt($.substr(E+1,2),16);if(I<128)y+=String.fromCharCode(I),E+=3;else if(I>=194&&I<224){if(C-E>=6){var ae=parseInt($.substr(E+4,2),16);y+=String.fromCharCode((I&31)<<6|ae&63)}else y+=$.substr(E,6);E+=6}else if(I>=224){if(C-E>=9){var se=parseInt($.substr(E+4,2),16),Ee=parseInt($.substr(E+7,2),16);y+=String.fromCharCode((I&15)<<12|(se&63)<<6|Ee&63)}else y+=$.substr(E,9);E+=9}else y+=$.substr(E,3),E+=3}return y}function ne($,y){function E(C){var I=fe(C);return I.match(y.UNRESERVED)?I:C}return $.scheme&&($.scheme=String($.scheme).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_SCHEME,"")),$.userinfo!==void 0&&($.userinfo=String($.userinfo).replace(y.PCT_ENCODED,E).replace(y.NOT_USERINFO,Q).replace(y.PCT_ENCODED,i)),$.host!==void 0&&($.host=String($.host).replace(y.PCT_ENCODED,E).toLowerCase().replace(y.NOT_HOST,Q).replace(y.PCT_ENCODED,i)),$.path!==void 0&&($.path=String($.path).replace(y.PCT_ENCODED,E).replace($.scheme?y.NOT_PATH:y.NOT_PATH_NOSCHEME,Q).replace(y.PCT_ENCODED,i)),$.query!==void 0&&($.query=String($.query).replace(y.PCT_ENCODED,E).replace(y.NOT_QUERY,Q).replace(y.PCT_ENCODED,i)),$.fragment!==void 0&&($.fragment=String($.fragment).replace(y.PCT_ENCODED,E).replace(y.NOT_FRAGMENT,Q).replace(y.PCT_ENCODED,i)),$}function he($){return $.replace(/^0*(.*)/,"$1")||"0"}function ct($,y){var E=$.match(y.IPV4ADDRESS)||[],C=g(E,2),I=C[1];return I?I.split(".").map(he).join("."):$}function Ke($,y){var E=$.match(y.IPV6ADDRESS)||[],C=g(E,3),I=C[1],ae=C[2];if(I){for(var se=I.toLowerCase().split("::").reverse(),Ee=g(se,2),je=Ee[0],Be=Ee[1],$e=Be?Be.split(":").map(he):[],Ce=je.split(":").map(he),We=y.IPV4ADDRESS.test(Ce[Ce.length-1]),ce=We?7:8,Me=Ce.length-ce,Ye=Array(ce),Le=0;Le<ce;++Le)Ye[Le]=$e[Le]||Ce[Me+Le]||"";We&&(Ye[ce-1]=ct(Ye[ce-1],y));var kr=Ye.reduce(function(Rt,er,zr){if(!er||er==="0"){var dr=Rt[Rt.length-1];dr&&dr.index+dr.length===zr?dr.length++:Rt.push({index:zr,length:1})}return Rt},[]),Yt=kr.sort(function(Rt,er){return er.length-Rt.length})[0],Xt=void 0;if(Yt&&Yt.length>1){var _a=Ye.slice(0,Yt.index),Vr=Ye.slice(Yt.index+Yt.length);Xt=_a.join(":")+"::"+Vr.join(":")}else Xt=Ye.join(":");return ae&&(Xt+="%"+ae),Xt}else return $}var Te=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Pt="".match(/(){0}/)[1]===void 0;function Ge($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},C=y.iri!==!1?d:u;y.reference==="suffix"&&($=(y.scheme?y.scheme+":":"")+"//"+$);var I=$.match(Te);if(I){Pt?(E.scheme=I[1],E.userinfo=I[3],E.host=I[4],E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=I[7],E.fragment=I[8],isNaN(E.port)&&(E.port=I[5])):(E.scheme=I[1]||void 0,E.userinfo=$.indexOf("@")!==-1?I[3]:void 0,E.host=$.indexOf("//")!==-1?I[4]:void 0,E.port=parseInt(I[5],10),E.path=I[6]||"",E.query=$.indexOf("?")!==-1?I[7]:void 0,E.fragment=$.indexOf("#")!==-1?I[8]:void 0,isNaN(E.port)&&(E.port=$.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?I[4]:void 0)),E.host&&(E.host=Ke(ct(E.host,C),C)),E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0?E.reference="same-document":E.scheme===void 0?E.reference="relative":E.fragment===void 0?E.reference="absolute":E.reference="uri",y.reference&&y.reference!=="suffix"&&y.reference!==E.reference&&(E.error=E.error||"URI is not a "+y.reference+" reference.");var ae=K[(y.scheme||E.scheme||"").toLowerCase()];if(!y.unicodeSupport&&(!ae||!ae.unicodeSupport)){if(E.host&&(y.domainHost||ae&&ae.domainHost))try{E.host=O.toASCII(E.host.replace(C.PCT_ENCODED,fe).toLowerCase())}catch(se){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+se}ne(E,u)}else ne(E,C);ae&&ae.parse&&ae.parse(E,y)}else E.error=E.error||"URI can not be parsed.";return E}function Qt($,y){var E=y.iri!==!1?d:u,C=[];return $.userinfo!==void 0&&(C.push($.userinfo),C.push("@")),$.host!==void 0&&C.push(Ke(ct(String($.host),E),E).replace(E.IPV6ADDRESS,function(I,ae,se){return"["+ae+(se?"%25"+se:"")+"]"})),(typeof $.port=="number"||typeof $.port=="string")&&(C.push(":"),C.push(String($.port))),C.length?C.join(""):void 0}var Lt=/^\.\.?\//,ze=/^\/\.(\/|$)/,Et=/^\/\.\.(\/|$)/,lr=/^\/?(?:.|\n)*?(?=\/|$)/;function qe($){for(var y=[];$.length;)if($.match(Lt))$=$.replace(Lt,"");else if($.match(ze))$=$.replace(ze,"/");else if($.match(Et))$=$.replace(Et,"/"),y.pop();else if($==="."||$==="..")$="";else{var E=$.match(lr);if(E){var C=E[0];$=$.slice(C.length),y.push(C)}else throw new Error("Unexpected dot segment condition")}return y.join("")}function Ue($){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=y.iri?d:u,C=[],I=K[(y.scheme||$.scheme||"").toLowerCase()];if(I&&I.serialize&&I.serialize($,y),$.host&&!E.IPV6ADDRESS.test($.host)){if(y.domainHost||I&&I.domainHost)try{$.host=y.iri?O.toUnicode($.host):O.toASCII($.host.replace(E.PCT_ENCODED,fe).toLowerCase())}catch(Ee){$.error=$.error||"Host's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}ne($,E),y.reference!=="suffix"&&$.scheme&&(C.push($.scheme),C.push(":"));var ae=Qt($,y);if(ae!==void 0&&(y.reference!=="suffix"&&C.push("//"),C.push(ae),$.path&&$.path.charAt(0)!=="/"&&C.push("/")),$.path!==void 0){var se=$.path;!y.absolutePath&&(!I||!I.absolutePath)&&(se=qe(se)),ae===void 0&&(se=se.replace(/^\/\//,"/%2F")),C.push(se)}return $.query!==void 0&&(C.push("?"),C.push($.query)),$.fragment!==void 0&&(C.push("#"),C.push($.fragment)),C.join("")}function tt($,y){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=arguments[3],I={};return C||($=Ge(Ue($,E),E),y=Ge(Ue(y,E),E)),E=E||{},!E.tolerant&&y.scheme?(I.scheme=y.scheme,I.userinfo=y.userinfo,I.host=y.host,I.port=y.port,I.path=qe(y.path||""),I.query=y.query):(y.userinfo!==void 0||y.host!==void 0||y.port!==void 0?(I.userinfo=y.userinfo,I.host=y.host,I.port=y.port,I.path=qe(y.path||""),I.query=y.query):(y.path?(y.path.charAt(0)==="/"?I.path=qe(y.path):(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path?I.path="/"+y.path:$.path?I.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+y.path:I.path=y.path,I.path=qe(I.path)),I.query=y.query):(I.path=$.path,y.query!==void 0?I.query=y.query:I.query=$.query),I.userinfo=$.userinfo,I.host=$.host,I.port=$.port),I.scheme=$.scheme),I.fragment=y.fragment,I}function Rr($,y,E){var C=l({scheme:"null"},E);return Ue(tt(Ge($,C),Ge(y,C),C,!0),C)}function ur($,y){return typeof $=="string"?$=Ue(Ge($,y),y):n($)==="object"&&($=Ge(Ue($,y),y)),$}function qr($,y,E){return typeof $=="string"?$=Ue(Ge($,E),E):n($)==="object"&&($=Ue($,E)),typeof y=="string"?y=Ue(Ge(y,E),E):n(y)==="object"&&(y=Ue(y,E)),$===y}function Pn($,y){return $&&$.toString().replace(!y||!y.iri?u.ESCAPE:d.ESCAPE,Q)}function St($,y){return $&&$.toString().replace(!y||!y.iri?u.PCT_ENCODED:d.PCT_ENCODED,fe)}var Ur={scheme:"http",domainHost:!0,parse:function(y,E){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y},serialize:function(y,E){var C=String(y.scheme).toLowerCase()==="https";return(y.port===(C?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}},zd={scheme:"https",domainHost:Ur.domainHost,parse:Ur.parse,serialize:Ur.serialize};function Hd($){return typeof $.secure=="boolean"?$.secure:String($.scheme).toLowerCase()==="wss"}var ns={scheme:"ws",domainHost:!0,parse:function(y,E){var C=y;return C.secure=Hd(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C},serialize:function(y,E){if((y.port===(Hd(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){var C=y.resourceName.split("?"),I=g(C,2),ae=I[0],se=I[1];y.path=ae&&ae!=="/"?ae:void 0,y.query=se,y.resourceName=void 0}return y.fragment=void 0,y}},Zd={scheme:"wss",domainHost:ns.domainHost,parse:ns.parse,serialize:ns.serialize},Gb={},Kd="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Gt="[0-9A-Fa-f]",Yb=r(r("%[EFef]"+Gt+"%"+Gt+Gt+"%"+Gt+Gt)+"|"+r("%[89A-Fa-f]"+Gt+"%"+Gt+Gt)+"|"+r("%"+Gt+Gt)),Xb="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ew="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",tw=s(ew,'[\\"\\\\]'),rw="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",aw=new RegExp(Kd,"g"),ga=new RegExp(Yb,"g"),sw=new RegExp(s("[^]",Xb,"[\\.]",'[\\"]',tw),"g"),Bd=new RegExp(s("[^]",Kd,rw),"g"),nw=Bd;function ic($){var y=fe($);return y.match(aw)?y:$}var Wd={scheme:"mailto",parse:function(y,E){var C=y,I=C.to=C.path?C.path.split(","):[];if(C.path=void 0,C.query){for(var ae=!1,se={},Ee=C.query.split("&"),je=0,Be=Ee.length;je<Be;++je){var $e=Ee[je].split("=");switch($e[0]){case"to":for(var Ce=$e[1].split(","),We=0,ce=Ce.length;We<ce;++We)I.push(Ce[We]);break;case"subject":C.subject=St($e[1],E);break;case"body":C.body=St($e[1],E);break;default:ae=!0,se[St($e[0],E)]=St($e[1],E);break}}ae&&(C.headers=se)}C.query=void 0;for(var Me=0,Ye=I.length;Me<Ye;++Me){var Le=I[Me].split("@");if(Le[0]=St(Le[0]),E.unicodeSupport)Le[1]=St(Le[1],E).toLowerCase();else try{Le[1]=O.toASCII(St(Le[1],E).toLowerCase())}catch(kr){C.error=C.error||"Email address's domain name can not be converted to ASCII via punycode: "+kr}I[Me]=Le.join("@")}return C},serialize:function(y,E){var C=y,I=o(y.to);if(I){for(var ae=0,se=I.length;ae<se;++ae){var Ee=String(I[ae]),je=Ee.lastIndexOf("@"),Be=Ee.slice(0,je).replace(ga,ic).replace(ga,i).replace(sw,Q),$e=Ee.slice(je+1);try{$e=E.iri?O.toUnicode($e):O.toASCII(St($e,E).toLowerCase())}catch(Me){C.error=C.error||"Email address's domain name can not be converted to "+(E.iri?"Unicode":"ASCII")+" via punycode: "+Me}I[ae]=Be+"@"+$e}C.path=I.join(",")}var Ce=y.headers=y.headers||{};y.subject&&(Ce.subject=y.subject),y.body&&(Ce.body=y.body);var We=[];for(var ce in Ce)Ce[ce]!==Gb[ce]&&We.push(ce.replace(ga,ic).replace(ga,i).replace(Bd,Q)+"="+Ce[ce].replace(ga,ic).replace(ga,i).replace(nw,Q));return We.length&&(C.query=We.join("&")),C}},iw=/^([^\:]+)\:(.*)/,Jd={scheme:"urn",parse:function(y,E){var C=y.path&&y.path.match(iw),I=y;if(C){var ae=E.scheme||I.scheme||"urn",se=C[1].toLowerCase(),Ee=C[2],je=ae+":"+(E.nid||se),Be=K[je];I.nid=se,I.nss=Ee,I.path=void 0,Be&&(I=Be.parse(I,E))}else I.error=I.error||"URN can not be parsed.";return I},serialize:function(y,E){var C=E.scheme||y.scheme||"urn",I=y.nid,ae=C+":"+(E.nid||I),se=K[ae];se&&(y=se.serialize(y,E));var Ee=y,je=y.nss;return Ee.path=(I||E.nid)+":"+je,Ee}},ow=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Qd={scheme:"urn:uuid",parse:function(y,E){var C=y;return C.uuid=C.nss,C.nss=void 0,!E.tolerant&&(!C.uuid||!C.uuid.match(ow))&&(C.error=C.error||"UUID is not valid."),C},serialize:function(y,E){var C=y;return C.nss=(y.uuid||"").toLowerCase(),C}};K[Ur.scheme]=Ur,K[zd.scheme]=zd,K[ns.scheme]=ns,K[Zd.scheme]=Zd,K[Wd.scheme]=Wd,K[Jd.scheme]=Jd,K[Qd.scheme]=Qd,a.SCHEMES=K,a.pctEncChar=Q,a.pctDecChars=fe,a.parse=Ge,a.removeDotSegments=qe,a.serialize=Ue,a.resolveComponents=tt,a.resolve=Rr,a.normalize=ur,a.equal=qr,a.escapeComponent=Pn,a.unescapeComponent=St,Object.defineProperty(a,"__esModule",{value:!0})})})(ao,ao.exports);var Ag=ao.exports,jg=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},la={copy:Dg,checkDataType:so,checkDataTypes:Mg,coerceToTypes:Lg,toHash:no,getProperty:io,escapeQuotes:oo,equal:$a,ucs2length:jg,varOccurences:Ug,varReplace:Vg,schemaHasRules:zg,schemaHasRulesExcept:Hg,schemaUnknownRules:Zg,toQuotedString:co,getPathExpr:Kg,getPath:Bg,getData:Qg,unescapeFragment:Gg,unescapeJsonPointer:uo,escapeFragment:Yg,escapeJsonPointer:lo};function Dg(t,e){e=e||{};for(var a in t)e[a]=t[a];return e}function so(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 Mg(t,e,a){switch(t.length){case 1:return so(t[0],e,a,!0);default:var s="",r=no(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?" && ":"")+so(n,e,a,!0);return s}}var Pu=no(["string","number","integer","boolean","null"]);function Lg(t,e){if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var r=e[s];(Pu[r]||t==="array"&&r==="array")&&(a[a.length]=r)}if(a.length)return a}else{if(Pu[e])return[e];if(t==="array"&&e==="array")return["array"]}}function no(t){for(var e={},a=0;a<t.length;a++)e[t[a]]=!0;return e}var Fg=/^[a-z$_][a-z$_0-9]*$/i,qg=/'|\\/g;function io(t){return typeof t=="number"?"["+t+"]":Fg.test(t)?"."+t:"['"+oo(t)+"']"}function oo(t){return t.replace(qg,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Ug(t,e){e+="[^0-9]";var a=t.match(new RegExp(e,"g"));return a?a.length:0}function Vg(t,e,a){return e+="([^0-9])",a=a.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),a+"$1")}function zg(t,e){if(typeof t=="boolean")return!t;for(var a in t)if(e[a])return!0}function Hg(t,e,a){if(typeof t=="boolean")return!t&&a!="not";for(var s in t)if(s!=a&&e[s])return!0}function Zg(t,e){if(typeof t!="boolean"){for(var a in t)if(!e[a])return a}}function co(t){return"'"+oo(t)+"'"}function Kg(t,e,a,s){var r=a?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Eu(t,r)}function Bg(t,e,a){var s=co(a?"/"+lo(e):io(e));return Eu(t,s)}var Wg=/^\/(?:[^~]|~0|~1)*$/,Jg=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qg(t,e,a){var s,r,n,i;if(t==="")return"rootData";if(t[0]=="/"){if(!Wg.test(t))throw new Error("Invalid JSON-pointer: "+t);r=t,n="rootData"}else{if(i=t.match(Jg),!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,l=r.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(n+=io(uo(u)),o+=" && "+n)}return o}function Eu(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Gg(t){return uo(decodeURIComponent(t))}function Yg(t){return encodeURIComponent(lo(t))}function lo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function uo(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}var Xg=la,Su=e_;function e_(t){Xg.copy(t,this)}var Ru={exports:{}},wr=Ru.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(){};zs(e,s,r,t,"",t)};wr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},wr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},wr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},wr.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 zs(t,e,a,s,r,n,i,o,l,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,l,c);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in wr.arrayKeywords)for(var g=0;g<d.length;g++)zs(t,e,a,d[g],r+"/"+u+"/"+g,n,r,u,s,g)}else if(u in wr.propsKeywords){if(d&&typeof d=="object")for(var f in d)zs(t,e,a,d[f],r+"/"+u+"/"+t_(f),n,r,u,s,f)}else(u in wr.keywords||t.allKeys&&!(u in wr.skipKeywords))&&zs(t,e,a,d,r+"/"+u,n,r,u,s)}a(s,r,n,i,o,l,c)}}function t_(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var r_=Ru.exports,Ga=Ag,ku=$a,Hs=la,Zs=Su,a_=r_,fo=$r;$r.normalizeId=Pr,$r.fullPath=Bs,$r.url=Ws,$r.ids=c_,$r.inlineRef=ho,$r.schema=Ks;function $r(t,e,a){var s=this._refs[a];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return $r.call(this,t,e,s);if(s=s||this._schemas[a],s instanceof Zs)return ho(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ks.call(this,e,a),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Zs?i=n.validate||t.call(this,n.schema,e,void 0,o):n!==void 0&&(i=ho(n,this._opts.inlineRefs)?n:t.call(this,n,e,void 0,o)),i}function Ks(t,e){var a=Ga.parse(e),s=Tu(a),r=Bs(this._getId(t.schema));if(Object.keys(t.schema).length===0||s!==r){var n=Pr(s),i=this._refs[n];if(typeof i=="string")return s_.call(this,t,i,a);if(i instanceof Zs)i.validate||this._compile(i),t=i;else if(i=this._schemas[n],i instanceof Zs){if(i.validate||this._compile(i),n==Pr(e))return{schema:i,root:t,baseId:r};t=i}else return;if(!t.schema)return;r=Bs(this._getId(t.schema))}return xu.call(this,a,r,t.schema,t)}function s_(t,e,a){var s=Ks.call(this,t,e);if(s){var r=s.schema,n=s.baseId;t=s.root;var i=this._getId(r);return i&&(n=Ws(n,i)),xu.call(this,a,n,r,t)}}var n_=Hs.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function xu(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=Hs.unescapeFragment(i),a=a[i],a===void 0)break;var o;if(!n_[i]&&(o=this._getId(a),o&&(e=Ws(e,o)),a.$ref)){var l=Ws(e,a.$ref),c=Ks.call(this,s,l);c&&(a=c.schema,s=c.root,e=c.baseId)}}}if(a!==void 0&&a!==s.schema)return{schema:a,root:s,baseId:e}}}var i_=Hs.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function ho(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return po(t);if(e)return mo(t)<=e}function po(t){var e;if(Array.isArray(t)){for(var a=0;a<t.length;a++)if(e=t[a],typeof e=="object"&&!po(e))return!1}else for(var s in t)if(s=="$ref"||(e=t[s],typeof e=="object"&&!po(e)))return!1;return!0}function mo(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+=mo(a)),e==1/0)return 1/0}else for(var r in t){if(r=="$ref")return 1/0;if(i_[r])e++;else if(a=t[r],typeof a=="object"&&(e+=mo(a)+1),e==1/0)return 1/0}return e}function Bs(t,e){e!==!1&&(t=Pr(t));var a=Ga.parse(t);return Tu(a)}function Tu(t){return Ga.serialize(t).split("#")[0]+"#"}var o_=/#\/?$/;function Pr(t){return t?t.replace(o_,""):""}function Ws(t,e){return e=Pr(e),Ga.resolve(t,e)}function c_(t){var e=Pr(this._getId(t)),a={"":e},s={"":Bs(e,!1)},r={},n=this;return a_(t,{allKeys:!0},function(i,o,l,c,u,d,g){if(o!==""){var f=n._getId(i),m=a[c],p=s[c]+"/"+u;if(g!==void 0&&(p+="/"+(typeof g=="number"?g:Hs.escapeFragment(g))),typeof f=="string"){f=m=Pr(m?Ga.resolve(m,f):f);var h=n._refs[f];if(typeof h=="string"&&(h=n._refs[h]),h&&h.schema){if(!ku(i,h.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=Pr(p))if(f[0]=="#"){if(r[f]&&!ku(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 vo=fo,go={Validation:Iu(l_),MissingRef:Iu(_o)};function l_(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}_o.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function _o(t,e,a){this.message=a||_o.message(t,e),this.missingRef=vo.url(t,e),this.missingSchema=vo.normalizeId(vo.fullPath(this.missingRef))}function Iu(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Cu=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,l){var c={key:o,value:i[o]},u={key:l,value:i[l]};return n(c,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,l;if(Array.isArray(i)){for(l="[",o=0;o<i.length;o++)o&&(l+=","),l+=n(i[o])||"null";return l+"]"}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 c=r.push(i)-1,u=Object.keys(i).sort(s&&s(i));for(l="",o=0;o<u.length;o++){var d=u[o],g=n(i[d]);g&&(l&&(l+=","),l+=JSON.stringify(d)+":"+g)}return r.splice(c,1),"{"+l+"}"}}(t)},Ou=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 l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",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,g=e.schema[a],f=e.schemaPath+e.util.getProperty(a),m=e.errSchemaPath+"/"+a,x=!e.opts.allErrors,U,p="data"+(d||""),S="valid"+u;if(e.schema===!1){e.isTop?x=!0:r+=" var "+S+" = false; ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"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&&x?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 "+S+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var b=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 P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,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 S="valid"+u,x=!e.opts.allErrors,A="",z="",U,D=e.schema.type,W=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(W?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],W=!0)),W&&D.length==1&&(D=D[0],W=!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")),D){if(e.opts.coerceTypes)var J=e.util.coerceToTypes(e.opts.coerceTypes,D);var H=e.RULES.types[D];if(J||W||H===!0||H&&!ze(H)){var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",f=e.schemaPath+".type",m=e.errSchemaPath+"/type",F=W?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[F](D,p,e.opts.strictNumbers,!0)+") { ",J){var M="dataType"+u,te="coerced"+u;r+=" var "+M+" = typeof "+p+"; var "+te+" = 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)+") "+te+" = "+p+"; } "),r+=" if ("+te+" !== undefined) ; ";var ye=J;if(ye)for(var ve,we=-1,de=ye.length-1;we<de;)ve=ye[we+=1],ve=="string"?r+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+te+" = '' + "+p+"; else if ("+p+" === null) "+te+" = ''; ":ve=="number"||ve=="integer"?(r+=" else if ("+M+" == 'boolean' || "+p+" === null || ("+M+" == 'string' && "+p+" && "+p+" == +"+p+" ",ve=="integer"&&(r+=" && !("+p+" % 1)"),r+=")) "+te+" = +"+p+"; "):ve=="boolean"?r+=" else if ("+p+" === 'false' || "+p+" === 0 || "+p+" === null) "+te+" = false; else if ("+p+" === 'true' || "+p+" === 1) "+te+" = true; ":ve=="null"?r+=" else if ("+p+" === '' || "+p+" === 0 || "+p+" === false) "+te+" = null; ":e.opts.coerceTypes=="array"&&ve=="array"&&(r+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+p+" == null) "+te+" = ["+p+"]; ");r+=" else { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,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&&x?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 ("+te+" !== undefined) { ";var N=d?"data"+(d-1||""):"parentData",R=d?e.dataPathArr[d]:"parentDataProperty";r+=" "+p+" = "+te+"; ",d||(r+="if ("+N+" !== undefined)"),r+=" "+N+"["+R+"] = "+te+"; } "}else{var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,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&&x?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")+" ",x&&(r+=" } if (errors === ",b?r+="0":r+="errs_"+u,r+=") { ",z+="}");else{var j=e.RULES;if(j){for(var H,T=-1,_=j.length-1;T<_;)if(H=j[T+=1],ze(H)){if(H.type&&(r+=" if ("+e.util.checkDataType(H.type,p,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(H.type=="object"&&e.schema.properties){var g=e.schema.properties,w=Object.keys(g),O=w;if(O)for(var K,Q=-1,fe=O.length-1;Q<fe;){K=O[Q+=1];var ne=g[K];if(ne.default!==void 0){var he=p+e.util.getProperty(K);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ne.default)+" ":r+=" "+JSON.stringify(ne.default)+" ",r+="; "}}}else if(H.type=="array"&&Array.isArray(e.schema.items)){var ct=e.schema.items;if(ct){for(var ne,we=-1,Ke=ct.length-1;we<Ke;)if(ne=ct[we+=1],ne.default!==void 0){var he=p+"["+we+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+he;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+he+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+he+" === null || "+he+" === '' "),r+=" ) "+he+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(ne.default)+" ":r+=" "+JSON.stringify(ne.default)+" ",r+="; "}}}}var Te=H.rules;if(Te){for(var Pt,Ge=-1,Qt=Te.length-1;Ge<Qt;)if(Pt=Te[Ge+=1],Et(Pt)){var Lt=Pt.code(e,Pt.keyword,H.type);Lt&&(r+=" "+Lt+" ",x&&(A+="}"))}}if(x&&(r+=" "+A+" ",A=""),H.type&&(r+=" } ",D&&D===H.type&&!J)){r+=" else { ";var f=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",W?r+=""+D.join(","):r+=""+D,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",W?r+=""+D.join(","):r+=""+D,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&&x?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+=" } "}x&&(r+=" if (errors === ",b?r+="0":r+="errs_"+u,r+=") { ",z+="}")}}}x&&(r+=" "+z+" "),b?(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 "+S+" = errors === errs_"+u+";";function ze(qe){for(var Ue=qe.rules,tt=0;tt<Ue.length;tt++)if(Et(Ue[tt]))return!0}function Et(qe){return e.schema[qe.keyword]!==void 0||qe.implements&&lr(qe)}function lr(qe){for(var Ue=qe.implements,tt=0;tt<Ue.length;tt++)if(e.schema[Ue[tt]]!==void 0)return!0}return r},Js=fo,Qs=la,Nu=go,u_=Cu,Au=Ou,d_=Qs.ucs2length,f_=$a,h_=Nu.Validation,p_=yo;function yo(t,e,a,s){var r=this,n=this._opts,i=[void 0],o={},l=[],c={},u=[],d={},g=[];e=e||{schema:t,refVal:i,refs:o};var f=m_.call(this,t,e,s),m=this._compilations[f.index];if(f.compiling)return m.callValidate=P;var p=this._formats,h=this.RULES;try{var v=S(t,e,a,s);m.validate=v;var b=m.callValidate;return b&&(b.schema=v.schema,b.errors=null,b.refs=v.refs,b.refVal=v.refVal,b.root=v.root,b.$async=v.$async,n.sourceCode&&(b.source=v.source)),v}finally{v_.call(this,t,e,s)}function P(){var F=m.validate,M=F.apply(this,arguments);return P.errors=F.errors,M}function S(F,M,te,ye){var ve=!M||M&&M.schema==F;if(M.schema!=e.schema)return yo.call(r,F,M,te,ye);var we=F.$async===!0,de=Au({isTop:!0,schema:F,isRoot:ve,baseId:ye,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Nu.MissingRef,RULES:h,validate:Au,util:Qs,resolve:Js,resolveRef:x,usePattern:W,useDefault:J,useCustomRule:H,opts:n,formats:p,logger:r.logger,self:r});de=Gs(i,y_)+Gs(l,g_)+Gs(u,__)+Gs(g,b_)+de,n.processCode&&(de=n.processCode(de,F));var N;try{var R=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",de);N=R(r,h,p,e,i,u,g,f_,d_,h_),i[0]=N}catch(j){throw r.logger.error("Error compiling schema, function code:",de),j}return N.schema=F,N.errors=null,N.refs=o,N.refVal=i,N.root=ve?N:M,we&&(N.$async=!0),n.sourceCode===!0&&(N.source={code:de,patterns:l,defaults:u}),N}function x(F,M,te){M=Js.url(F,M);var ye=o[M],ve,we;if(ye!==void 0)return ve=i[ye],we="refVal["+ye+"]",D(ve,we);if(!te&&e.refs){var de=e.refs[M];if(de!==void 0)return ve=e.refVal[de],we=A(M,ve),D(ve,we)}we=A(M);var N=Js.call(r,S,e,M);if(N===void 0){var R=a&&a[M];R&&(N=Js.inlineRef(R,n.inlineRefs)?R:yo.call(r,R,e,a,F))}if(N===void 0)z(M);else return U(M,N),D(N,we)}function A(F,M){var te=i.length;return i[te]=M,o[F]=te,"refVal"+te}function z(F){delete o[F]}function U(F,M){var te=o[F];i[te]=M}function D(F,M){return typeof F=="object"||typeof F=="boolean"?{code:M,schema:F,inline:!0}:{code:M,$async:F&&!!F.$async}}function W(F){var M=c[F];return M===void 0&&(M=c[F]=l.length,l[M]=F),"pattern"+M}function J(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return Qs.toQuotedString(F);case"object":if(F===null)return"null";var M=u_(F),te=d[M];return te===void 0&&(te=d[M]=u.length,u[te]=F),"default"+te}}function H(F,M,te,ye){if(r._opts.validateSchema!==!1){var ve=F.definition.dependencies;if(ve&&!ve.every(function(O){return Object.prototype.hasOwnProperty.call(te,O)}))throw new Error("parent schema must have all required keywords: "+ve.join(","));var we=F.definition.validateSchema;if(we){var de=we(M);if(!de){var N="keyword schema is invalid: "+r.errorsText(we.errors);if(r._opts.validateSchema=="log")r.logger.error(N);else throw new Error(N)}}}var R=F.definition.compile,j=F.definition.inline,T=F.definition.macro,_;if(R)_=R.call(r,M,te,ye);else if(T)_=T.call(r,M,te,ye),n.validateSchema!==!1&&r.validateSchema(_,!0);else if(j)_=j.call(r,ye,F.keyword,M,te);else if(_=F.definition.validate,!_)return;if(_===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var w=g.length;return g[w]=_,{code:"customRule"+w,validate:_}}}function m_(t,e,a){var s=ju.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 v_(t,e,a){var s=ju.call(this,t,e,a);s>=0&&this._compilations.splice(s,1)}function ju(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 g_(t,e){return"var pattern"+t+" = new RegExp("+Qs.toQuotedString(e[t])+");"}function __(t){return"var default"+t+" = defaults["+t+"];"}function y_(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function b_(t){return"var customRule"+t+" = customRules["+t+"];"}function Gs(t,e){if(!t.length)return"";for(var a="",s=0;s<t.length;s++)a+=e(s,t);return a}var Du={exports:{}},Ys=Du.exports=function(){this._cache={}};Ys.prototype.put=function(e,a){this._cache[e]=a},Ys.prototype.get=function(e){return this._cache[e]},Ys.prototype.del=function(e){delete this._cache[e]},Ys.prototype.clear=function(){this._cache={}};var w_=Du.exports,$_=la,P_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,E_=[0,31,28,31,30,31,30,31,31,30,31,30,31],S_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Mu=/^(?=.{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,R_=/^(?:[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,k_=/^(?:[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,Lu=/^(?:(?:[^\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,Fu=/^(?:(?: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,qu=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Uu=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Vu=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,zu=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,x_=Xs;function Xs(t){return t=t=="full"?"full":"fast",$_.copy(Xs[t])}Xs.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":Lu,url:Fu,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:Mu,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:Ku,uuid:qu,"json-pointer":Uu,"json-pointer-uri-fragment":Vu,"relative-json-pointer":zu},Xs.full={date:Hu,time:Zu,"date-time":C_,uri:N_,"uri-reference":k_,"uri-template":Lu,url:Fu,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:Mu,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:Ku,uuid:qu,"json-pointer":Uu,"json-pointer-uri-fragment":Vu,"relative-json-pointer":zu};function T_(t){return t%4===0&&(t%100!==0||t%400===0)}function Hu(t){var e=t.match(P_);if(!e)return!1;var a=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&T_(a)?29:E_[s])}function Zu(t,e){var a=t.match(S_);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 I_=/t|\s/i;function C_(t){var e=t.split(I_);return e.length==2&&Hu(e[0])&&Zu(e[1],!0)}var O_=/\/|:/;function N_(t){return O_.test(t)&&R_.test(t)}var A_=/[^\\]\\Z/;function Ku(t){if(A_.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}var j_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.errSchemaPath+"/"+a,c=!e.opts.allErrors,u="data"+(i||""),d="valid"+n,g,f;if(o=="#"||o=="#/")e.isRoot?(g=e.async,f="validate"):(g=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(l)+" , 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&&c?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(p),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,p)}else if(m.inline){var b=e.util.copy(e);b.level++;var P="valid"+b.level;b.schema=m.schema,b.schemaPath="",b.errSchemaPath=o;var S=e.validate(b).replace(/validate\.schema/g,m.code);r+=" "+S+" ",c&&(r+=" if ("+P+") { ")}else g=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 x=i?"data"+(i-1||""):"parentData",A=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+x+" , "+A+", rootData) ";var z=r;if(r=h.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+d+"; "),r+=" try { await "+z+"; ",c&&(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; ",c&&(r+=" "+d+" = false; "),r+=" } ",c&&(r+=" if ("+d+") { ")}else r+=" if (!"+z+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r},D_=function(e,a,s){var r=" ",n=e.schema[a],i=e.schemaPath+e.util.getProperty(a),o=e.errSchemaPath+"/"+a,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var d="valid"+c.level,g=c.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,c.schema=p,c.schemaPath=i+"["+h+"]",c.errSchemaPath=o+"/"+h,r+=" "+e.validate(c)+" ",c.baseId=g,l&&(r+=" if ("+d+") { ",u+="}"));return l&&(f?r+=" if (true) { ":r+=" "+u.slice(0,-1)+" "),r},M_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=o.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(v){var b=m.baseId;r+=" var "+f+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=m.compositeRule=!0;var S=o;if(S)for(var x,A=-1,z=S.length-1;A<z;)x=S[A+=1],m.schema=x,m.schemaPath=l+"["+A+"]",m.errSchemaPath=c+"/"+A,r+=" "+e.validate(m)+" ",m.baseId=b,r+=" "+g+" = "+g+" || "+h+"; if (!"+g+") { ",p+="}";e.compositeRule=m.compositeRule=P,r+=" "+p+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},L_=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},F_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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"+l+";"),r+="var "+g+" = equal("+d+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},q_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,b=m.dataLevel=e.dataLevel+1,P="data"+b,S=e.baseId,x=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 "+g+";",x){var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,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 z=d+"["+v+"]";m.dataPathArr[b]=v;var U=e.validate(m);m.baseId=S,e.util.varOccurences(U,P)<2?r+=" "+e.util.varReplace(U,P,z)+" ":r+=" var "+P+" = "+z+"; "+U+" ",r+=" if ("+h+") break; } ",e.compositeRule=m.compositeRule=A,r+=" "+p+" if (!"+h+") {"}else r+=" if ("+d+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var W=r;return r=D.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+W+"]); ":r+=" validate.errors = ["+W+"]; return false; ":r+=" var err = "+W+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",x&&(r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r},U_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h={},v={},b=e.opts.ownProperties;for(A in o)if(A!="__proto__"){var P=o[A],S=Array.isArray(P)?v:h;S[A]=P}r+="var "+g+" = errors;";var x=e.errorPath;r+="var missing"+n+";";for(var A in v)if(S=v[A],S.length){if(r+=" if ( "+d+e.util.getProperty(A)+" !== undefined ",b&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),u){r+=" && ( ";var z=S;if(z)for(var U,D=-1,W=z.length-1;D<W;){U=z[D+=1],D&&(r+=" || ");var J=e.util.getProperty(U),H=d+J;r+=" ( ( "+H+" === undefined ",b&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:J)+") ) "}r+=")) { ";var F="missing"+n,M="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,F,!0):x+" + "+F);var te=te||[];te.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",S.length==1?r+="property "+e.util.escapeQuotes(S[0]):r+="properties "+e.util.escapeQuotes(S.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var ye=r;r=te.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+ye+"]); ":r+=" validate.errors = ["+ye+"]; return false; ":r+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var ve=S;if(ve)for(var U,we=-1,de=ve.length-1;we<de;){U=ve[we+=1];var J=e.util.getProperty(U),M=e.util.escapeQuotes(U),H=d+J;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,U,e.opts.jsonPointers)),r+=" if ( "+H+" === undefined ",b&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+M+"', depsCount: "+S.length+", deps: '"+e.util.escapeQuotes(S.length==1?S[0]:S.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",S.length==1?r+="property "+e.util.escapeQuotes(S[0]):r+="properties "+e.util.escapeQuotes(S.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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=x;var N=f.baseId;for(var A in h){var P=h[A];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+p+" = true; if ( "+d+e.util.getProperty(A)+" !== undefined ",b&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(A)+"') "),r+=") { ",f.schema=P,f.schemaPath=l+e.util.getProperty(A),f.errSchemaPath=c+"/"+e.util.escapeFragment(A),r+=" "+e.validate(f)+" ",f.baseId=N,r+=" } ",u&&(r+=" if ("+p+") { ",m+="}"))}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},V_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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"+l+";"),r+="var "+g+";",f&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+p+".length; "+m+"++) if (equal("+d+", "+p+"["+m+"])) { "+g+" = true; break; }",f&&(r+=" } "),r+=" if (!"+g+") { ";var h=h||[];h.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},z_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return u&&(r+=" if (true) { "),r;var g=e.opts.$data&&o&&o.$data,f;g?(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(g){var h="format"+n,v="isObject"+n,b="formatType"+n;r+=" var "+h+" = formats["+f+"]; var "+v+" = typeof "+h+" == 'object' && !("+h+" instanceof RegExp) && "+h+".validate; var "+b+" = "+v+" && "+h+".type || 'string'; if ("+v+") { ",e.async&&(r+=" var async"+n+" = "+h+".async; "),r+=" "+h+" = "+h+".validate; } if ( ",g&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),r+=" (",m!="ignore"&&(r+=" ("+f+" && !"+h+" ",p&&(r+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),r+=") || "),r+=" ("+h+" && "+b+" == '"+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,b=v&&h.type||"string";if(v){var P=h.async===!0;h=h.validate}if(b!=s)return u&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var S="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+S+"("+d+"))) { "}else{r+=" if (! ";var S="formats"+e.util.getProperty(o);v&&(S+=".validate"),typeof h=="function"?r+=" "+S+"("+d+") ":r+=" "+S+".test("+d+") ",r+=") { "}}var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var A=r;return r=x.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { "),r},H_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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,b=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),P=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),S=m.baseId;if(b||P){var x;m.createErrors=!1,m.schema=o,m.schemaPath=l,m.errSchemaPath=c,r+=" var "+f+" = errors; var "+g+" = true; ";var A=e.compositeRule;e.compositeRule=m.compositeRule=!0,r+=" "+e.validate(m)+" ",m.baseId=S,m.createErrors=!0,r+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=A,b?(r+=" if ("+p+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(m)+" ",m.baseId=S,r+=" "+g+" = "+p+"; ",b&&P?(x="ifClause"+n,r+=" var "+x+" = 'then'; "):x="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+p+") { ",P&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(m)+" ",m.baseId=S,r+=" "+g+" = "+p+"; ",b&&P?(x="ifClause"+n,r+=" var "+x+" = 'else'; "):x="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+x+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+x+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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},Z_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v="i"+n,b=m.dataLevel=e.dataLevel+1,P="data"+b,S=e.baseId;if(r+="var "+f+" = errors;var "+g+";",Array.isArray(o)){var x=e.schema.additionalItems;if(x===!1){r+=" "+g+" = "+d+".length <= "+o.length+"; ";var A=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , 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 U=r;r=z.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=A,u&&(p+="}",r+=" else { ")}var D=o;if(D){for(var W,J=-1,H=D.length-1;J<H;)if(W=D[J+=1],e.opts.strictKeywords?typeof W=="object"&&Object.keys(W).length>0||W===!1:e.util.schemaHasRules(W,e.RULES.all)){r+=" "+h+" = true; if ("+d+".length > "+J+") { ";var F=d+"["+J+"]";m.schema=W,m.schemaPath=l+"["+J+"]",m.errSchemaPath=c+"/"+J,m.errorPath=e.util.getPathExpr(e.errorPath,J,e.opts.jsonPointers,!0),m.dataPathArr[b]=J;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",r+=" } ",u&&(r+=" if ("+h+") { ",p+="}")}}if(typeof x=="object"&&(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=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[b]=v;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+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=l,m.errSchemaPath=c,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[b]=v;var M=e.validate(m);m.baseId=S,e.util.varOccurences(M,P)<2?r+=" "+e.util.varReplace(M,P,F)+" ":r+=" var "+P+" = "+F+"; "+M+" ",u&&(r+=" if (!"+h+") break; "),r+=" }"}return u&&(r+=" "+p+" if ("+f+" == errors) {"),r},Bu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,S,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;g?(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,b=m?"<":">",P=m?">":"<",S=void 0;if(!(g||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 x=e.util.getData(h.$data,i,e.dataPathArr),A="exclusive"+n,z="exclType"+n,U="exclIsNumber"+n,D="op"+n,W="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+x+"; ",x="schemaExcl"+n,r+=" var "+A+"; var "+z+" = typeof "+x+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var S=p,J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(S||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else if ( ",g&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+z+" == 'number' ? ( ("+A+" = "+f+" === undefined || "+x+" "+b+"= "+f+") ? "+d+" "+P+"= "+x+" : "+d+" "+P+" "+f+" ) : ( ("+A+" = "+x+" === true) ? "+d+" "+P+"= "+f+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { var op"+n+" = "+A+" ? '"+b+"' : '"+b+"='; ",o===void 0&&(S=p,c=e.errSchemaPath+"/"+p,f=x,g=v)}else{var U=typeof h=="number",W=b;if(U&&g){var D="'"+W+"'";r+=" if ( ",g&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" ( "+f+" === undefined || "+h+" "+b+"= "+f+" ? "+d+" "+P+"= "+h+" : "+d+" "+P+" "+f+" ) || "+d+" !== "+d+") { "}else{U&&o===void 0?(A=!0,S=p,c=e.errSchemaPath+"/"+p,f=h,P+="="):(U&&(f=Math[m?"min":"max"](h,o)),h===(U?f:!0)?(A=!0,S=p,c=e.errSchemaPath+"/"+p,P+="="):(A=!1,W+="="));var D="'"+W+"'";r+=" if ( ",g&&(r+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),r+=" "+d+" "+P+" "+f+" || "+d+" !== "+d+") { "}}S=S||a;var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(S||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+D+", limit: "+f+", exclusive: "+A+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+W+" ",g?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;return r=J.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},Wu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxItems"?">":"<";r+="if ( ",g&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+f+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l: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},Ju=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxLength"?">":"<";r+="if ( ",g&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+f+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l: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},Qu=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,p,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(a+" must be number");var m=a=="maxProperties"?">":"<";r+="if ( ",g&&(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(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+f+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l: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},K_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o,!(g||typeof o=="number"))throw new Error(a+" must be number");r+="var division"+n+";if (",g&&(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+=" ) ",g&&(r+=" ) "),r+=" ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+f:r+=""+f+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l: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},B_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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=l,f.errSchemaPath=c,r+=" var "+g+" = 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(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var b=r;r=v.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 { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ");return r},W_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="valid"+n,f="errs__"+n,m=e.util.copy(e),p="";m.level++;var h="valid"+m.level,v=m.baseId,b="prevValid"+n,P="passingSchemas"+n;r+="var "+f+" = errors , "+b+" = false , "+g+" = false , "+P+" = null; ";var S=e.compositeRule;e.compositeRule=m.compositeRule=!0;var x=o;if(x)for(var A,z=-1,U=x.length-1;z<U;)A=x[z+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(m.schema=A,m.schemaPath=l+"["+z+"]",m.errSchemaPath=c+"/"+z,r+=" "+e.validate(m)+" ",m.baseId=v):r+=" var "+h+" = true; ",z&&(r+=" if ("+h+" && "+b+") { "+g+" = false; "+P+" = ["+P+", "+z+"]; } else { ",p+="}"),r+=" if ("+h+") { "+g+" = "+b+" = true; "+P+" = "+z+"; }";return e.compositeRule=m.compositeRule=S,r+=""+p+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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},J_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g=e.opts.$data&&o&&o.$data,f;g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+n):f=o;var m=g?"(new RegExp("+f+"))":e.usePattern(o);r+="if ( ",g&&(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(c)+" , params: { pattern: ",g?r+=""+f:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+f+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+l: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},Q_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,h="key"+n,v="idx"+n,b=f.dataLevel=e.dataLevel+1,P="data"+b,S="dataProperties"+n,x=Object.keys(o||{}).filter(we),A=e.schema.patternProperties||{},z=Object.keys(A).filter(we),U=e.schema.additionalProperties,D=x.length||z.length,W=U===!1,J=typeof U=="object"&&Object.keys(U).length,H=e.opts.removeAdditional,F=W||J||H,M=e.opts.ownProperties,te=e.baseId,ye=e.schema.required;if(ye&&!(e.opts.$data&&ye.$data)&&ye.length<e.opts.loopRequired)var ve=e.util.toHash(ye);function we(qr){return qr!=="__proto__"}if(r+="var "+g+" = errors;var "+p+" = true;",M&&(r+=" var "+S+" = undefined;"),F){if(M?r+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+S+".length; "+v+"++) { var "+h+" = "+S+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",D){if(r+=" var isAdditional"+n+" = !(false ",x.length)if(x.length>8)r+=" || validate.schema"+l+".hasOwnProperty("+h+") ";else{var de=x;if(de)for(var N,R=-1,j=de.length-1;R<j;)N=de[R+=1],r+=" || "+h+" == "+e.util.toQuotedString(N)+" "}if(z.length){var T=z;if(T)for(var _,w=-1,O=T.length-1;w<O;)_=T[w+=1],r+=" || "+e.usePattern(_)+".test("+h+") "}r+=" ); if (isAdditional"+n+") { "}if(H=="all")r+=" delete "+d+"["+h+"]; ";else{var K=e.errorPath,Q="' + "+h+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),W)if(H)r+=" delete "+d+"["+h+"]; ";else{r+=" "+p+" = false; ";var fe=c;c=e.errSchemaPath+"/additionalProperties";var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , 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=ne.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++; ",c=fe,u&&(r+=" break; ")}else if(J)if(H=="failing"){r+=" var "+g+" = errors; ";var ct=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=U,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 Ke=d+"["+h+"]";f.dataPathArr[b]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",r+=" if (!"+p+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+h+"]; } ",e.compositeRule=f.compositeRule=ct}else{f.schema=U,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 Ke=d+"["+h+"]";f.dataPathArr[b]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",u&&(r+=" if (!"+p+") break; ")}e.errorPath=K}D&&(r+=" } "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}var Pt=e.opts.useDefaults&&!e.compositeRule;if(x.length){var Ge=x;if(Ge)for(var N,Qt=-1,Lt=Ge.length-1;Qt<Lt;){N=Ge[Qt+=1];var ze=o[N];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){var Et=e.util.getProperty(N),Ke=d+Et,lr=Pt&&ze.default!==void 0;f.schema=ze,f.schemaPath=l+Et,f.errSchemaPath=c+"/"+e.util.escapeFragment(N),f.errorPath=e.util.getPath(e.errorPath,N,e.opts.jsonPointers),f.dataPathArr[b]=e.util.toQuotedString(N);var Te=e.validate(f);if(f.baseId=te,e.util.varOccurences(Te,P)<2){Te=e.util.varReplace(Te,P,Ke);var qe=Ke}else{var qe=P;r+=" var "+P+" = "+Ke+"; "}if(lr)r+=" "+Te+" ";else{if(ve&&ve[N]){r+=" if ( "+qe+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=") { "+p+" = false; ";var K=e.errorPath,fe=c,Ue=e.util.escapeQuotes(N);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(K,N,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var ne=ne||[];ne.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ue+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+Ue+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var he=r;r=ne.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++; ",c=fe,e.errorPath=K,r+=" } else { "}else u?(r+=" if ( "+qe+" === undefined ",M&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=") { "+p+" = true; } else { "):(r+=" if ("+qe+" !== undefined ",M&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(N)+"') "),r+=" ) { ");r+=" "+Te+" } "}}u&&(r+=" if ("+p+") { ",m+="}")}}if(z.length){var tt=z;if(tt)for(var _,Rr=-1,ur=tt.length-1;Rr<ur;){_=tt[Rr+=1];var ze=A[_];if(e.opts.strictKeywords?typeof ze=="object"&&Object.keys(ze).length>0||ze===!1:e.util.schemaHasRules(ze,e.RULES.all)){f.schema=ze,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_),M?r+=" "+S+" = "+S+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+S+".length; "+v+"++) { var "+h+" = "+S+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" if ("+e.usePattern(_)+".test("+h+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var Ke=d+"["+h+"]";f.dataPathArr[b]=h;var Te=e.validate(f);f.baseId=te,e.util.varOccurences(Te,P)<2?r+=" "+e.util.varReplace(Te,P,Ke)+" ":r+=" var "+P+" = "+Ke+"; "+Te+" ",u&&(r+=" if (!"+p+") break; "),r+=" } ",u&&(r+=" else "+p+" = true; "),r+=" } ",u&&(r+=" if ("+p+") { ",m+="}")}}}return u&&(r+=" "+m+" if ("+g+" == errors) {"),r},G_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="errs__"+n,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level;if(r+="var "+g+" = 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=l,f.errSchemaPath=c;var h="key"+n,v="idx"+n,b="i"+n,P="' + "+h+" + '",S=f.dataLevel=e.dataLevel+1,x="data"+S,A="dataProperties"+n,z=e.opts.ownProperties,U=e.baseId;z&&(r+=" var "+A+" = undefined; "),z?r+=" "+A+" = "+A+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+A+".length; "+v+"++) { var "+h+" = "+A+"["+v+"]; ":r+=" for (var "+h+" in "+d+") { ",r+=" var startErrs"+n+" = errors; ";var D=h,W=e.compositeRule;e.compositeRule=f.compositeRule=!0;var J=e.validate(f);f.baseId=U,e.util.varOccurences(J,x)<2?r+=" "+e.util.varReplace(J,x,D)+" ":r+=" var "+x+" = "+D+"; "+J+" ",e.compositeRule=f.compositeRule=W,r+=" if (!"+p+") { for (var "+b+"=startErrs"+n+"; "+b+"<errors; "+b+"++) { vErrors["+b+"].propertyName = "+h+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+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 ("+g+" == errors) {"),r},Y_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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,b=-1,P=h.length-1;b<P;){v=h[b+=1];var S=e.schema.properties[v];S&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(p[p.length]=v)}}else var p=o;if(f||p.length){var x=e.errorPath,A=f||p.length>=e.opts.loopRequired,z=e.opts.ownProperties;if(u)if(r+=" var missing"+n+"; ",A){f||(r+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,e.opts.jsonPointers)),r+=" var "+g+" = true; ",f&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { "+g+" = "+d+"["+m+"["+U+"]] !== undefined ",z&&(r+=" && Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),r+="; if (!"+g+") break; } ",f&&(r+=" } "),r+=" if (!"+g+") { ";var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else { "}else{r+=" if ( ";var F=p;if(F)for(var M,U=-1,te=F.length-1;U<te;){M=F[U+=1],U&&(r+=" || ");var ye=e.util.getProperty(M),ve=d+ye;r+=" ( ( "+ve+" === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:ye)+") ) "}r+=") { ";var D="missing"+n,W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,D,!0):x+" + "+D);var J=J||[];J.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var H=r;r=J.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+=" } else { "}else if(A){f||(r+=" var "+m+" = validate.schema"+l+"; ");var U="i"+n,D="schema"+n+"["+U+"]",W="' + "+D+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,D,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(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , 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 "+U+" = 0; "+U+" < "+m+".length; "+U+"++) { if ("+d+"["+m+"["+U+"]] === undefined ",z&&(r+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+m+"["+U+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(r+=" } ")}else{var we=p;if(we)for(var M,de=-1,N=we.length-1;de<N;){M=we[de+=1];var ye=e.util.getProperty(M),W=e.util.escapeQuotes(M),ve=d+ye;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,M,e.opts.jsonPointers)),r+=" if ( "+ve+" === undefined ",z&&(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(c)+" , params: { missingProperty: '"+W+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+W+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=x}else u&&(r+=" if (true) {");return r},X_=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d="data"+(i||""),g="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 "+g+"; if ("+m+" === false || "+m+" === undefined) "+g+" = true; else if (typeof "+m+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+d+".length , "+g+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,h=Array.isArray(p);if(!p||p=="object"||p=="array"||h&&(p.indexOf("object")>=0||p.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+g+" = 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') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",f&&(r+=" } "),r+=" if (!"+g+") { ";var b=b||[];b.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",f?r+="validate.schema"+l:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var P=r;r=b.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",u&&(r+=" else { ")}else u&&(r+=" if (true) { ");return r},ey={$ref:j_,allOf:D_,anyOf:M_,$comment:L_,const:F_,contains:q_,dependencies:U_,enum:V_,format:z_,if:H_,items:Z_,maximum:Bu,minimum:Bu,maxItems:Wu,minItems:Wu,maxLength:Ju,minLength:Ju,maxProperties:Qu,minProperties:Qu,multipleOf:K_,not:B_,oneOf:W_,pattern:J_,properties:Q_,propertyNames:G_,required:Y_,uniqueItems:X_,validate:Ou},Gu=ey,bo=la.toHash,ty=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=bo(a),e.types=bo(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var l=Object.keys(i)[0];o=i[l],i=l,o.forEach(function(u){a.push(u),e.all[u]=!0})}a.push(i);var c=e.all[i]={keyword:i,code:Gu[i],implements:o};return c}),e.all.$comment={keyword:"$comment",code:Gu.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=bo(a.concat(s)),e.custom={},e},Yu=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],ry=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<Yu.length;n++){var i=Yu[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t},ay=go.MissingRef,sy=Xu;function Xu(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 l=o.$schema;return l&&!s.getSchema(l)?Xu.call(s,{$ref:l},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(c){if(c instanceof ay)return l(c);throw c}function l(c){var u=c.missingSchema;if(f(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var d=s._loadingSchemas[u];return d||(d=s._loadingSchemas[u]=s._opts.loadSchema(u),d.then(g,g)),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 g(){delete s._loadingSchemas[u]}function f(m){return s._refs[m]||s._schemas[m]}}}}var ny=function(e,a,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[a],l=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,u=!e.opts.allErrors,d,g="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,b="definition"+n,P=v.definition,S="",x,A,z,U,D;if(p&&P.$data){D="keywordValidate"+n;var W=P.validateSchema;r+=" var "+b+" = RULES.custom['"+a+"'].definition; var "+D+" = "+b+".validate;"}else{if(U=e.useCustomRule(v,o,e.schema,e),!U)return;h="validate.schema"+l,D=U.code,x=P.compile,A=P.inline,z=P.macro}var J=D+".errors",H="i"+n,F="ruleErr"+n,M=P.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(A||z||(r+=""+J+" = null;"),r+="var "+m+" = errors;var "+f+";",p&&P.$data&&(S+="}",r+=" if ("+h+" === undefined) { "+f+" = true; } else { ",W&&(S+="}",r+=" "+f+" = "+b+".validateSchema("+h+"); if ("+f+") { ")),A)P.statements?r+=" "+U.validate+" ":r+=" "+f+" = "+U.validate+"; ";else if(z){var te=e.util.copy(e),S="";te.level++;var ye="valid"+te.level;te.schema=U.validate,te.schemaPath="";var ve=e.compositeRule;e.compositeRule=te.compositeRule=!0;var we=e.validate(te).replace(/validate\.schema/g,D);e.compositeRule=te.compositeRule=ve,r+=" "+we}else{var de=de||[];de.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",x||P.schema===!1?r+=" , "+g+" ":r+=" , "+h+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var N=i?"data"+(i-1||""):"parentData",R=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+N+" , "+R+" , rootData ) ";var j=r;r=de.pop(),P.errors===!1?(r+=" "+f+" = ",M&&(r+="await "),r+=""+j+"; "):M?(J="customErrors"+n,r+=" var "+J+" = null; try { "+f+" = await "+j+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+J+" = e.errors; else throw e; } "):r+=" "+J+" = null; "+f+" = "+j+"; "}if(P.modifying&&(r+=" if ("+N+") "+g+" = "+N+"["+R+"];"),r+=""+S,P.valid)u&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",z?r+=""+ye:r+=""+f):r+=" "+!P.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(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var T=r;r=de.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _=r;r=de.pop(),A?P.errors?P.errors!="full"&&(r+=" for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+_+" ":(r+=" if ("+m+" == errors) { "+_+" } else { for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),r+=" } } "):z?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+_+" ":(r+=" if (Array.isArray("+J+")) { if (vErrors === null) vErrors = "+J+"; else vErrors = vErrors.concat("+J+"); errors = vErrors.length; for (var "+H+"="+m+"; "+H+"<errors; "+H+"++) { var "+F+" = vErrors["+H+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+F+".schema = "+h+"; "+F+".data = "+g+"; "),r+=" } } else { "+_+" } "),r+=" } ",u&&(r+=" else { ")}return r};const ed={$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 td=ed,iy={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:td.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:td.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"}]}}},oy=/^[a-z_$][a-z0-9_$-]*$/i,cy=ny,ly=iy,uy={add:dy,get:fy,remove:hy,validate:wo};function dy(t,e){var a=this.RULES;if(a.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!oy.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,l,c){for(var u,d=0;d<a.length;d++){var g=a[d];if(g.type==l){u=g;break}}u||(u={type:l,rules:[]},a.push(u));var f={keyword:o,definition:c,custom:!0,code:cy,implements:c.implements};u.rules.push(f),a.custom[o]=f}return this}function fy(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function hy(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 wo(t,e){wo.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(ly,!0);if(a(t))return!0;if(wo.errors=a.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}const py={$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 rd=p_,Lr=fo,my=w_,ad=Su,vy=Cu,gy=x_,_y=ty,sd=ry,nd=la,yy=Ve;Ve.prototype.validate=wy,Ve.prototype.compile=$y,Ve.prototype.addSchema=Py,Ve.prototype.addMetaSchema=Ey,Ve.prototype.validateSchema=Sy,Ve.prototype.getSchema=ky,Ve.prototype.removeSchema=Ty,Ve.prototype.addFormat=My,Ve.prototype.errorsText=Dy,Ve.prototype._addSchema=Iy,Ve.prototype._compile=Cy,Ve.prototype.compileAsync=sy;var en=uy;Ve.prototype.addKeyword=en.add,Ve.prototype.getKeyword=en.get,Ve.prototype.removeKeyword=en.remove,Ve.prototype.validateKeyword=en.validate;var id=go;Ve.ValidationError=id.Validation,Ve.MissingRefError=id.MissingRef,Ve.$dataMetaSchema=sd;var tn="http://json-schema.org/draft-07/schema",od=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],by=["/properties"];function Ve(t){if(!(this instanceof Ve))return new Ve(t);t=this._opts=nd.copy(t)||{},zy(this),this._schemas={},this._refs={},this._fragments={},this._formats=gy(t.format),this._cache=t.cache||new my,this._loadingSchemas={},this._compilations=[],this.RULES=_y(),this._getId=Oy(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=vy),this._metaOpts=Vy(this),t.formats&&qy(this),t.keywords&&Uy(this),Ly(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Fy(this)}function wy(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 $y(t,e){var a=this._addSchema(t,void 0,e);return a.validate||this._compile(a)}function Py(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=Lr.normalizeId(e||n),ld(this,e),this._schemas[e]=this._addSchema(t,a,s,!0),this}function Ey(t,e,a){return this.addSchema(t,e,a,!0),this}function Sy(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||Ry(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 Ry(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(tn)?tn:void 0,t._opts.defaultMeta}function ky(t){var e=cd(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return xy(this,t)}}function xy(t,e){var a=Lr.schema.call(t,{schema:{}},e);if(a){var s=a.schema,r=a.root,n=a.baseId,i=rd.call(t,s,r,void 0,n);return t._fragments[e]=new ad({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function cd(t,e){return e=Lr.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Ty(t){if(t instanceof RegExp)return rn(this,this._schemas,t),rn(this,this._refs,t),this;switch(typeof t){case"undefined":return rn(this,this._schemas),rn(this,this._refs),this._cache.clear(),this;case"string":var e=cd(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=Lr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function rn(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 Iy(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=Lr.normalizeId(this._getId(t));o&&s&&ld(this,o);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=o&&o==Lr.normalizeId(t.$schema))&&this.validateSchema(t,!0);var u=Lr.ids.call(this,t),d=new ad({id:o,schema:t,localRefs:u,cacheKey:n,meta:a});return o[0]!="#"&&s&&(this._refs[o]=d),this._cache.put(n,d),l&&c&&this.validateSchema(t,!0),d}function Cy(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=rd.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 Oy(t){switch(t.schemaId){case"auto":return jy;case"id":return Ny;default:return Ay}}function Ny(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Ay(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 Dy(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 My(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Ly(t){var e;if(t._opts.$data&&(e=py,t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var a=ed;t._opts.$data&&(a=sd(a,by)),t.addMetaSchema(a,tn,!0),t._refs["http://json-schema.org/schema"]=tn}}function Fy(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 qy(t){for(var e in t._opts.formats){var a=t._opts.formats[e];t.addFormat(e,a)}}function Uy(t){for(var e in t._opts.keywords){var a=t._opts.keywords[e];t.addKeyword(e,a)}}function ld(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Vy(t){for(var e=nd.copy(t._opts),a=0;a<od.length;a++)delete e[od[a]];return e}function zy(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 ud=oc(yy);class Ya extends wu{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 ud}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=$u(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:Wa,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ql,a);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!ql.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"},br,e)}async complete(e,a){return this.request({method:"completion/complete",params:e},_u,a)}async setLoggingLevel(e,a){return this.request({method:"logging/setLevel",params:{level:e}},br,a)}async getPrompt(e,a){return this.request({method:"prompts/get",params:e},uu,a)}async listPrompts(e,a){return this.request({method:"prompts/list",params:e},cu,a)}async listResources(e,a){return this.request({method:"resources/list",params:e},tu,a)}async listResourceTemplates(e,a){return this.request({method:"resources/templates/list",params:e},ru,a)}async readResource(e,a){return this.request({method:"resources/read",params:e},au,a)}async subscribeResource(e,a){return this.request({method:"resources/subscribe",params:e},br,a)}async unsubscribeResource(e,a){return this.request({method:"resources/unsubscribe",params:e},br,a)}async callTool(e,a=Vs,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 Ae(Ie.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new Ae(Ie.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof Ae?i:new Ae(Ie.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},fu,a);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}class dd 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 Po(t){}function fd(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=Po,onError:a=Po,onRetry:s=Po,onComment:r}=t;let n="",i=!0,o,l="",c="";function u(p){const h=i?p.replace(/^\xEF\xBB\xBF/,""):p,[v,b]=Hy(`${n}${h}`);for(const P of v)d(P);n=b,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),b=p[h+1]===" "?2:1,P=p.slice(h+b);g(v,P,p);return}g(p,"",p)}function g(p,h,v){switch(p){case"event":c=h;break;case"data":l=`${l}${h}
|
|
9
|
+
`;break;case"id":o=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?s(parseInt(h,10)):a(new dd(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:v}));break;default:a(new dd(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:h,line:v}));break}}function f(){l.length>0&&e({id:o,event:c||void 0,data:l.endsWith(`
|
|
10
10
|
`)?l.slice(0,-1):l}),o=void 0,l="",c=""}function m(p={}){n&&p.consume&&d(n),i=!0,o=void 0,l="",c="",n=""}return{feed:u,reset:m}}function Hy(t){const e=[];let a="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),n=t.indexOf(`
|
|
11
11
|
`,s);let 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 hd 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(pd(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(pd(this),a)}}function Zy(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function So(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(So).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${So(t.cause)}`:t.message:`${t}`}function pd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var md=t=>{throw TypeError(t)},Ro=(t,e,a)=>e.has(t)||md("Cannot "+a),we=(t,e,a)=>(Ro(t,e,"read from private field"),a?a.call(t):e.get(t)),et=(t,e,a)=>e.has(t)?md("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),De=(t,e,a,s)=>(Ro(t,e,"write to private field"),e.set(t,a),a),or=(t,e,a)=>(Ro(t,e,"access private method"),a),mt,Fr,ua,nn,on,es,da,ts,Er,fa,ha,pa,rs,At,ko,xo,To,vd,Io,Co,as,Oo,No;class cn extends EventTarget{constructor(e,a){var s,r;super(),et(this,At),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,et(this,mt),et(this,Fr),et(this,ua),et(this,nn),et(this,on),et(this,es),et(this,da),et(this,ts,null),et(this,Er),et(this,fa),et(this,ha,null),et(this,pa,null),et(this,rs,null),et(this,xo,async n=>{var i;we(this,fa).reset();const{body:o,redirected:l,status:c,headers:u}=n;if(c===204){or(this,At,as).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?De(this,ua,new URL(n.url)):De(this,ua,void 0),c!==200){or(this,At,as).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){or(this,At,as).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(we(this,mt)===this.CLOSED)return;De(this,mt,this.OPEN);const d=new Event("open");if((i=we(this,rs))==null||i.call(this,d),this.dispatchEvent(d),typeof o!="object"||!o||!("getReader"in o)){or(this,At,as).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const v=new TextDecoder,f=o.getReader();let m=!0;do{const{done:p,value:h}=await f.read();h&&we(this,fa).feed(v.decode(h,{stream:!p})),p&&(m=!1,we(this,fa).reset(),or(this,At,Oo).call(this))}while(m)}),et(this,To,n=>{De(this,Er,void 0),!(n.name==="AbortError"||n.type==="aborted")&&or(this,At,Oo).call(this,So(n))}),et(this,Io,n=>{typeof n.id=="string"&&De(this,ts,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:we(this,ua)?we(this,ua).origin:we(this,Fr).origin,lastEventId:n.id||""});we(this,pa)&&(!n.event||n.event==="message")&&we(this,pa).call(this,i),this.dispatchEvent(i)}),et(this,Co,n=>{De(this,es,n)}),et(this,No,()=>{De(this,da,void 0),we(this,mt)===this.CONNECTING&&or(this,At,ko).call(this)});try{if(e instanceof URL)De(this,Fr,e);else if(typeof e=="string")De(this,Fr,new URL(e,Ky()));else throw new Error("Invalid URL")}catch{throw Zy("An invalid or illegal string was specified")}De(this,fa,fd({onEvent:we(this,Io),onRetry:we(this,Co)})),De(this,mt,this.CONNECTING),De(this,es,3e3),De(this,on,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),De(this,nn,(r=a==null?void 0:a.withCredentials)!=null?r:!1),or(this,At,ko).call(this)}get readyState(){return we(this,mt)}get url(){return we(this,Fr).href}get withCredentials(){return we(this,nn)}get onerror(){return we(this,ha)}set onerror(e){De(this,ha,e)}get onmessage(){return we(this,pa)}set onmessage(e){De(this,pa,e)}get onopen(){return we(this,rs)}set onopen(e){De(this,rs,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,da)&&clearTimeout(we(this,da)),we(this,mt)!==this.CLOSED&&(we(this,Er)&&we(this,Er).abort(),De(this,mt,this.CLOSED),De(this,Er,void 0))}}mt=new WeakMap,Fr=new WeakMap,ua=new WeakMap,nn=new WeakMap,on=new WeakMap,es=new WeakMap,da=new WeakMap,ts=new WeakMap,Er=new WeakMap,fa=new WeakMap,ha=new WeakMap,pa=new WeakMap,rs=new WeakMap,At=new WeakSet,ko=function(){De(this,mt,this.CONNECTING),De(this,Er,new AbortController),we(this,on)(we(this,Fr),or(this,At,vd).call(this)).then(we(this,xo)).catch(we(this,To))},xo=new WeakMap,To=new WeakMap,vd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...we(this,ts)?{"Last-Event-ID":we(this,ts)}:void 0},cache:"no-store",signal:(t=we(this,Er))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Io=new WeakMap,Co=new WeakMap,as=function(t,e){var a;we(this,mt)!==this.CLOSED&&De(this,mt,this.CLOSED);const s=new hd("error",{code:e,message:t});(a=we(this,ha))==null||a.call(this,s),this.dispatchEvent(s)},Oo=function(t,e){var a;if(we(this,mt)===this.CLOSED)return;De(this,mt,this.CONNECTING);const s=new hd("error",{code:e,message:t});(a=we(this,ha))==null||a.call(this,s),this.dispatchEvent(s),De(this,da,setTimeout(we(this,No),we(this,es)))},No=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function Ky(){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}let Ao;Ao=globalThis.crypto;async function By(t){return(await Ao).getRandomValues(new Uint8Array(t))}async function Wy(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await By(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function Jy(t){return await Wy(t)}async function Qy(t){const e=await(await Ao).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Gy(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Jy(t),a=await Qy(e);return{code_verifier:e,code_challenge:a}}const Yy=Z({resource:k().url(),authorization_servers:X(k().url()).optional(),jwks_uri:k().url().optional(),scopes_supported:X(k()).optional(),bearer_methods_supported:X(k()).optional(),resource_signing_alg_values_supported:X(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:Ze().optional(),authorization_details_types_supported:X(k()).optional(),dpop_signing_alg_values_supported:X(k()).optional(),dpop_bound_access_tokens_required:Ze().optional()}).passthrough(),gd=Z({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),registration_endpoint:k().optional(),scopes_supported:X(k()).optional(),response_types_supported:X(k()),response_modes_supported:X(k()).optional(),grant_types_supported:X(k()).optional(),token_endpoint_auth_methods_supported:X(k()).optional(),token_endpoint_auth_signing_alg_values_supported:X(k()).optional(),service_documentation:k().optional(),revocation_endpoint:k().optional(),revocation_endpoint_auth_methods_supported:X(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:X(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:X(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:X(k()).optional(),code_challenge_methods_supported:X(k()).optional()}).passthrough(),Xy=Z({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),userinfo_endpoint:k().optional(),jwks_uri:k(),registration_endpoint:k().optional(),scopes_supported:X(k()).optional(),response_types_supported:X(k()),response_modes_supported:X(k()).optional(),grant_types_supported:X(k()).optional(),acr_values_supported:X(k()).optional(),subject_types_supported:X(k()),id_token_signing_alg_values_supported:X(k()),id_token_encryption_alg_values_supported:X(k()).optional(),id_token_encryption_enc_values_supported:X(k()).optional(),userinfo_signing_alg_values_supported:X(k()).optional(),userinfo_encryption_alg_values_supported:X(k()).optional(),userinfo_encryption_enc_values_supported:X(k()).optional(),request_object_signing_alg_values_supported:X(k()).optional(),request_object_encryption_alg_values_supported:X(k()).optional(),request_object_encryption_enc_values_supported:X(k()).optional(),token_endpoint_auth_methods_supported:X(k()).optional(),token_endpoint_auth_signing_alg_values_supported:X(k()).optional(),display_values_supported:X(k()).optional(),claim_types_supported:X(k()).optional(),claims_supported:X(k()).optional(),service_documentation:k().optional(),claims_locales_supported:X(k()).optional(),ui_locales_supported:X(k()).optional(),claims_parameter_supported:Ze().optional(),request_parameter_supported:Ze().optional(),request_uri_parameter_supported:Ze().optional(),require_request_uri_registration:Ze().optional(),op_policy_uri:k().optional(),op_tos_uri:k().optional()}).passthrough().merge(gd.pick({code_challenge_methods_supported:!0})),_d=Z({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Je().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),e0=Z({error:k(),error_description:k().optional(),error_uri:k().optional()}),t0=Z({redirect_uris:X(k()).refine(t=>t.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:k().optional(),grant_types:X(k()).optional(),response_types:X(k()).optional(),client_name:k().optional(),client_uri:k().optional(),logo_uri:k().optional(),scope:k().optional(),contacts:X(k()).optional(),tos_uri:k().optional(),policy_uri:k().optional(),jwks_uri:k().optional(),jwks:Ml().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),r0=Z({client_id:k(),client_secret:k().optional(),client_id_issued_at:Je().optional(),client_secret_expires_at:Je().optional()}).strip(),a0=t0.merge(r0);Z({error:k(),error_description:k().optional()}).strip(),Z({token:k(),token_type_hint:k().optional()}).strip();function s0(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function n0({requestedResource:t,configuredResource:e}){const a=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const r=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}class st extends Error{constructor(e,a){super(e),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class jo extends st{}jo.errorCode="invalid_request";class ln extends st{}ln.errorCode="invalid_client";class un extends st{}un.errorCode="invalid_grant";class dn extends st{}dn.errorCode="unauthorized_client";class Do extends st{}Do.errorCode="unsupported_grant_type";class Mo extends st{}Mo.errorCode="invalid_scope";class Lo extends st{}Lo.errorCode="access_denied";class ma extends st{}ma.errorCode="server_error";class Fo extends st{}Fo.errorCode="temporarily_unavailable";class qo extends st{}qo.errorCode="unsupported_response_type";class Uo extends st{}Uo.errorCode="unsupported_token_type";class Vo extends st{}Vo.errorCode="invalid_token";class zo extends st{}zo.errorCode="method_not_allowed";class Ho extends st{}Ho.errorCode="too_many_requests";class Zo extends st{}Zo.errorCode="invalid_client_metadata";class Ko extends st{}Ko.errorCode="insufficient_scope";const i0={[jo.errorCode]:jo,[ln.errorCode]:ln,[un.errorCode]:un,[dn.errorCode]:dn,[Do.errorCode]:Do,[Mo.errorCode]:Mo,[Lo.errorCode]:Lo,[ma.errorCode]:ma,[Fo.errorCode]:Fo,[qo.errorCode]:qo,[Uo.errorCode]:Uo,[Vo.errorCode]:Vo,[zo.errorCode]:zo,[Ho.errorCode]:Ho,[Zo.errorCode]:Zo,[Ko.errorCode]:Ko};class jt extends Error{constructor(e){super(e??"Unauthorized")}}function yd(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 wd(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":o0(r,n,a);return;case"client_secret_post":c0(r,n,s);return;case"none":l0(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function o0(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 c0(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function l0(t,e){e.set("client_id",t)}async function Bo(t){const e=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{const s=e0.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:i}=s,o=i0[r]||ma;return new o(n||"",i)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new ma(r)}}async function va(t,e){var a,s;try{return await Wo(t,e)}catch(r){if(r instanceof ln||r instanceof dn)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await Wo(t,e);if(r instanceof un)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Wo(t,e);throw r}}async function Wo(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let i,o;try{i=await d0(e,{resourceMetadataUrl:r},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);const l=await u0(e,t,i),c=await v0(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 w0(o,{metadata:c,clientMetadata:t.clientMetadata});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await _0(o,{metadata:c,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const d=await t.tokens();if(d!=null&&d.refresh_token)try{const p=await y0(o,{metadata:c,clientInformation:u,refreshToken:d.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof st)||p instanceof ma))throw p}const v=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:m}=await g0(o,{metadata:c,clientInformation:u,state:v,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(f),"REDIRECT"}async function u0(t,e,a){const s=s0(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!n0({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 Jo(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 d0(t,e,a=fetch){const s=await p0(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 Yy.parse(await s.json())}async function Qo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?Qo(t,void 0,a):void 0;throw s}}function f0(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function bd(t,e,a=fetch){return await Qo(t,{"MCP-Protocol-Version":e},a)}function h0(t,e){return!t||t.status===404&&e!=="/"}async function p0(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:Ja;let l;if(s!=null&&s.metadataUrl)l=new URL(s.metadataUrl);else{const u=f0(e,i.pathname);l=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),l.search=i.search}let c=await bd(l,o,a);if(!(s!=null&&s.metadataUrl)&&h0(c,i.pathname)){const u=new URL(`/.well-known/${e}`,i);c=await bd(u,o,a)}return c}function m0(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 v0(t,{fetchFn:e=fetch,protocolVersion:a=Ja}={}){var s;const r={"MCP-Protocol-Version":a},n=m0(t);for(const{url:i,type:o}of n){const l=await Qo(i,r,e);if(!l)throw new Error(`CORS error trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`);if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(o==="oauth")return gd.parse(await l.json());{const c=Xy.parse(await l.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${i}: does not support S256 code challenge method required by MCP specification`);return c}}}async function g0(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:i}){const o="code",l="S256";let c;if(e){if(c=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(l))throw new Error(`Incompatible auth server: does not support code challenge method ${l}`)}else c=new URL("/authorize",t);const u=await Gy(),d=u.code_verifier,v=u.code_challenge;return c.searchParams.set("response_type",o),c.searchParams.set("client_id",a.client_id),c.searchParams.set("code_challenge",v),c.searchParams.set("code_challenge_method",l),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",i.href),{authorizationUrl:c,codeVerifier:d}}async function _0(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:l}){var c;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 v=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(v,f,t,e);else{const p=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=yd(a,p);wd(h,a,v,f)}i&&f.set("resource",i.href);const m=await(l??fetch)(d,{method:"POST",headers:v,body:f});if(!m.ok)throw await Bo(m);return _d.parse(await m.json())}async function y0(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:i}){var o;const l="refresh_token";let c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else c=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:l,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=yd(a,f);wd(m,a,u,d)}r&&d.set("resource",r.href);const v=await(i??fetch)(c,{method:"POST",headers:u,body:d});if(!v.ok)throw await Bo(v);return _d.parse({refresh_token:s,...await v.json()})}async function w0(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 Bo(n);return a0.parse(await n.json())}class b0 extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class ga{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 jt("No auth provider");let a;try{a=await va(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 jt;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 cn(this._url.href,{...this._eventSourceInit,fetch:async(o,l)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const u=await r(o,{...l,headers:c});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Jo(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var l;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}const c=new b0(o.code,o.message,o);i(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var l;const c=o;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}n()}),this._eventSource.onmessage=o=>{var l,c;const u=o;let d;try{d=ca.parse(JSON.parse(u.data))}catch(v){(l=this.onerror)===null||l===void 0||l.call(this,v);return}(c=this.onmessage)===null||c===void 0||c.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 jt("No auth provider");if(await va(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt("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=Jo(o),await va(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt;return this.send(e)}const l=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${l}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class $0 extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=fd({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 P0={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Go extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class ss{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:P0}async _authThenStart(){var e;if(!this._authProvider)throw new jt("No auth provider");let a;try{a=await va(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 jt;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 Go(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 l,c,u,d;try{const v=e.pipeThrough(new TextDecoderStream).pipeThrough(new $0).getReader();for(;;){const{value:f,done:m}=await v.read();if(m)break;if(f.id&&(i=f.id,r==null||r(f.id)),!f.event||f.event==="message")try{const p=ca.parse(JSON.parse(f.data));n!==void 0&&Li(p)&&(p.id=n),(l=this.onmessage)===null||l===void 0||l.call(this,p)}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p)}}}catch(v){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${v}`)),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 jt("No auth provider");if(await va(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt("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:l}=a||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Hl(e)?e.id:void 0}).catch(h=>{var g;return(g=this.onerror)===null||g===void 0?void 0:g.call(this,h)});return}const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},d=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),v=d.headers.get("mcp-session-id");if(v&&(this._sessionId=v),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=Jo(d),await va(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt;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){fg(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var g;return(g=this.onerror)===null||g===void 0?void 0:g.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:l},!1);else if(p!=null&&p.includes("application/json")){const h=await d.json(),g=Array.isArray(h)?h.map(w=>ca.parse(w)):[ca.parse(h)];for(const w of g)(n=this.onmessage)===null||n===void 0||n.call(this,w)}else throw new Go(-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 Go(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}}const E0="mcp";class $d{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,a)=>{this._socket=new WebSocket(this._url,E0),this._socket.onerror=s=>{var r;const n="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);a(n),(r=this.onerror)===null||r===void 0||r.call(this,n)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{var s;(s=this.onclose)===null||s===void 0||s.call(this)},this._socket.onmessage=s=>{var r,n;let i;try{i=ca.parse(JSON.parse(s.data))}catch(o){(r=this.onerror)===null||r===void 0||r.call(this,o);return}(n=this.onmessage)===null||n===void 0||n.call(this,i)}})}async close(){var e;(e=this._socket)===null||e===void 0||e.close()}send(e){return new Promise((a,s)=>{var r;if(!this._socket){s(new Error("Not connected"));return}(r=this._socket)===null||r===void 0||r.send(JSON.stringify(e)),a()})}}function fn(){const t=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return fn=function(){return t},fn()}(function(t,e){const a=Qe,s=Qe,r=t();for(;;)try{if(parseInt(a(417))/1*(parseInt(a(421))/2)+parseInt(a(433))/3+parseInt(a(424))/4*(-parseInt(s(429))/5)+parseInt(s(423))/6*(-parseInt(s(418))/7)+-parseInt(s(430))/8+-parseInt(a(416))/9*(-parseInt(a(405))/10)+-parseInt(a(415))/11*(-parseInt(a(411))/12)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(fn,650197);const Pd=()=>{const t=Qe,e={EGhzU:function(a,s){return a!==s},kIrDB:"undefined",llYQe:function(a,s){return a!==s},PZfJg:function(a,s){return a(s)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[t(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==t(398)?self:e.PZfJg(Function,e[t(399)])()},S0=(t,e,a)=>{const s=Qe,r=Qe,n={};n[s(410)]=r(398),n.dBkaX=function(o,l){return o===l},n[r(393)]="function";const i=n;typeof window!==i[r(410)]?t.postMessage(e,"*",a):r(428)in t&&i.dBkaX(typeof t.postMessage,i[s(393)])&&t.postMessage(e,a)},R0=(t,e)=>{const a=Qe,s=Qe,r={};r.MbsGh="addEventListener",r.PPniK=function(i,o){return i===o},r[a(419)]=s(412),r[s(404)]="onmessage",r[a(397)]="undefined";const n=r;n.MbsGh in t&&n.PPniK(typeof t[a(427)],n.wRKyh)?t[a(427)](a(400),e):n.thraG in t&&typeof t[s(413)]!==n[s(397)]&&(t.onmessage=e)};class hn{constructor(e){const a=Qe;this[a(406)]=e}async start(){const e=Qe,a=Qe;this[e(406)]&&(this[e(406)][e(413)]=s=>{var r,n;const i=e,o=a;try{const l=ca[i(402)](s.data[i(400)]);(r=this[i(413)])==null||r.call(this,l,s[o(409)].extra)}catch(l){const c=new Error("MessageChannel failed to parse message: "+l);(n=this[o(408)])==null||n.call(this,c)}},this._port[e(396)]=s=>{var r;const n=a,i=a,o=new Error(n(394)+JSON[i(395)](s));(r=this.onerror)==null||r.call(this,o)},this[e(406)][e(434)]())}async send(e,a){const s={lEyuq:function(r){return r()},YihNw:function(r,n){return r(n)}};return new Promise((r,n)=>{var i;const o=Qe,l=Qe;try{const c={};c[o(403)]=a==null?void 0:a[o(403)];const u={};u[l(400)]=e,u.extra=c,this[l(406)]&&this[o(406)].postMessage(u),s.lEyuq(r)}catch(c){const u=c instanceof Error?c:new Error(s.YihNw(String,c));(i=this[l(408)])==null||i.call(this,u),n(u)}})}async close(){var e,a;const s=Qe,r=Qe;(e=this._port)==null||e[s(431)](),this._port=void 0,(a=this[r(420)])==null||a.call(this)}}class Yo extends hn{constructor(e,a=Pd()){const s=Qe,r=Qe,n={EkZCC:function(o,l,c,u){return o(l,c,u)}};super(),this[s(391)]=e,this[r(401)]=a;const i=new MessageChannel;this[r(406)]=i.port1,n[r(426)](S0,this[s(401)],{endpoint:this[r(391)]},[i[r(414)]])}}class Xo extends hn{constructor(e,a=Pd()){const s=Qe,r={mOWMr:function(n,i){return n===i},kgkem:function(n,i,o){return n(i,o)}};super(),this._endpoint=e,this._globalObject=a,this[s(432)]=new Promise(n=>{const i=s,o=s;r[i(392)](R0,this[o(401)],l=>{const c=o,u=o;l.data&&r[c(425)](l.data[u(422)],this[u(391)])&&(this[u(406)]=l.ports[-1*4852+1*1601+3251],n())})})}async listen(){return this[Qe(432)]}}function Qe(t,e){const a=fn();return Qe=function(s,r){return s=s-(17*-491+-669+9407),a[s]},Qe(t,e)}const k0=()=>{const t=new MessageChannel;return[new hn(t.port1),new hn(t.port2)]};(function(t,e){const a=xe,s=xe,r=t();for(;;)try{if(parseInt(a(355))/1+-parseInt(a(356))/2*(-parseInt(a(373))/3)+-parseInt(a(337))/4+parseInt(s(357))/5+-parseInt(s(389))/6*(-parseInt(a(396))/7)+parseInt(s(325))/8*(parseInt(a(382))/9)+-parseInt(a(366))/10===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(pn,-763475+-52067*10+1724410);const x0=async(t,e,a)=>{var s;const r=xe,n=xe,i={};i[r(345)]="tools/list",i.rqstG="tools/call",i.WqUnk="resources/list",i[r(329)]=n(358),i[r(365)]=r(335),i.ookoz="resources/unsubscribe",i[r(385)]=r(340),i.VTIWq="prompts/list",i.SkoRK=r(376),i.QUtUV=r(388),i.XtowM=n(332);const o=i,{id:l,method:c,params:u}=a;let d={};switch(c){case o[n(345)]:d=await e.listTools(u);break;case o.rqstG:d=await e.callTool(u);break;case o[r(334)]:d=await e[r(350)](u);break;case o[n(329)]:d=await e.listResourceTemplates(u);break;case r(372):d=await e[r(383)](u);break;case o.HgYgW:d=await e.subscribeResource(u);break;case o.ookoz:d=await e.unsubscribeResource(u);break;case o[r(385)]:d=await e.getPrompt(u);break;case o.VTIWq:d=await e.listPrompts(u);break;case o[r(344)]:d=await e[r(376)]();break;case o.QUtUV:d=await e.complete(u);break;case r(390):d=await e[r(336)](u==null?void 0:u.level);break}const v={};v[r(361)]=d,v[r(394)]=o[r(364)],v.id=l,await((s=t==null?void 0:t.transport)==null?void 0:s[r(392)](v))},T0=async(t,e,a)=>{var s;const r=xe,n=xe,i={};i.jQBBS="sampling/createMessage",i.EZqgC="elicitation/create",i[r(370)]=n(376),i.aVeaL=n(332);const o=i,{id:l,method:c,params:u}=a;let d={};switch(c){case r(368):const f={};f.method=c,f[n(367)]=u,d=await e.request(f,ao);break;case o[n(391)]:const m={};m.method=c,m[n(367)]=u,d=await e[n(381)](m,eo);break;case o.EZqgC:const p={};p.method=c,p.params=u,d=await e.request(p,to);break;case o[n(370)]:const h={};h.method=c,d=await e[n(381)](h,wr);break}const v={};return v[n(361)]=d,v.jsonrpc=o[n(387)],v.id=l,await((s=t==null?void 0:t[r(371)])==null?void 0:s.send(v)),d},I0=(t,e)=>{const a=xe,s={gXsjT:function(n,i){return n===i},oegpC:a(351),lZOUC:function(n,i,o,l){return n(i,o,l)},ifIKG:"2.0"},r=t._onrequest;t._onrequest=async(n,i)=>{var o,l,c,u,d;const v=a,f=a,{id:m,method:p}=n;try{s[v(333)](p,s.oegpC)?await r[v(386)](t,n,i):await s.lZOUC(x0,t,e,n)}catch(h){const{code:g,message:w,data:P}=h;try{if(g){const S={};S.code=g,S.message=w,S.data=P;const x={};x.error=S,x[v(394)]=s[f(331)],x.id=m,await((o=t==null?void 0:t.transport)==null?void 0:o.send(x))}else(c=(l=t==null?void 0:t[f(371)])==null?void 0:l.onerror)==null||c.call(l,h)}catch(S){(d=(u=t==null?void 0:t[v(371)])==null?void 0:u.onerror)==null||d.call(u,S)}}}},C0=(t,e)=>{const a=xe,s=xe,r={};r[a(363)]=function(i,o){return i!==o},r[a(398)]=a(353),r.hzhyg="notifications/cancelled";const n=r;t._onnotification=async i=>{var o,l;const c=a,u=s,{method:d,params:v}=i;if(n[c(363)](d,n[u(398)])&&(n[c(363)](d,n.hzhyg)||v!=null&&v.forward))try{await e.notification(i)}catch(f){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,f)}}},O0=(t,e)=>async a=>{var s,r,n,i,o;const l=xe,c=xe,u={};u.SEmWX=l(332);const d=u;try{return await T0(t,e,a)}catch(v){const{code:f,message:m,data:p}=v;try{if(f){const h={};h[c(377)]=f,h.message=m,h.data=p;const g={};g[c(348)]=h,g.jsonrpc=d[l(338)],g.id=a.id,await((s=t==null?void 0:t.transport)==null?void 0:s[c(392)](g))}else(n=(r=t==null?void 0:t.transport)==null?void 0:r[c(339)])==null||n.call(r,v)}catch(h){(o=(i=t==null?void 0:t[l(371)])==null?void 0:i[c(339)])==null||o.call(i,h)}}},N0=(t,e)=>async a=>{var s,r,n;const i=xe,o=xe,l={};l.dtUgZ=function(v,f){return v!==f},l.jgCIb=i(353),l.uUjKY="2.0";const c=l,{method:u,params:d}=a;if(c.dtUgZ(u,c.jgCIb)&&(u!==i(400)||d!=null&&d.forward))try{const v={...a};v[i(394)]=c[o(352)],await((s=e==null?void 0:e[i(371)])==null?void 0:s[i(392)](v))}catch(v){(n=(r=t==null?void 0:t[i(371)])==null?void 0:r[o(339)])==null||n.call(r,v)}};function xe(t,e){const a=pn();return xe=function(s,r){return s=s-(9*-113+-1439*-1+-97),a[s]},xe(t,e)}const A0=(t,e)=>async a=>{var s,r,n,i,o,l;const c=xe,u=xe,d={};d[c(401)]=u(332);const v=d;try{await((s=e==null?void 0:e.transport)==null?void 0:s.send(a))}catch(f){const{code:m,message:p,data:h}=f;try{if(m){const g={};g.code=m,g[c(399)]=p,g.data=h;const w={};w[c(348)]=g,w[c(394)]=v.OhJjz,w.id=a.id,await((r=t==null?void 0:t[c(371)])==null?void 0:r.send(w))}else(i=(n=t==null?void 0:t.transport)==null?void 0:n[u(339)])==null||i.call(n,f)}catch(g){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,g)}}},ec=()=>{const t=xe,e=xe,a={vnkqu:function(c,u){return c!==u},wxDWr:function(c,u){return c(u)},GdkkV:function(c,u){return c===u}},s=[],r=(c,u)=>{const d=xe,v=xe;if(u){const f=[];for(const m of s)try{f.push(m(c,u))}catch{}for(const m of f)if(a[d(379)](m,null))return m}else for(const f of s)try{a[v(343)](f,c)}catch{}},n=c=>{const u=xe;a[u(384)](typeof c,u(369))&&!s.includes(c)&&s.push(c)},i=c=>{const u=s.indexOf(c);u!==-1&&s.splice(u,1*-6854+8*-33+7119)},o=()=>{const c=xe;s[c(374)]=7102*1+5522+-526*24},l={};return l[t(346)]=r,l[e(330)]=n,l.removeListener=i,l[t(359)]=o,l},j0=t=>{const e=xe,a=xe,s={xwPeb:function(r){return r()},Mfvzm:function(r){return r()}};{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[e(326)](ec);t._onresponse=r,t[e(395)]=n,t.removeResponseListener=i,t.clearResponseListener=o}{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[a(326)](ec);t[a(328)]=r,t.addRequestListener=n,t[a(354)]=i,t[a(341)]=o}{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[e(375)](ec);t[e(342)]=r,t[e(327)]=n,t.removeNotificationListener=i,t.clearNotificationListener=o}};function pn(){const t=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return pn=function(){return t},pn()}const D0=(t,{beforeInit:e,afterInit:a}={})=>{const s=xe,r=xe,n={tqDZP:function(o,l){return o===l},cjSoZ:"function",iQqcJ:s(378),Zybtx:function(o,l){return o(l)},ElOQH:function(o){return o()}},i=new Map(t._notificationHandlers);t[s(393)][s(402)](),t._notificationHandlers[s(402)](),n.tqDZP(typeof e,n[s(380)])&&e(),n[s(362)](t._onresponse.name,n[s(360)])&&(t[r(349)]=t._onresponse),n[s(347)](j0,t),t.addResponseListener(o=>{const l=r;t.originalOnResponse[l(386)](t,o)}),n.tqDZP(typeof a,n[r(380)])&&n[s(397)](a),t[r(327)](o=>{const{method:l}=o,c=i.get(l);n.tqDZP(typeof c,n.cjSoZ)&&c(o)})},M0=Wt,L0=Wt;(function(t,e){const a=Wt,s=Wt,r=t();for(;;)try{if(-parseInt(a(393))/1+parseInt(a(397))/2*(-parseInt(a(400))/3)+-parseInt(s(398))/4+parseInt(a(390))/5*(parseInt(s(388))/6)+-parseInt(a(389))/7+-parseInt(a(402))/8*(-parseInt(s(395))/9)+parseInt(s(399))/10*(parseInt(s(385))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(mn,-1*-881393+2*180895+1*-644809);function Wt(t,e){const a=mn();return Wt=function(s,r){return s=s-(-1861+-499*4+4241),a[s]},Wt(t,e)}function mn(){const t=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return mn=function(){return t},mn()}const F0=()=>{const t=Wt,e=Wt,a={};a.REzPF=function(r,n){return r&n},a.suJHI=function(r,n){return r===n},a[t(386)]=function(r,n){return r&n},a[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const s=a;return s.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():s.dHTfU.replace(/[xy]/g,r=>{const n=t,i=t,o=s[n(392)](crypto[n(384)](new Uint8Array(-25*-62+7113+2*-4331))[741*2+-1385*-2+4252*-1],8648+-107*62+-1999);return(s.suJHI(r,"x")?o:s[i(386)](o,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},q0=t=>{const e=Wt,a=Wt,s=new Uint8Array(t);return crypto.getRandomValues(s),Array[e(401)](s,r=>r[a(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},Sr={};Sr[M0(391)]=F0,Sr[L0(396)]=q0;const yt=Jt;(function(t,e){const a=Jt,s=Jt,r=t();for(;;)try{if(parseInt(a(521))/1*(parseInt(s(499))/2)+parseInt(s(543))/3*(parseInt(s(514))/4)+parseInt(a(502))/5*(parseInt(s(539))/6)+parseInt(a(553))/7+parseInt(a(516))/8*(-parseInt(a(518))/9)+-parseInt(a(531))/10+-parseInt(a(545))/11*(parseInt(a(541))/12)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(vn,1472653*1+-2*-897917+-2275789);const U0=(t,e)=>{const a=Jt,s=Jt,r={FyYHt:function(l,c,u){return l(c,u)},Fxtoq:function(l,c,u){return l(c,u)}};I0(t,e),C0(t,e);const n=O0(e,t),i=r[a(510)](A0,e,t),o=r[s(549)](N0,e,t);e[s(537)](n),e[a(519)](i),e.addNotificationListener(o),t[s(556)]=()=>{const l=s;e.removeRequestListener(n),e[l(530)](i),e[l(529)](o)}},tc=(t,e,a)=>{const s=Jt,r={pMiva:function(o,l){return o instanceof l},TeTEy:s(546),fyZbd:function(o,l,c){return o(l,c)}},n=()=>{var o;const l=s;r.pMiva(a,ga)&&((o=a._eventSource)==null||o.addEventListener(r[l(547)],()=>{var c;const u=l;(c=a[u(509)])==null||c[u(546)]()})),U0(t,e)},i={};i.afterInit=n,r.fyZbd(D0,e,i)},Ed=(t,e=Sr.randomUUID())=>{const a=Jt,s=Jt,r={OfssH:function(u,d,v){return u(d,v)}},n={};n[a(528)]=e;const i=n,o={};o[a(528)]=e;const l={};l[s(558)]=o,l[a(534)]=a(524);const c={requestInit:l,eventSourceInit:{async fetch(u,d){const v=a,f=s,m=new Headers((d==null?void 0:d[v(558)])||{});Object.entries(i)[f(498)](([h,g])=>{m[f(527)](h,g)});const p={...d};return p[f(558)]=m,r.OfssH(fetch,u,p)},withCredentials:!0}};return t&&(c.requestInit[a(558)].Authorization=a(533)+t,i.Authorization="Bearer "+t),c},Sd=(t,e=Sr[yt(517)]())=>{const a=yt,s=yt,r={};r.nwQhY="include";const n=r,i={};i["stream-session-id"]=e;const o={};o.headers=i,o.credentials=n[a(520)];const l={};l[a(544)]=o;const c=l;return t&&(c.requestInit.headers[s(552)]=s(533)+t),c},ns=async(t,e,a)=>{const s=yt,r=yt,n={CFfFC:function(o){return o()},egwVO:function(o,l,c,u){return o(l,c,u)}},i=n.CFfFC(a);try{return await t[s(538)](i),i}catch(o){if(o instanceof jt){const l=await e();return await i[r(505)](l),await n[s(525)](ns,t,e,a)}else throw o}};function Jt(t,e){const a=vn();return Jt=function(s,r){return s=s-(74*-67+-8341+-73*-189),a[s]},Jt(t,e)}const Rd=(t,e)=>{const a=yt,s=yt,r={};r.RsKXs=function(i,o){return i in o},r.PBhps="waitForOAuthCode",r[a(535)]="function",r[a(507)]="waitForOAuthCode need to be provided when authProvider is provided";const n=r;if(n.RsKXs(n[s(551)],t))return t[s(523)];if(typeof e===n.yTKoP)return e;throw new Error(n.RZhOv)},V0=async t=>{const e=yt,a=yt,s={TFSRn:function(D,W,J){return D(W,J)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(D){return D()},WIVYl:function(D,W,J,H){return D(W,J,H)},jniGY:"sessionId"},{client:r,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,eventSourceInit:u,waitForOAuthCode:d}=t,v={};v.authProvider=l,v.requestInit=c,v.eventSourceInit=u;const f=v,m=o||Sr.randomUUID(),p=s[e(506)](Ed,i,m);if(c){const D={...p.requestInit,...c};D.headers={...p[e(544)].headers,...c.headers},f.requestInit=D}else f[a(544)]=p.requestInit;if(u){const D={...p[e(559)],...u};f.eventSourceInit=D}else f.eventSourceInit=p.eventSourceInit;const h={};h.listChanged=!0;const g={};g.roots=h,g.sampling={},g[e(511)]={};const w=g,P={};P[a(536)]=s.HwvVa,P.version=e(526);const S={};S.capabilities=w;const x=new Xa(P,S),A=()=>new ga(new URL(n),f);let z=s[a(504)](A);if(l){const D=s[e(506)](Rd,l,d);z=await s[a(513)](ns,x,D,A)}else await x[e(538)](z);s[a(513)](tc,x,r,z),z[a(557)]=z[a(542)].searchParams[a(532)](s.jniGY);const U={};return U.transport=z,U.sessionId=z[e(557)],U};function vn(){const t=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return vn=function(){return t},vn()}const z0=async t=>{const e=yt,a=yt,s={Vajmx:e(500),biJOc:function(D){return D()},zXcpO:function(D,W,J){return D(W,J)},zDnjZ:function(D,W,J,H){return D(W,J,H)},FQMAh:function(D,W,J,H){return D(W,J,H)}},{client:r,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,reconnectionOptions:u,waitForOAuthCode:d}=t,v={};v.authProvider=l,v.requestInit=c,v.reconnectionOptions=u;const f=v,m=o||Sr.randomUUID(),p=Sd(i,m);if(c){const D={...p.requestInit,...c};D.headers={...p.requestInit.headers,...c.headers},f[e(544)]=D}else f.requestInit=p.requestInit;const h={};h.listChanged=!0;const g={};g[a(550)]=h,g.sampling={},g.elicitation={};const w=g,P={};P[e(536)]=s[a(508)],P[e(555)]="1.0.0";const S={};S.capabilities=w;const x=new Xa(P,S),A=()=>new ss(new URL(n),f);let z=s[e(503)](A);if(l){const D=s[e(501)](Rd,l,d);z=await s.zDnjZ(ns,x,D,A)}else await x.connect(z);s.FQMAh(tc,x,r,z);const U={};return U.transport=z,U[a(557)]=z.sessionId,U},H0=async t=>{const e=yt,a=yt,s={QgzDy:e(540),jkaVB:function(g,w,P,S){return g(w,P,S)}},{client:r,url:n,token:i,sessionId:o}=t,l={};l.listChanged=!0;const c={};c[e(550)]=l,c[e(515)]={},c[a(511)]={};const u=c,d={};d.name=s[a(548)],d[a(555)]=a(526);const v={};v.capabilities=u;const f=new Xa(d,v),m=o||Sr[a(517)](),p=new $d(new URL(n+e(522)+m+a(554)+i));await f.connect(p),s.jkaVB(tc,f,r,p);const h={};return h[e(512)]=p,h[a(557)]=m,h},is=vt,gn=vt;function vt(t,e){const a=_n();return vt=function(s,r){return s=s-(-16761+51*337),a[s]},vt(t,e)}(function(t,e){const a=vt,s=vt,r=t();for(;;)try{if(-parseInt(a(440))/1+-parseInt(a(458))/2*(parseInt(a(448))/3)+-parseInt(a(451))/4*(parseInt(s(449))/5)+-parseInt(s(455))/6+-parseInt(a(427))/7+-parseInt(s(438))/8*(parseInt(s(459))/9)+parseInt(a(430))/10*(parseInt(s(436))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(_n,-220880+1*-333337+-2*-384996);function _n(){const t=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return _n=function(){return t},_n()}const Z0=()=>Sr.randomBytes(3485*1+-261+-3184);class K0{constructor(e){const a=vt,s=vt;this._callBackPromise={};const{clientMetadata:r,state:n,redirectCallback:i,getAuthCodeByState:o,waitForOAuthCode:l}=e;this[a(428)]=r,this[a(454)]=r[a(445)][0],this._state=n||Z0(),this._redirectCallback=i||this.redirectCallbackFunction,this._getAuthCodeByState=o||this.getAuthCodeByStateFunction,this[s(426)]=l||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var a,s,r,n,i,o;const l=vt,c=vt,u={qITTp:function(m,p,h){return m(p,h)},qcFPW:l(452)},d=await u.qITTp(fetch,e,{method:u[l(453)]});!d.ok&&((s=(a=this._callBackPromise).reject)==null||s.call(a,c(446)+d.statusText));const v=await this._getAuthCodeByState(this[c(454)],this[l(442)]);if(!v.ok){(n=(r=this[l(433)]).reject)==null||n.call(r,"Failed to fetch auth code: "+v.statusText);return}const f=await v[l(431)]();(o=(i=this[c(433)])[l(456)])==null||o.call(i,f[l(432)])}async getAuthCodeByStateFunction(e,a){const s=vt,r=vt,n={};n.tuSmb=s(429);const i=n,o={};o[s(460)]=i.tuSmb;const l={};return l[r(441)]=a,fetch(e,{method:"POST",headers:o,body:new URLSearchParams(l)})}waitForOAuthCodeFunction(){const e=vt,a=this[e(433)];return()=>new Promise((s,r)=>{const n=e;a.resolve=s,a[n(434)]=r})}get redirectUrl(){return this[vt(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[is(447)](){return this[is(444)]}[gn(435)](e){const a=is;this[a(444)]=e}[gn(457)](){return this[gn(439)]}saveTokens(e){this._tokens=e}[gn(450)](e){this[is(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[is(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(t,e){for(var a=wn,s=wn,r=t();;)try{var n=parseInt(a(361))/1*(parseInt(s(363))/2)+-parseInt(a(358))/3+parseInt(a(359))/4*(parseInt(a(357))/5)+parseInt(s(354))/6*(parseInt(a(360))/7)+parseInt(s(362))/8+parseInt(s(364))/9+-parseInt(s(356))/10*(parseInt(a(355))/11);if(n===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(yn,-73523*-3+1*-407717+530518);function yn(){var t=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return yn=function(){return t},yn()}function wn(t,e){var a=yn();return wn=function(s,r){s=s-(-1*-642+503*-5+2227);var n=a[s];return n},wn(t,e)}class B0 extends bu{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(Jl,r=>this._oninitialize(r)),this.setNotificationHandler(qi,()=>{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=$u(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:ql.includes(a)?a:Ja,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"},wr)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},eo,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},to,a);if(s.action==="accept"&&s.content)try{const r=new ud,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ae(Ie.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ae?r:new Ae(Ie.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},ao,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 W0=Symbol("Let zodToJsonSchema decide on which parser to use"),kd={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"},J0=t=>typeof t=="string"?{...kd,name:t}:{...kd,...t},Q0=t=>{const e=J0(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 xd(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function Re(t,e,a,s,r){t[e]=a,xd(t,e,s,r)}const Td=(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 gt(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Td(e,t.currentPath):e.join("/")}}function G0(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)!==V.ZodAny&&(a.items=Se(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Re(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(a,"minItems",t.exactLength.value,t.exactLength.message,e),Re(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function Y0(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?Re(a,"minimum",s.value,s.message,e):Re(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Re(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(a,"maximum",s.value,s.message,e):Re(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Re(a,"maximum",s.value,s.message,e));break;case"multipleOf":Re(a,"multipleOf",s.value,s.message,e);break}return a}function X0(){return{type:"boolean"}}function Id(t,e){return Se(t.type._def,e)}const ew=(t,e)=>Se(t.innerType._def,e);function Cd(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Cd(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 tw(t,e)}}const tw=(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":Re(a,"minimum",s.value,s.message,e);break;case"max":Re(a,"maximum",s.value,s.message,e);break}return a};function rw(t,e){return{...Se(t.innerType._def,e),default:t.defaultValue()}}function aw(t,e){return e.effectStrategy==="input"?Se(t.schema._def,e):gt(e)}function sw(t){return{type:"string",enum:Array.from(t.values)}}const nw=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function iw(t,e){const a=[Se(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Se(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(nw(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,...l}=n;i=l}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function ow(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 rc;const Dt={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:()=>(rc===void 0&&(rc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rc),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 Od(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Re(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":Re(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":Mt(a,"email",s.message,e);break;case"format:idn-email":Mt(a,"idn-email",s.message,e);break;case"pattern:zod":dt(a,Dt.email,s.message,e);break}break;case"url":Mt(a,"uri",s.message,e);break;case"uuid":Mt(a,"uuid",s.message,e);break;case"regex":dt(a,s.regex,s.message,e);break;case"cuid":dt(a,Dt.cuid,s.message,e);break;case"cuid2":dt(a,Dt.cuid2,s.message,e);break;case"startsWith":dt(a,RegExp(`^${ac(s.value,e)}`),s.message,e);break;case"endsWith":dt(a,RegExp(`${ac(s.value,e)}$`),s.message,e);break;case"datetime":Mt(a,"date-time",s.message,e);break;case"date":Mt(a,"date",s.message,e);break;case"time":Mt(a,"time",s.message,e);break;case"duration":Mt(a,"duration",s.message,e);break;case"length":Re(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),Re(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{dt(a,RegExp(ac(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Mt(a,"ipv4",s.message,e),s.version!=="v4"&&Mt(a,"ipv6",s.message,e);break}case"base64url":dt(a,Dt.base64url,s.message,e);break;case"jwt":dt(a,Dt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&dt(a,Dt.ipv4Cidr,s.message,e),s.version!=="v4"&&dt(a,Dt.ipv6Cidr,s.message,e);break}case"emoji":dt(a,Dt.emoji(),s.message,e);break;case"ulid":{dt(a,Dt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Mt(a,"binary",s.message,e);break}case"contentEncoding:base64":{Re(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{dt(a,Dt.base64,s.message,e);break}}break}case"nanoid":dt(a,Dt.nanoid,s.message,e)}return a}function ac(t,e){return e.patternStrategy==="escape"?lw(t):t}const cw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function lw(t){let e="";for(let a=0;a<t.length;a++)cw.has(t[a])||(e+="\\"),e+=t[a];return e}function Mt(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}}})):Re(t,"format",e,a,s)}function dt(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:Nd(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):Re(t,"pattern",Nd(e,s),a,s)}function Nd(t,e){var l;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=a.i?t.source.toLowerCase():t.source;let r="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(a.i){if(i){if(s[c].match(/[a-z]/)){o?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&((l=s[c+2])!=null&&l.match(/[a-z]/))?(r+=s[c],o=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(a.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
12
|
+
`&&s++}}return[e,a]}class hd 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(pd(this),a)}[Symbol.for("Deno.customInspect")](e,a){return e(pd(this),a)}}function Zy(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Eo(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Eo).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Eo(t.cause)}`:t.message:`${t}`}function pd(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var md=t=>{throw TypeError(t)},So=(t,e,a)=>e.has(t)||md("Cannot "+a),be=(t,e,a)=>(So(t,e,"read from private field"),a?a.call(t):e.get(t)),et=(t,e,a)=>e.has(t)?md("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),De=(t,e,a,s)=>(So(t,e,"write to private field"),e.set(t,a),a),or=(t,e,a)=>(So(t,e,"access private method"),a),mt,Fr,ua,an,sn,Xa,da,es,Er,fa,ha,pa,ts,At,Ro,ko,xo,vd,To,Io,rs,Co,Oo;class nn extends EventTarget{constructor(e,a){var s,r;super(),et(this,At),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,et(this,mt),et(this,Fr),et(this,ua),et(this,an),et(this,sn),et(this,Xa),et(this,da),et(this,es,null),et(this,Er),et(this,fa),et(this,ha,null),et(this,pa,null),et(this,ts,null),et(this,ko,async n=>{var i;be(this,fa).reset();const{body:o,redirected:l,status:c,headers:u}=n;if(c===204){or(this,At,rs).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?De(this,ua,new URL(n.url)):De(this,ua,void 0),c!==200){or(this,At,rs).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){or(this,At,rs).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(be(this,mt)===this.CLOSED)return;De(this,mt,this.OPEN);const d=new Event("open");if((i=be(this,ts))==null||i.call(this,d),this.dispatchEvent(d),typeof o!="object"||!o||!("getReader"in o)){or(this,At,rs).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const g=new TextDecoder,f=o.getReader();let m=!0;do{const{done:p,value:h}=await f.read();h&&be(this,fa).feed(g.decode(h,{stream:!p})),p&&(m=!1,be(this,fa).reset(),or(this,At,Co).call(this))}while(m)}),et(this,xo,n=>{De(this,Er,void 0),!(n.name==="AbortError"||n.type==="aborted")&&or(this,At,Co).call(this,Eo(n))}),et(this,To,n=>{typeof n.id=="string"&&De(this,es,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:be(this,ua)?be(this,ua).origin:be(this,Fr).origin,lastEventId:n.id||""});be(this,pa)&&(!n.event||n.event==="message")&&be(this,pa).call(this,i),this.dispatchEvent(i)}),et(this,Io,n=>{De(this,Xa,n)}),et(this,Oo,()=>{De(this,da,void 0),be(this,mt)===this.CONNECTING&&or(this,At,Ro).call(this)});try{if(e instanceof URL)De(this,Fr,e);else if(typeof e=="string")De(this,Fr,new URL(e,Ky()));else throw new Error("Invalid URL")}catch{throw Zy("An invalid or illegal string was specified")}De(this,fa,fd({onEvent:be(this,To),onRetry:be(this,Io)})),De(this,mt,this.CONNECTING),De(this,Xa,3e3),De(this,sn,(s=a==null?void 0:a.fetch)!=null?s:globalThis.fetch),De(this,an,(r=a==null?void 0:a.withCredentials)!=null?r:!1),or(this,At,Ro).call(this)}get readyState(){return be(this,mt)}get url(){return be(this,Fr).href}get withCredentials(){return be(this,an)}get onerror(){return be(this,ha)}set onerror(e){De(this,ha,e)}get onmessage(){return be(this,pa)}set onmessage(e){De(this,pa,e)}get onopen(){return be(this,ts)}set onopen(e){De(this,ts,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(){be(this,da)&&clearTimeout(be(this,da)),be(this,mt)!==this.CLOSED&&(be(this,Er)&&be(this,Er).abort(),De(this,mt,this.CLOSED),De(this,Er,void 0))}}mt=new WeakMap,Fr=new WeakMap,ua=new WeakMap,an=new WeakMap,sn=new WeakMap,Xa=new WeakMap,da=new WeakMap,es=new WeakMap,Er=new WeakMap,fa=new WeakMap,ha=new WeakMap,pa=new WeakMap,ts=new WeakMap,At=new WeakSet,Ro=function(){De(this,mt,this.CONNECTING),De(this,Er,new AbortController),be(this,sn)(be(this,Fr),or(this,At,vd).call(this)).then(be(this,ko)).catch(be(this,xo))},ko=new WeakMap,xo=new WeakMap,vd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...be(this,es)?{"Last-Event-ID":be(this,es)}:void 0},cache:"no-store",signal:(t=be(this,Er))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},To=new WeakMap,Io=new WeakMap,rs=function(t,e){var a;be(this,mt)!==this.CLOSED&&De(this,mt,this.CLOSED);const s=new hd("error",{code:e,message:t});(a=be(this,ha))==null||a.call(this,s),this.dispatchEvent(s)},Co=function(t,e){var a;if(be(this,mt)===this.CLOSED)return;De(this,mt,this.CONNECTING);const s=new hd("error",{code:e,message:t});(a=be(this,ha))==null||a.call(this,s),this.dispatchEvent(s),De(this,da,setTimeout(be(this,Oo),be(this,Xa)))},Oo=new WeakMap,nn.CONNECTING=0,nn.OPEN=1,nn.CLOSED=2;function Ky(){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}let No;No=globalThis.crypto;async function By(t){return(await No).getRandomValues(new Uint8Array(t))}async function Wy(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let a="";const s=await By(t);for(let r=0;r<t;r++){const n=s[r]%e.length;a+=e[n]}return a}async function Jy(t){return await Wy(t)}async function Qy(t){const e=await(await No).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Gy(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Jy(t),a=await Qy(e);return{code_verifier:e,code_challenge:a}}const Yy=Z({resource:k().url(),authorization_servers:X(k().url()).optional(),jwks_uri:k().url().optional(),scopes_supported:X(k()).optional(),bearer_methods_supported:X(k()).optional(),resource_signing_alg_values_supported:X(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:Ze().optional(),authorization_details_types_supported:X(k()).optional(),dpop_signing_alg_values_supported:X(k()).optional(),dpop_bound_access_tokens_required:Ze().optional()}).passthrough(),gd=Z({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),registration_endpoint:k().optional(),scopes_supported:X(k()).optional(),response_types_supported:X(k()),response_modes_supported:X(k()).optional(),grant_types_supported:X(k()).optional(),token_endpoint_auth_methods_supported:X(k()).optional(),token_endpoint_auth_signing_alg_values_supported:X(k()).optional(),service_documentation:k().optional(),revocation_endpoint:k().optional(),revocation_endpoint_auth_methods_supported:X(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:X(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:X(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:X(k()).optional(),code_challenge_methods_supported:X(k()).optional()}).passthrough(),Xy=Z({issuer:k(),authorization_endpoint:k(),token_endpoint:k(),userinfo_endpoint:k().optional(),jwks_uri:k(),registration_endpoint:k().optional(),scopes_supported:X(k()).optional(),response_types_supported:X(k()),response_modes_supported:X(k()).optional(),grant_types_supported:X(k()).optional(),acr_values_supported:X(k()).optional(),subject_types_supported:X(k()),id_token_signing_alg_values_supported:X(k()),id_token_encryption_alg_values_supported:X(k()).optional(),id_token_encryption_enc_values_supported:X(k()).optional(),userinfo_signing_alg_values_supported:X(k()).optional(),userinfo_encryption_alg_values_supported:X(k()).optional(),userinfo_encryption_enc_values_supported:X(k()).optional(),request_object_signing_alg_values_supported:X(k()).optional(),request_object_encryption_alg_values_supported:X(k()).optional(),request_object_encryption_enc_values_supported:X(k()).optional(),token_endpoint_auth_methods_supported:X(k()).optional(),token_endpoint_auth_signing_alg_values_supported:X(k()).optional(),display_values_supported:X(k()).optional(),claim_types_supported:X(k()).optional(),claims_supported:X(k()).optional(),service_documentation:k().optional(),claims_locales_supported:X(k()).optional(),ui_locales_supported:X(k()).optional(),claims_parameter_supported:Ze().optional(),request_parameter_supported:Ze().optional(),request_uri_parameter_supported:Ze().optional(),require_request_uri_registration:Ze().optional(),op_policy_uri:k().optional(),op_tos_uri:k().optional()}).passthrough().merge(gd.pick({code_challenge_methods_supported:!0})),_d=Z({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Je().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),e0=Z({error:k(),error_description:k().optional(),error_uri:k().optional()}),t0=Z({redirect_uris:X(k()).refine(t=>t.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:k().optional(),grant_types:X(k()).optional(),response_types:X(k()).optional(),client_name:k().optional(),client_uri:k().optional(),logo_uri:k().optional(),scope:k().optional(),contacts:X(k()).optional(),tos_uri:k().optional(),policy_uri:k().optional(),jwks_uri:k().optional(),jwks:Ml().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),r0=Z({client_id:k(),client_secret:k().optional(),client_id_issued_at:Je().optional(),client_secret_expires_at:Je().optional()}).strip(),a0=t0.merge(r0);Z({error:k(),error_description:k().optional()}).strip(),Z({token:k(),token_type_hint:k().optional()}).strip();function s0(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function n0({requestedResource:t,configuredResource:e}){const a=typeof t=="string"?new URL(t):new URL(t.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(a.origin!==s.origin||a.pathname.length<s.pathname.length)return!1;const r=a.pathname.endsWith("/")?a.pathname:a.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}class st extends Error{constructor(e,a){super(e),this.errorUri=a,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class Ao extends st{}Ao.errorCode="invalid_request";class on extends st{}on.errorCode="invalid_client";class cn extends st{}cn.errorCode="invalid_grant";class ln extends st{}ln.errorCode="unauthorized_client";class jo extends st{}jo.errorCode="unsupported_grant_type";class Do extends st{}Do.errorCode="invalid_scope";class Mo extends st{}Mo.errorCode="access_denied";class ma extends st{}ma.errorCode="server_error";class Lo extends st{}Lo.errorCode="temporarily_unavailable";class Fo extends st{}Fo.errorCode="unsupported_response_type";class qo extends st{}qo.errorCode="unsupported_token_type";class Uo extends st{}Uo.errorCode="invalid_token";class Vo extends st{}Vo.errorCode="method_not_allowed";class zo extends st{}zo.errorCode="too_many_requests";class Ho extends st{}Ho.errorCode="invalid_client_metadata";class Zo extends st{}Zo.errorCode="insufficient_scope";const i0={[Ao.errorCode]:Ao,[on.errorCode]:on,[cn.errorCode]:cn,[ln.errorCode]:ln,[jo.errorCode]:jo,[Do.errorCode]:Do,[Mo.errorCode]:Mo,[ma.errorCode]:ma,[Lo.errorCode]:Lo,[Fo.errorCode]:Fo,[qo.errorCode]:qo,[Uo.errorCode]:Uo,[Vo.errorCode]:Vo,[zo.errorCode]:zo,[Ho.errorCode]:Ho,[Zo.errorCode]:Zo};class jt extends Error{constructor(e){super(e??"Unauthorized")}}function yd(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 bd(t,e,a,s){const{client_id:r,client_secret:n}=e;switch(t){case"client_secret_basic":o0(r,n,a);return;case"client_secret_post":c0(r,n,s);return;case"none":l0(r,s);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function o0(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 c0(t,e,a){a.set("client_id",t),e&&a.set("client_secret",e)}function l0(t,e){e.set("client_id",t)}async function Ko(t){const e=t instanceof Response?t.status:void 0,a=t instanceof Response?await t.text():t;try{const s=e0.parse(JSON.parse(a)),{error:r,error_description:n,error_uri:i}=s,o=i0[r]||ma;return new o(n||"",i)}catch(s){const r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${a}`;return new ma(r)}}async function va(t,e){var a,s;try{return await Bo(t,e)}catch(r){if(r instanceof on||r instanceof ln)return await((a=t.invalidateCredentials)===null||a===void 0?void 0:a.call(t,"all")),await Bo(t,e);if(r instanceof cn)return await((s=t.invalidateCredentials)===null||s===void 0?void 0:s.call(t,"tokens")),await Bo(t,e);throw r}}async function Bo(t,{serverUrl:e,authorizationCode:a,scope:s,resourceMetadataUrl:r,fetchFn:n}){let i,o;try{i=await d0(e,{resourceMetadataUrl:r},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);const l=await u0(e,t,i),c=await v0(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 b0(o,{metadata:c,clientMetadata:t.clientMetadata});await t.saveClientInformation(p),u=p}if(a!==void 0){const p=await t.codeVerifier(),h=await _0(o,{metadata:c,clientInformation:u,authorizationCode:a,codeVerifier:p,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:n});return await t.saveTokens(h),"AUTHORIZED"}const d=await t.tokens();if(d!=null&&d.refresh_token)try{const p=await y0(o,{metadata:c,clientInformation:u,refreshToken:d.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication});return await t.saveTokens(p),"AUTHORIZED"}catch(p){if(!(!(p instanceof st)||p instanceof ma))throw p}const g=t.state?await t.state():void 0,{authorizationUrl:f,codeVerifier:m}=await g0(o,{metadata:c,clientInformation:u,state:g,redirectUrl:t.redirectUrl,scope:s||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(f),"REDIRECT"}async function u0(t,e,a){const s=s0(t);if(e.validateResourceURL)return await e.validateResourceURL(s,a==null?void 0:a.resource);if(a){if(!n0({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 Wo(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 d0(t,e,a=fetch){const s=await p0(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 Yy.parse(await s.json())}async function Jo(t,e,a=fetch){try{return await a(t,{headers:e})}catch(s){if(s instanceof TypeError)return e?Jo(t,void 0,a):void 0;throw s}}function f0(t,e="",a={}){return e.endsWith("/")&&(e=e.slice(0,-1)),a.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function wd(t,e,a=fetch){return await Jo(t,{"MCP-Protocol-Version":e},a)}function h0(t,e){return!t||t.status===404&&e!=="/"}async function p0(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:Wa;let l;if(s!=null&&s.metadataUrl)l=new URL(s.metadataUrl);else{const u=f0(e,i.pathname);l=new URL(u,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),l.search=i.search}let c=await wd(l,o,a);if(!(s!=null&&s.metadataUrl)&&h0(c,i.pathname)){const u=new URL(`/.well-known/${e}`,i);c=await wd(u,o,a)}return c}function m0(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 v0(t,{fetchFn:e=fetch,protocolVersion:a=Wa}={}){var s;const r={"MCP-Protocol-Version":a},n=m0(t);for(const{url:i,type:o}of n){const l=await Jo(i,r,e);if(!l)throw new Error(`CORS error trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`);if(!l.ok){if(l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(o==="oauth")return gd.parse(await l.json());{const c=Xy.parse(await l.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${i}: does not support S256 code challenge method required by MCP specification`);return c}}}async function g0(t,{metadata:e,clientInformation:a,redirectUrl:s,scope:r,state:n,resource:i}){const o="code",l="S256";let c;if(e){if(c=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(l))throw new Error(`Incompatible auth server: does not support code challenge method ${l}`)}else c=new URL("/authorize",t);const u=await Gy(),d=u.code_verifier,g=u.code_challenge;return c.searchParams.set("response_type",o),c.searchParams.set("client_id",a.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",l),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",i.href),{authorizationUrl:c,codeVerifier:d}}async function _0(t,{metadata:e,clientInformation:a,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:l}){var c;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 g=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(g,f,t,e);else{const p=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],h=yd(a,p);bd(h,a,g,f)}i&&f.set("resource",i.href);const m=await(l??fetch)(d,{method:"POST",headers:g,body:f});if(!m.ok)throw await Ko(m);return _d.parse(await m.json())}async function y0(t,{metadata:e,clientInformation:a,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:i}){var o;const l="refresh_token";let c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`)}else c=new URL("/token",t);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:l,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=yd(a,f);bd(m,a,u,d)}r&&d.set("resource",r.href);const g=await(i??fetch)(c,{method:"POST",headers:u,body:d});if(!g.ok)throw await Ko(g);return _d.parse({refresh_token:s,...await g.json()})}async function b0(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 Ko(n);return a0.parse(await n.json())}class w0 extends Error{constructor(e,a,s){super(`SSE error: ${a}`),this.code=e,this.event=s}}class as{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 jt("No auth provider");let a;try{a=await va(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 jt;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 nn(this._url.href,{...this._eventSourceInit,fetch:async(o,l)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const u=await r(o,{...l,headers:c});return u.status===401&&u.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Wo(u)),u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var l;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}const c=new w0(o.code,o.message,o);i(c),(l=this.onerror)===null||l===void 0||l.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var l;const c=o;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(u){i(u),(l=this.onerror)===null||l===void 0||l.call(this,u),this.close();return}n()}),this._eventSource.onmessage=o=>{var l,c;const u=o;let d;try{d=ca.parse(JSON.parse(u.data))}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g);return}(c=this.onmessage)===null||c===void 0||c.call(this,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 jt("No auth provider");if(await va(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt("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=Wo(o),await va(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt;return this.send(e)}const l=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${l}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}}class $0 extends TransformStream{constructor({onError:e,onRetry:a,onComment:s}={}){let r;super({start(n){r=fd({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 P0={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Qo extends Error{constructor(e,a){super(`Streamable HTTP error: ${a}`),this.code=e}}class un{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:P0}async _authThenStart(){var e;if(!this._authProvider)throw new jt("No auth provider");let a;try{a=await va(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 jt;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 Qo(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 l,c,u,d;try{const g=e.pipeThrough(new TextDecoderStream).pipeThrough(new $0).getReader();for(;;){const{value:f,done:m}=await g.read();if(m)break;if(f.id&&(i=f.id,r==null||r(f.id)),!f.event||f.event==="message")try{const p=ca.parse(JSON.parse(f.data));n!==void 0&&Mi(p)&&(p.id=n),(l=this.onmessage)===null||l===void 0||l.call(this,p)}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p)}}}catch(g){if((u=this.onerror)===null||u===void 0||u.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken: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 jt("No auth provider");if(await va(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt("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:l}=a||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Hl(e)?e.id:void 0}).catch(h=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,h)});return}const c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");const u={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},d=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,u),g=d.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=Wo(d),await va(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new jt;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){fg(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:l},!1);else if(p!=null&&p.includes("application/json")){const h=await d.json(),v=Array.isArray(h)?h.map(b=>ca.parse(b)):[ca.parse(h)];for(const b of v)(n=this.onmessage)===null||n===void 0||n.call(this,b)}else throw new Qo(-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 Qo(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}}const E0="mcp";class $d{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,a)=>{this._socket=new WebSocket(this._url,E0),this._socket.onerror=s=>{var r;const n="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);a(n),(r=this.onerror)===null||r===void 0||r.call(this,n)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{var s;(s=this.onclose)===null||s===void 0||s.call(this)},this._socket.onmessage=s=>{var r,n;let i;try{i=ca.parse(JSON.parse(s.data))}catch(o){(r=this.onerror)===null||r===void 0||r.call(this,o);return}(n=this.onmessage)===null||n===void 0||n.call(this,i)}})}async close(){var e;(e=this._socket)===null||e===void 0||e.close()}send(e){return new Promise((a,s)=>{var r;if(!this._socket){s(new Error("Not connected"));return}(r=this._socket)===null||r===void 0||r.send(JSON.stringify(e)),a()})}}function dn(){const t=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return dn=function(){return t},dn()}(function(t,e){const a=Qe,s=Qe,r=t();for(;;)try{if(parseInt(a(417))/1*(parseInt(a(421))/2)+parseInt(a(433))/3+parseInt(a(424))/4*(-parseInt(s(429))/5)+parseInt(s(423))/6*(-parseInt(s(418))/7)+-parseInt(s(430))/8+-parseInt(a(416))/9*(-parseInt(a(405))/10)+-parseInt(a(415))/11*(-parseInt(a(411))/12)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(dn,650197);const Pd=()=>{const t=Qe,e={EGhzU:function(a,s){return a!==s},kIrDB:"undefined",llYQe:function(a,s){return a!==s},PZfJg:function(a,s){return a(s)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[t(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==t(398)?self:e.PZfJg(Function,e[t(399)])()},S0=(t,e,a)=>{const s=Qe,r=Qe,n={};n[s(410)]=r(398),n.dBkaX=function(o,l){return o===l},n[r(393)]="function";const i=n;typeof window!==i[r(410)]?t.postMessage(e,"*",a):r(428)in t&&i.dBkaX(typeof t.postMessage,i[s(393)])&&t.postMessage(e,a)},R0=(t,e)=>{const a=Qe,s=Qe,r={};r.MbsGh="addEventListener",r.PPniK=function(i,o){return i===o},r[a(419)]=s(412),r[s(404)]="onmessage",r[a(397)]="undefined";const n=r;n.MbsGh in t&&n.PPniK(typeof t[a(427)],n.wRKyh)?t[a(427)](a(400),e):n.thraG in t&&typeof t[s(413)]!==n[s(397)]&&(t.onmessage=e)};class fn{constructor(e){const a=Qe;this[a(406)]=e}async start(){const e=Qe,a=Qe;this[e(406)]&&(this[e(406)][e(413)]=s=>{var r,n;const i=e,o=a;try{const l=ca[i(402)](s.data[i(400)]);(r=this[i(413)])==null||r.call(this,l,s[o(409)].extra)}catch(l){const c=new Error("MessageChannel failed to parse message: "+l);(n=this[o(408)])==null||n.call(this,c)}},this._port[e(396)]=s=>{var r;const n=a,i=a,o=new Error(n(394)+JSON[i(395)](s));(r=this.onerror)==null||r.call(this,o)},this[e(406)][e(434)]())}async send(e,a){const s={lEyuq:function(r){return r()},YihNw:function(r,n){return r(n)}};return new Promise((r,n)=>{var i;const o=Qe,l=Qe;try{const c={};c[o(403)]=a==null?void 0:a[o(403)];const u={};u[l(400)]=e,u.extra=c,this[l(406)]&&this[o(406)].postMessage(u),s.lEyuq(r)}catch(c){const u=c instanceof Error?c:new Error(s.YihNw(String,c));(i=this[l(408)])==null||i.call(this,u),n(u)}})}async close(){var e,a;const s=Qe,r=Qe;(e=this._port)==null||e[s(431)](),this._port=void 0,(a=this[r(420)])==null||a.call(this)}}class Go extends fn{constructor(e,a=Pd()){const s=Qe,r=Qe,n={EkZCC:function(o,l,c,u){return o(l,c,u)}};super(),this[s(391)]=e,this[r(401)]=a;const i=new MessageChannel;this[r(406)]=i.port1,n[r(426)](S0,this[s(401)],{endpoint:this[r(391)]},[i[r(414)]])}}class Yo extends fn{constructor(e,a=Pd()){const s=Qe,r={mOWMr:function(n,i){return n===i},kgkem:function(n,i,o){return n(i,o)}};super(),this._endpoint=e,this._globalObject=a,this[s(432)]=new Promise(n=>{const i=s,o=s;r[i(392)](R0,this[o(401)],l=>{const c=o,u=o;l.data&&r[c(425)](l.data[u(422)],this[u(391)])&&(this[u(406)]=l.ports[-1*4852+1*1601+3251],n())})})}async listen(){return this[Qe(432)]}}function Qe(t,e){const a=dn();return Qe=function(s,r){return s=s-(17*-491+-669+9407),a[s]},Qe(t,e)}const k0=()=>{const t=new MessageChannel;return[new fn(t.port1),new fn(t.port2)]};(function(t,e){const a=xe,s=xe,r=t();for(;;)try{if(parseInt(a(355))/1+-parseInt(a(356))/2*(-parseInt(a(373))/3)+-parseInt(a(337))/4+parseInt(s(357))/5+-parseInt(s(389))/6*(-parseInt(a(396))/7)+parseInt(s(325))/8*(parseInt(a(382))/9)+-parseInt(a(366))/10===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(hn,-763475+-52067*10+1724410);const x0=async(t,e,a)=>{var s;const r=xe,n=xe,i={};i[r(345)]="tools/list",i.rqstG="tools/call",i.WqUnk="resources/list",i[r(329)]=n(358),i[r(365)]=r(335),i.ookoz="resources/unsubscribe",i[r(385)]=r(340),i.VTIWq="prompts/list",i.SkoRK=r(376),i.QUtUV=r(388),i.XtowM=n(332);const o=i,{id:l,method:c,params:u}=a;let d={};switch(c){case o[n(345)]:d=await e.listTools(u);break;case o.rqstG:d=await e.callTool(u);break;case o[r(334)]:d=await e[r(350)](u);break;case o[n(329)]:d=await e.listResourceTemplates(u);break;case r(372):d=await e[r(383)](u);break;case o.HgYgW:d=await e.subscribeResource(u);break;case o.ookoz:d=await e.unsubscribeResource(u);break;case o[r(385)]:d=await e.getPrompt(u);break;case o.VTIWq:d=await e.listPrompts(u);break;case o[r(344)]:d=await e[r(376)]();break;case o.QUtUV:d=await e.complete(u);break;case r(390):d=await e[r(336)](u==null?void 0:u.level);break}const g={};g[r(361)]=d,g[r(394)]=o[r(364)],g.id=l,await((s=t==null?void 0:t.transport)==null?void 0:s[r(392)](g))},T0=async(t,e,a)=>{var s;const r=xe,n=xe,i={};i.jQBBS="sampling/createMessage",i.EZqgC="elicitation/create",i[r(370)]=n(376),i.aVeaL=n(332);const o=i,{id:l,method:c,params:u}=a;let d={};switch(c){case r(368):const f={};f.method=c,f[n(367)]=u,d=await e.request(f,ro);break;case o[n(391)]:const m={};m.method=c,m[n(367)]=u,d=await e[n(381)](m,Xi);break;case o.EZqgC:const p={};p.method=c,p.params=u,d=await e.request(p,eo);break;case o[n(370)]:const h={};h.method=c,d=await e[n(381)](h,br);break}const g={};return g[n(361)]=d,g.jsonrpc=o[n(387)],g.id=l,await((s=t==null?void 0:t[r(371)])==null?void 0:s.send(g)),d},I0=(t,e)=>{const a=xe,s={gXsjT:function(n,i){return n===i},oegpC:a(351),lZOUC:function(n,i,o,l){return n(i,o,l)},ifIKG:"2.0"},r=t._onrequest;t._onrequest=async(n,i)=>{var o,l,c,u,d;const g=a,f=a,{id:m,method:p}=n;try{s[g(333)](p,s.oegpC)?await r[g(386)](t,n,i):await s.lZOUC(x0,t,e,n)}catch(h){const{code:v,message:b,data:P}=h;try{if(v){const S={};S.code=v,S.message=b,S.data=P;const x={};x.error=S,x[g(394)]=s[f(331)],x.id=m,await((o=t==null?void 0:t.transport)==null?void 0:o.send(x))}else(c=(l=t==null?void 0:t[f(371)])==null?void 0:l.onerror)==null||c.call(l,h)}catch(S){(d=(u=t==null?void 0:t[g(371)])==null?void 0:u.onerror)==null||d.call(u,S)}}}},C0=(t,e)=>{const a=xe,s=xe,r={};r[a(363)]=function(i,o){return i!==o},r[a(398)]=a(353),r.hzhyg="notifications/cancelled";const n=r;t._onnotification=async i=>{var o,l;const c=a,u=s,{method:d,params:g}=i;if(n[c(363)](d,n[u(398)])&&(n[c(363)](d,n.hzhyg)||g!=null&&g.forward))try{await e.notification(i)}catch(f){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,f)}}},O0=(t,e)=>async a=>{var s,r,n,i,o;const l=xe,c=xe,u={};u.SEmWX=l(332);const d=u;try{return await T0(t,e,a)}catch(g){const{code:f,message:m,data:p}=g;try{if(f){const h={};h[c(377)]=f,h.message=m,h.data=p;const v={};v[c(348)]=h,v.jsonrpc=d[l(338)],v.id=a.id,await((s=t==null?void 0:t.transport)==null?void 0:s[c(392)](v))}else(n=(r=t==null?void 0:t.transport)==null?void 0:r[c(339)])==null||n.call(r,g)}catch(h){(o=(i=t==null?void 0:t[l(371)])==null?void 0:i[c(339)])==null||o.call(i,h)}}},N0=(t,e)=>async a=>{var s,r,n;const i=xe,o=xe,l={};l.dtUgZ=function(g,f){return g!==f},l.jgCIb=i(353),l.uUjKY="2.0";const c=l,{method:u,params:d}=a;if(c.dtUgZ(u,c.jgCIb)&&(u!==i(400)||d!=null&&d.forward))try{const g={...a};g[i(394)]=c[o(352)],await((s=e==null?void 0:e[i(371)])==null?void 0:s[i(392)](g))}catch(g){(n=(r=t==null?void 0:t[i(371)])==null?void 0:r[o(339)])==null||n.call(r,g)}};function xe(t,e){const a=hn();return xe=function(s,r){return s=s-(9*-113+-1439*-1+-97),a[s]},xe(t,e)}const A0=(t,e)=>async a=>{var s,r,n,i,o,l;const c=xe,u=xe,d={};d[c(401)]=u(332);const g=d;try{await((s=e==null?void 0:e.transport)==null?void 0:s.send(a))}catch(f){const{code:m,message:p,data:h}=f;try{if(m){const v={};v.code=m,v[c(399)]=p,v.data=h;const b={};b[c(348)]=v,b[c(394)]=g.OhJjz,b.id=a.id,await((r=t==null?void 0:t[c(371)])==null?void 0:r.send(b))}else(i=(n=t==null?void 0:t.transport)==null?void 0:n[u(339)])==null||i.call(n,f)}catch(v){(l=(o=t==null?void 0:t.transport)==null?void 0:o.onerror)==null||l.call(o,v)}}},Xo=()=>{const t=xe,e=xe,a={vnkqu:function(c,u){return c!==u},wxDWr:function(c,u){return c(u)},GdkkV:function(c,u){return c===u}},s=[],r=(c,u)=>{const d=xe,g=xe;if(u){const f=[];for(const m of s)try{f.push(m(c,u))}catch{}for(const m of f)if(a[d(379)](m,null))return m}else for(const f of s)try{a[g(343)](f,c)}catch{}},n=c=>{const u=xe;a[u(384)](typeof c,u(369))&&!s.includes(c)&&s.push(c)},i=c=>{const u=s.indexOf(c);u!==-1&&s.splice(u,1*-6854+8*-33+7119)},o=()=>{const c=xe;s[c(374)]=7102*1+5522+-526*24},l={};return l[t(346)]=r,l[e(330)]=n,l.removeListener=i,l[t(359)]=o,l},j0=t=>{const e=xe,a=xe,s={xwPeb:function(r){return r()},Mfvzm:function(r){return r()}};{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[e(326)](Xo);t._onresponse=r,t[e(395)]=n,t.removeResponseListener=i,t.clearResponseListener=o}{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[a(326)](Xo);t[a(328)]=r,t.addRequestListener=n,t[a(354)]=i,t[a(341)]=o}{const{handleListener:r,addListener:n,removeListener:i,clearListener:o}=s[e(375)](Xo);t[e(342)]=r,t[e(327)]=n,t.removeNotificationListener=i,t.clearNotificationListener=o}};function hn(){const t=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return hn=function(){return t},hn()}const D0=(t,{beforeInit:e,afterInit:a}={})=>{const s=xe,r=xe,n={tqDZP:function(o,l){return o===l},cjSoZ:"function",iQqcJ:s(378),Zybtx:function(o,l){return o(l)},ElOQH:function(o){return o()}},i=new Map(t._notificationHandlers);t[s(393)][s(402)](),t._notificationHandlers[s(402)](),n.tqDZP(typeof e,n[s(380)])&&e(),n[s(362)](t._onresponse.name,n[s(360)])&&(t[r(349)]=t._onresponse),n[s(347)](j0,t),t.addResponseListener(o=>{const l=r;t.originalOnResponse[l(386)](t,o)}),n.tqDZP(typeof a,n[r(380)])&&n[s(397)](a),t[r(327)](o=>{const{method:l}=o,c=i.get(l);n.tqDZP(typeof c,n.cjSoZ)&&c(o)})},M0=Wt,L0=Wt;(function(t,e){const a=Wt,s=Wt,r=t();for(;;)try{if(-parseInt(a(393))/1+parseInt(a(397))/2*(-parseInt(a(400))/3)+-parseInt(s(398))/4+parseInt(a(390))/5*(parseInt(s(388))/6)+-parseInt(a(389))/7+-parseInt(a(402))/8*(-parseInt(s(395))/9)+parseInt(s(399))/10*(parseInt(s(385))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(pn,-1*-881393+2*180895+1*-644809);function Wt(t,e){const a=pn();return Wt=function(s,r){return s=s-(-1861+-499*4+4241),a[s]},Wt(t,e)}function pn(){const t=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return pn=function(){return t},pn()}const F0=()=>{const t=Wt,e=Wt,a={};a.REzPF=function(r,n){return r&n},a.suJHI=function(r,n){return r===n},a[t(386)]=function(r,n){return r&n},a[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const s=a;return s.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():s.dHTfU.replace(/[xy]/g,r=>{const n=t,i=t,o=s[n(392)](crypto[n(384)](new Uint8Array(-25*-62+7113+2*-4331))[741*2+-1385*-2+4252*-1],8648+-107*62+-1999);return(s.suJHI(r,"x")?o:s[i(386)](o,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},q0=t=>{const e=Wt,a=Wt,s=new Uint8Array(t);return crypto.getRandomValues(s),Array[e(401)](s,r=>r[a(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},Sr={};Sr[M0(391)]=F0,Sr[L0(396)]=q0;const yt=Jt;(function(t,e){const a=Jt,s=Jt,r=t();for(;;)try{if(parseInt(a(521))/1*(parseInt(s(499))/2)+parseInt(s(543))/3*(parseInt(s(514))/4)+parseInt(a(502))/5*(parseInt(s(539))/6)+parseInt(a(553))/7+parseInt(a(516))/8*(-parseInt(a(518))/9)+-parseInt(a(531))/10+-parseInt(a(545))/11*(parseInt(a(541))/12)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(mn,1472653*1+-2*-897917+-2275789);const U0=(t,e)=>{const a=Jt,s=Jt,r={FyYHt:function(l,c,u){return l(c,u)},Fxtoq:function(l,c,u){return l(c,u)}};I0(t,e),C0(t,e);const n=O0(e,t),i=r[a(510)](A0,e,t),o=r[s(549)](N0,e,t);e[s(537)](n),e[a(519)](i),e.addNotificationListener(o),t[s(556)]=()=>{const l=s;e.removeRequestListener(n),e[l(530)](i),e[l(529)](o)}},ec=(t,e,a)=>{const s=Jt,r={pMiva:function(o,l){return o instanceof l},TeTEy:s(546),fyZbd:function(o,l,c){return o(l,c)}},n=()=>{var o;const l=s;r.pMiva(a,as)&&((o=a._eventSource)==null||o.addEventListener(r[l(547)],()=>{var c;const u=l;(c=a[u(509)])==null||c[u(546)]()})),U0(t,e)},i={};i.afterInit=n,r.fyZbd(D0,e,i)},Ed=(t,e=Sr.randomUUID())=>{const a=Jt,s=Jt,r={OfssH:function(u,d,g){return u(d,g)}},n={};n[a(528)]=e;const i=n,o={};o[a(528)]=e;const l={};l[s(558)]=o,l[a(534)]=a(524);const c={requestInit:l,eventSourceInit:{async fetch(u,d){const g=a,f=s,m=new Headers((d==null?void 0:d[g(558)])||{});Object.entries(i)[f(498)](([h,v])=>{m[f(527)](h,v)});const p={...d};return p[f(558)]=m,r.OfssH(fetch,u,p)},withCredentials:!0}};return t&&(c.requestInit[a(558)].Authorization=a(533)+t,i.Authorization="Bearer "+t),c},Sd=(t,e=Sr[yt(517)]())=>{const a=yt,s=yt,r={};r.nwQhY="include";const n=r,i={};i["stream-session-id"]=e;const o={};o.headers=i,o.credentials=n[a(520)];const l={};l[a(544)]=o;const c=l;return t&&(c.requestInit.headers[s(552)]=s(533)+t),c},tc=async(t,e,a)=>{const s=yt,r=yt,n={CFfFC:function(o){return o()},egwVO:function(o,l,c,u){return o(l,c,u)}},i=n.CFfFC(a);try{return await t[s(538)](i),i}catch(o){if(o instanceof jt){const l=await e();return await i[r(505)](l),await n[s(525)](tc,t,e,a)}else throw o}};function Jt(t,e){const a=mn();return Jt=function(s,r){return s=s-(74*-67+-8341+-73*-189),a[s]},Jt(t,e)}const Rd=(t,e)=>{const a=yt,s=yt,r={};r.RsKXs=function(i,o){return i in o},r.PBhps="waitForOAuthCode",r[a(535)]="function",r[a(507)]="waitForOAuthCode need to be provided when authProvider is provided";const n=r;if(n.RsKXs(n[s(551)],t))return t[s(523)];if(typeof e===n.yTKoP)return e;throw new Error(n.RZhOv)},V0=async t=>{const e=yt,a=yt,s={TFSRn:function(D,W,J){return D(W,J)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(D){return D()},WIVYl:function(D,W,J,H){return D(W,J,H)},jniGY:"sessionId"},{client:r,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,eventSourceInit:u,waitForOAuthCode:d}=t,g={};g.authProvider=l,g.requestInit=c,g.eventSourceInit=u;const f=g,m=o||Sr.randomUUID(),p=s[e(506)](Ed,i,m);if(c){const D={...p.requestInit,...c};D.headers={...p[e(544)].headers,...c.headers},f.requestInit=D}else f[a(544)]=p.requestInit;if(u){const D={...p[e(559)],...u};f.eventSourceInit=D}else f.eventSourceInit=p.eventSourceInit;const h={};h.listChanged=!0;const v={};v.roots=h,v.sampling={},v[e(511)]={};const b=v,P={};P[a(536)]=s.HwvVa,P.version=e(526);const S={};S.capabilities=b;const x=new Ya(P,S),A=()=>new as(new URL(n),f);let z=s[a(504)](A);if(l){const D=s[e(506)](Rd,l,d);z=await s[a(513)](tc,x,D,A)}else await x[e(538)](z);s[a(513)](ec,x,r,z),z[a(557)]=z[a(542)].searchParams[a(532)](s.jniGY);const U={};return U.transport=z,U.sessionId=z[e(557)],U};function mn(){const t=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return mn=function(){return t},mn()}const z0=async t=>{const e=yt,a=yt,s={Vajmx:e(500),biJOc:function(D){return D()},zXcpO:function(D,W,J){return D(W,J)},zDnjZ:function(D,W,J,H){return D(W,J,H)},FQMAh:function(D,W,J,H){return D(W,J,H)}},{client:r,url:n,token:i,sessionId:o,authProvider:l,requestInit:c,reconnectionOptions:u,waitForOAuthCode:d}=t,g={};g.authProvider=l,g.requestInit=c,g.reconnectionOptions=u;const f=g,m=o||Sr.randomUUID(),p=Sd(i,m);if(c){const D={...p.requestInit,...c};D.headers={...p.requestInit.headers,...c.headers},f[e(544)]=D}else f.requestInit=p.requestInit;const h={};h.listChanged=!0;const v={};v[a(550)]=h,v.sampling={},v.elicitation={};const b=v,P={};P[e(536)]=s[a(508)],P[e(555)]="1.0.0";const S={};S.capabilities=b;const x=new Ya(P,S),A=()=>new un(new URL(n),f);let z=s[e(503)](A);if(l){const D=s[e(501)](Rd,l,d);z=await s.zDnjZ(tc,x,D,A)}else await x.connect(z);s.FQMAh(ec,x,r,z);const U={};return U.transport=z,U[a(557)]=z.sessionId,U},H0=async t=>{const e=yt,a=yt,s={QgzDy:e(540),jkaVB:function(v,b,P,S){return v(b,P,S)}},{client:r,url:n,token:i,sessionId:o}=t,l={};l.listChanged=!0;const c={};c[e(550)]=l,c[e(515)]={},c[a(511)]={};const u=c,d={};d.name=s[a(548)],d[a(555)]=a(526);const g={};g.capabilities=u;const f=new Ya(d,g),m=o||Sr[a(517)](),p=new $d(new URL(n+e(522)+m+a(554)+i));await f.connect(p),s.jkaVB(ec,f,r,p);const h={};return h[e(512)]=p,h[a(557)]=m,h},ss=vt,vn=vt;function vt(t,e){const a=gn();return vt=function(s,r){return s=s-(-16761+51*337),a[s]},vt(t,e)}(function(t,e){const a=vt,s=vt,r=t();for(;;)try{if(-parseInt(a(440))/1+-parseInt(a(458))/2*(parseInt(a(448))/3)+-parseInt(a(451))/4*(parseInt(s(449))/5)+-parseInt(s(455))/6+-parseInt(a(427))/7+-parseInt(s(438))/8*(parseInt(s(459))/9)+parseInt(a(430))/10*(parseInt(s(436))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(gn,-220880+1*-333337+-2*-384996);function gn(){const t=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return gn=function(){return t},gn()}const Z0=()=>Sr.randomBytes(3485*1+-261+-3184);class K0{constructor(e){const a=vt,s=vt;this._callBackPromise={};const{clientMetadata:r,state:n,redirectCallback:i,getAuthCodeByState:o,waitForOAuthCode:l}=e;this[a(428)]=r,this[a(454)]=r[a(445)][0],this._state=n||Z0(),this._redirectCallback=i||this.redirectCallbackFunction,this._getAuthCodeByState=o||this.getAuthCodeByStateFunction,this[s(426)]=l||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var a,s,r,n,i,o;const l=vt,c=vt,u={qITTp:function(m,p,h){return m(p,h)},qcFPW:l(452)},d=await u.qITTp(fetch,e,{method:u[l(453)]});!d.ok&&((s=(a=this._callBackPromise).reject)==null||s.call(a,c(446)+d.statusText));const g=await this._getAuthCodeByState(this[c(454)],this[l(442)]);if(!g.ok){(n=(r=this[l(433)]).reject)==null||n.call(r,"Failed to fetch auth code: "+g.statusText);return}const f=await g[l(431)]();(o=(i=this[c(433)])[l(456)])==null||o.call(i,f[l(432)])}async getAuthCodeByStateFunction(e,a){const s=vt,r=vt,n={};n.tuSmb=s(429);const i=n,o={};o[s(460)]=i.tuSmb;const l={};return l[r(441)]=a,fetch(e,{method:"POST",headers:o,body:new URLSearchParams(l)})}waitForOAuthCodeFunction(){const e=vt,a=this[e(433)];return()=>new Promise((s,r)=>{const n=e;a.resolve=s,a[n(434)]=r})}get redirectUrl(){return this[vt(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[ss(447)](){return this[ss(444)]}[vn(435)](e){const a=ss;this[a(444)]=e}[vn(457)](){return this[vn(439)]}saveTokens(e){this._tokens=e}[vn(450)](e){this[ss(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[ss(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(t,e){for(var a=yn,s=yn,r=t();;)try{var n=parseInt(a(361))/1*(parseInt(s(363))/2)+-parseInt(a(358))/3+parseInt(a(359))/4*(parseInt(a(357))/5)+parseInt(s(354))/6*(parseInt(a(360))/7)+parseInt(s(362))/8+parseInt(s(364))/9+-parseInt(s(356))/10*(parseInt(a(355))/11);if(n===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(_n,-73523*-3+1*-407717+530518);function _n(){var t=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return _n=function(){return t},_n()}function yn(t,e){var a=_n();return yn=function(s,r){s=s-(-1*-642+503*-5+2227);var n=a[s];return n},yn(t,e)}class B0 extends wu{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(Jl,r=>this._oninitialize(r)),this.setNotificationHandler(Fi,()=>{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=$u(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:ql.includes(a)?a:Wa,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"},br)}async createMessage(e,a){return this.request({method:"sampling/createMessage",params:e},Xi,a)}async elicitInput(e,a){const s=await this.request({method:"elicitation/create",params:e},eo,a);if(s.action==="accept"&&s.content)try{const r=new ud,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ae(Ie.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ae?r:new Ae(Ie.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,a){return this.request({method:"roots/list",params:e},ro,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 W0=Symbol("Let zodToJsonSchema decide on which parser to use"),kd={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"},J0=t=>typeof t=="string"?{...kd,name:t}:{...kd,...t},Q0=t=>{const e=J0(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 xd(t,e,a,s){s!=null&&s.errorMessages&&a&&(t.errorMessage={...t.errorMessage,[e]:a})}function Re(t,e,a,s,r){t[e]=a,xd(t,e,s,r)}const Td=(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 gt(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Td(e,t.currentPath):e.join("/")}}function G0(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)!==V.ZodAny&&(a.items=Se(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Re(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(a,"minItems",t.exactLength.value,t.exactLength.message,e),Re(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}function Y0(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?Re(a,"minimum",s.value,s.message,e):Re(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Re(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(a,"maximum",s.value,s.message,e):Re(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Re(a,"maximum",s.value,s.message,e));break;case"multipleOf":Re(a,"multipleOf",s.value,s.message,e);break}return a}function X0(){return{type:"boolean"}}function Id(t,e){return Se(t.type._def,e)}const eb=(t,e)=>Se(t.innerType._def,e);function Cd(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Cd(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 tb(t,e)}}const tb=(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":Re(a,"minimum",s.value,s.message,e);break;case"max":Re(a,"maximum",s.value,s.message,e);break}return a};function rb(t,e){return{...Se(t.innerType._def,e),default:t.defaultValue()}}function ab(t,e){return e.effectStrategy==="input"?Se(t.schema._def,e):gt(e)}function sb(t){return{type:"string",enum:Array.from(t.values)}}const nb=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function ib(t,e){const a=[Se(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Se(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(nb(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,...l}=n;i=l}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function ob(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 rc;const Dt={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:()=>(rc===void 0&&(rc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rc),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 Od(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Re(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e);break;case"max":Re(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":Mt(a,"email",s.message,e);break;case"format:idn-email":Mt(a,"idn-email",s.message,e);break;case"pattern:zod":dt(a,Dt.email,s.message,e);break}break;case"url":Mt(a,"uri",s.message,e);break;case"uuid":Mt(a,"uuid",s.message,e);break;case"regex":dt(a,s.regex,s.message,e);break;case"cuid":dt(a,Dt.cuid,s.message,e);break;case"cuid2":dt(a,Dt.cuid2,s.message,e);break;case"startsWith":dt(a,RegExp(`^${ac(s.value,e)}`),s.message,e);break;case"endsWith":dt(a,RegExp(`${ac(s.value,e)}$`),s.message,e);break;case"datetime":Mt(a,"date-time",s.message,e);break;case"date":Mt(a,"date",s.message,e);break;case"time":Mt(a,"time",s.message,e);break;case"duration":Mt(a,"duration",s.message,e);break;case"length":Re(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,s.message,e),Re(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value,s.message,e);break;case"includes":{dt(a,RegExp(ac(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Mt(a,"ipv4",s.message,e),s.version!=="v4"&&Mt(a,"ipv6",s.message,e);break}case"base64url":dt(a,Dt.base64url,s.message,e);break;case"jwt":dt(a,Dt.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&dt(a,Dt.ipv4Cidr,s.message,e),s.version!=="v4"&&dt(a,Dt.ipv6Cidr,s.message,e);break}case"emoji":dt(a,Dt.emoji(),s.message,e);break;case"ulid":{dt(a,Dt.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Mt(a,"binary",s.message,e);break}case"contentEncoding:base64":{Re(a,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{dt(a,Dt.base64,s.message,e);break}}break}case"nanoid":dt(a,Dt.nanoid,s.message,e)}return a}function ac(t,e){return e.patternStrategy==="escape"?lb(t):t}const cb=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function lb(t){let e="";for(let a=0;a<t.length;a++)cb.has(t[a])||(e+="\\"),e+=t[a];return e}function Mt(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}}})):Re(t,"format",e,a,s)}function dt(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:Nd(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):Re(t,"pattern",Nd(e,s),a,s)}function Nd(t,e){var l;if(!e.applyRegexFlags||!t.flags)return t.source;const a={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=a.i?t.source.toLowerCase():t.source;let r="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(a.i){if(i){if(s[c].match(/[a-z]/)){o?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&((l=s[c+2])!=null&&l.match(/[a-z]/))?(r+=s[c],o=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(a.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
13
13
|
]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
|
|
14
14
|
]))`;continue}}if(a.s&&s[c]==="."){r+=i?`${s[c]}\r
|
|
15
15
|
`:`[${s[c]}\r
|
|
16
|
-
]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(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 Ad(t,e){var s,r,n,i,o,l;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=t.keyType)==null?void 0:s._def.typeName)===V.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,u)=>({...c,[u]:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??gt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Se(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)===V.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:c,...u}=Od(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===V.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((o=t.keyType)==null?void 0:o._def.typeName)===V.ZodBranded&&t.keyType._def.type._def.typeName===V.ZodString&&((l=t.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=Id(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function uw(t,e){if(e.mapStrategy==="record")return Ad(t,e);const a=Se(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||gt(e),s=Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||gt(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function dw(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 fw(t){return t.target==="openAi"?void 0:{not:gt({...t,currentPath:[...t.currentPath,"not"]})}}function hw(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const bn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pw(t,e){if(e.target==="openApi3")return jd(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in bn&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=bn[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 jd(t,e)}const jd=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Se(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 mw(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:bn[t.innerType._def.typeName],nullable:!0}:{type:[bn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Se(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function vw(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",xd(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?Re(a,"minimum",s.value,s.message,e):Re(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Re(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(a,"maximum",s.value,s.message,e):Re(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Re(a,"maximum",s.value,s.message,e));break;case"multipleOf":Re(a,"multipleOf",s.value,s.message,e);break}return a}function gw(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const o in n){let l=n[o];if(l===void 0||l._def===void 0)continue;let c=yw(l);c&&a&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Se(l._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(s.properties[o]=u,c||r.push(o))}r.length&&(s.required=r);const i=_w(t,e);return i!==void 0&&(s.additionalProperties=i),s}function _w(t,e){if(t.catchall._def.typeName!=="ZodNever")return Se(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 yw(t){try{return t.isOptional()}catch{return!0}}const ww=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Se(t.innerType._def,e);const a=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:gt(e)},a]}:gt(e)},bw=(t,e)=>{if(e.pipeStrategy==="input")return Se(t.in._def,e);if(e.pipeStrategy==="output")return Se(t.out._def,e);const a=Se(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Se(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function $w(t,e){return Se(t.type._def,e)}function Pw(t,e){const s={type:"array",uniqueItems:!0,items:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Re(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function Ew(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Se(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Se(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Se(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Sw(t){return{not:gt(t)}}function Rw(t){return gt(t)}const kw=(t,e)=>Se(t.innerType._def,e),xw=(t,e,a)=>{switch(e){case V.ZodString:return Od(t,a);case V.ZodNumber:return vw(t,a);case V.ZodObject:return gw(t,a);case V.ZodBigInt:return Y0(t,a);case V.ZodBoolean:return X0();case V.ZodDate:return Cd(t,a);case V.ZodUndefined:return Sw(a);case V.ZodNull:return hw(a);case V.ZodArray:return G0(t,a);case V.ZodUnion:case V.ZodDiscriminatedUnion:return pw(t,a);case V.ZodIntersection:return iw(t,a);case V.ZodTuple:return Ew(t,a);case V.ZodRecord:return Ad(t,a);case V.ZodLiteral:return ow(t,a);case V.ZodEnum:return sw(t);case V.ZodNativeEnum:return dw(t);case V.ZodNullable:return mw(t,a);case V.ZodOptional:return ww(t,a);case V.ZodMap:return uw(t,a);case V.ZodSet:return Pw(t,a);case V.ZodLazy:return()=>t.getter()._def;case V.ZodPromise:return $w(t,a);case V.ZodNaN:case V.ZodNever:return fw(a);case V.ZodEffects:return aw(t,a);case V.ZodAny:return gt(a);case V.ZodUnknown:return Rw(a);case V.ZodDefault:return rw(t,a);case V.ZodBranded:return Id(t,a);case V.ZodReadonly:return kw(t,a);case V.ZodCatch:return ew(t,a);case V.ZodPipeline:return bw(t,a);case V.ZodFunction:case V.ZodVoid:case V.ZodSymbol:return;default:return(s=>{})()}};function Se(t,e,a=!1){var o;const s=e.seen.get(t);if(e.override){const l=(o=e.override)==null?void 0:o.call(e,t,e,s,a);if(l!==W0)return l}if(s&&!a){const l=Tw(s,e);if(l!==void 0)return l}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=xw(t,t.typeName,e),i=typeof n=="function"?Se(n(),e):n;if(i&&Iw(t,e,i),e.postProcess){const l=e.postProcess(i,t,e);return r.jsonSchema=i,l}return r.jsonSchema=i,i}const Tw=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Td(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`),gt(e)):e.$refStrategy==="seen"?gt(e):void 0}},Iw=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),Dd=(t,e)=>{const a=Q0(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Se(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,c]},!0)??gt(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Se(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??gt(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};var sc;(function(t){t.Completable="McpCompletable"})(sc||(sc={}));class $n extends me{_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}}$n.create=(t,e)=>new $n({type:t,typeName:sc.Completable,complete:e.complete,...Ow(e)});function Cw(t,e){return $n.create(t,{...t._def,complete:e})}function Ow(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 l,c;const{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=u??a)!==null&&c!==void 0?c:o.defaultError}},description:r}}const Md=1e6,nc=1e6,Ld=1e4,Nw=1e6;class cr{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){cr.validateLength(e,Md,"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>Ld)throw new Error(`Template contains too many expressions (max ${Ld})`);const o=e.slice(r+1,i),l=this.getOperator(o),c=o.includes("*"),u=this.getNames(o),d=u[0];for(const v of u)cr.validateLength(v,nc,"Variable name");a.push({name:d,operator:l,names:u,exploded:c}),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 cr.validateLength(e,nc,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(l=>{const c=a[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(c.toString(),e.operator);return`${l}=${u}`}).filter(l=>l.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)cr.validateLength(n,nc,"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){cr.validateLength(e,Md,"URI");let a="^";const s=[];for(const o of this.parts)if(typeof o=="string")a+=this.escapeRegExp(o);else{const l=this.partToRegExp(o);for(const{pattern:c,name:u}of l)a+=c,s.push({name:u,exploded:o.exploded})}a+="$",cr.validateLength(a,Nw,"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:l,exploded:c}=s[o],u=n[o+1],d=l.replace("*","");c&&u.includes(",")?i[d]=u.split(","):i[d]=u}return i}}class Fd{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 B0(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Gi.shape.method.value),this.server.assertCanSetRequestHandler(Yi.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Gi,()=>({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?Dd(a.inputSchema,{strictUnions:!0}):jw,annotations:a.annotations};return a.outputSchema&&(s.outputSchema=Dd(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Yi,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new Ae(Ie.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new Ae(Ie.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 Ae(Ie.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(l){r={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(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 Ae(Ie.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 Ae(Ie.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ro.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ro,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 Ae(Ie.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,a){const s=this._registeredPrompts[a.name];if(!s)throw new Ae(Ie.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new Ae(Ie.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return Pn;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof $n))return Pn;const i=await r._def.complete(e.params.argument.value,e.params.context);return Ud(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 Pn;throw new Ae(Ie.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Pn;const n=await r(e.params.argument.value,e.params.context);return Ud(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(zs.shape.method.value),this.server.assertCanSetRequestHandler(Hi.shape.method.value),this.server.assertCanSetRequestHandler(Zi.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(zs,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(Hi,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(Zi,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new Ae(Ie.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 Ae(Ie.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ki.shape.method.value),this.server.assertCanSetRequestHandler(Bi.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ki,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,a])=>({name:e,title:a.title,description:a.description,arguments:a.argsSchema?Mw(a.argsSchema):void 0}))})),this.server.setRequestHandler(Bi,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new Ae(Ie.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new Ae(Ie.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new Ae(Ie.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:Z(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=Z(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 l={title:a,description:s,inputSchema:r===void 0?void 0:Z(r),outputSchema:n===void 0?void 0:Z(n),annotations:i,callback:o,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==e&&(delete this._registeredTools[e],c.name&&(this._registeredTools[c.name]=l)),typeof c.title<"u"&&(l.title=c.title),typeof c.description<"u"&&(l.description=c.description),typeof c.paramsSchema<"u"&&(l.inputSchema=Z(c.paramsSchema)),typeof c.callback<"u"&&(l.callback=c.callback),typeof c.annotations<"u"&&(l.annotations=c.annotations),typeof c.enabled<"u"&&(l.enabled=c.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const l=a[0];qd(l)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!qd(a[0])&&(i=a.shift())):typeof l=="object"&&l!==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:l}=a;return this._createRegisteredTool(e,r,n,i,o,l,s)}prompt(e,...a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof a[0]=="string"&&(s=a.shift());let r;a.length>1&&(r=a.shift());const n=a[0],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 Aw{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new cr(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 jw={type:"object",properties:{}};function qd(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Dw)}function Dw(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Mw(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function Ud(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const Pn={completion:{values:[],hasMore:!1}};class Lw{constructor(e,a){const s={name:"web-mcp-server",version:"1.0.0"},r={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new Fd(e||s,a||{capabilities:r}),this.server.server.oninitialized=()=>{var n;(n=this.oninitialized)==null||n.call(this)},this.server.server.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.server.server.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)},this.server.server.setRequestHandler(Xi,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new Xo(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,a,s){return this.server.registerTool(e,a,s)}registerPrompt(e,a,s){return this.server.registerPrompt(e,a,s)}registerResource(e,a,s,r){return typeof a=="string"?this.server.registerResource(e,a,s,r):this.server.registerResource(e,a,s,r)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,a){return await this.server.server.createMessage(e,a)}async elicitInput(e,a){return await this.server.server.elicitInput(e,a)}async listRoots(e,a){return await this.server.server.listRoots(e,a)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,a,s){return this.server.server.request(e,a,s)}async notification(e,a){return await this.server.server.notification(e,a)}setRequestHandler(e,a){this.server.server.setRequestHandler(e,a)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,a){this.server.server.setNotificationHandler(e,a)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(nu,e)}onUnsubscribe(e){this.server.server.setRequestHandler(iu,e)}onSetLogLevel(e){this.server.server.setRequestHandler(Xi,e)}onListResources(e){this.server.server.setRequestHandler(zs,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(wu,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const Fw=(t,e)=>new Xo(t,e),qw=()=>k0(),Uw=t=>t instanceof Xo,Vw=t=>t instanceof Fd;class zw{constructor(e,a){const s={name:"web-mcp-client",version:"1.0.0"},r={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new Xa(e||s,a||{capabilities:r}),this.client.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.client.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:a,token:s,sessionId:r,authProvider:n,type:i,agent:o,onError:l,onUnauthorized:c,onReconnect:u}=e;if(o===!0){const f={client:this.client,url:a,token:s,sessionId:r,authProvider:n};let m=!1,p;const h=async()=>{const{transport:g,sessionId:w}=i==="sse"?await V0(f):i==="socket"?await H0(f):await z0(f);g.onerror=async P=>{l==null||l(P),P.message==="Unauthorized"&&!m&&(typeof c=="function"?await c(h):(m=!0,await h(),m=!1,await(u==null?void 0:u())))},p={transport:g,sessionId:w}};return await h(),p}const d=new URL(a);let v;if(i==="channel"&&(v=new Yo(a),await this.client.connect(v)),i==="sse")if(n){const f=()=>new ga(d,{authProvider:n});v=await ns(this.client,n.waitForOAuthCode,f)}else{const f=Ed(s,r);v=new ga(d,f),await this.client.connect(v)}if(i==="socket"&&(v=new $d(new URL(`${a}?sessionId=${r}&token=${s}`)),v.sessionId=r,await this.client.connect(v)),typeof v>"u")if(n){const f=()=>new ss(d,{authProvider:n});v=await ns(this.client,n.waitForOAuthCode,f)}else{const f=Sd(s,r);v=new ss(d,f),await this.client.connect(v)}return this.transport=v,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,a){return await this.client.complete(e,a)}async setLoggingLevel(e,a){return await this.client.setLoggingLevel(e,a)}async getPrompt(e,a){return await this.client.getPrompt(e,a)}async listPrompts(e,a){return await this.client.listPrompts(e,a)}async listResources(e,a){return await this.client.listResources(e,a)}async listResourceTemplates(e,a){return await this.client.listResourceTemplates(e,a)}async readResource(e,a){return await this.client.readResource(e,a)}async subscribeResource(e,a){return await this.client.subscribeResource(e,a)}async unsubscribeResource(e,a){return await this.client.unsubscribeResource(e,a)}async callTool(e,a){return await this.client.callTool(e,Hs,a)}async listTools(e,a){return await this.client.listTools(e,a)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,a,s){return this.client.request(e,a,s)}async notification(e,a){return await this.client.notification(e,a)}setRequestHandler(e,a){this.client.setRequestHandler(e,a)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,a){this.client.setNotificationHandler(e,a)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler(gu,e)}onCreateMessage(e){this.client.setRequestHandler(vu,e)}onListRoots(e){this.client.setRequestHandler(yu,e)}onToolListChanged(e){this.client.setNotificationHandler(hu,e)}onPromptListChanged(e){this.client.setNotificationHandler(du,e)}onResourceListChanged(e){this.client.setNotificationHandler(su,e)}onResourceUpdated(e){this.client.setNotificationHandler(ou,e)}onLoggingMessage(e){this.client.setNotificationHandler(mu,e)}async onPagehide(e){e.persisted||(Vd(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const Hw=(t,e)=>new ga(t,e),Zw=(t,e)=>new ss(t,e),Kw=(t,e)=>new Yo(t,e),Bw=t=>t instanceof ga,Vd=t=>t instanceof ss,Ww=t=>t instanceof Yo,Jw=t=>t instanceof Xa;function Qw(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}Oe.Ajv=fv,Oe.AuthClientProvider=K0,Oe.ResourceTemplate=Aw,Oe.UriTemplate=cr,Oe.WebMcpClient=zw,Oe.WebMcpServer=Lw,Oe.completable=Cw,Oe.createMessageChannelClientTransport=Kw,Oe.createMessageChannelPairTransport=qw,Oe.createMessageChannelServerTransport=Fw,Oe.createSSEClientTransport=Hw,Oe.createStreamableHTTPClientTransport=Zw,Oe.getDisplayName=Qw,Oe.isMcpClient=Jw,Oe.isMcpServer=Vw,Oe.isMessageChannelClientTransport=Ww,Oe.isMessageChannelServerTransport=Uw,Oe.isSSEClientTransport=Bw,Oe.isStreamableHTTPClientTransport=Vd,Oe.z=ig,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
|
|
16
|
+
]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(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 Ad(t,e){var s,r,n,i,o,l;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=t.keyType)==null?void 0:s._def.typeName)===V.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((c,u)=>({...c,[u]:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",u]})??gt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const a={type:"object",additionalProperties:Se(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)===V.ZodString&&((n=t.keyType._def.checks)!=null&&n.length)){const{type:c,...u}=Od(t.keyType._def,e);return{...a,propertyNames:u}}else{if(((i=t.keyType)==null?void 0:i._def.typeName)===V.ZodEnum)return{...a,propertyNames:{enum:t.keyType._def.values}};if(((o=t.keyType)==null?void 0:o._def.typeName)===V.ZodBranded&&t.keyType._def.type._def.typeName===V.ZodString&&((l=t.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=Id(t.keyType._def,e);return{...a,propertyNames:u}}}return a}function ub(t,e){if(e.mapStrategy==="record")return Ad(t,e);const a=Se(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||gt(e),s=Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||gt(e);return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function db(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 fb(t){return t.target==="openAi"?void 0:{not:gt({...t,currentPath:[...t.currentPath,"not"]})}}function hb(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const bn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pb(t,e){if(e.target==="openApi3")return jd(t,e);const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in bn&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=bn[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 jd(t,e)}const jd=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>Se(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 mb(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:bn[t.innerType._def.typeName],nullable:!0}:{type:[bn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const s=Se(t.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}const a=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function vb(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",xd(a,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?Re(a,"minimum",s.value,s.message,e):Re(a,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(a.exclusiveMinimum=!0),Re(a,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?Re(a,"maximum",s.value,s.message,e):Re(a,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(a.exclusiveMaximum=!0),Re(a,"maximum",s.value,s.message,e));break;case"multipleOf":Re(a,"multipleOf",s.value,s.message,e);break}return a}function gb(t,e){const a=e.target==="openAi",s={type:"object",properties:{}},r=[],n=t.shape();for(const o in n){let l=n[o];if(l===void 0||l._def===void 0)continue;let c=yb(l);c&&a&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Se(l._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});u!==void 0&&(s.properties[o]=u,c||r.push(o))}r.length&&(s.required=r);const i=_b(t,e);return i!==void 0&&(s.additionalProperties=i),s}function _b(t,e){if(t.catchall._def.typeName!=="ZodNever")return Se(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 yb(t){try{return t.isOptional()}catch{return!0}}const bb=(t,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return Se(t.innerType._def,e);const a=Se(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return a?{anyOf:[{not:gt(e)},a]}:gt(e)},wb=(t,e)=>{if(e.pipeStrategy==="input")return Se(t.in._def,e);if(e.pipeStrategy==="output")return Se(t.out._def,e);const a=Se(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Se(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function $b(t,e){return Se(t.type._def,e)}function Pb(t,e){const s={type:"array",uniqueItems:!0,items:Se(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Re(s,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(s,"maxItems",t.maxSize.value,t.maxSize.message,e),s}function Eb(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>Se(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:Se(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>Se(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Sb(t){return{not:gt(t)}}function Rb(t){return gt(t)}const kb=(t,e)=>Se(t.innerType._def,e),xb=(t,e,a)=>{switch(e){case V.ZodString:return Od(t,a);case V.ZodNumber:return vb(t,a);case V.ZodObject:return gb(t,a);case V.ZodBigInt:return Y0(t,a);case V.ZodBoolean:return X0();case V.ZodDate:return Cd(t,a);case V.ZodUndefined:return Sb(a);case V.ZodNull:return hb(a);case V.ZodArray:return G0(t,a);case V.ZodUnion:case V.ZodDiscriminatedUnion:return pb(t,a);case V.ZodIntersection:return ib(t,a);case V.ZodTuple:return Eb(t,a);case V.ZodRecord:return Ad(t,a);case V.ZodLiteral:return ob(t,a);case V.ZodEnum:return sb(t);case V.ZodNativeEnum:return db(t);case V.ZodNullable:return mb(t,a);case V.ZodOptional:return bb(t,a);case V.ZodMap:return ub(t,a);case V.ZodSet:return Pb(t,a);case V.ZodLazy:return()=>t.getter()._def;case V.ZodPromise:return $b(t,a);case V.ZodNaN:case V.ZodNever:return fb(a);case V.ZodEffects:return ab(t,a);case V.ZodAny:return gt(a);case V.ZodUnknown:return Rb(a);case V.ZodDefault:return rb(t,a);case V.ZodBranded:return Id(t,a);case V.ZodReadonly:return kb(t,a);case V.ZodCatch:return eb(t,a);case V.ZodPipeline:return wb(t,a);case V.ZodFunction:case V.ZodVoid:case V.ZodSymbol:return;default:return(s=>{})()}};function Se(t,e,a=!1){var o;const s=e.seen.get(t);if(e.override){const l=(o=e.override)==null?void 0:o.call(e,t,e,s,a);if(l!==W0)return l}if(s&&!a){const l=Tb(s,e);if(l!==void 0)return l}const r={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,r);const n=xb(t,t.typeName,e),i=typeof n=="function"?Se(n(),e):n;if(i&&Ib(t,e,i),e.postProcess){const l=e.postProcess(i,t,e);return r.jsonSchema=i,l}return r.jsonSchema=i,i}const Tb=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Td(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`),gt(e)):e.$refStrategy==="seen"?gt(e):void 0}},Ib=(t,e,a)=>(t.description&&(a.description=t.description,e.markdownDescription&&(a.markdownDescription=t.description)),a),Dd=(t,e)=>{const a=Q0(e);let s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Se(u._def,{...a,currentPath:[...a.basePath,a.definitionPath,c]},!0)??gt(a)}),{}):void 0;const r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=Se(t._def,r===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??gt(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};var sc;(function(t){t.Completable="McpCompletable"})(sc||(sc={}));class wn extends me{_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}}wn.create=(t,e)=>new wn({type:t,typeName:sc.Completable,complete:e.complete,...Ob(e)});function Cb(t,e){return wn.create(t,{...t._def,complete:e})}function Ob(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 l,c;const{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(l=u??s)!==null&&l!==void 0?l:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=u??a)!==null&&c!==void 0?c:o.defaultError}},description:r}}const Md=1e6,nc=1e6,Ld=1e4,Nb=1e6;class cr{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){cr.validateLength(e,Md,"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>Ld)throw new Error(`Template contains too many expressions (max ${Ld})`);const o=e.slice(r+1,i),l=this.getOperator(o),c=o.includes("*"),u=this.getNames(o),d=u[0];for(const g of u)cr.validateLength(g,nc,"Variable name");a.push({name:d,operator:l,names:u,exploded:c}),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 cr.validateLength(e,nc,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const i=e.names.map(l=>{const c=a[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(c.toString(),e.operator);return`${l}=${u}`}).filter(l=>l.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)cr.validateLength(n,nc,"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){cr.validateLength(e,Md,"URI");let a="^";const s=[];for(const o of this.parts)if(typeof o=="string")a+=this.escapeRegExp(o);else{const l=this.partToRegExp(o);for(const{pattern:c,name:u}of l)a+=c,s.push({name:u,exploded:o.exploded})}a+="$",cr.validateLength(a,Nb,"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:l,exploded:c}=s[o],u=n[o+1],d=l.replace("*","");c&&u.includes(",")?i[d]=u.split(","):i[d]=u}return i}}class Fd{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 B0(e,a)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Qi.shape.method.value),this.server.assertCanSetRequestHandler(Gi.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Qi,()=>({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?Dd(a.inputSchema,{strictUnions:!0}):jb,annotations:a.annotations};return a.outputSchema&&(s.outputSchema=Dd(a.outputSchema,{strictUnions:!0})),s})})),this.server.setRequestHandler(Gi,async(e,a)=>{const s=this._registeredTools[e.params.name];if(!s)throw new Ae(Ie.InvalidParams,`Tool ${e.params.name} not found`);if(!s.enabled)throw new Ae(Ie.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 Ae(Ie.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(l){r={content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}else{const n=s.callback;try{r=await Promise.resolve(n(a))}catch(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 Ae(Ie.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 Ae(Ie.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${n.error.message}`)}return r}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(to.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(to,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 Ae(Ie.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,a){const s=this._registeredPrompts[a.name];if(!s)throw new Ae(Ie.InvalidParams,`Prompt ${a.name} not found`);if(!s.enabled)throw new Ae(Ie.InvalidParams,`Prompt ${a.name} disabled`);if(!s.argsSchema)return $n;const r=s.argsSchema.shape[e.params.argument.name];if(!(r instanceof wn))return $n;const i=await r._def.complete(e.params.argument.value,e.params.context);return Ud(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 $n;throw new Ae(Ie.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const r=s.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return $n;const n=await r(e.params.argument.value,e.params.context);return Ud(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Us.shape.method.value),this.server.assertCanSetRequestHandler(zi.shape.method.value),this.server.assertCanSetRequestHandler(Hi.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Us,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(zi,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([a,s])=>({name:a,uriTemplate:s.resourceTemplate.uriTemplate.toString(),...s.metadata}))})),this.server.setRequestHandler(Hi,async(e,a)=>{const s=new URL(e.params.uri),r=this._registeredResources[s.toString()];if(r){if(!r.enabled)throw new Ae(Ie.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 Ae(Ie.InvalidParams,`Resource ${s} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Zi.shape.method.value),this.server.assertCanSetRequestHandler(Ki.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Zi,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,a])=>({name:e,title:a.title,description:a.description,arguments:a.argsSchema?Mb(a.argsSchema):void 0}))})),this.server.setRequestHandler(Ki,async(e,a)=>{const s=this._registeredPrompts[e.params.name];if(!s)throw new Ae(Ie.InvalidParams,`Prompt ${e.params.name} not found`);if(!s.enabled)throw new Ae(Ie.InvalidParams,`Prompt ${e.params.name} disabled`);if(s.argsSchema){const r=await s.argsSchema.safeParseAsync(e.params.arguments);if(!r.success)throw new Ae(Ie.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:Z(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=Z(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 l={title:a,description:s,inputSchema:r===void 0?void 0:Z(r),outputSchema:n===void 0?void 0:Z(n),annotations:i,callback:o,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==e&&(delete this._registeredTools[e],c.name&&(this._registeredTools[c.name]=l)),typeof c.title<"u"&&(l.title=c.title),typeof c.description<"u"&&(l.description=c.description),typeof c.paramsSchema<"u"&&(l.inputSchema=Z(c.paramsSchema)),typeof c.callback<"u"&&(l.callback=c.callback),typeof c.annotations<"u"&&(l.annotations=c.annotations),typeof c.enabled<"u"&&(l.enabled=c.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let s,r,n,i;if(typeof a[0]=="string"&&(s=a.shift()),a.length>1){const l=a[0];qd(l)?(r=a.shift(),a.length>1&&typeof a[0]=="object"&&a[0]!==null&&!qd(a[0])&&(i=a.shift())):typeof l=="object"&&l!==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:l}=a;return this._createRegisteredTool(e,r,n,i,o,l,s)}prompt(e,...a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let s;typeof a[0]=="string"&&(s=a.shift());let r;a.length>1&&(r=a.shift());const n=a[0],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 Ab{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new cr(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 jb={type:"object",properties:{}};function qd(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Db)}function Db(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Mb(t){return Object.entries(t.shape).map(([e,a])=>({name:e,description:a.description,required:!a.isOptional()}))}function Ud(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const $n={completion:{values:[],hasMore:!1}};class Lb{constructor(e,a){const s={name:"web-mcp-server",version:"1.0.0"},r={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new Fd(e||s,a||{capabilities:r}),this.server.server.oninitialized=()=>{var n;(n=this.oninitialized)==null||n.call(this)},this.server.server.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.server.server.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)},this.server.server.setRequestHandler(Yi,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new Yo(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,a,s){return this.server.registerTool(e,a,s)}registerPrompt(e,a,s){return this.server.registerPrompt(e,a,s)}registerResource(e,a,s,r){return typeof a=="string"?this.server.registerResource(e,a,s,r):this.server.registerResource(e,a,s,r)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,a){return await this.server.server.createMessage(e,a)}async elicitInput(e,a){return await this.server.server.elicitInput(e,a)}async listRoots(e,a){return await this.server.server.listRoots(e,a)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,a,s){return this.server.server.request(e,a,s)}async notification(e,a){return await this.server.server.notification(e,a)}setRequestHandler(e,a){this.server.server.setRequestHandler(e,a)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,a){this.server.server.setNotificationHandler(e,a)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(nu,e)}onUnsubscribe(e){this.server.server.setRequestHandler(iu,e)}onSetLogLevel(e){this.server.server.setRequestHandler(Yi,e)}onListResources(e){this.server.server.setRequestHandler(Us,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(bu,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const Fb=(t,e)=>new Yo(t,e),qb=()=>k0(),Ub=t=>t instanceof Yo,Vb=t=>t instanceof Fd;class zb{constructor(e,a){const s={name:"web-mcp-client",version:"1.0.0"},r={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new Ya(e||s,a||{capabilities:r}),this.client.onclose=()=>{var n;(n=this.onclose)==null||n.call(this)},this.client.onerror=n=>{var i;(i=this.onerror)==null||i.call(this,n)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:a,token:s,sessionId:r,type:n,agent:i,onError:o}=e;if(i===!0){const u={client:this.client,url:a,token:s,sessionId:r};let d;return await(async()=>{const{transport:f,sessionId:m}=n==="sse"?await V0(u):n==="socket"?await H0(u):await z0(u);f.onerror=async p=>{o==null||o(p)},d={transport:f,sessionId:m}})(),d}const l=new URL(a);let c;if(n==="channel"&&(c=new Go(a),await this.client.connect(c)),n==="sse"){const u=Ed(s,r);c=new as(l,u),await this.client.connect(c)}if(n==="socket"&&(c=new $d(new URL(`${a}?sessionId=${r}&token=${s}`)),c.sessionId=r,await this.client.connect(c)),typeof c>"u"){const u=Sd(s,r);c=new un(l,u),await this.client.connect(c)}return this.transport=c,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,a){return await this.client.complete(e,a)}async setLoggingLevel(e,a){return await this.client.setLoggingLevel(e,a)}async getPrompt(e,a){return await this.client.getPrompt(e,a)}async listPrompts(e,a){return await this.client.listPrompts(e,a)}async listResources(e,a){return await this.client.listResources(e,a)}async listResourceTemplates(e,a){return await this.client.listResourceTemplates(e,a)}async readResource(e,a){return await this.client.readResource(e,a)}async subscribeResource(e,a){return await this.client.subscribeResource(e,a)}async unsubscribeResource(e,a){return await this.client.unsubscribeResource(e,a)}async callTool(e,a){return await this.client.callTool(e,Vs,a)}async listTools(e,a){return await this.client.listTools(e,a)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,a,s){return this.client.request(e,a,s)}async notification(e,a){return await this.client.notification(e,a)}setRequestHandler(e,a){this.client.setRequestHandler(e,a)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,a){this.client.setNotificationHandler(e,a)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler(gu,e)}onCreateMessage(e){this.client.setRequestHandler(vu,e)}onListRoots(e){this.client.setRequestHandler(yu,e)}onToolListChanged(e){this.client.setNotificationHandler(hu,e)}onPromptListChanged(e){this.client.setNotificationHandler(du,e)}onResourceListChanged(e){this.client.setNotificationHandler(su,e)}onResourceUpdated(e){this.client.setNotificationHandler(ou,e)}onLoggingMessage(e){this.client.setNotificationHandler(mu,e)}async onPagehide(e){e.persisted||(Vd(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const Hb=(t,e)=>new as(t,e),Zb=(t,e)=>new un(t,e),Kb=(t,e)=>new Go(t,e),Bb=t=>t instanceof as,Vd=t=>t instanceof un,Wb=t=>t instanceof Go,Jb=t=>t instanceof Ya;function Qb(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}Oe.Ajv=fv,Oe.AuthClientProvider=K0,Oe.ResourceTemplate=Ab,Oe.UriTemplate=cr,Oe.WebMcpClient=zb,Oe.WebMcpServer=Lb,Oe.completable=Cb,Oe.createMessageChannelClientTransport=Kb,Oe.createMessageChannelPairTransport=qb,Oe.createMessageChannelServerTransport=Fb,Oe.createSSEClientTransport=Hb,Oe.createStreamableHTTPClientTransport=Zb,Oe.getDisplayName=Qb,Oe.isMcpClient=Jb,Oe.isMcpServer=Vb,Oe.isMessageChannelClientTransport=Wb,Oe.isMessageChannelServerTransport=Ub,Oe.isSSEClientTransport=Bb,Oe.isStreamableHTTPClientTransport=Vd,Oe.z=ig,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
|