emceepee 0.2.0 → 0.2.2

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/dist/mcp-proxy.js DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire as zU}from"node:module";var JU=Object.create;var{getPrototypeOf:GU,defineProperty:RW,getOwnPropertyNames:HU}=Object;var BU=Object.prototype.hasOwnProperty;var CW=(Q,X,W)=>{W=Q!=null?JU(GU(Q)):{};let Y=X||!Q||!Q.__esModule?RW(W,"default",{value:Q,enumerable:!0}):W;for(let $ of HU(Q))if(!BU.call(Y,$))RW(Y,$,{get:()=>Q[$],enumerable:!0});return Y};var M=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var pQ=(Q,X)=>{for(var W in X)RW(Q,W,{get:X[W],enumerable:!0,configurable:!0,set:(Y)=>X[W]=()=>Y})};var KU=zU(import.meta.url);var r4=M((e3)=>{Object.defineProperty(e3,"__esModule",{value:!0});e3.regexpCode=e3.getEsmExportName=e3.getProperty=e3.safeStringify=e3.stringify=e3.strConcat=e3.addCodeArg=e3.str=e3._=e3.nil=e3._Code=e3.Name=e3.IDENTIFIER=e3._CodeOrName=void 0;class d8{}e3._CodeOrName=d8;e3.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class y9 extends d8{constructor(Q){super();if(!e3.IDENTIFIER.test(Q))throw Error("CodeGen: name must be a valid identifier");this.str=Q}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e3.Name=y9;class w1 extends d8{constructor(Q){super();this._items=typeof Q==="string"?[Q]:Q}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Q=this._items[0];return Q===""||Q==='""'}get str(){var Q;return(Q=this._str)!==null&&Q!==void 0?Q:this._str=this._items.reduce((X,W)=>`${X}${W}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((X,W)=>{if(W instanceof y9)X[W.str]=(X[W.str]||0)+1;return X},{})}}e3._Code=w1;e3.nil=new w1("");function a3(Q,...X){let W=[Q[0]],Y=0;while(Y<X.length)E5(W,X[Y]),W.push(Q[++Y]);return new w1(W)}e3._=a3;var b5=new w1("+");function s3(Q,...X){let W=[o4(Q[0])],Y=0;while(Y<X.length)W.push(b5),E5(W,X[Y]),W.push(b5,o4(Q[++Y]));return nj(W),new w1(W)}e3.str=s3;function E5(Q,X){if(X instanceof w1)Q.push(...X._items);else if(X instanceof y9)Q.push(X);else Q.push(tj(X))}e3.addCodeArg=E5;function nj(Q){let X=1;while(X<Q.length-1){if(Q[X]===b5){let W=oj(Q[X-1],Q[X+1]);if(W!==void 0){Q.splice(X-1,3,W);continue}Q[X++]="+"}X++}}function oj(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof y9||Q[Q.length-1]!=='"')return;if(typeof X!="string")return`${Q.slice(0,-1)}${X}"`;if(X[0]==='"')return Q.slice(0,-1)+X.slice(1);return}if(typeof X=="string"&&X[0]==='"'&&!(Q instanceof y9))return`"${Q}${X.slice(1)}`;return}function rj(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:s3`${Q}${X}`}e3.strConcat=rj;function tj(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:o4(Array.isArray(Q)?Q.join(","):Q)}function aj(Q){return new w1(o4(Q))}e3.stringify=aj;function o4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e3.safeStringify=o4;function sj(Q){return typeof Q=="string"&&e3.IDENTIFIER.test(Q)?new w1(`.${Q}`):a3`[${Q}]`}e3.getProperty=sj;function ej(Q){if(typeof Q=="string"&&e3.IDENTIFIER.test(Q))return new w1(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}e3.getEsmExportName=ej;function Qw(Q){return new w1(Q.toString())}e3.regexpCode=Qw});var S5=M((YB)=>{Object.defineProperty(YB,"__esModule",{value:!0});YB.ValueScope=YB.ValueScopeName=YB.Scope=YB.varKinds=YB.UsedValueState=void 0;var t0=r4();class XB extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var o8;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(o8||(YB.UsedValueState=o8={}));YB.varKinds={const:new t0.Name("const"),let:new t0.Name("let"),var:new t0.Name("var")};class I5{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof t0.Name?Q:this.name(Q)}name(Q){return new t0.Name(this._newName(Q))}_newName(Q){let X=this._names[Q]||this._nameGroup(Q);return`${Q}${X.index++}`}_nameGroup(Q){var X,W;if(((W=(X=this._parent)===null||X===void 0?void 0:X._prefixes)===null||W===void 0?void 0:W.has(Q))||this._prefixes&&!this._prefixes.has(Q))throw Error(`CodeGen: prefix "${Q}" is not allowed in this scope`);return this._names[Q]={prefix:Q,index:0}}}YB.Scope=I5;class Z5 extends t0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:W}){this.value=Q,this.scopePath=t0._`.${new t0.Name(X)}[${W}]`}}YB.ValueScopeName=Z5;var Aw=t0._`\n`;class WB extends I5{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?Aw:t0.nil}}get(){return this._scope}name(Q){return new Z5(Q,this._newName(Q))}value(Q,X){var W;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName(Q),{prefix:$}=Y,J=(W=X.key)!==null&&W!==void 0?W:X.ref,G=this._values[$];if(G){let z=G.get(J);if(z)return z}else G=this._values[$]=new Map;G.set(J,Y);let H=this._scope[$]||(this._scope[$]=[]),B=H.length;return H[B]=X.ref,Y.setValue(X,{property:$,itemIndex:B}),Y}getValue(Q,X){let W=this._values[Q];if(!W)return;return W.get(X)}scopeRefs(Q,X=this._values){return this._reduceValues(X,(W)=>{if(W.scopePath===void 0)throw Error(`CodeGen: name "${W}" has no value`);return t0._`${Q}${W.scopePath}`})}scopeCode(Q=this._values,X,W){return this._reduceValues(Q,(Y)=>{if(Y.value===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return Y.value.code},X,W)}_reduceValues(Q,X,W={},Y){let $=t0.nil;for(let J in Q){let G=Q[J];if(!G)continue;let H=W[J]=W[J]||new Map;G.forEach((B)=>{if(H.has(B))return;H.set(B,o8.Started);let z=X(B);if(z){let K=this.opts.es5?YB.varKinds.var:YB.varKinds.const;$=t0._`${$}${K} ${B} = ${z};${this.opts._n}`}else if(z=Y===null||Y===void 0?void 0:Y(B))$=t0._`${$}${z}${this.opts._n}`;else throw new XB(B);H.set(B,o8.Completed)})}return $}}YB.ValueScope=WB});var n=M((a0)=>{Object.defineProperty(a0,"__esModule",{value:!0});a0.or=a0.and=a0.not=a0.CodeGen=a0.operators=a0.varKinds=a0.ValueScopeName=a0.ValueScope=a0.Scope=a0.Name=a0.regexpCode=a0.stringify=a0.getProperty=a0.nil=a0.strConcat=a0.str=a0._=void 0;var a=r4(),b1=S5(),q6=r4();Object.defineProperty(a0,"_",{enumerable:!0,get:function(){return q6._}});Object.defineProperty(a0,"str",{enumerable:!0,get:function(){return q6.str}});Object.defineProperty(a0,"strConcat",{enumerable:!0,get:function(){return q6.strConcat}});Object.defineProperty(a0,"nil",{enumerable:!0,get:function(){return q6.nil}});Object.defineProperty(a0,"getProperty",{enumerable:!0,get:function(){return q6.getProperty}});Object.defineProperty(a0,"stringify",{enumerable:!0,get:function(){return q6.stringify}});Object.defineProperty(a0,"regexpCode",{enumerable:!0,get:function(){return q6.regexpCode}});Object.defineProperty(a0,"Name",{enumerable:!0,get:function(){return q6.Name}});var QX=S5();Object.defineProperty(a0,"Scope",{enumerable:!0,get:function(){return QX.Scope}});Object.defineProperty(a0,"ValueScope",{enumerable:!0,get:function(){return QX.ValueScope}});Object.defineProperty(a0,"ValueScopeName",{enumerable:!0,get:function(){return QX.ValueScopeName}});Object.defineProperty(a0,"varKinds",{enumerable:!0,get:function(){return QX.varKinds}});a0.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class N6{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class JB extends N6{constructor(Q,X,W){super();this.varKind=Q,this.name=X,this.rhs=W}render({es5:Q,_n:X}){let W=Q?b1.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${Y};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=g9(this.rhs,Q,X);return this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class T5 extends N6{constructor(Q,X,W){super();this.lhs=Q,this.rhs=X,this.sideEffects=W}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof a.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=g9(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof a.Name?{}:{...this.lhs.names};return e8(Q,this.rhs)}}class GB extends T5{constructor(Q,X,W,Y){super(Q,W,Y);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class HB extends N6{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class BB extends N6{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class zB extends N6{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class KB extends N6{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,X){return this.code=g9(this.code,Q,X),this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class XX extends N6{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,W)=>X+W.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let W=Q[X].optimizeNodes();if(Array.isArray(W))Q.splice(X,1,...W);else if(W)Q[X]=W;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:W}=this,Y=W.length;while(Y--){let $=W[Y];if($.optimizeNames(Q,X))continue;Uw(Q,$.names),W.splice(Y,1)}return W.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>r6(Q,X.names),{})}}class M6 extends XX{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class LB extends XX{}class t4 extends M6{}t4.kind="else";class a1 extends M6{constructor(Q,X){super(X);this.condition=Q}render(Q){let X=`if(${this.condition})`+super.render(Q);if(this.else)X+="else "+this.else.render(Q);return X}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let X=this.else;if(X){let W=X.optimizeNodes();X=this.else=Array.isArray(W)?new t4(W):W}if(X){if(Q===!1)return X instanceof a1?X:X.nodes;if(this.nodes.length)return this;return new a1(OB(Q),X instanceof a1?[X]:X.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,X){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(Q,X),!(super.optimizeNames(Q,X)||this.else))return;return this.condition=g9(this.condition,Q,X),this}get names(){let Q=super.names;if(e8(Q,this.condition),this.else)r6(Q,this.else.names);return Q}}a1.kind="if";class f9 extends M6{}f9.kind="for";class FB extends f9{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iteration=g9(this.iteration,Q,X),this}get names(){return r6(super.names,this.iteration.names)}}class AB extends f9{constructor(Q,X,W,Y){super();this.varKind=Q,this.name=X,this.from=W,this.to=Y}render(Q){let X=Q.es5?b1.varKinds.var:this.varKind,{name:W,from:Y,to:$}=this;return`for(${X} ${W}=${Y}; ${W}<${$}; ${W}++)`+super.render(Q)}get names(){let Q=e8(super.names,this.from);return e8(Q,this.to)}}class R5 extends f9{constructor(Q,X,W,Y){super();this.loop=Q,this.varKind=X,this.name=W,this.iterable=Y}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iterable=g9(this.iterable,Q,X),this}get names(){return r6(super.names,this.iterable.names)}}class r8 extends M6{constructor(Q,X,W){super();this.name=Q,this.args=X,this.async=W}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}r8.kind="func";class t8 extends XX{render(Q){return"return "+super.render(Q)}}t8.kind="return";class DB extends M6{render(Q){let X="try"+super.render(Q);if(this.catch)X+=this.catch.render(Q);if(this.finally)X+=this.finally.render(Q);return X}optimizeNodes(){var Q,X;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(Q,X){var W,Y;return super.optimizeNames(Q,X),(W=this.catch)===null||W===void 0||W.optimizeNames(Q,X),(Y=this.finally)===null||Y===void 0||Y.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)r6(Q,this.catch.names);if(this.finally)r6(Q,this.finally.names);return Q}}class a8 extends M6{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}a8.kind="catch";class s8 extends M6{render(Q){return"finally"+super.render(Q)}}s8.kind="finally";class VB{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
3
- `:""},this._extScope=Q,this._scope=new b1.Scope({parent:Q}),this._nodes=[new LB]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,X){let W=this._extScope.value(Q,X);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(Q,X){return this._extScope.getValue(Q,X)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,X,W,Y){let $=this._scope.toName(X);if(W!==void 0&&Y)this._constants[$.str]=W;return this._leafNode(new JB(Q,$,W)),$}const(Q,X,W){return this._def(b1.varKinds.const,Q,X,W)}let(Q,X,W){return this._def(b1.varKinds.let,Q,X,W)}var(Q,X,W){return this._def(b1.varKinds.var,Q,X,W)}assign(Q,X,W){return this._leafNode(new T5(Q,X,W))}add(Q,X){return this._leafNode(new GB(Q,a0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==a.nil)this._leafNode(new KB(Q));return this}object(...Q){let X=["{"];for(let[W,Y]of Q){if(X.length>1)X.push(",");if(X.push(W),W!==Y||this.opts.es5)X.push(":"),(0,a.addCodeArg)(X,Y)}return X.push("}"),new a._Code(X)}if(Q,X,W){if(this._blockNode(new a1(Q)),X&&W)this.code(X).else().code(W).endIf();else if(X)this.code(X).endIf();else if(W)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new a1(Q))}else(){return this._elseNode(new t4)}endIf(){return this._endBlockNode(a1,t4)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new FB(Q),X)}forRange(Q,X,W,Y,$=this.opts.es5?b1.varKinds.var:b1.varKinds.let){let J=this._scope.toName(Q);return this._for(new AB($,J,X,W),()=>Y(J))}forOf(Q,X,W,Y=b1.varKinds.const){let $=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof a.Name?X:this.var("_arr",X);return this.forRange("_i",0,a._`${J}.length`,(G)=>{this.var($,a._`${J}[${G}]`),W($)})}return this._for(new R5("of",Y,$,X),()=>W($))}forIn(Q,X,W,Y=this.opts.es5?b1.varKinds.var:b1.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,a._`Object.keys(${X})`,W);let $=this._scope.toName(Q);return this._for(new R5("in",Y,$,X),()=>W($))}endFor(){return this._endBlockNode(f9)}label(Q){return this._leafNode(new HB(Q))}break(Q){return this._leafNode(new BB(Q))}return(Q){let X=new t8;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(t8)}try(Q,X,W){if(!X&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new DB;if(this._blockNode(Y),this.code(Q),X){let $=this.name("e");this._currNode=Y.catch=new a8($),X($)}if(W)this._currNode=Y.finally=new s8,this.code(W);return this._endBlockNode(a8,s8)}throw(Q){return this._leafNode(new zB(Q))}block(Q,X){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(X);return this}endBlock(Q){let X=this._blockStarts.pop();if(X===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-X;if(W<0||Q!==void 0&&W!==Q)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${Q} expected`);return this._nodes.length=X,this}func(Q,X=a.nil,W,Y){if(this._blockNode(new r8(Q,X,W)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(r8)}optimize(Q=1){while(Q-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(Q){return this._currNode.nodes.push(Q),this}_blockNode(Q){this._currNode.nodes.push(Q),this._nodes.push(Q)}_endBlockNode(Q,X){let W=this._currNode;if(W instanceof Q||X&&W instanceof X)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${X?`${Q.kind}/${X.kind}`:Q.kind}"`)}_elseNode(Q){let X=this._currNode;if(!(X instanceof a1))throw Error('CodeGen: "else" without "if"');return this._currNode=X.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let X=this._nodes;X[X.length-1]=Q}}a0.CodeGen=VB;function r6(Q,X){for(let W in X)Q[W]=(Q[W]||0)+(X[W]||0);return Q}function e8(Q,X){return X instanceof a._CodeOrName?r6(Q,X.names):Q}function g9(Q,X,W){if(Q instanceof a.Name)return Y(Q);if(!$(Q))return Q;return new a._Code(Q._items.reduce((J,G)=>{if(G instanceof a.Name)G=Y(G);if(G instanceof a._Code)J.push(...G._items);else J.push(G);return J},[]));function Y(J){let G=W[J.str];if(G===void 0||X[J.str]!==1)return J;return delete X[J.str],G}function $(J){return J instanceof a._Code&&J._items.some((G)=>G instanceof a.Name&&X[G.str]===1&&W[G.str]!==void 0)}}function Uw(Q,X){for(let W in X)Q[W]=(Q[W]||0)-(X[W]||0)}function OB(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:a._`!${C5(Q)}`}a0.not=OB;var qw=UB(a0.operators.AND);function Nw(...Q){return Q.reduce(qw)}a0.and=Nw;var Mw=UB(a0.operators.OR);function jw(...Q){return Q.reduce(Mw)}a0.or=jw;function UB(Q){return(X,W)=>X===a.nil?W:W===a.nil?X:a._`${C5(X)} ${Q} ${C5(W)}`}function C5(Q){return Q instanceof a.Name?Q:a._`(${Q})`}});var W0=M((IB)=>{Object.defineProperty(IB,"__esModule",{value:!0});IB.checkStrictMode=IB.getErrorPath=IB.Type=IB.useFunc=IB.setEvaluated=IB.evaluatedPropsToName=IB.mergeEvaluated=IB.eachItem=IB.unescapeJsonPointer=IB.escapeJsonPointer=IB.escapeFragment=IB.unescapeFragment=IB.schemaRefOrVal=IB.schemaHasRulesButRef=IB.schemaHasRules=IB.checkUnknownRules=IB.alwaysValidSchema=IB.toHash=void 0;var H0=n(),Pw=r4();function Iw(Q){let X={};for(let W of Q)X[W]=!0;return X}IB.toHash=Iw;function Zw(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return jB(Q,X),!wB(X,Q.self.RULES.all)}IB.alwaysValidSchema=Zw;function jB(Q,X=Q.schema){let{opts:W,self:Y}=Q;if(!W.strictSchema)return;if(typeof X==="boolean")return;let $=Y.RULES.keywords;for(let J in X)if(!$[J])PB(Q,`unknown keyword: "${J}"`)}IB.checkUnknownRules=jB;function wB(Q,X){if(typeof Q=="boolean")return!Q;for(let W in Q)if(X[W])return!0;return!1}IB.schemaHasRules=wB;function Sw(Q,X){if(typeof Q=="boolean")return!Q;for(let W in Q)if(W!=="$ref"&&X.all[W])return!0;return!1}IB.schemaHasRulesButRef=Sw;function Rw({topSchemaRef:Q,schemaPath:X},W,Y,$){if(!$){if(typeof W=="number"||typeof W=="boolean")return W;if(typeof W=="string")return H0._`${W}`}return H0._`${Q}${X}${(0,H0.getProperty)(Y)}`}IB.schemaRefOrVal=Rw;function Cw(Q){return bB(decodeURIComponent(Q))}IB.unescapeFragment=Cw;function Tw(Q){return encodeURIComponent(v5(Q))}IB.escapeFragment=Tw;function v5(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}IB.escapeJsonPointer=v5;function bB(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}IB.unescapeJsonPointer=bB;function kw(Q,X){if(Array.isArray(Q))for(let W of Q)X(W);else X(Q)}IB.eachItem=kw;function NB({mergeNames:Q,mergeToName:X,mergeValues:W,resultToName:Y}){return($,J,G,H)=>{let B=G===void 0?J:G instanceof H0.Name?(J instanceof H0.Name?Q($,J,G):X($,J,G),G):J instanceof H0.Name?(X($,G,J),J):W(J,G);return H===H0.Name&&!(B instanceof H0.Name)?Y($,B):B}}IB.mergeEvaluated={props:NB({mergeNames:(Q,X,W)=>Q.if(H0._`${W} !== true && ${X} !== undefined`,()=>{Q.if(H0._`${X} === true`,()=>Q.assign(W,!0),()=>Q.assign(W,H0._`${W} || {}`).code(H0._`Object.assign(${W}, ${X})`))}),mergeToName:(Q,X,W)=>Q.if(H0._`${W} !== true`,()=>{if(X===!0)Q.assign(W,!0);else Q.assign(W,H0._`${W} || {}`),_5(Q,W,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:EB}),items:NB({mergeNames:(Q,X,W)=>Q.if(H0._`${W} !== true && ${X} !== undefined`,()=>Q.assign(W,H0._`${X} === true ? true : ${W} > ${X} ? ${W} : ${X}`)),mergeToName:(Q,X,W)=>Q.if(H0._`${W} !== true`,()=>Q.assign(W,X===!0?!0:H0._`${W} > ${X} ? ${W} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function EB(Q,X){if(X===!0)return Q.var("props",!0);let W=Q.var("props",H0._`{}`);if(X!==void 0)_5(Q,W,X);return W}IB.evaluatedPropsToName=EB;function _5(Q,X,W){Object.keys(W).forEach((Y)=>Q.assign(H0._`${X}${(0,H0.getProperty)(Y)}`,!0))}IB.setEvaluated=_5;var MB={};function vw(Q,X){return Q.scopeValue("func",{ref:X,code:MB[X.code]||(MB[X.code]=new Pw._Code(X.code))})}IB.useFunc=vw;var k5;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(k5||(IB.Type=k5={}));function _w(Q,X,W){if(Q instanceof H0.Name){let Y=X===k5.Num;return W?Y?H0._`"[" + ${Q} + "]"`:H0._`"['" + ${Q} + "']"`:Y?H0._`"/" + ${Q}`:H0._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return W?(0,H0.getProperty)(Q).toString():"/"+v5(Q)}IB.getErrorPath=_w;function PB(Q,X,W=Q.opts.strictSchema){if(!W)return;if(X=`strict mode: ${X}`,W===!0)throw Error(X);Q.self.logger.warn(X)}IB.checkStrictMode=PB});var s1=M((SB)=>{Object.defineProperty(SB,"__esModule",{value:!0});var f0=n(),sw={data:new f0.Name("data"),valCxt:new f0.Name("valCxt"),instancePath:new f0.Name("instancePath"),parentData:new f0.Name("parentData"),parentDataProperty:new f0.Name("parentDataProperty"),rootData:new f0.Name("rootData"),dynamicAnchors:new f0.Name("dynamicAnchors"),vErrors:new f0.Name("vErrors"),errors:new f0.Name("errors"),this:new f0.Name("this"),self:new f0.Name("self"),scope:new f0.Name("scope"),json:new f0.Name("json"),jsonPos:new f0.Name("jsonPos"),jsonLen:new f0.Name("jsonLen"),jsonPart:new f0.Name("jsonPart")};SB.default=sw});var a4=M((kB)=>{Object.defineProperty(kB,"__esModule",{value:!0});kB.extendErrors=kB.resetErrorsCount=kB.reportExtraError=kB.reportError=kB.keyword$DataError=kB.keywordError=void 0;var Q0=n(),YX=W0(),l0=s1();kB.keywordError={message:({keyword:Q})=>Q0.str`must pass "${Q}" keyword validation`};kB.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?Q0.str`"${Q}" keyword must be ${X} ($data)`:Q0.str`"${Q}" keyword is invalid ($data)`};function Qb(Q,X=kB.keywordError,W,Y){let{it:$}=Q,{gen:J,compositeRule:G,allErrors:H}=$,B=TB(Q,X,W);if(Y!==null&&Y!==void 0?Y:G||H)RB(J,B);else CB($,Q0._`[${B}]`)}kB.reportError=Qb;function Xb(Q,X=kB.keywordError,W){let{it:Y}=Q,{gen:$,compositeRule:J,allErrors:G}=Y,H=TB(Q,X,W);if(RB($,H),!(J||G))CB(Y,l0.default.vErrors)}kB.reportExtraError=Xb;function Wb(Q,X){Q.assign(l0.default.errors,X),Q.if(Q0._`${l0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(Q0._`${l0.default.vErrors}.length`,X),()=>Q.assign(l0.default.vErrors,null)))}kB.resetErrorsCount=Wb;function Yb({gen:Q,keyword:X,schemaValue:W,data:Y,errsCount:$,it:J}){if($===void 0)throw Error("ajv implementation error");let G=Q.name("err");Q.forRange("i",$,l0.default.errors,(H)=>{if(Q.const(G,Q0._`${l0.default.vErrors}[${H}]`),Q.if(Q0._`${G}.instancePath === undefined`,()=>Q.assign(Q0._`${G}.instancePath`,(0,Q0.strConcat)(l0.default.instancePath,J.errorPath))),Q.assign(Q0._`${G}.schemaPath`,Q0.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(Q0._`${G}.schema`,W),Q.assign(Q0._`${G}.data`,Y)})}kB.extendErrors=Yb;function RB(Q,X){let W=Q.const("err",X);Q.if(Q0._`${l0.default.vErrors} === null`,()=>Q.assign(l0.default.vErrors,Q0._`[${W}]`),Q0._`${l0.default.vErrors}.push(${W})`),Q.code(Q0._`${l0.default.errors}++`)}function CB(Q,X){let{gen:W,validateName:Y,schemaEnv:$}=Q;if($.$async)W.throw(Q0._`new ${Q.ValidationError}(${X})`);else W.assign(Q0._`${Y}.errors`,X),W.return(!1)}var t6={keyword:new Q0.Name("keyword"),schemaPath:new Q0.Name("schemaPath"),params:new Q0.Name("params"),propertyName:new Q0.Name("propertyName"),message:new Q0.Name("message"),schema:new Q0.Name("schema"),parentSchema:new Q0.Name("parentSchema")};function TB(Q,X,W){let{createErrors:Y}=Q.it;if(Y===!1)return Q0._`{}`;return $b(Q,X,W)}function $b(Q,X,W={}){let{gen:Y,it:$}=Q,J=[Jb($,W),Gb(Q,W)];return Hb(Q,X,J),Y.object(...J)}function Jb({errorPath:Q},{instancePath:X}){let W=X?Q0.str`${Q}${(0,YX.getErrorPath)(X,YX.Type.Str)}`:Q;return[l0.default.instancePath,(0,Q0.strConcat)(l0.default.instancePath,W)]}function Gb({keyword:Q,it:{errSchemaPath:X}},{schemaPath:W,parentSchema:Y}){let $=Y?X:Q0.str`${X}/${Q}`;if(W)$=Q0.str`${$}${(0,YX.getErrorPath)(W,YX.Type.Str)}`;return[t6.schemaPath,$]}function Hb(Q,{params:X,message:W},Y){let{keyword:$,data:J,schemaValue:G,it:H}=Q,{opts:B,propertyName:z,topSchemaRef:K,schemaPath:L}=H;if(Y.push([t6.keyword,$],[t6.params,typeof X=="function"?X(Q):X||Q0._`{}`]),B.messages)Y.push([t6.message,typeof W=="function"?W(Q):W]);if(B.verbose)Y.push([t6.schema,G],[t6.parentSchema,Q0._`${K}${L}`],[l0.default.data,J]);if(z)Y.push([t6.propertyName,z])}});var fB=M((xB)=>{Object.defineProperty(xB,"__esModule",{value:!0});xB.boolOrEmptySchema=xB.topBoolOrEmptySchema=void 0;var Fb=a4(),Ab=n(),Db=s1(),Vb={message:"boolean schema is false"};function Ob(Q){let{gen:X,schema:W,validateName:Y}=Q;if(W===!1)_B(Q,!1);else if(typeof W=="object"&&W.$async===!0)X.return(Db.default.data);else X.assign(Ab._`${Y}.errors`,null),X.return(!0)}xB.topBoolOrEmptySchema=Ob;function Ub(Q,X){let{gen:W,schema:Y}=Q;if(Y===!1)W.var(X,!1),_B(Q);else W.var(X,!0)}xB.boolOrEmptySchema=Ub;function _B(Q,X){let{gen:W,data:Y}=Q,$={gen:W,keyword:"false schema",data:Y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,Fb.reportError)($,Vb,void 0,X)}});var y5=M((gB)=>{Object.defineProperty(gB,"__esModule",{value:!0});gB.getRules=gB.isJSONType=void 0;var Nb=["string","number","integer","boolean","null","object","array"],Mb=new Set(Nb);function jb(Q){return typeof Q=="string"&&Mb.has(Q)}gB.isJSONType=jb;function wb(){let Q={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...Q,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},Q.number,Q.string,Q.array,Q.object],post:{rules:[]},all:{},keywords:{}}}gB.getRules=wb});var f5=M((mB)=>{Object.defineProperty(mB,"__esModule",{value:!0});mB.shouldUseRule=mB.shouldUseGroup=mB.schemaHasRulesForType=void 0;function Eb({schema:Q,self:X},W){let Y=X.RULES.types[W];return Y&&Y!==!0&&uB(Q,Y)}mB.schemaHasRulesForType=Eb;function uB(Q,X){return X.rules.some((W)=>lB(Q,W))}mB.shouldUseGroup=uB;function lB(Q,X){var W;return Q[X.keyword]!==void 0||((W=X.definition.implements)===null||W===void 0?void 0:W.some((Y)=>Q[Y]!==void 0))}mB.shouldUseRule=lB});var s4=M((nB)=>{Object.defineProperty(nB,"__esModule",{value:!0});nB.reportTypeError=nB.checkDataTypes=nB.checkDataType=nB.coerceAndCheckDataType=nB.getJSONTypes=nB.getSchemaTypes=nB.DataType=void 0;var Zb=y5(),Sb=f5(),Rb=a4(),c=n(),pB=W0(),h9;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(h9||(nB.DataType=h9={}));function Cb(Q){let X=iB(Q.type);if(X.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!X.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)X.push("null")}return X}nB.getSchemaTypes=Cb;function iB(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(Zb.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}nB.getJSONTypes=iB;function Tb(Q,X){let{gen:W,data:Y,opts:$}=Q,J=kb(X,$.coerceTypes),G=X.length>0&&!(J.length===0&&X.length===1&&(0,Sb.schemaHasRulesForType)(Q,X[0]));if(G){let H=h5(X,Y,$.strictNumbers,h9.Wrong);W.if(H,()=>{if(J.length)vb(Q,X,J);else u5(Q)})}return G}nB.coerceAndCheckDataType=Tb;var dB=new Set(["string","number","integer","boolean","null"]);function kb(Q,X){return X?Q.filter((W)=>dB.has(W)||X==="array"&&W==="array"):[]}function vb(Q,X,W){let{gen:Y,data:$,opts:J}=Q,G=Y.let("dataType",c._`typeof ${$}`),H=Y.let("coerced",c._`undefined`);if(J.coerceTypes==="array")Y.if(c._`${G} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>Y.assign($,c._`${$}[0]`).assign(G,c._`typeof ${$}`).if(h5(X,$,J.strictNumbers),()=>Y.assign(H,$)));Y.if(c._`${H} !== undefined`);for(let z of W)if(dB.has(z)||z==="array"&&J.coerceTypes==="array")B(z);Y.else(),u5(Q),Y.endIf(),Y.if(c._`${H} !== undefined`,()=>{Y.assign($,H),_b(Q,H)});function B(z){switch(z){case"string":Y.elseIf(c._`${G} == "number" || ${G} == "boolean"`).assign(H,c._`"" + ${$}`).elseIf(c._`${$} === null`).assign(H,c._`""`);return;case"number":Y.elseIf(c._`${G} == "boolean" || ${$} === null
4
- || (${G} == "string" && ${$} && ${$} == +${$})`).assign(H,c._`+${$}`);return;case"integer":Y.elseIf(c._`${G} === "boolean" || ${$} === null
5
- || (${G} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(H,c._`+${$}`);return;case"boolean":Y.elseIf(c._`${$} === "false" || ${$} === 0 || ${$} === null`).assign(H,!1).elseIf(c._`${$} === "true" || ${$} === 1`).assign(H,!0);return;case"null":Y.elseIf(c._`${$} === "" || ${$} === 0 || ${$} === false`),Y.assign(H,null);return;case"array":Y.elseIf(c._`${G} === "string" || ${G} === "number"
6
- || ${G} === "boolean" || ${$} === null`).assign(H,c._`[${$}]`)}}}function _b({gen:Q,parentData:X,parentDataProperty:W},Y){Q.if(c._`${X} !== undefined`,()=>Q.assign(c._`${X}[${W}]`,Y))}function g5(Q,X,W,Y=h9.Correct){let $=Y===h9.Correct?c.operators.EQ:c.operators.NEQ,J;switch(Q){case"null":return c._`${X} ${$} null`;case"array":J=c._`Array.isArray(${X})`;break;case"object":J=c._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=G(c._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=G();break;default:return c._`typeof ${X} ${$} ${Q}`}return Y===h9.Correct?J:(0,c.not)(J);function G(H=c.nil){return(0,c.and)(c._`typeof ${X} == "number"`,H,W?c._`isFinite(${X})`:c.nil)}}nB.checkDataType=g5;function h5(Q,X,W,Y){if(Q.length===1)return g5(Q[0],X,W,Y);let $,J=(0,pB.toHash)(Q);if(J.array&&J.object){let G=c._`typeof ${X} != "object"`;$=J.null?G:c._`!${X} || ${G}`,delete J.null,delete J.array,delete J.object}else $=c.nil;if(J.number)delete J.integer;for(let G in J)$=(0,c.and)($,g5(G,X,W,Y));return $}nB.checkDataTypes=h5;var xb={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?c._`{type: ${Q}}`:c._`{type: ${X}}`};function u5(Q){let X=yb(Q);(0,Rb.reportError)(X,xb)}nB.reportTypeError=u5;function yb(Q){let{gen:X,data:W,schema:Y}=Q,$=(0,pB.schemaRefOrVal)(Q,Y,"type");return{gen:X,keyword:"type",data:W,schema:Y.type,schemaCode:$,schemaValue:$,parentSchema:Y,params:{},it:Q}}});var sB=M((tB)=>{Object.defineProperty(tB,"__esModule",{value:!0});tB.assignDefaults=void 0;var u9=n(),cb=W0();function pb(Q,X){let{properties:W,items:Y}=Q.schema;if(X==="object"&&W)for(let $ in W)rB(Q,$,W[$].default);else if(X==="array"&&Array.isArray(Y))Y.forEach(($,J)=>rB(Q,J,$.default))}tB.assignDefaults=pb;function rB(Q,X,W){let{gen:Y,compositeRule:$,data:J,opts:G}=Q;if(W===void 0)return;let H=u9._`${J}${(0,u9.getProperty)(X)}`;if($){(0,cb.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=u9._`${H} === undefined`;if(G.useDefaults==="empty")B=u9._`${B} || ${H} === null || ${H} === ""`;Y.if(B,u9._`${H} = ${(0,u9.stringify)(W)}`)}});var B1=M((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});Xz.validateUnion=Xz.validateArray=Xz.usePattern=Xz.callValidateCode=Xz.schemaProperties=Xz.allSchemaProperties=Xz.noPropertyInData=Xz.propertyInData=Xz.isOwnProperty=Xz.hasPropFunc=Xz.reportMissingProp=Xz.checkMissingProp=Xz.checkReportMissingProp=void 0;var D0=n(),l5=W0(),j6=s1(),ib=W0();function db(Q,X){let{gen:W,data:Y,it:$}=Q;W.if(c5(W,Y,X,$.opts.ownProperties),()=>{Q.setParams({missingProperty:D0._`${X}`},!0),Q.error()})}Xz.checkReportMissingProp=db;function nb({gen:Q,data:X,it:{opts:W}},Y,$){return(0,D0.or)(...Y.map((J)=>(0,D0.and)(c5(Q,X,J,W.ownProperties),D0._`${$} = ${J}`)))}Xz.checkMissingProp=nb;function ob(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}Xz.reportMissingProp=ob;function eB(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:D0._`Object.prototype.hasOwnProperty`})}Xz.hasPropFunc=eB;function m5(Q,X,W){return D0._`${eB(Q)}.call(${X}, ${W})`}Xz.isOwnProperty=m5;function rb(Q,X,W,Y){let $=D0._`${X}${(0,D0.getProperty)(W)} !== undefined`;return Y?D0._`${$} && ${m5(Q,X,W)}`:$}Xz.propertyInData=rb;function c5(Q,X,W,Y){let $=D0._`${X}${(0,D0.getProperty)(W)} === undefined`;return Y?(0,D0.or)($,(0,D0.not)(m5(Q,X,W))):$}Xz.noPropertyInData=c5;function Qz(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}Xz.allSchemaProperties=Qz;function tb(Q,X){return Qz(X).filter((W)=>!(0,l5.alwaysValidSchema)(Q,X[W]))}Xz.schemaProperties=tb;function ab({schemaCode:Q,data:X,it:{gen:W,topSchemaRef:Y,schemaPath:$,errorPath:J},it:G},H,B,z){let K=z?D0._`${Q}, ${X}, ${Y}${$}`:X,L=[[j6.default.instancePath,(0,D0.strConcat)(j6.default.instancePath,J)],[j6.default.parentData,G.parentData],[j6.default.parentDataProperty,G.parentDataProperty],[j6.default.rootData,j6.default.rootData]];if(G.opts.dynamicRef)L.push([j6.default.dynamicAnchors,j6.default.dynamicAnchors]);let V=D0._`${K}, ${W.object(...L)}`;return B!==D0.nil?D0._`${H}.call(${B}, ${V})`:D0._`${H}(${V})`}Xz.callValidateCode=ab;var sb=D0._`new RegExp`;function eb({gen:Q,it:{opts:X}},W){let Y=X.unicodeRegExp?"u":"",{regExp:$}=X.code,J=$(W,Y);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:D0._`${$.code==="new RegExp"?sb:(0,ib.useFunc)(Q,$)}(${W}, ${Y})`})}Xz.usePattern=eb;function QE(Q){let{gen:X,data:W,keyword:Y,it:$}=Q,J=X.name("valid");if($.allErrors){let H=X.let("valid",!0);return G(()=>X.assign(H,!1)),H}return X.var(J,!0),G(()=>X.break()),J;function G(H){let B=X.const("len",D0._`${W}.length`);X.forRange("i",0,B,(z)=>{Q.subschema({keyword:Y,dataProp:z,dataPropType:l5.Type.Num},J),X.if((0,D0.not)(J),H)})}}Xz.validateArray=QE;function XE(Q){let{gen:X,schema:W,keyword:Y,it:$}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");if(W.some((B)=>(0,l5.alwaysValidSchema)($,B))&&!$.opts.unevaluated)return;let G=X.let("valid",!1),H=X.name("_valid");X.block(()=>W.forEach((B,z)=>{let K=Q.subschema({keyword:Y,schemaProp:z,compositeRule:!0},H);if(X.assign(G,D0._`${G} || ${H}`),!Q.mergeValidEvaluated(K,H))X.if((0,D0.not)(G))})),Q.result(G,()=>Q.reset(),()=>Q.error(!0))}Xz.validateUnion=XE});var Hz=M((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});Jz.validateKeywordUsage=Jz.validSchemaType=Jz.funcKeywordCode=Jz.macroKeywordCode=void 0;var m0=n(),a6=s1(),DE=B1(),VE=a4();function OE(Q,X){let{gen:W,keyword:Y,schema:$,parentSchema:J,it:G}=Q,H=X.macro.call(G.self,$,J,G),B=$z(W,Y,H);if(G.opts.validateSchema!==!1)G.self.validateSchema(H,!0);let z=W.name("valid");Q.subschema({schema:H,schemaPath:m0.nil,errSchemaPath:`${G.errSchemaPath}/${Y}`,topSchemaRef:B,compositeRule:!0},z),Q.pass(z,()=>Q.error(!0))}Jz.macroKeywordCode=OE;function UE(Q,X){var W;let{gen:Y,keyword:$,schema:J,parentSchema:G,$data:H,it:B}=Q;NE(B,X);let z=!H&&X.compile?X.compile.call(B.self,J,G,B):X.validate,K=$z(Y,$,z),L=Y.let("valid");Q.block$data(L,V),Q.ok((W=X.valid)!==null&&W!==void 0?W:L);function V(){if(X.errors===!1){if(A(),X.modifying)Yz(Q);O(()=>Q.error())}else{let U=X.async?F():D();if(X.modifying)Yz(Q);O(()=>qE(Q,U))}}function F(){let U=Y.let("ruleErrs",null);return Y.try(()=>A(m0._`await `),(j)=>Y.assign(L,!1).if(m0._`${j} instanceof ${B.ValidationError}`,()=>Y.assign(U,m0._`${j}.errors`),()=>Y.throw(j))),U}function D(){let U=m0._`${K}.errors`;return Y.assign(U,null),A(m0.nil),U}function A(U=X.async?m0._`await `:m0.nil){let j=B.opts.passContext?a6.default.this:a6.default.self,w=!(("compile"in X)&&!H||X.schema===!1);Y.assign(L,m0._`${U}${(0,DE.callValidateCode)(Q,K,j,w)}`,X.modifying)}function O(U){var j;Y.if((0,m0.not)((j=X.valid)!==null&&j!==void 0?j:L),U)}}Jz.funcKeywordCode=UE;function Yz(Q){let{gen:X,data:W,it:Y}=Q;X.if(Y.parentData,()=>X.assign(W,m0._`${Y.parentData}[${Y.parentDataProperty}]`))}function qE(Q,X){let{gen:W}=Q;W.if(m0._`Array.isArray(${X})`,()=>{W.assign(a6.default.vErrors,m0._`${a6.default.vErrors} === null ? ${X} : ${a6.default.vErrors}.concat(${X})`).assign(a6.default.errors,m0._`${a6.default.vErrors}.length`),(0,VE.extendErrors)(Q)},()=>Q.error())}function NE({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function $z(Q,X,W){if(W===void 0)throw Error(`keyword "${X}" failed to compile`);return Q.scopeValue("keyword",typeof W=="function"?{ref:W}:{ref:W,code:(0,m0.stringify)(W)})}function ME(Q,X,W=!1){return!X.length||X.some((Y)=>Y==="array"?Array.isArray(Q):Y==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==Y||W&&typeof Q>"u")}Jz.validSchemaType=ME;function jE({schema:Q,opts:X,self:W,errSchemaPath:Y},$,J){if(Array.isArray($.keyword)?!$.keyword.includes(J):$.keyword!==J)throw Error("ajv implementation error");let G=$.dependencies;if(G===null||G===void 0?void 0:G.some((H)=>!Object.prototype.hasOwnProperty.call(Q,H)))throw Error(`parent schema must have dependencies of ${J}: ${G.join(",")}`);if($.validateSchema){if(!$.validateSchema(Q[J])){let B=`keyword "${J}" value is invalid at path "${Y}": `+W.errorsText($.validateSchema.errors);if(X.validateSchema==="log")W.logger.error(B);else throw Error(B)}}}Jz.validateKeywordUsage=jE});var Lz=M((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});zz.extendSubschemaMode=zz.extendSubschemaData=zz.getSubschema=void 0;var u1=n(),Bz=W0();function PE(Q,{keyword:X,schemaProp:W,schema:Y,schemaPath:$,errSchemaPath:J,topSchemaRef:G}){if(X!==void 0&&Y!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let H=Q.schema[X];return W===void 0?{schema:H,schemaPath:u1._`${Q.schemaPath}${(0,u1.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[W],schemaPath:u1._`${Q.schemaPath}${(0,u1.getProperty)(X)}${(0,u1.getProperty)(W)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,Bz.escapeFragment)(W)}`}}if(Y!==void 0){if($===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Y,schemaPath:$,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}zz.getSubschema=PE;function IE(Q,X,{dataProp:W,dataPropType:Y,data:$,dataTypes:J,propertyName:G}){if($!==void 0&&W!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:H}=X;if(W!==void 0){let{errorPath:z,dataPathArr:K,opts:L}=X,V=H.let("data",u1._`${X.data}${(0,u1.getProperty)(W)}`,!0);B(V),Q.errorPath=u1.str`${z}${(0,Bz.getErrorPath)(W,Y,L.jsPropertySyntax)}`,Q.parentDataProperty=u1._`${W}`,Q.dataPathArr=[...K,Q.parentDataProperty]}if($!==void 0){let z=$ instanceof u1.Name?$:H.let("data",$,!0);if(B(z),G!==void 0)Q.propertyName=G}if(J)Q.dataTypes=J;function B(z){Q.data=z,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,z]}}zz.extendSubschemaData=IE;function ZE(Q,{jtdDiscriminator:X,jtdMetadata:W,compositeRule:Y,createErrors:$,allErrors:J}){if(Y!==void 0)Q.compositeRule=Y;if($!==void 0)Q.createErrors=$;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=W}zz.extendSubschemaMode=ZE});var e4=M((um,Fz)=>{Fz.exports=function Q(X,W){if(X===W)return!0;if(X&&W&&typeof X=="object"&&typeof W=="object"){if(X.constructor!==W.constructor)return!1;var Y,$,J;if(Array.isArray(X)){if(Y=X.length,Y!=W.length)return!1;for($=Y;$--!==0;)if(!Q(X[$],W[$]))return!1;return!0}if(X.constructor===RegExp)return X.source===W.source&&X.flags===W.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===W.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===W.toString();if(J=Object.keys(X),Y=J.length,Y!==Object.keys(W).length)return!1;for($=Y;$--!==0;)if(!Object.prototype.hasOwnProperty.call(W,J[$]))return!1;for($=Y;$--!==0;){var G=J[$];if(!Q(X[G],W[G]))return!1}return!0}return X!==X&&W!==W}});var Dz=M((lm,Az)=>{var w6=Az.exports=function(Q,X,W){if(typeof X=="function")W=X,X={};W=X.cb||W;var Y=typeof W=="function"?W:W.pre||function(){},$=W.post||function(){};$X(X,Y,$,Q,"",Q)};w6.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};w6.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};w6.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};w6.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 $X(Q,X,W,Y,$,J,G,H,B,z){if(Y&&typeof Y=="object"&&!Array.isArray(Y)){X(Y,$,J,G,H,B,z);for(var K in Y){var L=Y[K];if(Array.isArray(L)){if(K in w6.arrayKeywords)for(var V=0;V<L.length;V++)$X(Q,X,W,L[V],$+"/"+K+"/"+V,J,$,K,Y,V)}else if(K in w6.propsKeywords){if(L&&typeof L=="object")for(var F in L)$X(Q,X,W,L[F],$+"/"+K+"/"+CE(F),J,$,K,Y,F)}else if(K in w6.keywords||Q.allKeys&&!(K in w6.skipKeywords))$X(Q,X,W,L,$+"/"+K,J,$,K,Y)}W(Y,$,J,G,H,B,z)}}function CE(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var QQ=M((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});qz.getSchemaRefs=qz.resolveUrl=qz.normalizeId=qz._getFullPath=qz.getFullPath=qz.inlineRef=void 0;var TE=W0(),kE=e4(),vE=Dz(),_E=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function xE(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!p5(Q);if(!X)return!1;return Vz(Q)<=X}qz.inlineRef=xE;var yE=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function p5(Q){for(let X in Q){if(yE.has(X))return!0;let W=Q[X];if(Array.isArray(W)&&W.some(p5))return!0;if(typeof W=="object"&&p5(W))return!0}return!1}function Vz(Q){let X=0;for(let W in Q){if(W==="$ref")return 1/0;if(X++,_E.has(W))continue;if(typeof Q[W]=="object")(0,TE.eachItem)(Q[W],(Y)=>X+=Vz(Y));if(X===1/0)return 1/0}return X}function Oz(Q,X="",W){if(W!==!1)X=l9(X);let Y=Q.parse(X);return Uz(Q,Y)}qz.getFullPath=Oz;function Uz(Q,X){return Q.serialize(X).split("#")[0]+"#"}qz._getFullPath=Uz;var fE=/#\/?$/;function l9(Q){return Q?Q.replace(fE,""):""}qz.normalizeId=l9;function gE(Q,X,W){return W=l9(W),Q.resolve(X,W)}qz.resolveUrl=gE;var hE=/^[a-z_][-a-z0-9._]*$/i;function uE(Q,X){if(typeof Q=="boolean")return{};let{schemaId:W,uriResolver:Y}=this.opts,$=l9(Q[W]||X),J={"":$},G=Oz(Y,$,!1),H={},B=new Set;return vE(Q,{allKeys:!0},(L,V,F,D)=>{if(D===void 0)return;let A=G+V,O=J[D];if(typeof L[W]=="string")O=U.call(this,L[W]);j.call(this,L.$anchor),j.call(this,L.$dynamicAnchor),J[V]=O;function U(w){let T=this.opts.uriResolver.resolve;if(w=l9(O?T(O,w):w),B.has(w))throw K(w);B.add(w);let P=this.refs[w];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")z(L,P.schema,w);else if(w!==l9(A))if(w[0]==="#")z(L,H[w],w),H[w]=L;else this.refs[w]=A;return w}function j(w){if(typeof w=="string"){if(!hE.test(w))throw Error(`invalid anchor "${w}"`);U.call(this,`#${w}`)}}}),H;function z(L,V,F){if(V!==void 0&&!kE(L,V))throw K(F)}function K(L){return Error(`reference "${L}" resolves to more than one schema`)}}qz.getSchemaRefs=uE});var YQ=M((_z)=>{Object.defineProperty(_z,"__esModule",{value:!0});_z.getData=_z.KeywordCxt=_z.validateFunctionCode=void 0;var Ez=fB(),Mz=s4(),d5=f5(),JX=s4(),dE=sB(),WQ=Hz(),i5=Lz(),x=n(),u=s1(),nE=QQ(),e1=W0(),XQ=a4();function oE(Q){if(Zz(Q)){if(Sz(Q),Iz(Q)){aE(Q);return}}Pz(Q,()=>(0,Ez.topBoolOrEmptySchema)(Q))}_z.validateFunctionCode=oE;function Pz({gen:Q,validateName:X,schema:W,schemaEnv:Y,opts:$},J){if($.code.es5)Q.func(X,x._`${u.default.data}, ${u.default.valCxt}`,Y.$async,()=>{Q.code(x._`"use strict"; ${jz(W,$)}`),tE(Q,$),Q.code(J)});else Q.func(X,x._`${u.default.data}, ${rE($)}`,Y.$async,()=>Q.code(jz(W,$)).code(J))}function rE(Q){return x._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${Q.dynamicRef?x._`, ${u.default.dynamicAnchors}={}`:x.nil}}={}`}function tE(Q,X){Q.if(u.default.valCxt,()=>{if(Q.var(u.default.instancePath,x._`${u.default.valCxt}.${u.default.instancePath}`),Q.var(u.default.parentData,x._`${u.default.valCxt}.${u.default.parentData}`),Q.var(u.default.parentDataProperty,x._`${u.default.valCxt}.${u.default.parentDataProperty}`),Q.var(u.default.rootData,x._`${u.default.valCxt}.${u.default.rootData}`),X.dynamicRef)Q.var(u.default.dynamicAnchors,x._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(Q.var(u.default.instancePath,x._`""`),Q.var(u.default.parentData,x._`undefined`),Q.var(u.default.parentDataProperty,x._`undefined`),Q.var(u.default.rootData,u.default.data),X.dynamicRef)Q.var(u.default.dynamicAnchors,x._`{}`)})}function aE(Q){let{schema:X,opts:W,gen:Y}=Q;Pz(Q,()=>{if(W.$comment&&X.$comment)Cz(Q);if(WP(Q),Y.let(u.default.vErrors,null),Y.let(u.default.errors,0),W.unevaluated)sE(Q);Rz(Q),JP(Q)});return}function sE(Q){let{gen:X,validateName:W}=Q;Q.evaluated=X.const("evaluated",x._`${W}.evaluated`),X.if(x._`${Q.evaluated}.dynamicProps`,()=>X.assign(x._`${Q.evaluated}.props`,x._`undefined`)),X.if(x._`${Q.evaluated}.dynamicItems`,()=>X.assign(x._`${Q.evaluated}.items`,x._`undefined`))}function jz(Q,X){let W=typeof Q=="object"&&Q[X.schemaId];return W&&(X.code.source||X.code.process)?x._`/*# sourceURL=${W} */`:x.nil}function eE(Q,X){if(Zz(Q)){if(Sz(Q),Iz(Q)){QP(Q,X);return}}(0,Ez.boolOrEmptySchema)(Q,X)}function Iz({schema:Q,self:X}){if(typeof Q=="boolean")return!Q;for(let W in Q)if(X.RULES.all[W])return!0;return!1}function Zz(Q){return typeof Q.schema!="boolean"}function QP(Q,X){let{schema:W,gen:Y,opts:$}=Q;if($.$comment&&W.$comment)Cz(Q);YP(Q),$P(Q);let J=Y.const("_errs",u.default.errors);Rz(Q,J),Y.var(X,x._`${J} === ${u.default.errors}`)}function Sz(Q){(0,e1.checkUnknownRules)(Q),XP(Q)}function Rz(Q,X){if(Q.opts.jtd)return wz(Q,[],!1,X);let W=(0,Mz.getSchemaTypes)(Q.schema),Y=(0,Mz.coerceAndCheckDataType)(Q,W);wz(Q,W,!Y,X)}function XP(Q){let{schema:X,errSchemaPath:W,opts:Y,self:$}=Q;if(X.$ref&&Y.ignoreKeywordsWithRef&&(0,e1.schemaHasRulesButRef)(X,$.RULES))$.logger.warn(`$ref: keywords ignored in schema at path "${W}"`)}function WP(Q){let{schema:X,opts:W}=Q;if(X.default!==void 0&&W.useDefaults&&W.strictSchema)(0,e1.checkStrictMode)(Q,"default is ignored in the schema root")}function YP(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,nE.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function $P(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Cz({gen:Q,schemaEnv:X,schema:W,errSchemaPath:Y,opts:$}){let J=W.$comment;if($.$comment===!0)Q.code(x._`${u.default.self}.logger.log(${J})`);else if(typeof $.$comment=="function"){let G=x.str`${Y}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(x._`${u.default.self}.opts.$comment(${J}, ${G}, ${H}.schema)`)}}function JP(Q){let{gen:X,schemaEnv:W,validateName:Y,ValidationError:$,opts:J}=Q;if(W.$async)X.if(x._`${u.default.errors} === 0`,()=>X.return(u.default.data),()=>X.throw(x._`new ${$}(${u.default.vErrors})`));else{if(X.assign(x._`${Y}.errors`,u.default.vErrors),J.unevaluated)GP(Q);X.return(x._`${u.default.errors} === 0`)}}function GP({gen:Q,evaluated:X,props:W,items:Y}){if(W instanceof x.Name)Q.assign(x._`${X}.props`,W);if(Y instanceof x.Name)Q.assign(x._`${X}.items`,Y)}function wz(Q,X,W,Y){let{gen:$,schema:J,data:G,allErrors:H,opts:B,self:z}=Q,{RULES:K}=z;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,e1.schemaHasRulesButRef)(J,K))){$.block(()=>kz(Q,"$ref",K.all.$ref.definition));return}if(!B.jtd)HP(Q,X);$.block(()=>{for(let V of K.rules)L(V);L(K.post)});function L(V){if(!(0,d5.shouldUseGroup)(J,V))return;if(V.type){if($.if((0,JX.checkDataType)(V.type,G,B.strictNumbers)),bz(Q,V),X.length===1&&X[0]===V.type&&W)$.else(),(0,JX.reportTypeError)(Q);$.endIf()}else bz(Q,V);if(!H)$.if(x._`${u.default.errors} === ${Y||0}`)}}function bz(Q,X){let{gen:W,schema:Y,opts:{useDefaults:$}}=Q;if($)(0,dE.assignDefaults)(Q,X.type);W.block(()=>{for(let J of X.rules)if((0,d5.shouldUseRule)(Y,J))kz(Q,J.keyword,J.definition,X.type)})}function HP(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(BP(Q,X),!Q.opts.allowUnionTypes)zP(Q,X);KP(Q,Q.dataTypes)}function BP(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((W)=>{if(!Tz(Q.dataTypes,W))n5(Q,`type "${W}" not allowed by context "${Q.dataTypes.join(",")}"`)}),FP(Q,X)}function zP(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))n5(Q,"use allowUnionTypes to allow union type keyword")}function KP(Q,X){let W=Q.self.RULES.all;for(let Y in W){let $=W[Y];if(typeof $=="object"&&(0,d5.shouldUseRule)(Q.schema,$)){let{type:J}=$.definition;if(J.length&&!J.some((G)=>LP(X,G)))n5(Q,`missing type "${J.join(",")}" for keyword "${Y}"`)}}}function LP(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function Tz(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function FP(Q,X){let W=[];for(let Y of Q.dataTypes)if(Tz(X,Y))W.push(Y);else if(X.includes("integer")&&Y==="number")W.push("integer");Q.dataTypes=W}function n5(Q,X){let W=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${W}" (strictTypes)`,(0,e1.checkStrictMode)(Q,X,Q.opts.strictTypes)}class o5{constructor(Q,X,W){if((0,WQ.validateKeywordUsage)(Q,X,W),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=W,this.data=Q.data,this.schema=Q.schema[W],this.$data=X.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,e1.schemaRefOrVal)(Q,this.schema,W,this.$data),this.schemaType=X.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=X,this.$data)this.schemaCode=Q.gen.const("vSchema",vz(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,WQ.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${W} value must be ${JSON.stringify(X.schemaType)}`);if("code"in X?X.trackErrors:X.errors!==!1)this.errsCount=Q.gen.const("_errs",u.default.errors)}result(Q,X,W){this.failResult((0,x.not)(Q),X,W)}failResult(Q,X,W){if(this.gen.if(Q),W)W();else this.error();if(X){if(this.gen.else(),X(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,X){this.failResult((0,x.not)(Q),void 0,X)}fail(Q){if(Q===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(Q),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(Q){if(!this.$data)return this.fail(Q);let{schemaCode:X}=this;this.fail(x._`${X} !== undefined && (${(0,x.or)(this.invalid$data(),Q)})`)}error(Q,X,W){if(X){this.setParams(X),this._error(Q,W),this.setParams({});return}this._error(Q,W)}_error(Q,X){(Q?XQ.reportExtraError:XQ.reportError)(this,this.def.error,X)}$dataError(){(0,XQ.reportError)(this,this.def.$dataError||XQ.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,XQ.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,X){if(X)Object.assign(this.params,Q);else this.params=Q}block$data(Q,X,W=x.nil){this.gen.block(()=>{this.check$data(Q,W),X()})}check$data(Q=x.nil,X=x.nil){if(!this.$data)return;let{gen:W,schemaCode:Y,schemaType:$,def:J}=this;if(W.if((0,x.or)(x._`${Y} === undefined`,X)),Q!==x.nil)W.assign(Q,!0);if($.length||J.validateSchema){if(W.elseIf(this.invalid$data()),this.$dataError(),Q!==x.nil)W.assign(Q,!1)}W.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:W,def:Y,it:$}=this;return(0,x.or)(J(),G());function J(){if(W.length){if(!(X instanceof x.Name))throw Error("ajv implementation error");let H=Array.isArray(W)?W:[W];return x._`${(0,JX.checkDataTypes)(H,X,$.opts.strictNumbers,JX.DataType.Wrong)}`}return x.nil}function G(){if(Y.validateSchema){let H=Q.scopeValue("validate$data",{ref:Y.validateSchema});return x._`!${H}(${X})`}return x.nil}}subschema(Q,X){let W=(0,i5.getSubschema)(this.it,Q);(0,i5.extendSubschemaData)(W,this.it,Q),(0,i5.extendSubschemaMode)(W,Q);let Y={...this.it,...W,items:void 0,props:void 0};return eE(Y,X),Y}mergeEvaluated(Q,X){let{it:W,gen:Y}=this;if(!W.opts.unevaluated)return;if(W.props!==!0&&Q.props!==void 0)W.props=e1.mergeEvaluated.props(Y,Q.props,W.props,X);if(W.items!==!0&&Q.items!==void 0)W.items=e1.mergeEvaluated.items(Y,Q.items,W.items,X)}mergeValidEvaluated(Q,X){let{it:W,gen:Y}=this;if(W.opts.unevaluated&&(W.props!==!0||W.items!==!0))return Y.if(X,()=>this.mergeEvaluated(Q,x.Name)),!0}}_z.KeywordCxt=o5;function kz(Q,X,W,Y){let $=new o5(Q,W,X);if("code"in W)W.code($,Y);else if($.$data&&W.validate)(0,WQ.funcKeywordCode)($,W);else if("macro"in W)(0,WQ.macroKeywordCode)($,W);else if(W.compile||W.validate)(0,WQ.funcKeywordCode)($,W)}var AP=/^\/(?:[^~]|~0|~1)*$/,DP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vz(Q,{dataLevel:X,dataNames:W,dataPathArr:Y}){let $,J;if(Q==="")return u.default.rootData;if(Q[0]==="/"){if(!AP.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);$=Q,J=u.default.rootData}else{let z=DP.exec(Q);if(!z)throw Error(`Invalid JSON-pointer: ${Q}`);let K=+z[1];if($=z[2],$==="#"){if(K>=X)throw Error(B("property/index",K));return Y[X-K]}if(K>X)throw Error(B("data",K));if(J=W[X-K],!$)return J}let G=J,H=$.split("/");for(let z of H)if(z)J=x._`${J}${(0,x.getProperty)((0,e1.unescapeJsonPointer)(z))}`,G=x._`${G} && ${J}`;return G;function B(z,K){return`Cannot access ${z} ${K} levels up, current level is ${X}`}}_z.getData=vz});var GX=M((fz)=>{Object.defineProperty(fz,"__esModule",{value:!0});class yz extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}fz.default=yz});var $Q=M((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});var r5=QQ();class gz extends Error{constructor(Q,X,W,Y){super(Y||`can't resolve reference ${W} from id ${X}`);this.missingRef=(0,r5.resolveUrl)(Q,X,W),this.missingSchema=(0,r5.normalizeId)((0,r5.getFullPath)(Q,this.missingRef))}}hz.default=gz});var BX=M((mz)=>{Object.defineProperty(mz,"__esModule",{value:!0});mz.resolveSchema=mz.getCompilingSchema=mz.resolveRef=mz.compileSchema=mz.SchemaEnv=void 0;var E1=n(),NP=GX(),s6=s1(),P1=QQ(),uz=W0(),MP=YQ();class JQ{constructor(Q){var X;this.refs={},this.dynamicAnchors={};let W;if(typeof Q.schema=="object")W=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(X=Q.baseId)!==null&&X!==void 0?X:(0,P1.normalizeId)(W===null||W===void 0?void 0:W[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=W===null||W===void 0?void 0:W.$async,this.refs={}}}mz.SchemaEnv=JQ;function a5(Q){let X=lz.call(this,Q);if(X)return X;let W=(0,P1.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:Y,lines:$}=this.opts.code,{ownProperties:J}=this.opts,G=new E1.CodeGen(this.scope,{es5:Y,lines:$,ownProperties:J}),H;if(Q.$async)H=G.scopeValue("Error",{ref:NP.default,code:E1._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");Q.validateName=B;let z={gen:G,allErrors:this.opts.allErrors,data:s6.default.data,parentData:s6.default.parentData,parentDataProperty:s6.default.parentDataProperty,dataNames:[s6.default.data],dataPathArr:[E1.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,E1.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:W,baseId:Q.baseId||W,schemaPath:E1.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:E1._`""`,opts:this.opts,self:this},K;try{this._compilations.add(Q),(0,MP.validateFunctionCode)(z),G.optimize(this.opts.code.optimize);let L=G.toString();if(K=`${G.scopeRefs(s6.default.scope)}return ${L}`,this.opts.code.process)K=this.opts.code.process(K,Q);let F=Function(`${s6.default.self}`,`${s6.default.scope}`,K)(this,this.scope.get());if(this.scope.value(B,{ref:F}),F.errors=null,F.schema=Q.schema,F.schemaEnv=Q,Q.$async)F.$async=!0;if(this.opts.code.source===!0)F.source={validateName:B,validateCode:L,scopeValues:G._values};if(this.opts.unevaluated){let{props:D,items:A}=z;if(F.evaluated={props:D instanceof E1.Name?void 0:D,items:A instanceof E1.Name?void 0:A,dynamicProps:D instanceof E1.Name,dynamicItems:A instanceof E1.Name},F.source)F.source.evaluated=(0,E1.stringify)(F.evaluated)}return Q.validate=F,Q}catch(L){if(delete Q.validate,delete Q.validateName,K)this.logger.error("Error compiling schema, function code:",K);throw L}finally{this._compilations.delete(Q)}}mz.compileSchema=a5;function jP(Q,X,W){var Y;W=(0,P1.resolveUrl)(this.opts.uriResolver,X,W);let $=Q.refs[W];if($)return $;let J=EP.call(this,Q,W);if(J===void 0){let G=(Y=Q.localRefs)===null||Y===void 0?void 0:Y[W],{schemaId:H}=this.opts;if(G)J=new JQ({schema:G,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[W]=wP.call(this,J)}mz.resolveRef=jP;function wP(Q){if((0,P1.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:a5.call(this,Q)}function lz(Q){for(let X of this._compilations)if(bP(X,Q))return X}mz.getCompilingSchema=lz;function bP(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function EP(Q,X){let W;while(typeof(W=this.refs[X])=="string")X=W;return W||this.schemas[X]||HX.call(this,Q,X)}function HX(Q,X){let W=this.opts.uriResolver.parse(X),Y=(0,P1._getFullPath)(this.opts.uriResolver,W),$=(0,P1.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&Y===$)return t5.call(this,W,Q);let J=(0,P1.normalizeId)(Y),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let H=HX.call(this,Q,G);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return t5.call(this,W,H)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)a5.call(this,G);if(J===(0,P1.normalizeId)(X)){let{schema:H}=G,{schemaId:B}=this.opts,z=H[B];if(z)$=(0,P1.resolveUrl)(this.opts.uriResolver,$,z);return new JQ({schema:H,schemaId:B,root:Q,baseId:$})}return t5.call(this,W,G)}mz.resolveSchema=HX;var PP=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function t5(Q,{baseId:X,schema:W,root:Y}){var $;if((($=Q.fragment)===null||$===void 0?void 0:$[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof W==="boolean")return;let B=W[(0,uz.unescapeFragment)(H)];if(B===void 0)return;W=B;let z=typeof W==="object"&&W[this.opts.schemaId];if(!PP.has(H)&&z)X=(0,P1.resolveUrl)(this.opts.uriResolver,X,z)}let J;if(typeof W!="boolean"&&W.$ref&&!(0,uz.schemaHasRulesButRef)(W,this.RULES)){let H=(0,P1.resolveUrl)(this.opts.uriResolver,X,W.$ref);J=HX.call(this,Y,H)}let{schemaId:G}=this.opts;if(J=J||new JQ({schema:W,schemaId:G,root:Y,baseId:X}),J.schema!==J.root.schema)return J;return}});var pz=M((nm,CP)=>{CP.exports={$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 e5=M((om,oz)=>{var TP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),dz=RegExp.prototype.test.bind(/^(?:(?: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 s5(Q){let X="",W=0,Y=0;for(Y=0;Y<Q.length;Y++){if(W=Q[Y].charCodeAt(0),W===48)continue;if(!(W>=48&&W<=57||W>=65&&W<=70||W>=97&&W<=102))return"";X+=Q[Y];break}for(Y+=1;Y<Q.length;Y++){if(W=Q[Y].charCodeAt(0),!(W>=48&&W<=57||W>=65&&W<=70||W>=97&&W<=102))return"";X+=Q[Y]}return X}var kP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function iz(Q){return Q.length=0,!0}function vP(Q,X,W){if(Q.length){let Y=s5(Q);if(Y!=="")X.push(Y);else return W.error=!0,!1;Q.length=0}return!0}function _P(Q){let X=0,W={error:!1,address:"",zone:""},Y=[],$=[],J=!1,G=!1,H=vP;for(let B=0;B<Q.length;B++){let z=Q[B];if(z==="["||z==="]")continue;if(z===":"){if(J===!0)G=!0;if(!H($,Y,W))break;if(++X>7){W.error=!0;break}if(B>0&&Q[B-1]===":")J=!0;Y.push(":");continue}else if(z==="%"){if(!H($,Y,W))break;H=iz}else{$.push(z);continue}}if($.length)if(H===iz)W.zone=$.join("");else if(G)Y.push($.join(""));else Y.push(s5($));return W.address=Y.join(""),W}function nz(Q){if(xP(Q,":")<2)return{host:Q,isIPV6:!1};let X=_P(Q);if(!X.error){let{address:W,address:Y}=X;if(X.zone)W+="%"+X.zone,Y+="%25"+X.zone;return{host:W,isIPV6:!0,escapedHost:Y}}else return{host:Q,isIPV6:!1}}function xP(Q,X){let W=0;for(let Y=0;Y<Q.length;Y++)if(Q[Y]===X)W++;return W}function yP(Q){let X=Q,W=[],Y=-1,$=0;while($=X.length){if($===1)if(X===".")break;else if(X==="/"){W.push("/");break}else{W.push(X);break}else if($===2){if(X[0]==="."){if(X[1]===".")break;else if(X[1]==="/"){X=X.slice(2);continue}}else if(X[0]==="/"){if(X[1]==="."||X[1]==="/"){W.push("/");break}}}else if($===3){if(X==="/.."){if(W.length!==0)W.pop();W.push("/");break}}if(X[0]==="."){if(X[1]==="."){if(X[2]==="/"){X=X.slice(3);continue}}else if(X[1]==="/"){X=X.slice(2);continue}}else if(X[0]==="/"){if(X[1]==="."){if(X[2]==="/"){X=X.slice(2);continue}else if(X[2]==="."){if(X[3]==="/"){if(X=X.slice(3),W.length!==0)W.pop();continue}}}}if((Y=X.indexOf("/",1))===-1){W.push(X);break}else W.push(X.slice(0,Y)),X=X.slice(Y)}return W.join("")}function fP(Q,X){let W=X!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=W(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=W(Q.userinfo);if(Q.host!==void 0)Q.host=W(Q.host);if(Q.path!==void 0)Q.path=W(Q.path);if(Q.query!==void 0)Q.query=W(Q.query);if(Q.fragment!==void 0)Q.fragment=W(Q.fragment);return Q}function gP(Q){let X=[];if(Q.userinfo!==void 0)X.push(Q.userinfo),X.push("@");if(Q.host!==void 0){let W=unescape(Q.host);if(!dz(W)){let Y=nz(W);if(Y.isIPV6===!0)W=`[${Y.escapedHost}]`;else W=Q.host}X.push(W)}if(typeof Q.port==="number"||typeof Q.port==="string")X.push(":"),X.push(String(Q.port));return X.length?X.join(""):void 0}oz.exports={nonSimpleDomain:kP,recomposeAuthority:gP,normalizeComponentEncoding:fP,removeDotSegments:yP,isIPv4:dz,isUUID:TP,normalizeIPv6:nz,stringArrayToHexStripped:s5}});var ez=M((rm,sz)=>{var{isUUID:hP}=e5(),uP=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,lP=["http","https","ws","wss","urn","urn:uuid"];function mP(Q){return lP.indexOf(Q)!==-1}function Q$(Q){if(Q.secure===!0)return!0;else if(Q.secure===!1)return!1;else if(Q.scheme)return Q.scheme.length===3&&(Q.scheme[0]==="w"||Q.scheme[0]==="W")&&(Q.scheme[1]==="s"||Q.scheme[1]==="S")&&(Q.scheme[2]==="s"||Q.scheme[2]==="S");else return!1}function rz(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function tz(Q){let X=String(Q.scheme).toLowerCase()==="https";if(Q.port===(X?443:80)||Q.port==="")Q.port=void 0;if(!Q.path)Q.path="/";return Q}function cP(Q){return Q.secure=Q$(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function pP(Q){if(Q.port===(Q$(Q)?443:80)||Q.port==="")Q.port=void 0;if(typeof Q.secure==="boolean")Q.scheme=Q.secure?"wss":"ws",Q.secure=void 0;if(Q.resourceName){let[X,W]=Q.resourceName.split("?");Q.path=X&&X!=="/"?X:void 0,Q.query=W,Q.resourceName=void 0}return Q.fragment=void 0,Q}function iP(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let W=Q.path.match(uP);if(W){let Y=X.scheme||Q.scheme||"urn";Q.nid=W[1].toLowerCase(),Q.nss=W[2];let $=`${Y}:${X.nid||Q.nid}`,J=X$($);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function dP(Q,X){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let W=X.scheme||Q.scheme||"urn",Y=Q.nid.toLowerCase(),$=`${W}:${X.nid||Y}`,J=X$($);if(J)Q=J.serialize(Q,X);let G=Q,H=Q.nss;return G.path=`${Y||X.nid}:${H}`,X.skipEscape=!0,G}function nP(Q,X){let W=Q;if(W.uuid=W.nss,W.nss=void 0,!X.tolerant&&(!W.uuid||!hP(W.uuid)))W.error=W.error||"UUID is not valid.";return W}function oP(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var az={scheme:"http",domainHost:!0,parse:rz,serialize:tz},rP={scheme:"https",domainHost:az.domainHost,parse:rz,serialize:tz},zX={scheme:"ws",domainHost:!0,parse:cP,serialize:pP},tP={scheme:"wss",domainHost:zX.domainHost,parse:zX.parse,serialize:zX.serialize},aP={scheme:"urn",parse:iP,serialize:dP,skipNormalize:!0},sP={scheme:"urn:uuid",parse:nP,serialize:oP,skipNormalize:!0},KX={http:az,https:rP,ws:zX,wss:tP,urn:aP,"urn:uuid":sP};Object.setPrototypeOf(KX,null);function X$(Q){return Q&&(KX[Q]||KX[Q.toLowerCase()])||void 0}sz.exports={wsIsSecure:Q$,SCHEMES:KX,isValidSchemeName:mP,getSchemeHandler:X$}});var Y$=M((tm,FX)=>{var{normalizeIPv6:eP,removeDotSegments:GQ,recomposeAuthority:QI,normalizeComponentEncoding:LX,isIPv4:XI,nonSimpleDomain:WI}=e5(),{SCHEMES:YI,getSchemeHandler:QK}=ez();function $I(Q,X){if(typeof Q==="string")Q=l1(Q6(Q,X),X);else if(typeof Q==="object")Q=Q6(l1(Q,X),X);return Q}function JI(Q,X,W){let Y=W?Object.assign({scheme:"null"},W):{scheme:"null"},$=XK(Q6(Q,Y),Q6(X,Y),Y,!0);return Y.skipEscape=!0,l1($,Y)}function XK(Q,X,W,Y){let $={};if(!Y)Q=Q6(l1(Q,W),W),X=Q6(l1(X,W),W);if(W=W||{},!W.tolerant&&X.scheme)$.scheme=X.scheme,$.userinfo=X.userinfo,$.host=X.host,$.port=X.port,$.path=GQ(X.path||""),$.query=X.query;else{if(X.userinfo!==void 0||X.host!==void 0||X.port!==void 0)$.userinfo=X.userinfo,$.host=X.host,$.port=X.port,$.path=GQ(X.path||""),$.query=X.query;else{if(!X.path)if($.path=Q.path,X.query!==void 0)$.query=X.query;else $.query=Q.query;else{if(X.path[0]==="/")$.path=GQ(X.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)$.path="/"+X.path;else if(!Q.path)$.path=X.path;else $.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+X.path;$.path=GQ($.path)}$.query=X.query}$.userinfo=Q.userinfo,$.host=Q.host,$.port=Q.port}$.scheme=Q.scheme}return $.fragment=X.fragment,$}function GI(Q,X,W){if(typeof Q==="string")Q=unescape(Q),Q=l1(LX(Q6(Q,W),!0),{...W,skipEscape:!0});else if(typeof Q==="object")Q=l1(LX(Q,!0),{...W,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=l1(LX(Q6(X,W),!0),{...W,skipEscape:!0});else if(typeof X==="object")X=l1(LX(X,!0),{...W,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function l1(Q,X){let W={host:Q.host,scheme:Q.scheme,userinfo:Q.userinfo,port:Q.port,path:Q.path,query:Q.query,nid:Q.nid,nss:Q.nss,uuid:Q.uuid,fragment:Q.fragment,reference:Q.reference,resourceName:Q.resourceName,secure:Q.secure,error:""},Y=Object.assign({},X),$=[],J=QK(Y.scheme||W.scheme);if(J&&J.serialize)J.serialize(W,Y);if(W.path!==void 0)if(!Y.skipEscape){if(W.path=escape(W.path),W.scheme!==void 0)W.path=W.path.split("%3A").join(":")}else W.path=unescape(W.path);if(Y.reference!=="suffix"&&W.scheme)$.push(W.scheme,":");let G=QI(W);if(G!==void 0){if(Y.reference!=="suffix")$.push("//");if($.push(G),W.path&&W.path[0]!=="/")$.push("/")}if(W.path!==void 0){let H=W.path;if(!Y.absolutePath&&(!J||!J.absolutePath))H=GQ(H);if(G===void 0&&H[0]==="/"&&H[1]==="/")H="/%2F"+H.slice(2);$.push(H)}if(W.query!==void 0)$.push("?",W.query);if(W.fragment!==void 0)$.push("#",W.fragment);return $.join("")}var HI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Q6(Q,X){let W=Object.assign({},X),Y={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},$=!1;if(W.reference==="suffix")if(W.scheme)Q=W.scheme+":"+Q;else Q="//"+Q;let J=Q.match(HI);if(J){if(Y.scheme=J[1],Y.userinfo=J[3],Y.host=J[4],Y.port=parseInt(J[5],10),Y.path=J[6]||"",Y.query=J[7],Y.fragment=J[8],isNaN(Y.port))Y.port=J[5];if(Y.host)if(XI(Y.host)===!1){let B=eP(Y.host);Y.host=B.host.toLowerCase(),$=B.isIPV6}else $=!0;if(Y.scheme===void 0&&Y.userinfo===void 0&&Y.host===void 0&&Y.port===void 0&&Y.query===void 0&&!Y.path)Y.reference="same-document";else if(Y.scheme===void 0)Y.reference="relative";else if(Y.fragment===void 0)Y.reference="absolute";else Y.reference="uri";if(W.reference&&W.reference!=="suffix"&&W.reference!==Y.reference)Y.error=Y.error||"URI is not a "+W.reference+" reference.";let G=QK(W.scheme||Y.scheme);if(!W.unicodeSupport&&(!G||!G.unicodeSupport)){if(Y.host&&(W.domainHost||G&&G.domainHost)&&$===!1&&WI(Y.host))try{Y.host=URL.domainToASCII(Y.host.toLowerCase())}catch(H){Y.error=Y.error||"Host's domain name can not be converted to ASCII: "+H}}if(!G||G&&!G.skipNormalize){if(Q.indexOf("%")!==-1){if(Y.scheme!==void 0)Y.scheme=unescape(Y.scheme);if(Y.host!==void 0)Y.host=unescape(Y.host)}if(Y.path)Y.path=escape(unescape(Y.path));if(Y.fragment)Y.fragment=encodeURI(decodeURIComponent(Y.fragment))}if(G&&G.parse)G.parse(Y,W)}else Y.error=Y.error||"URI can not be parsed.";return Y}var W$={SCHEMES:YI,normalize:$I,resolve:JI,resolveComponent:XK,equal:GI,serialize:l1,parse:Q6};FX.exports=W$;FX.exports.default=W$;FX.exports.fastUri=W$});var $K=M((YK)=>{Object.defineProperty(YK,"__esModule",{value:!0});var WK=Y$();WK.code='require("ajv/dist/runtime/uri").default';YK.default=WK});var FK=M((X6)=>{Object.defineProperty(X6,"__esModule",{value:!0});X6.CodeGen=X6.Name=X6.nil=X6.stringify=X6.str=X6._=X6.KeywordCxt=void 0;var zI=YQ();Object.defineProperty(X6,"KeywordCxt",{enumerable:!0,get:function(){return zI.KeywordCxt}});var m9=n();Object.defineProperty(X6,"_",{enumerable:!0,get:function(){return m9._}});Object.defineProperty(X6,"str",{enumerable:!0,get:function(){return m9.str}});Object.defineProperty(X6,"stringify",{enumerable:!0,get:function(){return m9.stringify}});Object.defineProperty(X6,"nil",{enumerable:!0,get:function(){return m9.nil}});Object.defineProperty(X6,"Name",{enumerable:!0,get:function(){return m9.Name}});Object.defineProperty(X6,"CodeGen",{enumerable:!0,get:function(){return m9.CodeGen}});var KI=GX(),zK=$Q(),LI=y5(),HQ=BX(),FI=n(),BQ=QQ(),AX=s4(),J$=W0(),JK=pz(),AI=$K(),KK=(Q,X)=>new RegExp(Q,X);KK.code="new RegExp";var DI=["removeAdditional","useDefaults","coerceTypes"],VI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),OI={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."},UI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},GK=200;function qI(Q){var X,W,Y,$,J,G,H,B,z,K,L,V,F,D,A,O,U,j,w,T,P,z0,w0,v1,_6;let F1=Q.strict,x6=(X=Q.code)===null||X===void 0?void 0:X.optimize,K4=x6===!0||x6===void 0?1:x6||0,L4=(Y=(W=Q.code)===null||W===void 0?void 0:W.regExp)!==null&&Y!==void 0?Y:KK,SW=($=Q.uriResolver)!==null&&$!==void 0?$:AI.default;return{strictSchema:(G=(J=Q.strictSchema)!==null&&J!==void 0?J:F1)!==null&&G!==void 0?G:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:F1)!==null&&B!==void 0?B:!0,strictTypes:(K=(z=Q.strictTypes)!==null&&z!==void 0?z:F1)!==null&&K!==void 0?K:"log",strictTuples:(V=(L=Q.strictTuples)!==null&&L!==void 0?L:F1)!==null&&V!==void 0?V:"log",strictRequired:(D=(F=Q.strictRequired)!==null&&F!==void 0?F:F1)!==null&&D!==void 0?D:!1,code:Q.code?{...Q.code,optimize:K4,regExp:L4}:{optimize:K4,regExp:L4},loopRequired:(A=Q.loopRequired)!==null&&A!==void 0?A:GK,loopEnum:(O=Q.loopEnum)!==null&&O!==void 0?O:GK,meta:(U=Q.meta)!==null&&U!==void 0?U:!0,messages:(j=Q.messages)!==null&&j!==void 0?j:!0,inlineRefs:(w=Q.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(T=Q.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(P=Q.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(z0=Q.validateSchema)!==null&&z0!==void 0?z0:!0,validateFormats:(w0=Q.validateFormats)!==null&&w0!==void 0?w0:!0,unicodeRegExp:(v1=Q.unicodeRegExp)!==null&&v1!==void 0?v1:!0,int32range:(_6=Q.int32range)!==null&&_6!==void 0?_6:!0,uriResolver:SW}}class DX{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...qI(Q)};let{es5:X,lines:W}=this.opts.code;this.scope=new FI.ValueScope({scope:{},prefixes:VI,es5:X,lines:W}),this.logger=EI(Q.logger);let Y=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,LI.getRules)(),HK.call(this,OI,Q,"NOT SUPPORTED"),HK.call(this,UI,Q,"DEPRECATED","warn"),this._metaOpts=wI.call(this),Q.formats)MI.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)jI.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);NI.call(this),Q.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:W}=this.opts,Y=JK;if(W==="id")Y={...JK},Y.id=Y.$id,delete Y.$id;if(X&&Q)this.addMetaSchema(Y,Y[W],!1)}defaultMeta(){let{meta:Q,schemaId:X}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[X]||Q:void 0}validate(Q,X){let W;if(typeof Q=="string"){if(W=this.getSchema(Q),!W)throw Error(`no schema with key or ref "${Q}"`)}else W=this.compile(Q);let Y=W(X);if(!("$async"in W))this.errors=W.errors;return Y}compile(Q,X){let W=this._addSchema(Q,X);return W.validate||this._compileSchemaEnv(W)}compileAsync(Q,X){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:W}=this.opts;return Y.call(this,Q,X);async function Y(z,K){await $.call(this,z.$schema);let L=this._addSchema(z,K);return L.validate||J.call(this,L)}async function $(z){if(z&&!this.getSchema(z))await Y.call(this,{$ref:z},!0)}async function J(z){try{return this._compileSchemaEnv(z)}catch(K){if(!(K instanceof zK.default))throw K;return G.call(this,K),await H.call(this,K.missingSchema),J.call(this,z)}}function G({missingSchema:z,missingRef:K}){if(this.refs[z])throw Error(`AnySchema ${z} is loaded but ${K} cannot be resolved`)}async function H(z){let K=await B.call(this,z);if(!this.refs[z])await $.call(this,K.$schema);if(!this.refs[z])this.addSchema(K,z,X)}async function B(z){let K=this._loading[z];if(K)return K;try{return await(this._loading[z]=W(z))}finally{delete this._loading[z]}}}addSchema(Q,X,W,Y=this.opts.validateSchema){if(Array.isArray(Q)){for(let J of Q)this.addSchema(J,void 0,W,Y);return this}let $;if(typeof Q==="object"){let{schemaId:J}=this.opts;if($=Q[J],$!==void 0&&typeof $!="string")throw Error(`schema ${J} must be string`)}return X=(0,BQ.normalizeId)(X||$),this._checkUnique(X),this.schemas[X]=this._addSchema(Q,W,X,Y,!0),this}addMetaSchema(Q,X,W=this.opts.validateSchema){return this.addSchema(Q,X,!0,W),this}validateSchema(Q,X){if(typeof Q=="boolean")return!0;let W;if(W=Q.$schema,W!==void 0&&typeof W!="string")throw Error("$schema must be a string");if(W=W||this.opts.defaultMeta||this.defaultMeta(),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Y=this.validate(W,Q);if(!Y&&X){let $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw Error($)}return Y}getSchema(Q){let X;while(typeof(X=BK.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:W}=this.opts,Y=new HQ.SchemaEnv({schema:{},schemaId:W});if(X=HQ.resolveSchema.call(this,Y,Q),!X)return;this.refs[Q]=X}return X.validate||this._compileSchemaEnv(X)}removeSchema(Q){if(Q instanceof RegExp)return this._removeAllSchemas(this.schemas,Q),this._removeAllSchemas(this.refs,Q),this;switch(typeof Q){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let X=BK.call(this,Q);if(typeof X=="object")this._cache.delete(X.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let X=Q;this._cache.delete(X);let W=Q[this.opts.schemaId];if(W)W=(0,BQ.normalizeId)(W),delete this.schemas[W],delete this.refs[W];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let X of Q)this.addKeyword(X);return this}addKeyword(Q,X){let W;if(typeof Q=="string"){if(W=Q,typeof X=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),X.keyword=W}else if(typeof Q=="object"&&X===void 0){if(X=Q,W=X.keyword,Array.isArray(W)&&!W.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(II.call(this,W,X),!X)return(0,J$.eachItem)(W,($)=>$$.call(this,$)),this;SI.call(this,X);let Y={...X,type:(0,AX.getJSONTypes)(X.type),schemaType:(0,AX.getJSONTypes)(X.schemaType)};return(0,J$.eachItem)(W,Y.type.length===0?($)=>$$.call(this,$,Y):($)=>Y.type.forEach((J)=>$$.call(this,$,Y,J))),this}getKeyword(Q){let X=this.RULES.all[Q];return typeof X=="object"?X.definition:!!X}removeKeyword(Q){let{RULES:X}=this;delete X.keywords[Q],delete X.all[Q];for(let W of X.rules){let Y=W.rules.findIndex(($)=>$.keyword===Q);if(Y>=0)W.rules.splice(Y,1)}return this}addFormat(Q,X){if(typeof X=="string")X=new RegExp(X);return this.formats[Q]=X,this}errorsText(Q=this.errors,{separator:X=", ",dataVar:W="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((Y)=>`${W}${Y.instancePath} ${Y.message}`).reduce((Y,$)=>Y+X+$)}$dataMetaSchema(Q,X){let W=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let Y of X){let $=Y.split("/").slice(1),J=Q;for(let G of $)J=J[G];for(let G in W){let H=W[G];if(typeof H!="object")continue;let{$data:B}=H.definition,z=J[G];if(B&&z)J[G]=LK(z)}}return Q}_removeAllSchemas(Q,X){for(let W in Q){let Y=Q[W];if(!X||X.test(W)){if(typeof Y=="string")delete Q[W];else if(Y&&!Y.meta)this._cache.delete(Y.schema),delete Q[W]}}}_addSchema(Q,X,W,Y=this.opts.validateSchema,$=this.opts.addUsedSchema){let J,{schemaId:G}=this.opts;if(typeof Q=="object")J=Q[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let H=this._cache.get(Q);if(H!==void 0)return H;W=(0,BQ.normalizeId)(J||W);let B=BQ.getSchemaRefs.call(this,Q,W);if(H=new HQ.SchemaEnv({schema:Q,schemaId:G,meta:X,baseId:W,localRefs:B}),this._cache.set(H.schema,H),$&&!W.startsWith("#")){if(W)this._checkUnique(W);this.refs[W]=H}if(Y)this.validateSchema(Q,!0);return H}_checkUnique(Q){if(this.schemas[Q]||this.refs[Q])throw Error(`schema with key or id "${Q}" already exists`)}_compileSchemaEnv(Q){if(Q.meta)this._compileMetaSchema(Q);else HQ.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let X=this.opts;this.opts=this._metaOpts;try{HQ.compileSchema.call(this,Q)}finally{this.opts=X}}}DX.ValidationError=KI.default;DX.MissingRefError=zK.default;X6.default=DX;function HK(Q,X,W,Y="error"){for(let $ in Q){let J=$;if(J in X)this.logger[Y](`${W}: option ${$}. ${Q[J]}`)}}function BK(Q){return Q=(0,BQ.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function NI(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let X in Q)this.addSchema(Q[X],X)}function MI(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function jI(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let X in Q){let W=Q[X];if(!W.keyword)W.keyword=X;this.addKeyword(W)}}function wI(){let Q={...this.opts};for(let X of DI)delete Q[X];return Q}var bI={log(){},warn(){},error(){}};function EI(Q){if(Q===!1)return bI;if(Q===void 0)return console;if(Q.log&&Q.warn&&Q.error)return Q;throw Error("logger must implement log, warn and error methods")}var PI=/^[a-z_$][a-z0-9_$:-]*$/i;function II(Q,X){let{RULES:W}=this;if((0,J$.eachItem)(Q,(Y)=>{if(W.keywords[Y])throw Error(`Keyword ${Y} is already defined`);if(!PI.test(Y))throw Error(`Keyword ${Y} has invalid name`)}),!X)return;if(X.$data&&!(("code"in X)||("validate"in X)))throw Error('$data keyword must have "code" or "validate" function')}function $$(Q,X,W){var Y;let $=X===null||X===void 0?void 0:X.post;if(W&&$)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=$?J.post:J.rules.find(({type:B})=>B===W);if(!G)G={type:W,rules:[]},J.rules.push(G);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,AX.getJSONTypes)(X.type),schemaType:(0,AX.getJSONTypes)(X.schemaType)}};if(X.before)ZI.call(this,G,H,X.before);else G.rules.push(H);J.all[Q]=H,(Y=X.implements)===null||Y===void 0||Y.forEach((B)=>this.addKeyword(B))}function ZI(Q,X,W){let Y=Q.rules.findIndex(($)=>$.keyword===W);if(Y>=0)Q.rules.splice(Y,0,X);else Q.rules.push(X),this.logger.warn(`rule ${W} is not defined`)}function SI(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=LK(X);Q.validateSchema=this.compile(X,!0)}var RI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function LK(Q){return{anyOf:[Q,RI]}}});var DK=M((AK)=>{Object.defineProperty(AK,"__esModule",{value:!0});var kI={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};AK.default=kI});var MK=M((qK)=>{Object.defineProperty(qK,"__esModule",{value:!0});qK.callRef=qK.getValidate=void 0;var _I=$Q(),VK=B1(),s0=n(),c9=s1(),OK=BX(),VX=W0(),xI={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:W,it:Y}=Q,{baseId:$,schemaEnv:J,validateName:G,opts:H,self:B}=Y,{root:z}=J;if((W==="#"||W==="#/")&&$===z.baseId)return L();let K=OK.resolveRef.call(B,z,$,W);if(K===void 0)throw new _I.default(Y.opts.uriResolver,$,W);if(K instanceof OK.SchemaEnv)return V(K);return F(K);function L(){if(J===z)return OX(Q,G,J,J.$async);let D=X.scopeValue("root",{ref:z});return OX(Q,s0._`${D}.validate`,z,z.$async)}function V(D){let A=UK(Q,D);OX(Q,A,D,D.$async)}function F(D){let A=X.scopeValue("schema",H.code.source===!0?{ref:D,code:(0,s0.stringify)(D)}:{ref:D}),O=X.name("valid"),U=Q.subschema({schema:D,dataTypes:[],schemaPath:s0.nil,topSchemaRef:A,errSchemaPath:W},O);Q.mergeEvaluated(U),Q.ok(O)}}};function UK(Q,X){let{gen:W}=Q;return X.validate?W.scopeValue("validate",{ref:X.validate}):s0._`${W.scopeValue("wrapper",{ref:X})}.validate`}qK.getValidate=UK;function OX(Q,X,W,Y){let{gen:$,it:J}=Q,{allErrors:G,schemaEnv:H,opts:B}=J,z=B.passContext?c9.default.this:s0.nil;if(Y)K();else L();function K(){if(!H.$async)throw Error("async schema referenced by sync schema");let D=$.let("valid");$.try(()=>{if($.code(s0._`await ${(0,VK.callValidateCode)(Q,X,z)}`),F(X),!G)$.assign(D,!0)},(A)=>{if($.if(s0._`!(${A} instanceof ${J.ValidationError})`,()=>$.throw(A)),V(A),!G)$.assign(D,!1)}),Q.ok(D)}function L(){Q.result((0,VK.callValidateCode)(Q,X,z),()=>F(X),()=>V(X))}function V(D){let A=s0._`${D}.errors`;$.assign(c9.default.vErrors,s0._`${c9.default.vErrors} === null ? ${A} : ${c9.default.vErrors}.concat(${A})`),$.assign(c9.default.errors,s0._`${c9.default.vErrors}.length`)}function F(D){var A;if(!J.opts.unevaluated)return;let O=(A=W===null||W===void 0?void 0:W.validate)===null||A===void 0?void 0:A.evaluated;if(J.props!==!0)if(O&&!O.dynamicProps){if(O.props!==void 0)J.props=VX.mergeEvaluated.props($,O.props,J.props)}else{let U=$.var("props",s0._`${D}.evaluated.props`);J.props=VX.mergeEvaluated.props($,U,J.props,s0.Name)}if(J.items!==!0)if(O&&!O.dynamicItems){if(O.items!==void 0)J.items=VX.mergeEvaluated.items($,O.items,J.items)}else{let U=$.var("items",s0._`${D}.evaluated.items`);J.items=VX.mergeEvaluated.items($,U,J.items,s0.Name)}}}qK.callRef=OX;qK.default=xI});var wK=M((jK)=>{Object.defineProperty(jK,"__esModule",{value:!0});var gI=DK(),hI=MK(),uI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gI.default,hI.default];jK.default=uI});var EK=M((bK)=>{Object.defineProperty(bK,"__esModule",{value:!0});var UX=n(),b6=UX.operators,qX={maximum:{okStr:"<=",ok:b6.LTE,fail:b6.GT},minimum:{okStr:">=",ok:b6.GTE,fail:b6.LT},exclusiveMaximum:{okStr:"<",ok:b6.LT,fail:b6.GTE},exclusiveMinimum:{okStr:">",ok:b6.GT,fail:b6.LTE}},mI={message:({keyword:Q,schemaCode:X})=>UX.str`must be ${qX[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>UX._`{comparison: ${qX[Q].okStr}, limit: ${X}}`},cI={keyword:Object.keys(qX),type:"number",schemaType:"number",$data:!0,error:mI,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q;Q.fail$data(UX._`${W} ${qX[X].fail} ${Y} || isNaN(${W})`)}};bK.default=cI});var IK=M((PK)=>{Object.defineProperty(PK,"__esModule",{value:!0});var zQ=n(),iI={message:({schemaCode:Q})=>zQ.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>zQ._`{multipleOf: ${Q}}`},dI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:iI,code(Q){let{gen:X,data:W,schemaCode:Y,it:$}=Q,J=$.opts.multipleOfPrecision,G=X.let("res"),H=J?zQ._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:zQ._`${G} !== parseInt(${G})`;Q.fail$data(zQ._`(${Y} === 0 || (${G} = ${W}/${Y}, ${H}))`)}};PK.default=dI});var RK=M((SK)=>{Object.defineProperty(SK,"__esModule",{value:!0});function ZK(Q){let X=Q.length,W=0,Y=0,$;while(Y<X)if(W++,$=Q.charCodeAt(Y++),$>=55296&&$<=56319&&Y<X){if($=Q.charCodeAt(Y),($&64512)===56320)Y++}return W}SK.default=ZK;ZK.code='require("ajv/dist/runtime/ucs2length").default'});var TK=M((CK)=>{Object.defineProperty(CK,"__esModule",{value:!0});var e6=n(),rI=W0(),tI=RK(),aI={message({keyword:Q,schemaCode:X}){let W=Q==="maxLength"?"more":"fewer";return e6.str`must NOT have ${W} than ${X} characters`},params:({schemaCode:Q})=>e6._`{limit: ${Q}}`},sI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:aI,code(Q){let{keyword:X,data:W,schemaCode:Y,it:$}=Q,J=X==="maxLength"?e6.operators.GT:e6.operators.LT,G=$.opts.unicode===!1?e6._`${W}.length`:e6._`${(0,rI.useFunc)(Q.gen,tI.default)}(${W})`;Q.fail$data(e6._`${G} ${J} ${Y}`)}};CK.default=sI});var vK=M((kK)=>{Object.defineProperty(kK,"__esModule",{value:!0});var QZ=B1(),NX=n(),XZ={message:({schemaCode:Q})=>NX.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>NX._`{pattern: ${Q}}`},WZ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:XZ,code(Q){let{data:X,$data:W,schema:Y,schemaCode:$,it:J}=Q,G=J.opts.unicodeRegExp?"u":"",H=W?NX._`(new RegExp(${$}, ${G}))`:(0,QZ.usePattern)(Q,Y);Q.fail$data(NX._`!${H}.test(${X})`)}};kK.default=WZ});var xK=M((_K)=>{Object.defineProperty(_K,"__esModule",{value:!0});var KQ=n(),$Z={message({keyword:Q,schemaCode:X}){let W=Q==="maxProperties"?"more":"fewer";return KQ.str`must NOT have ${W} than ${X} properties`},params:({schemaCode:Q})=>KQ._`{limit: ${Q}}`},JZ={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:$Z,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q,$=X==="maxProperties"?KQ.operators.GT:KQ.operators.LT;Q.fail$data(KQ._`Object.keys(${W}).length ${$} ${Y}`)}};_K.default=JZ});var fK=M((yK)=>{Object.defineProperty(yK,"__esModule",{value:!0});var LQ=B1(),FQ=n(),HZ=W0(),BZ={message:({params:{missingProperty:Q}})=>FQ.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>FQ._`{missingProperty: ${Q}}`},zZ={keyword:"required",type:"object",schemaType:"array",$data:!0,error:BZ,code(Q){let{gen:X,schema:W,schemaCode:Y,data:$,$data:J,it:G}=Q,{opts:H}=G;if(!J&&W.length===0)return;let B=W.length>=H.loopRequired;if(G.allErrors)z();else K();if(H.strictRequired){let F=Q.parentSchema.properties,{definedProperties:D}=Q.it;for(let A of W)if((F===null||F===void 0?void 0:F[A])===void 0&&!D.has(A)){let O=G.schemaEnv.baseId+G.errSchemaPath,U=`required property "${A}" is not defined at "${O}" (strictRequired)`;(0,HZ.checkStrictMode)(G,U,G.opts.strictRequired)}}function z(){if(B||J)Q.block$data(FQ.nil,L);else for(let F of W)(0,LQ.checkReportMissingProp)(Q,F)}function K(){let F=X.let("missing");if(B||J){let D=X.let("valid",!0);Q.block$data(D,()=>V(F,D)),Q.ok(D)}else X.if((0,LQ.checkMissingProp)(Q,W,F)),(0,LQ.reportMissingProp)(Q,F),X.else()}function L(){X.forOf("prop",Y,(F)=>{Q.setParams({missingProperty:F}),X.if((0,LQ.noPropertyInData)(X,$,F,H.ownProperties),()=>Q.error())})}function V(F,D){Q.setParams({missingProperty:F}),X.forOf(F,Y,()=>{X.assign(D,(0,LQ.propertyInData)(X,$,F,H.ownProperties)),X.if((0,FQ.not)(D),()=>{Q.error(),X.break()})},FQ.nil)}}};yK.default=zZ});var hK=M((gK)=>{Object.defineProperty(gK,"__esModule",{value:!0});var AQ=n(),LZ={message({keyword:Q,schemaCode:X}){let W=Q==="maxItems"?"more":"fewer";return AQ.str`must NOT have ${W} than ${X} items`},params:({schemaCode:Q})=>AQ._`{limit: ${Q}}`},FZ={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LZ,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q,$=X==="maxItems"?AQ.operators.GT:AQ.operators.LT;Q.fail$data(AQ._`${W}.length ${$} ${Y}`)}};gK.default=FZ});var MX=M((lK)=>{Object.defineProperty(lK,"__esModule",{value:!0});var uK=e4();uK.code='require("ajv/dist/runtime/equal").default';lK.default=uK});var cK=M((mK)=>{Object.defineProperty(mK,"__esModule",{value:!0});var G$=s4(),v0=n(),VZ=W0(),OZ=MX(),UZ={message:({params:{i:Q,j:X}})=>v0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>v0._`{i: ${Q}, j: ${X}}`},qZ={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:UZ,code(Q){let{gen:X,data:W,$data:Y,schema:$,parentSchema:J,schemaCode:G,it:H}=Q;if(!Y&&!$)return;let B=X.let("valid"),z=J.items?(0,G$.getSchemaTypes)(J.items):[];Q.block$data(B,K,v0._`${G} === false`),Q.ok(B);function K(){let D=X.let("i",v0._`${W}.length`),A=X.let("j");Q.setParams({i:D,j:A}),X.assign(B,!0),X.if(v0._`${D} > 1`,()=>(L()?V:F)(D,A))}function L(){return z.length>0&&!z.some((D)=>D==="object"||D==="array")}function V(D,A){let O=X.name("item"),U=(0,G$.checkDataTypes)(z,O,H.opts.strictNumbers,G$.DataType.Wrong),j=X.const("indices",v0._`{}`);X.for(v0._`;${D}--;`,()=>{if(X.let(O,v0._`${W}[${D}]`),X.if(U,v0._`continue`),z.length>1)X.if(v0._`typeof ${O} == "string"`,v0._`${O} += "_"`);X.if(v0._`typeof ${j}[${O}] == "number"`,()=>{X.assign(A,v0._`${j}[${O}]`),Q.error(),X.assign(B,!1).break()}).code(v0._`${j}[${O}] = ${D}`)})}function F(D,A){let O=(0,VZ.useFunc)(X,OZ.default),U=X.name("outer");X.label(U).for(v0._`;${D}--;`,()=>X.for(v0._`${A} = ${D}; ${A}--;`,()=>X.if(v0._`${O}(${W}[${D}], ${W}[${A}])`,()=>{Q.error(),X.assign(B,!1).break(U)})))}}};mK.default=qZ});var iK=M((pK)=>{Object.defineProperty(pK,"__esModule",{value:!0});var H$=n(),MZ=W0(),jZ=MX(),wZ={message:"must be equal to constant",params:({schemaCode:Q})=>H$._`{allowedValue: ${Q}}`},bZ={keyword:"const",$data:!0,error:wZ,code(Q){let{gen:X,data:W,$data:Y,schemaCode:$,schema:J}=Q;if(Y||J&&typeof J=="object")Q.fail$data(H$._`!${(0,MZ.useFunc)(X,jZ.default)}(${W}, ${$})`);else Q.fail(H$._`${J} !== ${W}`)}};pK.default=bZ});var nK=M((dK)=>{Object.defineProperty(dK,"__esModule",{value:!0});var DQ=n(),PZ=W0(),IZ=MX(),ZZ={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>DQ._`{allowedValues: ${Q}}`},SZ={keyword:"enum",schemaType:"array",$data:!0,error:ZZ,code(Q){let{gen:X,data:W,$data:Y,schema:$,schemaCode:J,it:G}=Q;if(!Y&&$.length===0)throw Error("enum must have non-empty array");let H=$.length>=G.opts.loopEnum,B,z=()=>B!==null&&B!==void 0?B:B=(0,PZ.useFunc)(X,IZ.default),K;if(H||Y)K=X.let("valid"),Q.block$data(K,L);else{if(!Array.isArray($))throw Error("ajv implementation error");let F=X.const("vSchema",J);K=(0,DQ.or)(...$.map((D,A)=>V(F,A)))}Q.pass(K);function L(){X.assign(K,!1),X.forOf("v",J,(F)=>X.if(DQ._`${z()}(${W}, ${F})`,()=>X.assign(K,!0).break()))}function V(F,D){let A=$[D];return typeof A==="object"&&A!==null?DQ._`${z()}(${W}, ${F}[${D}])`:DQ._`${W} === ${A}`}}};dK.default=SZ});var rK=M((oK)=>{Object.defineProperty(oK,"__esModule",{value:!0});var CZ=EK(),TZ=IK(),kZ=TK(),vZ=vK(),_Z=xK(),xZ=fK(),yZ=hK(),fZ=cK(),gZ=iK(),hZ=nK(),uZ=[CZ.default,TZ.default,kZ.default,vZ.default,_Z.default,xZ.default,yZ.default,fZ.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},gZ.default,hZ.default];oK.default=uZ});var z$=M((aK)=>{Object.defineProperty(aK,"__esModule",{value:!0});aK.validateAdditionalItems=void 0;var Q9=n(),B$=W0(),mZ={message:({params:{len:Q}})=>Q9.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Q9._`{limit: ${Q}}`},cZ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:mZ,code(Q){let{parentSchema:X,it:W}=Q,{items:Y}=X;if(!Array.isArray(Y)){(0,B$.checkStrictMode)(W,'"additionalItems" is ignored when "items" is not an array of schemas');return}tK(Q,Y)}};function tK(Q,X){let{gen:W,schema:Y,data:$,keyword:J,it:G}=Q;G.items=!0;let H=W.const("len",Q9._`${$}.length`);if(Y===!1)Q.setParams({len:X.length}),Q.pass(Q9._`${H} <= ${X.length}`);else if(typeof Y=="object"&&!(0,B$.alwaysValidSchema)(G,Y)){let z=W.var("valid",Q9._`${H} <= ${X.length}`);W.if((0,Q9.not)(z),()=>B(z)),Q.ok(z)}function B(z){W.forRange("i",X.length,H,(K)=>{if(Q.subschema({keyword:J,dataProp:K,dataPropType:B$.Type.Num},z),!G.allErrors)W.if((0,Q9.not)(z),()=>W.break())})}}aK.validateAdditionalItems=tK;aK.default=cZ});var K$=M((XL)=>{Object.defineProperty(XL,"__esModule",{value:!0});XL.validateTuple=void 0;var eK=n(),jX=W0(),iZ=B1(),dZ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:W}=Q;if(Array.isArray(X))return QL(Q,"additionalItems",X);if(W.items=!0,(0,jX.alwaysValidSchema)(W,X))return;Q.ok((0,iZ.validateArray)(Q))}};function QL(Q,X,W=Q.schema){let{gen:Y,parentSchema:$,data:J,keyword:G,it:H}=Q;if(K($),H.opts.unevaluated&&W.length&&H.items!==!0)H.items=jX.mergeEvaluated.items(Y,W.length,H.items);let B=Y.name("valid"),z=Y.const("len",eK._`${J}.length`);W.forEach((L,V)=>{if((0,jX.alwaysValidSchema)(H,L))return;Y.if(eK._`${z} > ${V}`,()=>Q.subschema({keyword:G,schemaProp:V,dataProp:V},B)),Q.ok(B)});function K(L){let{opts:V,errSchemaPath:F}=H,D=W.length,A=D===L.minItems&&(D===L.maxItems||L[X]===!1);if(V.strictTuples&&!A){let O=`"${G}" is ${D}-tuple, but minItems or maxItems/${X} are not specified or different at path "${F}"`;(0,jX.checkStrictMode)(H,O,V.strictTuples)}}}XL.validateTuple=QL;XL.default=dZ});var $L=M((YL)=>{Object.defineProperty(YL,"__esModule",{value:!0});var oZ=K$(),rZ={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,oZ.validateTuple)(Q,"items")};YL.default=rZ});var HL=M((GL)=>{Object.defineProperty(GL,"__esModule",{value:!0});var JL=n(),aZ=W0(),sZ=B1(),eZ=z$(),QS={message:({params:{len:Q}})=>JL.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>JL._`{limit: ${Q}}`},XS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:QS,code(Q){let{schema:X,parentSchema:W,it:Y}=Q,{prefixItems:$}=W;if(Y.items=!0,(0,aZ.alwaysValidSchema)(Y,X))return;if($)(0,eZ.validateAdditionalItems)(Q,$);else Q.ok((0,sZ.validateArray)(Q))}};GL.default=XS});var zL=M((BL)=>{Object.defineProperty(BL,"__esModule",{value:!0});var z1=n(),wX=W0(),YS={message:({params:{min:Q,max:X}})=>X===void 0?z1.str`must contain at least ${Q} valid item(s)`:z1.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?z1._`{minContains: ${Q}}`:z1._`{minContains: ${Q}, maxContains: ${X}}`},$S={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YS,code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,it:J}=Q,G,H,{minContains:B,maxContains:z}=Y;if(J.opts.next)G=B===void 0?1:B,H=z;else G=1;let K=X.const("len",z1._`${$}.length`);if(Q.setParams({min:G,max:H}),H===void 0&&G===0){(0,wX.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&G>H){(0,wX.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,wX.alwaysValidSchema)(J,W)){let A=z1._`${K} >= ${G}`;if(H!==void 0)A=z1._`${A} && ${K} <= ${H}`;Q.pass(A);return}J.items=!0;let L=X.name("valid");if(H===void 0&&G===1)F(L,()=>X.if(L,()=>X.break()));else if(G===0){if(X.let(L,!0),H!==void 0)X.if(z1._`${$}.length > 0`,V)}else X.let(L,!1),V();Q.result(L,()=>Q.reset());function V(){let A=X.name("_valid"),O=X.let("count",0);F(A,()=>X.if(A,()=>D(O)))}function F(A,O){X.forRange("i",0,K,(U)=>{Q.subschema({keyword:"contains",dataProp:U,dataPropType:wX.Type.Num,compositeRule:!0},A),O()})}function D(A){if(X.code(z1._`${A}++`),H===void 0)X.if(z1._`${A} >= ${G}`,()=>X.assign(L,!0).break());else if(X.if(z1._`${A} > ${H}`,()=>X.assign(L,!1).break()),G===1)X.assign(L,!0);else X.if(z1._`${A} >= ${G}`,()=>X.assign(L,!0))}}};BL.default=$S});var VL=M((FL)=>{Object.defineProperty(FL,"__esModule",{value:!0});FL.validateSchemaDeps=FL.validatePropertyDeps=FL.error=void 0;var L$=n(),GS=W0(),VQ=B1();FL.error={message:({params:{property:Q,depsCount:X,deps:W}})=>{let Y=X===1?"property":"properties";return L$.str`must have ${Y} ${W} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:W,missingProperty:Y}})=>L$._`{property: ${Q},
7
- missingProperty: ${Y},
8
- depsCount: ${X},
9
- deps: ${W}}`};var HS={keyword:"dependencies",type:"object",schemaType:"object",error:FL.error,code(Q){let[X,W]=BS(Q);KL(Q,X),LL(Q,W)}};function BS({schema:Q}){let X={},W={};for(let Y in Q){if(Y==="__proto__")continue;let $=Array.isArray(Q[Y])?X:W;$[Y]=Q[Y]}return[X,W]}function KL(Q,X=Q.schema){let{gen:W,data:Y,it:$}=Q;if(Object.keys(X).length===0)return;let J=W.let("missing");for(let G in X){let H=X[G];if(H.length===0)continue;let B=(0,VQ.propertyInData)(W,Y,G,$.opts.ownProperties);if(Q.setParams({property:G,depsCount:H.length,deps:H.join(", ")}),$.allErrors)W.if(B,()=>{for(let z of H)(0,VQ.checkReportMissingProp)(Q,z)});else W.if(L$._`${B} && (${(0,VQ.checkMissingProp)(Q,H,J)})`),(0,VQ.reportMissingProp)(Q,J),W.else()}}FL.validatePropertyDeps=KL;function LL(Q,X=Q.schema){let{gen:W,data:Y,keyword:$,it:J}=Q,G=W.name("valid");for(let H in X){if((0,GS.alwaysValidSchema)(J,X[H]))continue;W.if((0,VQ.propertyInData)(W,Y,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:$,schemaProp:H},G);Q.mergeValidEvaluated(B,G)},()=>W.var(G,!0)),Q.ok(G)}}FL.validateSchemaDeps=LL;FL.default=HS});var qL=M((UL)=>{Object.defineProperty(UL,"__esModule",{value:!0});var OL=n(),LS=W0(),FS={message:"property name must be valid",params:({params:Q})=>OL._`{propertyName: ${Q.propertyName}}`},AS={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:FS,code(Q){let{gen:X,schema:W,data:Y,it:$}=Q;if((0,LS.alwaysValidSchema)($,W))return;let J=X.name("valid");X.forIn("key",Y,(G)=>{Q.setParams({propertyName:G}),Q.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),X.if((0,OL.not)(J),()=>{if(Q.error(!0),!$.allErrors)X.break()})}),Q.ok(J)}};UL.default=AS});var F$=M((NL)=>{Object.defineProperty(NL,"__esModule",{value:!0});var bX=B1(),I1=n(),VS=s1(),EX=W0(),OS={message:"must NOT have additional properties",params:({params:Q})=>I1._`{additionalProperty: ${Q.additionalProperty}}`},US={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:OS,code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,errsCount:J,it:G}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:H,opts:B}=G;if(G.props=!0,B.removeAdditional!=="all"&&(0,EX.alwaysValidSchema)(G,W))return;let z=(0,bX.allSchemaProperties)(Y.properties),K=(0,bX.allSchemaProperties)(Y.patternProperties);L(),Q.ok(I1._`${J} === ${VS.default.errors}`);function L(){X.forIn("key",$,(O)=>{if(!z.length&&!K.length)D(O);else X.if(V(O),()=>D(O))})}function V(O){let U;if(z.length>8){let j=(0,EX.schemaRefOrVal)(G,Y.properties,"properties");U=(0,bX.isOwnProperty)(X,j,O)}else if(z.length)U=(0,I1.or)(...z.map((j)=>I1._`${O} === ${j}`));else U=I1.nil;if(K.length)U=(0,I1.or)(U,...K.map((j)=>I1._`${(0,bX.usePattern)(Q,j)}.test(${O})`));return(0,I1.not)(U)}function F(O){X.code(I1._`delete ${$}[${O}]`)}function D(O){if(B.removeAdditional==="all"||B.removeAdditional&&W===!1){F(O);return}if(W===!1){if(Q.setParams({additionalProperty:O}),Q.error(),!H)X.break();return}if(typeof W=="object"&&!(0,EX.alwaysValidSchema)(G,W)){let U=X.name("valid");if(B.removeAdditional==="failing")A(O,U,!1),X.if((0,I1.not)(U),()=>{Q.reset(),F(O)});else if(A(O,U),!H)X.if((0,I1.not)(U),()=>X.break())}}function A(O,U,j){let w={keyword:"additionalProperties",dataProp:O,dataPropType:EX.Type.Str};if(j===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(w,U)}}};NL.default=US});var bL=M((wL)=>{Object.defineProperty(wL,"__esModule",{value:!0});var NS=YQ(),ML=B1(),A$=W0(),jL=F$(),MS={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,it:J}=Q;if(J.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)jL.default.code(new NS.KeywordCxt(J,jL.default,"additionalProperties"));let G=(0,ML.allSchemaProperties)(W);for(let L of G)J.definedProperties.add(L);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=A$.mergeEvaluated.props(X,(0,A$.toHash)(G),J.props);let H=G.filter((L)=>!(0,A$.alwaysValidSchema)(J,W[L]));if(H.length===0)return;let B=X.name("valid");for(let L of H){if(z(L))K(L);else{if(X.if((0,ML.propertyInData)(X,$,L,J.opts.ownProperties)),K(L),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(L),Q.ok(B)}function z(L){return J.opts.useDefaults&&!J.compositeRule&&W[L].default!==void 0}function K(L){Q.subschema({keyword:"properties",schemaProp:L,dataProp:L},B)}}};wL.default=MS});var SL=M((ZL)=>{Object.defineProperty(ZL,"__esModule",{value:!0});var EL=B1(),PX=n(),PL=W0(),IL=W0(),wS={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:W,data:Y,parentSchema:$,it:J}=Q,{opts:G}=J,H=(0,EL.allSchemaProperties)(W),B=H.filter((A)=>(0,PL.alwaysValidSchema)(J,W[A]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let z=G.strictSchema&&!G.allowMatchingProperties&&$.properties,K=X.name("valid");if(J.props!==!0&&!(J.props instanceof PX.Name))J.props=(0,IL.evaluatedPropsToName)(X,J.props);let{props:L}=J;V();function V(){for(let A of H){if(z)F(A);if(J.allErrors)D(A);else X.var(K,!0),D(A),X.if(K)}}function F(A){for(let O in z)if(new RegExp(A).test(O))(0,PL.checkStrictMode)(J,`property ${O} matches pattern ${A} (use allowMatchingProperties)`)}function D(A){X.forIn("key",Y,(O)=>{X.if(PX._`${(0,EL.usePattern)(Q,A)}.test(${O})`,()=>{let U=B.includes(A);if(!U)Q.subschema({keyword:"patternProperties",schemaProp:A,dataProp:O,dataPropType:IL.Type.Str},K);if(J.opts.unevaluated&&L!==!0)X.assign(PX._`${L}[${O}]`,!0);else if(!U&&!J.allErrors)X.if((0,PX.not)(K),()=>X.break())})})}}};ZL.default=wS});var CL=M((RL)=>{Object.defineProperty(RL,"__esModule",{value:!0});var ES=W0(),PS={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:W,it:Y}=Q;if((0,ES.alwaysValidSchema)(Y,W)){Q.fail();return}let $=X.name("valid");Q.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},$),Q.failResult($,()=>Q.reset(),()=>Q.error())},error:{message:"must NOT be valid"}};RL.default=PS});var kL=M((TL)=>{Object.defineProperty(TL,"__esModule",{value:!0});var ZS=B1(),SS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ZS.validateUnion,error:{message:"must match a schema in anyOf"}};TL.default=SS});var _L=M((vL)=>{Object.defineProperty(vL,"__esModule",{value:!0});var IX=n(),CS=W0(),TS={message:"must match exactly one schema in oneOf",params:({params:Q})=>IX._`{passingSchemas: ${Q.passing}}`},kS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:TS,code(Q){let{gen:X,schema:W,parentSchema:Y,it:$}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");if($.opts.discriminator&&Y.discriminator)return;let J=W,G=X.let("valid",!1),H=X.let("passing",null),B=X.name("_valid");Q.setParams({passing:H}),X.block(z),Q.result(G,()=>Q.reset(),()=>Q.error(!0));function z(){J.forEach((K,L)=>{let V;if((0,CS.alwaysValidSchema)($,K))X.var(B,!0);else V=Q.subschema({keyword:"oneOf",schemaProp:L,compositeRule:!0},B);if(L>0)X.if(IX._`${B} && ${G}`).assign(G,!1).assign(H,IX._`[${H}, ${L}]`).else();X.if(B,()=>{if(X.assign(G,!0),X.assign(H,L),V)Q.mergeEvaluated(V,IX.Name)})})}}};vL.default=kS});var yL=M((xL)=>{Object.defineProperty(xL,"__esModule",{value:!0});var _S=W0(),xS={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:W,it:Y}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");let $=X.name("valid");W.forEach((J,G)=>{if((0,_S.alwaysValidSchema)(Y,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:G},$);Q.ok($),Q.mergeEvaluated(H)})}};xL.default=xS});var uL=M((hL)=>{Object.defineProperty(hL,"__esModule",{value:!0});var ZX=n(),gL=W0(),fS={message:({params:Q})=>ZX.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>ZX._`{failingKeyword: ${Q.ifClause}}`},gS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:fS,code(Q){let{gen:X,parentSchema:W,it:Y}=Q;if(W.then===void 0&&W.else===void 0)(0,gL.checkStrictMode)(Y,'"if" without "then" and "else" is ignored');let $=fL(Y,"then"),J=fL(Y,"else");if(!$&&!J)return;let G=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),$&&J){let K=X.let("ifClause");Q.setParams({ifClause:K}),X.if(H,z("then",K),z("else",K))}else if($)X.if(H,z("then"));else X.if((0,ZX.not)(H),z("else"));Q.pass(G,()=>Q.error(!0));function B(){let K=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(K)}function z(K,L){return()=>{let V=Q.subschema({keyword:K},H);if(X.assign(G,H),Q.mergeValidEvaluated(V,G),L)X.assign(L,ZX._`${K}`);else Q.setParams({ifClause:K})}}}};function fL(Q,X){let W=Q.schema[X];return W!==void 0&&!(0,gL.alwaysValidSchema)(Q,W)}hL.default=gS});var mL=M((lL)=>{Object.defineProperty(lL,"__esModule",{value:!0});var uS=W0(),lS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:W}){if(X.if===void 0)(0,uS.checkStrictMode)(W,`"${Q}" without "if" is ignored`)}};lL.default=lS});var pL=M((cL)=>{Object.defineProperty(cL,"__esModule",{value:!0});var cS=z$(),pS=$L(),iS=K$(),dS=HL(),nS=zL(),oS=VL(),rS=qL(),tS=F$(),aS=bL(),sS=SL(),eS=CL(),QR=kL(),XR=_L(),WR=yL(),YR=uL(),$R=mL();function JR(Q=!1){let X=[eS.default,QR.default,XR.default,WR.default,YR.default,$R.default,rS.default,tS.default,oS.default,aS.default,sS.default];if(Q)X.push(pS.default,dS.default);else X.push(cS.default,iS.default);return X.push(nS.default),X}cL.default=JR});var dL=M((iL)=>{Object.defineProperty(iL,"__esModule",{value:!0});var b0=n(),HR={message:({schemaCode:Q})=>b0.str`must match format "${Q}"`,params:({schemaCode:Q})=>b0._`{format: ${Q}}`},BR={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HR,code(Q,X){let{gen:W,data:Y,$data:$,schema:J,schemaCode:G,it:H}=Q,{opts:B,errSchemaPath:z,schemaEnv:K,self:L}=H;if(!B.validateFormats)return;if($)V();else F();function V(){let D=W.scopeValue("formats",{ref:L.formats,code:B.code.formats}),A=W.const("fDef",b0._`${D}[${G}]`),O=W.let("fType"),U=W.let("format");W.if(b0._`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>W.assign(O,b0._`${A}.type || "string"`).assign(U,b0._`${A}.validate`),()=>W.assign(O,b0._`"string"`).assign(U,A)),Q.fail$data((0,b0.or)(j(),w()));function j(){if(B.strictSchema===!1)return b0.nil;return b0._`${G} && !${U}`}function w(){let T=K.$async?b0._`(${A}.async ? await ${U}(${Y}) : ${U}(${Y}))`:b0._`${U}(${Y})`,P=b0._`(typeof ${U} == "function" ? ${T} : ${U}.test(${Y}))`;return b0._`${U} && ${U} !== true && ${O} === ${X} && !${P}`}}function F(){let D=L.formats[J];if(!D){j();return}if(D===!0)return;let[A,O,U]=w(D);if(A===X)Q.pass(T());function j(){if(B.strictSchema===!1){L.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${J}" ignored in schema at path "${z}"`}}function w(P){let z0=P instanceof RegExp?(0,b0.regexpCode)(P):B.code.formats?b0._`${B.code.formats}${(0,b0.getProperty)(J)}`:void 0,w0=W.scopeValue("formats",{key:J,ref:P,code:z0});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,b0._`${w0}.validate`];return["string",P,w0]}function T(){if(typeof D=="object"&&!(D instanceof RegExp)&&D.async){if(!K.$async)throw Error("async format in sync schema");return b0._`await ${U}(${Y})`}return typeof O=="function"?b0._`${U}(${Y})`:b0._`${U}.test(${Y})`}}}};iL.default=BR});var oL=M((nL)=>{Object.defineProperty(nL,"__esModule",{value:!0});var KR=dL(),LR=[KR.default];nL.default=LR});var aL=M((rL)=>{Object.defineProperty(rL,"__esModule",{value:!0});rL.contentVocabulary=rL.metadataVocabulary=void 0;rL.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];rL.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var QF=M((eL)=>{Object.defineProperty(eL,"__esModule",{value:!0});var DR=wK(),VR=rK(),OR=pL(),UR=oL(),sL=aL(),qR=[DR.default,VR.default,(0,OR.default)(),UR.default,sL.metadataVocabulary,sL.contentVocabulary];eL.default=qR});var $F=M((WF)=>{Object.defineProperty(WF,"__esModule",{value:!0});WF.DiscrError=void 0;var XF;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(XF||(WF.DiscrError=XF={}))});var HF=M((GF)=>{Object.defineProperty(GF,"__esModule",{value:!0});var p9=n(),D$=$F(),JF=BX(),MR=$Q(),jR=W0(),wR={message:({params:{discrError:Q,tagName:X}})=>Q===D$.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:W}})=>p9._`{error: ${Q}, tag: ${W}, tagValue: ${X}}`},bR={keyword:"discriminator",type:"object",schemaType:"object",error:wR,code(Q){let{gen:X,data:W,schema:Y,parentSchema:$,it:J}=Q,{oneOf:G}=$;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let H=Y.propertyName;if(typeof H!="string")throw Error("discriminator: requires propertyName");if(Y.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let B=X.let("valid",!1),z=X.const("tag",p9._`${W}${(0,p9.getProperty)(H)}`);X.if(p9._`typeof ${z} == "string"`,()=>K(),()=>Q.error(!1,{discrError:D$.DiscrError.Tag,tag:z,tagName:H})),Q.ok(B);function K(){let F=V();X.if(!1);for(let D in F)X.elseIf(p9._`${z} === ${D}`),X.assign(B,L(F[D]));X.else(),Q.error(!1,{discrError:D$.DiscrError.Mapping,tag:z,tagName:H}),X.endIf()}function L(F){let D=X.name("valid"),A=Q.subschema({keyword:"oneOf",schemaProp:F},D);return Q.mergeEvaluated(A,p9.Name),D}function V(){var F;let D={},A=U($),O=!0;for(let T=0;T<G.length;T++){let P=G[T];if((P===null||P===void 0?void 0:P.$ref)&&!(0,jR.schemaHasRulesButRef)(P,J.self.RULES)){let w0=P.$ref;if(P=JF.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,w0),P instanceof JF.SchemaEnv)P=P.schema;if(P===void 0)throw new MR.default(J.opts.uriResolver,J.baseId,w0)}let z0=(F=P===null||P===void 0?void 0:P.properties)===null||F===void 0?void 0:F[H];if(typeof z0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);O=O&&(A||U(P)),j(z0,T)}if(!O)throw Error(`discriminator: "${H}" must be required`);return D;function U({required:T}){return Array.isArray(T)&&T.includes(H)}function j(T,P){if(T.const)w(T.const,P);else if(T.enum)for(let z0 of T.enum)w(z0,P);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function w(T,P){if(typeof T!="string"||T in D)throw Error(`discriminator: "${H}" values must be unique strings`);D[T]=P}}}};GF.default=bR});var BF=M((pc,PR)=>{PR.exports={$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 KF=M((e0,V$)=>{Object.defineProperty(e0,"__esModule",{value:!0});e0.MissingRefError=e0.ValidationError=e0.CodeGen=e0.Name=e0.nil=e0.stringify=e0.str=e0._=e0.KeywordCxt=e0.Ajv=void 0;var IR=FK(),ZR=QF(),SR=HF(),zF=BF(),RR=["/properties"],SX="http://json-schema.org/draft-07/schema";class OQ extends IR.default{_addVocabularies(){if(super._addVocabularies(),ZR.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(SR.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(zF,RR):zF;this.addMetaSchema(Q,SX,!1),this.refs["http://json-schema.org/schema"]=SX}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(SX)?SX:void 0)}}e0.Ajv=OQ;V$.exports=e0=OQ;V$.exports.Ajv=OQ;Object.defineProperty(e0,"__esModule",{value:!0});e0.default=OQ;var CR=YQ();Object.defineProperty(e0,"KeywordCxt",{enumerable:!0,get:function(){return CR.KeywordCxt}});var i9=n();Object.defineProperty(e0,"_",{enumerable:!0,get:function(){return i9._}});Object.defineProperty(e0,"str",{enumerable:!0,get:function(){return i9.str}});Object.defineProperty(e0,"stringify",{enumerable:!0,get:function(){return i9.stringify}});Object.defineProperty(e0,"nil",{enumerable:!0,get:function(){return i9.nil}});Object.defineProperty(e0,"Name",{enumerable:!0,get:function(){return i9.Name}});Object.defineProperty(e0,"CodeGen",{enumerable:!0,get:function(){return i9.CodeGen}});var TR=GX();Object.defineProperty(e0,"ValidationError",{enumerable:!0,get:function(){return TR.default}});var kR=$Q();Object.defineProperty(e0,"MissingRefError",{enumerable:!0,get:function(){return kR.default}})});var MF=M((qF)=>{Object.defineProperty(qF,"__esModule",{value:!0});qF.formatNames=qF.fastFormats=qF.fullFormats=void 0;function m1(Q,X){return{validate:Q,compare:X}}qF.fullFormats={date:m1(DF,N$),time:m1(U$(!0),M$),"date-time":m1(LF(!0),OF),"iso-time":m1(U$(),VF),"iso-date-time":m1(LF(),UF),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uR,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:nR,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:lR,int32:{type:"number",validate:pR},int64:{type:"number",validate:iR},float:{type:"number",validate:AF},double:{type:"number",validate:AF},password:!0,binary:!0};qF.fastFormats={...qF.fullFormats,date:m1(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,N$),time:m1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,M$),"date-time":m1(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,OF),"iso-time":m1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,VF),"iso-date-time":m1(/^\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,UF),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};qF.formatNames=Object.keys(qF.fullFormats);function xR(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var yR=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fR=[0,31,28,31,30,31,30,31,31,30,31,30,31];function DF(Q){let X=yR.exec(Q);if(!X)return!1;let W=+X[1],Y=+X[2],$=+X[3];return Y>=1&&Y<=12&&$>=1&&$<=(Y===2&&xR(W)?29:fR[Y])}function N$(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var O$=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function U$(Q){return function(W){let Y=O$.exec(W);if(!Y)return!1;let $=+Y[1],J=+Y[2],G=+Y[3],H=Y[4],B=Y[5]==="-"?-1:1,z=+(Y[6]||0),K=+(Y[7]||0);if(z>23||K>59||Q&&!H)return!1;if($<=23&&J<=59&&G<60)return!0;let L=J-K*B,V=$-z*B-(L<0?1:0);return(V===23||V===-1)&&(L===59||L===-1)&&G<61}}function M$(Q,X){if(!(Q&&X))return;let W=new Date("2020-01-01T"+Q).valueOf(),Y=new Date("2020-01-01T"+X).valueOf();if(!(W&&Y))return;return W-Y}function VF(Q,X){if(!(Q&&X))return;let W=O$.exec(Q),Y=O$.exec(X);if(!(W&&Y))return;if(Q=W[1]+W[2]+W[3],X=Y[1]+Y[2]+Y[3],Q>X)return 1;if(Q<X)return-1;return 0}var q$=/t|\s/i;function LF(Q){let X=U$(Q);return function(Y){let $=Y.split(q$);return $.length===2&&DF($[0])&&X($[1])}}function OF(Q,X){if(!(Q&&X))return;let W=new Date(Q).valueOf(),Y=new Date(X).valueOf();if(!(W&&Y))return;return W-Y}function UF(Q,X){if(!(Q&&X))return;let[W,Y]=Q.split(q$),[$,J]=X.split(q$),G=N$(W,$);if(G===void 0)return;return G||M$(Y,J)}var gR=/\/|:/,hR=/^(?:[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;function uR(Q){return gR.test(Q)&&hR.test(Q)}var FF=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function lR(Q){return FF.lastIndex=0,FF.test(Q)}var mR=-2147483648,cR=2147483647;function pR(Q){return Number.isInteger(Q)&&Q<=cR&&Q>=mR}function iR(Q){return Number.isInteger(Q)}function AF(){return!0}var dR=/[^\\]\\Z/;function nR(Q){if(dR.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var qQ=M((bF)=>{Object.defineProperty(bF,"__esModule",{value:!0});bF.regexpCode=bF.getEsmExportName=bF.getProperty=bF.safeStringify=bF.stringify=bF.strConcat=bF.addCodeArg=bF.str=bF._=bF.nil=bF._Code=bF.Name=bF.IDENTIFIER=bF._CodeOrName=void 0;class RX{}bF._CodeOrName=RX;bF.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class d9 extends RX{constructor(Q){super();if(!bF.IDENTIFIER.test(Q))throw Error("CodeGen: name must be a valid identifier");this.str=Q}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}bF.Name=d9;class Z1 extends RX{constructor(Q){super();this._items=typeof Q==="string"?[Q]:Q}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Q=this._items[0];return Q===""||Q==='""'}get str(){var Q;return(Q=this._str)!==null&&Q!==void 0?Q:this._str=this._items.reduce((X,W)=>`${X}${W}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((X,W)=>{if(W instanceof d9)X[W.str]=(X[W.str]||0)+1;return X},{})}}bF._Code=Z1;bF.nil=new Z1("");function jF(Q,...X){let W=[Q[0]],Y=0;while(Y<X.length)b$(W,X[Y]),W.push(Q[++Y]);return new Z1(W)}bF._=jF;var w$=new Z1("+");function wF(Q,...X){let W=[UQ(Q[0])],Y=0;while(Y<X.length)W.push(w$),b$(W,X[Y]),W.push(w$,UQ(Q[++Y]));return rR(W),new Z1(W)}bF.str=wF;function b$(Q,X){if(X instanceof Z1)Q.push(...X._items);else if(X instanceof d9)Q.push(X);else Q.push(sR(X))}bF.addCodeArg=b$;function rR(Q){let X=1;while(X<Q.length-1){if(Q[X]===w$){let W=tR(Q[X-1],Q[X+1]);if(W!==void 0){Q.splice(X-1,3,W);continue}Q[X++]="+"}X++}}function tR(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof d9||Q[Q.length-1]!=='"')return;if(typeof X!="string")return`${Q.slice(0,-1)}${X}"`;if(X[0]==='"')return Q.slice(0,-1)+X.slice(1);return}if(typeof X=="string"&&X[0]==='"'&&!(Q instanceof d9))return`"${Q}${X.slice(1)}`;return}function aR(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:wF`${Q}${X}`}bF.strConcat=aR;function sR(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:UQ(Array.isArray(Q)?Q.join(","):Q)}function eR(Q){return new Z1(UQ(Q))}bF.stringify=eR;function UQ(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}bF.safeStringify=UQ;function QC(Q){return typeof Q=="string"&&bF.IDENTIFIER.test(Q)?new Z1(`.${Q}`):jF`[${Q}]`}bF.getProperty=QC;function XC(Q){if(typeof Q=="string"&&bF.IDENTIFIER.test(Q))return new Z1(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}bF.getEsmExportName=XC;function WC(Q){return new Z1(Q.toString())}bF.regexpCode=WC});var Z$=M((ZF)=>{Object.defineProperty(ZF,"__esModule",{value:!0});ZF.ValueScope=ZF.ValueScopeName=ZF.Scope=ZF.varKinds=ZF.UsedValueState=void 0;var Q1=qQ();class PF extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var TX;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(TX||(ZF.UsedValueState=TX={}));ZF.varKinds={const:new Q1.Name("const"),let:new Q1.Name("let"),var:new Q1.Name("var")};class P${constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof Q1.Name?Q:this.name(Q)}name(Q){return new Q1.Name(this._newName(Q))}_newName(Q){let X=this._names[Q]||this._nameGroup(Q);return`${Q}${X.index++}`}_nameGroup(Q){var X,W;if(((W=(X=this._parent)===null||X===void 0?void 0:X._prefixes)===null||W===void 0?void 0:W.has(Q))||this._prefixes&&!this._prefixes.has(Q))throw Error(`CodeGen: prefix "${Q}" is not allowed in this scope`);return this._names[Q]={prefix:Q,index:0}}}ZF.Scope=P$;class I$ extends Q1.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:W}){this.value=Q,this.scopePath=Q1._`.${new Q1.Name(X)}[${W}]`}}ZF.ValueScopeName=I$;var VC=Q1._`\n`;class IF extends P${constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?VC:Q1.nil}}get(){return this._scope}name(Q){return new I$(Q,this._newName(Q))}value(Q,X){var W;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName(Q),{prefix:$}=Y,J=(W=X.key)!==null&&W!==void 0?W:X.ref,G=this._values[$];if(G){let z=G.get(J);if(z)return z}else G=this._values[$]=new Map;G.set(J,Y);let H=this._scope[$]||(this._scope[$]=[]),B=H.length;return H[B]=X.ref,Y.setValue(X,{property:$,itemIndex:B}),Y}getValue(Q,X){let W=this._values[Q];if(!W)return;return W.get(X)}scopeRefs(Q,X=this._values){return this._reduceValues(X,(W)=>{if(W.scopePath===void 0)throw Error(`CodeGen: name "${W}" has no value`);return Q1._`${Q}${W.scopePath}`})}scopeCode(Q=this._values,X,W){return this._reduceValues(Q,(Y)=>{if(Y.value===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return Y.value.code},X,W)}_reduceValues(Q,X,W={},Y){let $=Q1.nil;for(let J in Q){let G=Q[J];if(!G)continue;let H=W[J]=W[J]||new Map;G.forEach((B)=>{if(H.has(B))return;H.set(B,TX.Started);let z=X(B);if(z){let K=this.opts.es5?ZF.varKinds.var:ZF.varKinds.const;$=Q1._`${$}${K} ${B} = ${z};${this.opts._n}`}else if(z=Y===null||Y===void 0?void 0:Y(B))$=Q1._`${$}${z}${this.opts._n}`;else throw new PF(B);H.set(B,TX.Completed)})}return $}}ZF.ValueScope=IF});var i=M((X1)=>{Object.defineProperty(X1,"__esModule",{value:!0});X1.or=X1.and=X1.not=X1.CodeGen=X1.operators=X1.varKinds=X1.ValueScopeName=X1.ValueScope=X1.Scope=X1.Name=X1.regexpCode=X1.stringify=X1.getProperty=X1.nil=X1.strConcat=X1.str=X1._=void 0;var s=qQ(),S1=Z$(),E6=qQ();Object.defineProperty(X1,"_",{enumerable:!0,get:function(){return E6._}});Object.defineProperty(X1,"str",{enumerable:!0,get:function(){return E6.str}});Object.defineProperty(X1,"strConcat",{enumerable:!0,get:function(){return E6.strConcat}});Object.defineProperty(X1,"nil",{enumerable:!0,get:function(){return E6.nil}});Object.defineProperty(X1,"getProperty",{enumerable:!0,get:function(){return E6.getProperty}});Object.defineProperty(X1,"stringify",{enumerable:!0,get:function(){return E6.stringify}});Object.defineProperty(X1,"regexpCode",{enumerable:!0,get:function(){return E6.regexpCode}});Object.defineProperty(X1,"Name",{enumerable:!0,get:function(){return E6.Name}});var fX=Z$();Object.defineProperty(X1,"Scope",{enumerable:!0,get:function(){return fX.Scope}});Object.defineProperty(X1,"ValueScope",{enumerable:!0,get:function(){return fX.ValueScope}});Object.defineProperty(X1,"ValueScopeName",{enumerable:!0,get:function(){return fX.ValueScopeName}});Object.defineProperty(X1,"varKinds",{enumerable:!0,get:function(){return fX.varKinds}});X1.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class P6{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class RF extends P6{constructor(Q,X,W){super();this.varKind=Q,this.name=X,this.rhs=W}render({es5:Q,_n:X}){let W=Q?S1.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${Y};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=o9(this.rhs,Q,X);return this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class C$ extends P6{constructor(Q,X,W){super();this.lhs=Q,this.rhs=X,this.sideEffects=W}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof s.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=o9(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof s.Name?{}:{...this.lhs.names};return yX(Q,this.rhs)}}class CF extends C${constructor(Q,X,W,Y){super(Q,W,Y);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class TF extends P6{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class kF extends P6{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class vF extends P6{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class _F extends P6{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,X){return this.code=o9(this.code,Q,X),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class gX extends P6{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,W)=>X+W.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let W=Q[X].optimizeNodes();if(Array.isArray(W))Q.splice(X,1,...W);else if(W)Q[X]=W;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:W}=this,Y=W.length;while(Y--){let $=W[Y];if($.optimizeNames(Q,X))continue;NC(Q,$.names),W.splice(Y,1)}return W.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>X9(Q,X.names),{})}}class I6 extends gX{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class xF extends gX{}class NQ extends I6{}NQ.kind="else";class W6 extends I6{constructor(Q,X){super(X);this.condition=Q}render(Q){let X=`if(${this.condition})`+super.render(Q);if(this.else)X+="else "+this.else.render(Q);return X}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let X=this.else;if(X){let W=X.optimizeNodes();X=this.else=Array.isArray(W)?new NQ(W):W}if(X){if(Q===!1)return X instanceof W6?X:X.nodes;if(this.nodes.length)return this;return new W6(uF(Q),X instanceof W6?[X]:X.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,X){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(Q,X),!(super.optimizeNames(Q,X)||this.else))return;return this.condition=o9(this.condition,Q,X),this}get names(){let Q=super.names;if(yX(Q,this.condition),this.else)X9(Q,this.else.names);return Q}}W6.kind="if";class n9 extends I6{}n9.kind="for";class yF extends n9{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iteration=o9(this.iteration,Q,X),this}get names(){return X9(super.names,this.iteration.names)}}class fF extends n9{constructor(Q,X,W,Y){super();this.varKind=Q,this.name=X,this.from=W,this.to=Y}render(Q){let X=Q.es5?S1.varKinds.var:this.varKind,{name:W,from:Y,to:$}=this;return`for(${X} ${W}=${Y}; ${W}<${$}; ${W}++)`+super.render(Q)}get names(){let Q=yX(super.names,this.from);return yX(Q,this.to)}}class S$ extends n9{constructor(Q,X,W,Y){super();this.loop=Q,this.varKind=X,this.name=W,this.iterable=Y}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iterable=o9(this.iterable,Q,X),this}get names(){return X9(super.names,this.iterable.names)}}class kX extends I6{constructor(Q,X,W){super();this.name=Q,this.args=X,this.async=W}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}kX.kind="func";class vX extends gX{render(Q){return"return "+super.render(Q)}}vX.kind="return";class gF extends I6{render(Q){let X="try"+super.render(Q);if(this.catch)X+=this.catch.render(Q);if(this.finally)X+=this.finally.render(Q);return X}optimizeNodes(){var Q,X;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(Q,X){var W,Y;return super.optimizeNames(Q,X),(W=this.catch)===null||W===void 0||W.optimizeNames(Q,X),(Y=this.finally)===null||Y===void 0||Y.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)X9(Q,this.catch.names);if(this.finally)X9(Q,this.finally.names);return Q}}class _X extends I6{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}_X.kind="catch";class xX extends I6{render(Q){return"finally"+super.render(Q)}}xX.kind="finally";class hF{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
10
- `:""},this._extScope=Q,this._scope=new S1.Scope({parent:Q}),this._nodes=[new xF]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,X){let W=this._extScope.value(Q,X);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(Q,X){return this._extScope.getValue(Q,X)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,X,W,Y){let $=this._scope.toName(X);if(W!==void 0&&Y)this._constants[$.str]=W;return this._leafNode(new RF(Q,$,W)),$}const(Q,X,W){return this._def(S1.varKinds.const,Q,X,W)}let(Q,X,W){return this._def(S1.varKinds.let,Q,X,W)}var(Q,X,W){return this._def(S1.varKinds.var,Q,X,W)}assign(Q,X,W){return this._leafNode(new C$(Q,X,W))}add(Q,X){return this._leafNode(new CF(Q,X1.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==s.nil)this._leafNode(new _F(Q));return this}object(...Q){let X=["{"];for(let[W,Y]of Q){if(X.length>1)X.push(",");if(X.push(W),W!==Y||this.opts.es5)X.push(":"),(0,s.addCodeArg)(X,Y)}return X.push("}"),new s._Code(X)}if(Q,X,W){if(this._blockNode(new W6(Q)),X&&W)this.code(X).else().code(W).endIf();else if(X)this.code(X).endIf();else if(W)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new W6(Q))}else(){return this._elseNode(new NQ)}endIf(){return this._endBlockNode(W6,NQ)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new yF(Q),X)}forRange(Q,X,W,Y,$=this.opts.es5?S1.varKinds.var:S1.varKinds.let){let J=this._scope.toName(Q);return this._for(new fF($,J,X,W),()=>Y(J))}forOf(Q,X,W,Y=S1.varKinds.const){let $=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof s.Name?X:this.var("_arr",X);return this.forRange("_i",0,s._`${J}.length`,(G)=>{this.var($,s._`${J}[${G}]`),W($)})}return this._for(new S$("of",Y,$,X),()=>W($))}forIn(Q,X,W,Y=this.opts.es5?S1.varKinds.var:S1.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,s._`Object.keys(${X})`,W);let $=this._scope.toName(Q);return this._for(new S$("in",Y,$,X),()=>W($))}endFor(){return this._endBlockNode(n9)}label(Q){return this._leafNode(new TF(Q))}break(Q){return this._leafNode(new kF(Q))}return(Q){let X=new vX;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(vX)}try(Q,X,W){if(!X&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new gF;if(this._blockNode(Y),this.code(Q),X){let $=this.name("e");this._currNode=Y.catch=new _X($),X($)}if(W)this._currNode=Y.finally=new xX,this.code(W);return this._endBlockNode(_X,xX)}throw(Q){return this._leafNode(new vF(Q))}block(Q,X){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(X);return this}endBlock(Q){let X=this._blockStarts.pop();if(X===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-X;if(W<0||Q!==void 0&&W!==Q)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${Q} expected`);return this._nodes.length=X,this}func(Q,X=s.nil,W,Y){if(this._blockNode(new kX(Q,X,W)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(kX)}optimize(Q=1){while(Q-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(Q){return this._currNode.nodes.push(Q),this}_blockNode(Q){this._currNode.nodes.push(Q),this._nodes.push(Q)}_endBlockNode(Q,X){let W=this._currNode;if(W instanceof Q||X&&W instanceof X)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${X?`${Q.kind}/${X.kind}`:Q.kind}"`)}_elseNode(Q){let X=this._currNode;if(!(X instanceof W6))throw Error('CodeGen: "else" without "if"');return this._currNode=X.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let X=this._nodes;X[X.length-1]=Q}}X1.CodeGen=hF;function X9(Q,X){for(let W in X)Q[W]=(Q[W]||0)+(X[W]||0);return Q}function yX(Q,X){return X instanceof s._CodeOrName?X9(Q,X.names):Q}function o9(Q,X,W){if(Q instanceof s.Name)return Y(Q);if(!$(Q))return Q;return new s._Code(Q._items.reduce((J,G)=>{if(G instanceof s.Name)G=Y(G);if(G instanceof s._Code)J.push(...G._items);else J.push(G);return J},[]));function Y(J){let G=W[J.str];if(G===void 0||X[J.str]!==1)return J;return delete X[J.str],G}function $(J){return J instanceof s._Code&&J._items.some((G)=>G instanceof s.Name&&X[G.str]===1&&W[G.str]!==void 0)}}function NC(Q,X){for(let W in X)Q[W]=(Q[W]||0)-(X[W]||0)}function uF(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:s._`!${R$(Q)}`}X1.not=uF;var MC=lF(X1.operators.AND);function jC(...Q){return Q.reduce(MC)}X1.and=jC;var wC=lF(X1.operators.OR);function bC(...Q){return Q.reduce(wC)}X1.or=bC;function lF(Q){return(X,W)=>X===s.nil?W:W===s.nil?X:s._`${R$(X)} ${Q} ${R$(W)}`}function R$(Q){return Q instanceof s.Name?Q:s._`(${Q})`}});var Y0=M((tF)=>{Object.defineProperty(tF,"__esModule",{value:!0});tF.checkStrictMode=tF.getErrorPath=tF.Type=tF.useFunc=tF.setEvaluated=tF.evaluatedPropsToName=tF.mergeEvaluated=tF.eachItem=tF.unescapeJsonPointer=tF.escapeJsonPointer=tF.escapeFragment=tF.unescapeFragment=tF.schemaRefOrVal=tF.schemaHasRulesButRef=tF.schemaHasRules=tF.checkUnknownRules=tF.alwaysValidSchema=tF.toHash=void 0;var B0=i(),ZC=qQ();function SC(Q){let X={};for(let W of Q)X[W]=!0;return X}tF.toHash=SC;function RC(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return iF(Q,X),!dF(X,Q.self.RULES.all)}tF.alwaysValidSchema=RC;function iF(Q,X=Q.schema){let{opts:W,self:Y}=Q;if(!W.strictSchema)return;if(typeof X==="boolean")return;let $=Y.RULES.keywords;for(let J in X)if(!$[J])rF(Q,`unknown keyword: "${J}"`)}tF.checkUnknownRules=iF;function dF(Q,X){if(typeof Q=="boolean")return!Q;for(let W in Q)if(X[W])return!0;return!1}tF.schemaHasRules=dF;function CC(Q,X){if(typeof Q=="boolean")return!Q;for(let W in Q)if(W!=="$ref"&&X.all[W])return!0;return!1}tF.schemaHasRulesButRef=CC;function TC({topSchemaRef:Q,schemaPath:X},W,Y,$){if(!$){if(typeof W=="number"||typeof W=="boolean")return W;if(typeof W=="string")return B0._`${W}`}return B0._`${Q}${X}${(0,B0.getProperty)(Y)}`}tF.schemaRefOrVal=TC;function kC(Q){return nF(decodeURIComponent(Q))}tF.unescapeFragment=kC;function vC(Q){return encodeURIComponent(k$(Q))}tF.escapeFragment=vC;function k$(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}tF.escapeJsonPointer=k$;function nF(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}tF.unescapeJsonPointer=nF;function _C(Q,X){if(Array.isArray(Q))for(let W of Q)X(W);else X(Q)}tF.eachItem=_C;function cF({mergeNames:Q,mergeToName:X,mergeValues:W,resultToName:Y}){return($,J,G,H)=>{let B=G===void 0?J:G instanceof B0.Name?(J instanceof B0.Name?Q($,J,G):X($,J,G),G):J instanceof B0.Name?(X($,G,J),J):W(J,G);return H===B0.Name&&!(B instanceof B0.Name)?Y($,B):B}}tF.mergeEvaluated={props:cF({mergeNames:(Q,X,W)=>Q.if(B0._`${W} !== true && ${X} !== undefined`,()=>{Q.if(B0._`${X} === true`,()=>Q.assign(W,!0),()=>Q.assign(W,B0._`${W} || {}`).code(B0._`Object.assign(${W}, ${X})`))}),mergeToName:(Q,X,W)=>Q.if(B0._`${W} !== true`,()=>{if(X===!0)Q.assign(W,!0);else Q.assign(W,B0._`${W} || {}`),v$(Q,W,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:oF}),items:cF({mergeNames:(Q,X,W)=>Q.if(B0._`${W} !== true && ${X} !== undefined`,()=>Q.assign(W,B0._`${X} === true ? true : ${W} > ${X} ? ${W} : ${X}`)),mergeToName:(Q,X,W)=>Q.if(B0._`${W} !== true`,()=>Q.assign(W,X===!0?!0:B0._`${W} > ${X} ? ${W} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function oF(Q,X){if(X===!0)return Q.var("props",!0);let W=Q.var("props",B0._`{}`);if(X!==void 0)v$(Q,W,X);return W}tF.evaluatedPropsToName=oF;function v$(Q,X,W){Object.keys(W).forEach((Y)=>Q.assign(B0._`${X}${(0,B0.getProperty)(Y)}`,!0))}tF.setEvaluated=v$;var pF={};function xC(Q,X){return Q.scopeValue("func",{ref:X,code:pF[X.code]||(pF[X.code]=new ZC._Code(X.code))})}tF.useFunc=xC;var T$;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(T$||(tF.Type=T$={}));function yC(Q,X,W){if(Q instanceof B0.Name){let Y=X===T$.Num;return W?Y?B0._`"[" + ${Q} + "]"`:B0._`"['" + ${Q} + "']"`:Y?B0._`"/" + ${Q}`:B0._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return W?(0,B0.getProperty)(Q).toString():"/"+k$(Q)}tF.getErrorPath=yC;function rF(Q,X,W=Q.opts.strictSchema){if(!W)return;if(X=`strict mode: ${X}`,W===!0)throw Error(X);Q.self.logger.warn(X)}tF.checkStrictMode=rF});var Y6=M((sF)=>{Object.defineProperty(sF,"__esModule",{value:!0});var g0=i(),QT={data:new g0.Name("data"),valCxt:new g0.Name("valCxt"),instancePath:new g0.Name("instancePath"),parentData:new g0.Name("parentData"),parentDataProperty:new g0.Name("parentDataProperty"),rootData:new g0.Name("rootData"),dynamicAnchors:new g0.Name("dynamicAnchors"),vErrors:new g0.Name("vErrors"),errors:new g0.Name("errors"),this:new g0.Name("this"),self:new g0.Name("self"),scope:new g0.Name("scope"),json:new g0.Name("json"),jsonPos:new g0.Name("jsonPos"),jsonLen:new g0.Name("jsonLen"),jsonPart:new g0.Name("jsonPart")};sF.default=QT});var MQ=M((WA)=>{Object.defineProperty(WA,"__esModule",{value:!0});WA.extendErrors=WA.resetErrorsCount=WA.reportExtraError=WA.reportError=WA.keyword$DataError=WA.keywordError=void 0;var X0=i(),uX=Y0(),c0=Y6();WA.keywordError={message:({keyword:Q})=>X0.str`must pass "${Q}" keyword validation`};WA.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?X0.str`"${Q}" keyword must be ${X} ($data)`:X0.str`"${Q}" keyword is invalid ($data)`};function WT(Q,X=WA.keywordError,W,Y){let{it:$}=Q,{gen:J,compositeRule:G,allErrors:H}=$,B=XA(Q,X,W);if(Y!==null&&Y!==void 0?Y:G||H)eF(J,B);else QA($,X0._`[${B}]`)}WA.reportError=WT;function YT(Q,X=WA.keywordError,W){let{it:Y}=Q,{gen:$,compositeRule:J,allErrors:G}=Y,H=XA(Q,X,W);if(eF($,H),!(J||G))QA(Y,c0.default.vErrors)}WA.reportExtraError=YT;function $T(Q,X){Q.assign(c0.default.errors,X),Q.if(X0._`${c0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(X0._`${c0.default.vErrors}.length`,X),()=>Q.assign(c0.default.vErrors,null)))}WA.resetErrorsCount=$T;function JT({gen:Q,keyword:X,schemaValue:W,data:Y,errsCount:$,it:J}){if($===void 0)throw Error("ajv implementation error");let G=Q.name("err");Q.forRange("i",$,c0.default.errors,(H)=>{if(Q.const(G,X0._`${c0.default.vErrors}[${H}]`),Q.if(X0._`${G}.instancePath === undefined`,()=>Q.assign(X0._`${G}.instancePath`,(0,X0.strConcat)(c0.default.instancePath,J.errorPath))),Q.assign(X0._`${G}.schemaPath`,X0.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(X0._`${G}.schema`,W),Q.assign(X0._`${G}.data`,Y)})}WA.extendErrors=JT;function eF(Q,X){let W=Q.const("err",X);Q.if(X0._`${c0.default.vErrors} === null`,()=>Q.assign(c0.default.vErrors,X0._`[${W}]`),X0._`${c0.default.vErrors}.push(${W})`),Q.code(X0._`${c0.default.errors}++`)}function QA(Q,X){let{gen:W,validateName:Y,schemaEnv:$}=Q;if($.$async)W.throw(X0._`new ${Q.ValidationError}(${X})`);else W.assign(X0._`${Y}.errors`,X),W.return(!1)}var W9={keyword:new X0.Name("keyword"),schemaPath:new X0.Name("schemaPath"),params:new X0.Name("params"),propertyName:new X0.Name("propertyName"),message:new X0.Name("message"),schema:new X0.Name("schema"),parentSchema:new X0.Name("parentSchema")};function XA(Q,X,W){let{createErrors:Y}=Q.it;if(Y===!1)return X0._`{}`;return GT(Q,X,W)}function GT(Q,X,W={}){let{gen:Y,it:$}=Q,J=[HT($,W),BT(Q,W)];return zT(Q,X,J),Y.object(...J)}function HT({errorPath:Q},{instancePath:X}){let W=X?X0.str`${Q}${(0,uX.getErrorPath)(X,uX.Type.Str)}`:Q;return[c0.default.instancePath,(0,X0.strConcat)(c0.default.instancePath,W)]}function BT({keyword:Q,it:{errSchemaPath:X}},{schemaPath:W,parentSchema:Y}){let $=Y?X:X0.str`${X}/${Q}`;if(W)$=X0.str`${$}${(0,uX.getErrorPath)(W,uX.Type.Str)}`;return[W9.schemaPath,$]}function zT(Q,{params:X,message:W},Y){let{keyword:$,data:J,schemaValue:G,it:H}=Q,{opts:B,propertyName:z,topSchemaRef:K,schemaPath:L}=H;if(Y.push([W9.keyword,$],[W9.params,typeof X=="function"?X(Q):X||X0._`{}`]),B.messages)Y.push([W9.message,typeof W=="function"?W(Q):W]);if(B.verbose)Y.push([W9.schema,G],[W9.parentSchema,X0._`${K}${L}`],[c0.default.data,J]);if(z)Y.push([W9.propertyName,z])}});var HA=M((JA)=>{Object.defineProperty(JA,"__esModule",{value:!0});JA.boolOrEmptySchema=JA.topBoolOrEmptySchema=void 0;var DT=MQ(),VT=i(),OT=Y6(),UT={message:"boolean schema is false"};function qT(Q){let{gen:X,schema:W,validateName:Y}=Q;if(W===!1)$A(Q,!1);else if(typeof W=="object"&&W.$async===!0)X.return(OT.default.data);else X.assign(VT._`${Y}.errors`,null),X.return(!0)}JA.topBoolOrEmptySchema=qT;function NT(Q,X){let{gen:W,schema:Y}=Q;if(Y===!1)W.var(X,!1),$A(Q);else W.var(X,!0)}JA.boolOrEmptySchema=NT;function $A(Q,X){let{gen:W,data:Y}=Q,$={gen:W,keyword:"false schema",data:Y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,DT.reportError)($,UT,void 0,X)}});var x$=M((BA)=>{Object.defineProperty(BA,"__esModule",{value:!0});BA.getRules=BA.isJSONType=void 0;var jT=["string","number","integer","boolean","null","object","array"],wT=new Set(jT);function bT(Q){return typeof Q=="string"&&wT.has(Q)}BA.isJSONType=bT;function ET(){let Q={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...Q,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},Q.number,Q.string,Q.array,Q.object],post:{rules:[]},all:{},keywords:{}}}BA.getRules=ET});var y$=M((FA)=>{Object.defineProperty(FA,"__esModule",{value:!0});FA.shouldUseRule=FA.shouldUseGroup=FA.schemaHasRulesForType=void 0;function IT({schema:Q,self:X},W){let Y=X.RULES.types[W];return Y&&Y!==!0&&KA(Q,Y)}FA.schemaHasRulesForType=IT;function KA(Q,X){return X.rules.some((W)=>LA(Q,W))}FA.shouldUseGroup=KA;function LA(Q,X){var W;return Q[X.keyword]!==void 0||((W=X.definition.implements)===null||W===void 0?void 0:W.some((Y)=>Q[Y]!==void 0))}FA.shouldUseRule=LA});var jQ=M((UA)=>{Object.defineProperty(UA,"__esModule",{value:!0});UA.reportTypeError=UA.checkDataTypes=UA.checkDataType=UA.coerceAndCheckDataType=UA.getJSONTypes=UA.getSchemaTypes=UA.DataType=void 0;var RT=x$(),CT=y$(),TT=MQ(),p=i(),DA=Y0(),r9;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(r9||(UA.DataType=r9={}));function kT(Q){let X=VA(Q.type);if(X.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!X.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)X.push("null")}return X}UA.getSchemaTypes=kT;function VA(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(RT.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}UA.getJSONTypes=VA;function vT(Q,X){let{gen:W,data:Y,opts:$}=Q,J=_T(X,$.coerceTypes),G=X.length>0&&!(J.length===0&&X.length===1&&(0,CT.schemaHasRulesForType)(Q,X[0]));if(G){let H=g$(X,Y,$.strictNumbers,r9.Wrong);W.if(H,()=>{if(J.length)xT(Q,X,J);else h$(Q)})}return G}UA.coerceAndCheckDataType=vT;var OA=new Set(["string","number","integer","boolean","null"]);function _T(Q,X){return X?Q.filter((W)=>OA.has(W)||X==="array"&&W==="array"):[]}function xT(Q,X,W){let{gen:Y,data:$,opts:J}=Q,G=Y.let("dataType",p._`typeof ${$}`),H=Y.let("coerced",p._`undefined`);if(J.coerceTypes==="array")Y.if(p._`${G} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>Y.assign($,p._`${$}[0]`).assign(G,p._`typeof ${$}`).if(g$(X,$,J.strictNumbers),()=>Y.assign(H,$)));Y.if(p._`${H} !== undefined`);for(let z of W)if(OA.has(z)||z==="array"&&J.coerceTypes==="array")B(z);Y.else(),h$(Q),Y.endIf(),Y.if(p._`${H} !== undefined`,()=>{Y.assign($,H),yT(Q,H)});function B(z){switch(z){case"string":Y.elseIf(p._`${G} == "number" || ${G} == "boolean"`).assign(H,p._`"" + ${$}`).elseIf(p._`${$} === null`).assign(H,p._`""`);return;case"number":Y.elseIf(p._`${G} == "boolean" || ${$} === null
11
- || (${G} == "string" && ${$} && ${$} == +${$})`).assign(H,p._`+${$}`);return;case"integer":Y.elseIf(p._`${G} === "boolean" || ${$} === null
12
- || (${G} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(H,p._`+${$}`);return;case"boolean":Y.elseIf(p._`${$} === "false" || ${$} === 0 || ${$} === null`).assign(H,!1).elseIf(p._`${$} === "true" || ${$} === 1`).assign(H,!0);return;case"null":Y.elseIf(p._`${$} === "" || ${$} === 0 || ${$} === false`),Y.assign(H,null);return;case"array":Y.elseIf(p._`${G} === "string" || ${G} === "number"
13
- || ${G} === "boolean" || ${$} === null`).assign(H,p._`[${$}]`)}}}function yT({gen:Q,parentData:X,parentDataProperty:W},Y){Q.if(p._`${X} !== undefined`,()=>Q.assign(p._`${X}[${W}]`,Y))}function f$(Q,X,W,Y=r9.Correct){let $=Y===r9.Correct?p.operators.EQ:p.operators.NEQ,J;switch(Q){case"null":return p._`${X} ${$} null`;case"array":J=p._`Array.isArray(${X})`;break;case"object":J=p._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=G(p._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=G();break;default:return p._`typeof ${X} ${$} ${Q}`}return Y===r9.Correct?J:(0,p.not)(J);function G(H=p.nil){return(0,p.and)(p._`typeof ${X} == "number"`,H,W?p._`isFinite(${X})`:p.nil)}}UA.checkDataType=f$;function g$(Q,X,W,Y){if(Q.length===1)return f$(Q[0],X,W,Y);let $,J=(0,DA.toHash)(Q);if(J.array&&J.object){let G=p._`typeof ${X} != "object"`;$=J.null?G:p._`!${X} || ${G}`,delete J.null,delete J.array,delete J.object}else $=p.nil;if(J.number)delete J.integer;for(let G in J)$=(0,p.and)($,f$(G,X,W,Y));return $}UA.checkDataTypes=g$;var fT={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?p._`{type: ${Q}}`:p._`{type: ${X}}`};function h$(Q){let X=gT(Q);(0,TT.reportError)(X,fT)}UA.reportTypeError=h$;function gT(Q){let{gen:X,data:W,schema:Y}=Q,$=(0,DA.schemaRefOrVal)(Q,Y,"type");return{gen:X,keyword:"type",data:W,schema:Y.type,schemaCode:$,schemaValue:$,parentSchema:Y,params:{},it:Q}}});var wA=M((MA)=>{Object.defineProperty(MA,"__esModule",{value:!0});MA.assignDefaults=void 0;var t9=i(),iT=Y0();function dT(Q,X){let{properties:W,items:Y}=Q.schema;if(X==="object"&&W)for(let $ in W)NA(Q,$,W[$].default);else if(X==="array"&&Array.isArray(Y))Y.forEach(($,J)=>NA(Q,J,$.default))}MA.assignDefaults=dT;function NA(Q,X,W){let{gen:Y,compositeRule:$,data:J,opts:G}=Q;if(W===void 0)return;let H=t9._`${J}${(0,t9.getProperty)(X)}`;if($){(0,iT.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=t9._`${H} === undefined`;if(G.useDefaults==="empty")B=t9._`${B} || ${H} === null || ${H} === ""`;Y.if(B,t9._`${H} = ${(0,t9.stringify)(W)}`)}});var K1=M((PA)=>{Object.defineProperty(PA,"__esModule",{value:!0});PA.validateUnion=PA.validateArray=PA.usePattern=PA.callValidateCode=PA.schemaProperties=PA.allSchemaProperties=PA.noPropertyInData=PA.propertyInData=PA.isOwnProperty=PA.hasPropFunc=PA.reportMissingProp=PA.checkMissingProp=PA.checkReportMissingProp=void 0;var V0=i(),u$=Y0(),Z6=Y6(),nT=Y0();function oT(Q,X){let{gen:W,data:Y,it:$}=Q;W.if(m$(W,Y,X,$.opts.ownProperties),()=>{Q.setParams({missingProperty:V0._`${X}`},!0),Q.error()})}PA.checkReportMissingProp=oT;function rT({gen:Q,data:X,it:{opts:W}},Y,$){return(0,V0.or)(...Y.map((J)=>(0,V0.and)(m$(Q,X,J,W.ownProperties),V0._`${$} = ${J}`)))}PA.checkMissingProp=rT;function tT(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}PA.reportMissingProp=tT;function bA(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:V0._`Object.prototype.hasOwnProperty`})}PA.hasPropFunc=bA;function l$(Q,X,W){return V0._`${bA(Q)}.call(${X}, ${W})`}PA.isOwnProperty=l$;function aT(Q,X,W,Y){let $=V0._`${X}${(0,V0.getProperty)(W)} !== undefined`;return Y?V0._`${$} && ${l$(Q,X,W)}`:$}PA.propertyInData=aT;function m$(Q,X,W,Y){let $=V0._`${X}${(0,V0.getProperty)(W)} === undefined`;return Y?(0,V0.or)($,(0,V0.not)(l$(Q,X,W))):$}PA.noPropertyInData=m$;function EA(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}PA.allSchemaProperties=EA;function sT(Q,X){return EA(X).filter((W)=>!(0,u$.alwaysValidSchema)(Q,X[W]))}PA.schemaProperties=sT;function eT({schemaCode:Q,data:X,it:{gen:W,topSchemaRef:Y,schemaPath:$,errorPath:J},it:G},H,B,z){let K=z?V0._`${Q}, ${X}, ${Y}${$}`:X,L=[[Z6.default.instancePath,(0,V0.strConcat)(Z6.default.instancePath,J)],[Z6.default.parentData,G.parentData],[Z6.default.parentDataProperty,G.parentDataProperty],[Z6.default.rootData,Z6.default.rootData]];if(G.opts.dynamicRef)L.push([Z6.default.dynamicAnchors,Z6.default.dynamicAnchors]);let V=V0._`${K}, ${W.object(...L)}`;return B!==V0.nil?V0._`${H}.call(${B}, ${V})`:V0._`${H}(${V})`}PA.callValidateCode=eT;var Qk=V0._`new RegExp`;function Xk({gen:Q,it:{opts:X}},W){let Y=X.unicodeRegExp?"u":"",{regExp:$}=X.code,J=$(W,Y);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:V0._`${$.code==="new RegExp"?Qk:(0,nT.useFunc)(Q,$)}(${W}, ${Y})`})}PA.usePattern=Xk;function Wk(Q){let{gen:X,data:W,keyword:Y,it:$}=Q,J=X.name("valid");if($.allErrors){let H=X.let("valid",!0);return G(()=>X.assign(H,!1)),H}return X.var(J,!0),G(()=>X.break()),J;function G(H){let B=X.const("len",V0._`${W}.length`);X.forRange("i",0,B,(z)=>{Q.subschema({keyword:Y,dataProp:z,dataPropType:u$.Type.Num},J),X.if((0,V0.not)(J),H)})}}PA.validateArray=Wk;function Yk(Q){let{gen:X,schema:W,keyword:Y,it:$}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");if(W.some((B)=>(0,u$.alwaysValidSchema)($,B))&&!$.opts.unevaluated)return;let G=X.let("valid",!1),H=X.name("_valid");X.block(()=>W.forEach((B,z)=>{let K=Q.subschema({keyword:Y,schemaProp:z,compositeRule:!0},H);if(X.assign(G,V0._`${G} || ${H}`),!Q.mergeValidEvaluated(K,H))X.if((0,V0.not)(G))})),Q.result(G,()=>Q.reset(),()=>Q.error(!0))}PA.validateUnion=Yk});var TA=M((RA)=>{Object.defineProperty(RA,"__esModule",{value:!0});RA.validateKeywordUsage=RA.validSchemaType=RA.funcKeywordCode=RA.macroKeywordCode=void 0;var p0=i(),Y9=Y6(),Ok=K1(),Uk=MQ();function qk(Q,X){let{gen:W,keyword:Y,schema:$,parentSchema:J,it:G}=Q,H=X.macro.call(G.self,$,J,G),B=SA(W,Y,H);if(G.opts.validateSchema!==!1)G.self.validateSchema(H,!0);let z=W.name("valid");Q.subschema({schema:H,schemaPath:p0.nil,errSchemaPath:`${G.errSchemaPath}/${Y}`,topSchemaRef:B,compositeRule:!0},z),Q.pass(z,()=>Q.error(!0))}RA.macroKeywordCode=qk;function Nk(Q,X){var W;let{gen:Y,keyword:$,schema:J,parentSchema:G,$data:H,it:B}=Q;jk(B,X);let z=!H&&X.compile?X.compile.call(B.self,J,G,B):X.validate,K=SA(Y,$,z),L=Y.let("valid");Q.block$data(L,V),Q.ok((W=X.valid)!==null&&W!==void 0?W:L);function V(){if(X.errors===!1){if(A(),X.modifying)ZA(Q);O(()=>Q.error())}else{let U=X.async?F():D();if(X.modifying)ZA(Q);O(()=>Mk(Q,U))}}function F(){let U=Y.let("ruleErrs",null);return Y.try(()=>A(p0._`await `),(j)=>Y.assign(L,!1).if(p0._`${j} instanceof ${B.ValidationError}`,()=>Y.assign(U,p0._`${j}.errors`),()=>Y.throw(j))),U}function D(){let U=p0._`${K}.errors`;return Y.assign(U,null),A(p0.nil),U}function A(U=X.async?p0._`await `:p0.nil){let j=B.opts.passContext?Y9.default.this:Y9.default.self,w=!(("compile"in X)&&!H||X.schema===!1);Y.assign(L,p0._`${U}${(0,Ok.callValidateCode)(Q,K,j,w)}`,X.modifying)}function O(U){var j;Y.if((0,p0.not)((j=X.valid)!==null&&j!==void 0?j:L),U)}}RA.funcKeywordCode=Nk;function ZA(Q){let{gen:X,data:W,it:Y}=Q;X.if(Y.parentData,()=>X.assign(W,p0._`${Y.parentData}[${Y.parentDataProperty}]`))}function Mk(Q,X){let{gen:W}=Q;W.if(p0._`Array.isArray(${X})`,()=>{W.assign(Y9.default.vErrors,p0._`${Y9.default.vErrors} === null ? ${X} : ${Y9.default.vErrors}.concat(${X})`).assign(Y9.default.errors,p0._`${Y9.default.vErrors}.length`),(0,Uk.extendErrors)(Q)},()=>Q.error())}function jk({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function SA(Q,X,W){if(W===void 0)throw Error(`keyword "${X}" failed to compile`);return Q.scopeValue("keyword",typeof W=="function"?{ref:W}:{ref:W,code:(0,p0.stringify)(W)})}function wk(Q,X,W=!1){return!X.length||X.some((Y)=>Y==="array"?Array.isArray(Q):Y==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==Y||W&&typeof Q>"u")}RA.validSchemaType=wk;function bk({schema:Q,opts:X,self:W,errSchemaPath:Y},$,J){if(Array.isArray($.keyword)?!$.keyword.includes(J):$.keyword!==J)throw Error("ajv implementation error");let G=$.dependencies;if(G===null||G===void 0?void 0:G.some((H)=>!Object.prototype.hasOwnProperty.call(Q,H)))throw Error(`parent schema must have dependencies of ${J}: ${G.join(",")}`);if($.validateSchema){if(!$.validateSchema(Q[J])){let B=`keyword "${J}" value is invalid at path "${Y}": `+W.errorsText($.validateSchema.errors);if(X.validateSchema==="log")W.logger.error(B);else throw Error(B)}}}RA.validateKeywordUsage=bk});var xA=M((vA)=>{Object.defineProperty(vA,"__esModule",{value:!0});vA.extendSubschemaMode=vA.extendSubschemaData=vA.getSubschema=void 0;var c1=i(),kA=Y0();function Zk(Q,{keyword:X,schemaProp:W,schema:Y,schemaPath:$,errSchemaPath:J,topSchemaRef:G}){if(X!==void 0&&Y!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let H=Q.schema[X];return W===void 0?{schema:H,schemaPath:c1._`${Q.schemaPath}${(0,c1.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[W],schemaPath:c1._`${Q.schemaPath}${(0,c1.getProperty)(X)}${(0,c1.getProperty)(W)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,kA.escapeFragment)(W)}`}}if(Y!==void 0){if($===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Y,schemaPath:$,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}vA.getSubschema=Zk;function Sk(Q,X,{dataProp:W,dataPropType:Y,data:$,dataTypes:J,propertyName:G}){if($!==void 0&&W!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:H}=X;if(W!==void 0){let{errorPath:z,dataPathArr:K,opts:L}=X,V=H.let("data",c1._`${X.data}${(0,c1.getProperty)(W)}`,!0);B(V),Q.errorPath=c1.str`${z}${(0,kA.getErrorPath)(W,Y,L.jsPropertySyntax)}`,Q.parentDataProperty=c1._`${W}`,Q.dataPathArr=[...K,Q.parentDataProperty]}if($!==void 0){let z=$ instanceof c1.Name?$:H.let("data",$,!0);if(B(z),G!==void 0)Q.propertyName=G}if(J)Q.dataTypes=J;function B(z){Q.data=z,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,z]}}vA.extendSubschemaData=Sk;function Rk(Q,{jtdDiscriminator:X,jtdMetadata:W,compositeRule:Y,createErrors:$,allErrors:J}){if(Y!==void 0)Q.compositeRule=Y;if($!==void 0)Q.createErrors=$;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=W}vA.extendSubschemaMode=Rk});var fA=M((Ip,yA)=>{var S6=yA.exports=function(Q,X,W){if(typeof X=="function")W=X,X={};W=X.cb||W;var Y=typeof W=="function"?W:W.pre||function(){},$=W.post||function(){};lX(X,Y,$,Q,"",Q)};S6.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};S6.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};S6.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};S6.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 lX(Q,X,W,Y,$,J,G,H,B,z){if(Y&&typeof Y=="object"&&!Array.isArray(Y)){X(Y,$,J,G,H,B,z);for(var K in Y){var L=Y[K];if(Array.isArray(L)){if(K in S6.arrayKeywords)for(var V=0;V<L.length;V++)lX(Q,X,W,L[V],$+"/"+K+"/"+V,J,$,K,Y,V)}else if(K in S6.propsKeywords){if(L&&typeof L=="object")for(var F in L)lX(Q,X,W,L[F],$+"/"+K+"/"+kk(F),J,$,K,Y,F)}else if(K in S6.keywords||Q.allKeys&&!(K in S6.skipKeywords))lX(Q,X,W,L,$+"/"+K,J,$,K,Y)}W(Y,$,J,G,H,B,z)}}function kk(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var wQ=M((lA)=>{Object.defineProperty(lA,"__esModule",{value:!0});lA.getSchemaRefs=lA.resolveUrl=lA.normalizeId=lA._getFullPath=lA.getFullPath=lA.inlineRef=void 0;var vk=Y0(),_k=e4(),xk=fA(),yk=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fk(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!c$(Q);if(!X)return!1;return gA(Q)<=X}lA.inlineRef=fk;var gk=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c$(Q){for(let X in Q){if(gk.has(X))return!0;let W=Q[X];if(Array.isArray(W)&&W.some(c$))return!0;if(typeof W=="object"&&c$(W))return!0}return!1}function gA(Q){let X=0;for(let W in Q){if(W==="$ref")return 1/0;if(X++,yk.has(W))continue;if(typeof Q[W]=="object")(0,vk.eachItem)(Q[W],(Y)=>X+=gA(Y));if(X===1/0)return 1/0}return X}function hA(Q,X="",W){if(W!==!1)X=a9(X);let Y=Q.parse(X);return uA(Q,Y)}lA.getFullPath=hA;function uA(Q,X){return Q.serialize(X).split("#")[0]+"#"}lA._getFullPath=uA;var hk=/#\/?$/;function a9(Q){return Q?Q.replace(hk,""):""}lA.normalizeId=a9;function uk(Q,X,W){return W=a9(W),Q.resolve(X,W)}lA.resolveUrl=uk;var lk=/^[a-z_][-a-z0-9._]*$/i;function mk(Q,X){if(typeof Q=="boolean")return{};let{schemaId:W,uriResolver:Y}=this.opts,$=a9(Q[W]||X),J={"":$},G=hA(Y,$,!1),H={},B=new Set;return xk(Q,{allKeys:!0},(L,V,F,D)=>{if(D===void 0)return;let A=G+V,O=J[D];if(typeof L[W]=="string")O=U.call(this,L[W]);j.call(this,L.$anchor),j.call(this,L.$dynamicAnchor),J[V]=O;function U(w){let T=this.opts.uriResolver.resolve;if(w=a9(O?T(O,w):w),B.has(w))throw K(w);B.add(w);let P=this.refs[w];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")z(L,P.schema,w);else if(w!==a9(A))if(w[0]==="#")z(L,H[w],w),H[w]=L;else this.refs[w]=A;return w}function j(w){if(typeof w=="string"){if(!lk.test(w))throw Error(`invalid anchor "${w}"`);U.call(this,`#${w}`)}}}),H;function z(L,V,F){if(V!==void 0&&!_k(L,V))throw K(F)}function K(L){return Error(`reference "${L}" resolves to more than one schema`)}}lA.getSchemaRefs=mk});var PQ=M((YD)=>{Object.defineProperty(YD,"__esModule",{value:!0});YD.getData=YD.KeywordCxt=YD.validateFunctionCode=void 0;var nA=HA(),cA=jQ(),i$=y$(),mX=jQ(),ok=wA(),EQ=TA(),p$=xA(),y=i(),l=Y6(),rk=wQ(),$6=Y0(),bQ=MQ();function tk(Q){if(tA(Q)){if(aA(Q),rA(Q)){ek(Q);return}}oA(Q,()=>(0,nA.topBoolOrEmptySchema)(Q))}YD.validateFunctionCode=tk;function oA({gen:Q,validateName:X,schema:W,schemaEnv:Y,opts:$},J){if($.code.es5)Q.func(X,y._`${l.default.data}, ${l.default.valCxt}`,Y.$async,()=>{Q.code(y._`"use strict"; ${pA(W,$)}`),sk(Q,$),Q.code(J)});else Q.func(X,y._`${l.default.data}, ${ak($)}`,Y.$async,()=>Q.code(pA(W,$)).code(J))}function ak(Q){return y._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${Q.dynamicRef?y._`, ${l.default.dynamicAnchors}={}`:y.nil}}={}`}function sk(Q,X){Q.if(l.default.valCxt,()=>{if(Q.var(l.default.instancePath,y._`${l.default.valCxt}.${l.default.instancePath}`),Q.var(l.default.parentData,y._`${l.default.valCxt}.${l.default.parentData}`),Q.var(l.default.parentDataProperty,y._`${l.default.valCxt}.${l.default.parentDataProperty}`),Q.var(l.default.rootData,y._`${l.default.valCxt}.${l.default.rootData}`),X.dynamicRef)Q.var(l.default.dynamicAnchors,y._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{if(Q.var(l.default.instancePath,y._`""`),Q.var(l.default.parentData,y._`undefined`),Q.var(l.default.parentDataProperty,y._`undefined`),Q.var(l.default.rootData,l.default.data),X.dynamicRef)Q.var(l.default.dynamicAnchors,y._`{}`)})}function ek(Q){let{schema:X,opts:W,gen:Y}=Q;oA(Q,()=>{if(W.$comment&&X.$comment)eA(Q);if($2(Q),Y.let(l.default.vErrors,null),Y.let(l.default.errors,0),W.unevaluated)Q2(Q);sA(Q),H2(Q)});return}function Q2(Q){let{gen:X,validateName:W}=Q;Q.evaluated=X.const("evaluated",y._`${W}.evaluated`),X.if(y._`${Q.evaluated}.dynamicProps`,()=>X.assign(y._`${Q.evaluated}.props`,y._`undefined`)),X.if(y._`${Q.evaluated}.dynamicItems`,()=>X.assign(y._`${Q.evaluated}.items`,y._`undefined`))}function pA(Q,X){let W=typeof Q=="object"&&Q[X.schemaId];return W&&(X.code.source||X.code.process)?y._`/*# sourceURL=${W} */`:y.nil}function X2(Q,X){if(tA(Q)){if(aA(Q),rA(Q)){W2(Q,X);return}}(0,nA.boolOrEmptySchema)(Q,X)}function rA({schema:Q,self:X}){if(typeof Q=="boolean")return!Q;for(let W in Q)if(X.RULES.all[W])return!0;return!1}function tA(Q){return typeof Q.schema!="boolean"}function W2(Q,X){let{schema:W,gen:Y,opts:$}=Q;if($.$comment&&W.$comment)eA(Q);J2(Q),G2(Q);let J=Y.const("_errs",l.default.errors);sA(Q,J),Y.var(X,y._`${J} === ${l.default.errors}`)}function aA(Q){(0,$6.checkUnknownRules)(Q),Y2(Q)}function sA(Q,X){if(Q.opts.jtd)return iA(Q,[],!1,X);let W=(0,cA.getSchemaTypes)(Q.schema),Y=(0,cA.coerceAndCheckDataType)(Q,W);iA(Q,W,!Y,X)}function Y2(Q){let{schema:X,errSchemaPath:W,opts:Y,self:$}=Q;if(X.$ref&&Y.ignoreKeywordsWithRef&&(0,$6.schemaHasRulesButRef)(X,$.RULES))$.logger.warn(`$ref: keywords ignored in schema at path "${W}"`)}function $2(Q){let{schema:X,opts:W}=Q;if(X.default!==void 0&&W.useDefaults&&W.strictSchema)(0,$6.checkStrictMode)(Q,"default is ignored in the schema root")}function J2(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,rk.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function G2(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function eA({gen:Q,schemaEnv:X,schema:W,errSchemaPath:Y,opts:$}){let J=W.$comment;if($.$comment===!0)Q.code(y._`${l.default.self}.logger.log(${J})`);else if(typeof $.$comment=="function"){let G=y.str`${Y}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(y._`${l.default.self}.opts.$comment(${J}, ${G}, ${H}.schema)`)}}function H2(Q){let{gen:X,schemaEnv:W,validateName:Y,ValidationError:$,opts:J}=Q;if(W.$async)X.if(y._`${l.default.errors} === 0`,()=>X.return(l.default.data),()=>X.throw(y._`new ${$}(${l.default.vErrors})`));else{if(X.assign(y._`${Y}.errors`,l.default.vErrors),J.unevaluated)B2(Q);X.return(y._`${l.default.errors} === 0`)}}function B2({gen:Q,evaluated:X,props:W,items:Y}){if(W instanceof y.Name)Q.assign(y._`${X}.props`,W);if(Y instanceof y.Name)Q.assign(y._`${X}.items`,Y)}function iA(Q,X,W,Y){let{gen:$,schema:J,data:G,allErrors:H,opts:B,self:z}=Q,{RULES:K}=z;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,$6.schemaHasRulesButRef)(J,K))){$.block(()=>XD(Q,"$ref",K.all.$ref.definition));return}if(!B.jtd)z2(Q,X);$.block(()=>{for(let V of K.rules)L(V);L(K.post)});function L(V){if(!(0,i$.shouldUseGroup)(J,V))return;if(V.type){if($.if((0,mX.checkDataType)(V.type,G,B.strictNumbers)),dA(Q,V),X.length===1&&X[0]===V.type&&W)$.else(),(0,mX.reportTypeError)(Q);$.endIf()}else dA(Q,V);if(!H)$.if(y._`${l.default.errors} === ${Y||0}`)}}function dA(Q,X){let{gen:W,schema:Y,opts:{useDefaults:$}}=Q;if($)(0,ok.assignDefaults)(Q,X.type);W.block(()=>{for(let J of X.rules)if((0,i$.shouldUseRule)(Y,J))XD(Q,J.keyword,J.definition,X.type)})}function z2(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(K2(Q,X),!Q.opts.allowUnionTypes)L2(Q,X);F2(Q,Q.dataTypes)}function K2(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((W)=>{if(!QD(Q.dataTypes,W))d$(Q,`type "${W}" not allowed by context "${Q.dataTypes.join(",")}"`)}),D2(Q,X)}function L2(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))d$(Q,"use allowUnionTypes to allow union type keyword")}function F2(Q,X){let W=Q.self.RULES.all;for(let Y in W){let $=W[Y];if(typeof $=="object"&&(0,i$.shouldUseRule)(Q.schema,$)){let{type:J}=$.definition;if(J.length&&!J.some((G)=>A2(X,G)))d$(Q,`missing type "${J.join(",")}" for keyword "${Y}"`)}}}function A2(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function QD(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function D2(Q,X){let W=[];for(let Y of Q.dataTypes)if(QD(X,Y))W.push(Y);else if(X.includes("integer")&&Y==="number")W.push("integer");Q.dataTypes=W}function d$(Q,X){let W=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${W}" (strictTypes)`,(0,$6.checkStrictMode)(Q,X,Q.opts.strictTypes)}class n${constructor(Q,X,W){if((0,EQ.validateKeywordUsage)(Q,X,W),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=W,this.data=Q.data,this.schema=Q.schema[W],this.$data=X.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,$6.schemaRefOrVal)(Q,this.schema,W,this.$data),this.schemaType=X.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=X,this.$data)this.schemaCode=Q.gen.const("vSchema",WD(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,EQ.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${W} value must be ${JSON.stringify(X.schemaType)}`);if("code"in X?X.trackErrors:X.errors!==!1)this.errsCount=Q.gen.const("_errs",l.default.errors)}result(Q,X,W){this.failResult((0,y.not)(Q),X,W)}failResult(Q,X,W){if(this.gen.if(Q),W)W();else this.error();if(X){if(this.gen.else(),X(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,X){this.failResult((0,y.not)(Q),void 0,X)}fail(Q){if(Q===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(Q),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(Q){if(!this.$data)return this.fail(Q);let{schemaCode:X}=this;this.fail(y._`${X} !== undefined && (${(0,y.or)(this.invalid$data(),Q)})`)}error(Q,X,W){if(X){this.setParams(X),this._error(Q,W),this.setParams({});return}this._error(Q,W)}_error(Q,X){(Q?bQ.reportExtraError:bQ.reportError)(this,this.def.error,X)}$dataError(){(0,bQ.reportError)(this,this.def.$dataError||bQ.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,bQ.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,X){if(X)Object.assign(this.params,Q);else this.params=Q}block$data(Q,X,W=y.nil){this.gen.block(()=>{this.check$data(Q,W),X()})}check$data(Q=y.nil,X=y.nil){if(!this.$data)return;let{gen:W,schemaCode:Y,schemaType:$,def:J}=this;if(W.if((0,y.or)(y._`${Y} === undefined`,X)),Q!==y.nil)W.assign(Q,!0);if($.length||J.validateSchema){if(W.elseIf(this.invalid$data()),this.$dataError(),Q!==y.nil)W.assign(Q,!1)}W.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:W,def:Y,it:$}=this;return(0,y.or)(J(),G());function J(){if(W.length){if(!(X instanceof y.Name))throw Error("ajv implementation error");let H=Array.isArray(W)?W:[W];return y._`${(0,mX.checkDataTypes)(H,X,$.opts.strictNumbers,mX.DataType.Wrong)}`}return y.nil}function G(){if(Y.validateSchema){let H=Q.scopeValue("validate$data",{ref:Y.validateSchema});return y._`!${H}(${X})`}return y.nil}}subschema(Q,X){let W=(0,p$.getSubschema)(this.it,Q);(0,p$.extendSubschemaData)(W,this.it,Q),(0,p$.extendSubschemaMode)(W,Q);let Y={...this.it,...W,items:void 0,props:void 0};return X2(Y,X),Y}mergeEvaluated(Q,X){let{it:W,gen:Y}=this;if(!W.opts.unevaluated)return;if(W.props!==!0&&Q.props!==void 0)W.props=$6.mergeEvaluated.props(Y,Q.props,W.props,X);if(W.items!==!0&&Q.items!==void 0)W.items=$6.mergeEvaluated.items(Y,Q.items,W.items,X)}mergeValidEvaluated(Q,X){let{it:W,gen:Y}=this;if(W.opts.unevaluated&&(W.props!==!0||W.items!==!0))return Y.if(X,()=>this.mergeEvaluated(Q,y.Name)),!0}}YD.KeywordCxt=n$;function XD(Q,X,W,Y){let $=new n$(Q,W,X);if("code"in W)W.code($,Y);else if($.$data&&W.validate)(0,EQ.funcKeywordCode)($,W);else if("macro"in W)(0,EQ.macroKeywordCode)($,W);else if(W.compile||W.validate)(0,EQ.funcKeywordCode)($,W)}var V2=/^\/(?:[^~]|~0|~1)*$/,O2=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function WD(Q,{dataLevel:X,dataNames:W,dataPathArr:Y}){let $,J;if(Q==="")return l.default.rootData;if(Q[0]==="/"){if(!V2.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);$=Q,J=l.default.rootData}else{let z=O2.exec(Q);if(!z)throw Error(`Invalid JSON-pointer: ${Q}`);let K=+z[1];if($=z[2],$==="#"){if(K>=X)throw Error(B("property/index",K));return Y[X-K]}if(K>X)throw Error(B("data",K));if(J=W[X-K],!$)return J}let G=J,H=$.split("/");for(let z of H)if(z)J=y._`${J}${(0,y.getProperty)((0,$6.unescapeJsonPointer)(z))}`,G=y._`${G} && ${J}`;return G;function B(z,K){return`Cannot access ${z} ${K} levels up, current level is ${X}`}}YD.getData=WD});var cX=M((GD)=>{Object.defineProperty(GD,"__esModule",{value:!0});class JD extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}GD.default=JD});var IQ=M((BD)=>{Object.defineProperty(BD,"__esModule",{value:!0});var o$=wQ();class HD extends Error{constructor(Q,X,W,Y){super(Y||`can't resolve reference ${W} from id ${X}`);this.missingRef=(0,o$.resolveUrl)(Q,X,W),this.missingSchema=(0,o$.normalizeId)((0,o$.getFullPath)(Q,this.missingRef))}}BD.default=HD});var iX=M((LD)=>{Object.defineProperty(LD,"__esModule",{value:!0});LD.resolveSchema=LD.getCompilingSchema=LD.resolveRef=LD.compileSchema=LD.SchemaEnv=void 0;var R1=i(),j2=cX(),$9=Y6(),C1=wQ(),zD=Y0(),w2=PQ();class ZQ{constructor(Q){var X;this.refs={},this.dynamicAnchors={};let W;if(typeof Q.schema=="object")W=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(X=Q.baseId)!==null&&X!==void 0?X:(0,C1.normalizeId)(W===null||W===void 0?void 0:W[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=W===null||W===void 0?void 0:W.$async,this.refs={}}}LD.SchemaEnv=ZQ;function t$(Q){let X=KD.call(this,Q);if(X)return X;let W=(0,C1.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:Y,lines:$}=this.opts.code,{ownProperties:J}=this.opts,G=new R1.CodeGen(this.scope,{es5:Y,lines:$,ownProperties:J}),H;if(Q.$async)H=G.scopeValue("Error",{ref:j2.default,code:R1._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");Q.validateName=B;let z={gen:G,allErrors:this.opts.allErrors,data:$9.default.data,parentData:$9.default.parentData,parentDataProperty:$9.default.parentDataProperty,dataNames:[$9.default.data],dataPathArr:[R1.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,R1.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:W,baseId:Q.baseId||W,schemaPath:R1.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:R1._`""`,opts:this.opts,self:this},K;try{this._compilations.add(Q),(0,w2.validateFunctionCode)(z),G.optimize(this.opts.code.optimize);let L=G.toString();if(K=`${G.scopeRefs($9.default.scope)}return ${L}`,this.opts.code.process)K=this.opts.code.process(K,Q);let F=Function(`${$9.default.self}`,`${$9.default.scope}`,K)(this,this.scope.get());if(this.scope.value(B,{ref:F}),F.errors=null,F.schema=Q.schema,F.schemaEnv=Q,Q.$async)F.$async=!0;if(this.opts.code.source===!0)F.source={validateName:B,validateCode:L,scopeValues:G._values};if(this.opts.unevaluated){let{props:D,items:A}=z;if(F.evaluated={props:D instanceof R1.Name?void 0:D,items:A instanceof R1.Name?void 0:A,dynamicProps:D instanceof R1.Name,dynamicItems:A instanceof R1.Name},F.source)F.source.evaluated=(0,R1.stringify)(F.evaluated)}return Q.validate=F,Q}catch(L){if(delete Q.validate,delete Q.validateName,K)this.logger.error("Error compiling schema, function code:",K);throw L}finally{this._compilations.delete(Q)}}LD.compileSchema=t$;function b2(Q,X,W){var Y;W=(0,C1.resolveUrl)(this.opts.uriResolver,X,W);let $=Q.refs[W];if($)return $;let J=I2.call(this,Q,W);if(J===void 0){let G=(Y=Q.localRefs)===null||Y===void 0?void 0:Y[W],{schemaId:H}=this.opts;if(G)J=new ZQ({schema:G,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[W]=E2.call(this,J)}LD.resolveRef=b2;function E2(Q){if((0,C1.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:t$.call(this,Q)}function KD(Q){for(let X of this._compilations)if(P2(X,Q))return X}LD.getCompilingSchema=KD;function P2(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function I2(Q,X){let W;while(typeof(W=this.refs[X])=="string")X=W;return W||this.schemas[X]||pX.call(this,Q,X)}function pX(Q,X){let W=this.opts.uriResolver.parse(X),Y=(0,C1._getFullPath)(this.opts.uriResolver,W),$=(0,C1.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&Y===$)return r$.call(this,W,Q);let J=(0,C1.normalizeId)(Y),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let H=pX.call(this,Q,G);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return r$.call(this,W,H)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)t$.call(this,G);if(J===(0,C1.normalizeId)(X)){let{schema:H}=G,{schemaId:B}=this.opts,z=H[B];if(z)$=(0,C1.resolveUrl)(this.opts.uriResolver,$,z);return new ZQ({schema:H,schemaId:B,root:Q,baseId:$})}return r$.call(this,W,G)}LD.resolveSchema=pX;var Z2=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function r$(Q,{baseId:X,schema:W,root:Y}){var $;if((($=Q.fragment)===null||$===void 0?void 0:$[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof W==="boolean")return;let B=W[(0,zD.unescapeFragment)(H)];if(B===void 0)return;W=B;let z=typeof W==="object"&&W[this.opts.schemaId];if(!Z2.has(H)&&z)X=(0,C1.resolveUrl)(this.opts.uriResolver,X,z)}let J;if(typeof W!="boolean"&&W.$ref&&!(0,zD.schemaHasRulesButRef)(W,this.RULES)){let H=(0,C1.resolveUrl)(this.opts.uriResolver,X,W.$ref);J=pX.call(this,Y,H)}let{schemaId:G}=this.opts;if(J=J||new ZQ({schema:W,schemaId:G,root:Y,baseId:X}),J.schema!==J.root.schema)return J;return}});var AD=M((kp,k2)=>{k2.exports={$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 OD=M((VD)=>{Object.defineProperty(VD,"__esModule",{value:!0});var DD=Y$();DD.code='require("ajv/dist/runtime/uri").default';VD.default=DD});var ED=M((J6)=>{Object.defineProperty(J6,"__esModule",{value:!0});J6.CodeGen=J6.Name=J6.nil=J6.stringify=J6.str=J6._=J6.KeywordCxt=void 0;var _2=PQ();Object.defineProperty(J6,"KeywordCxt",{enumerable:!0,get:function(){return _2.KeywordCxt}});var s9=i();Object.defineProperty(J6,"_",{enumerable:!0,get:function(){return s9._}});Object.defineProperty(J6,"str",{enumerable:!0,get:function(){return s9.str}});Object.defineProperty(J6,"stringify",{enumerable:!0,get:function(){return s9.stringify}});Object.defineProperty(J6,"nil",{enumerable:!0,get:function(){return s9.nil}});Object.defineProperty(J6,"Name",{enumerable:!0,get:function(){return s9.Name}});Object.defineProperty(J6,"CodeGen",{enumerable:!0,get:function(){return s9.CodeGen}});var x2=cX(),jD=IQ(),y2=x$(),SQ=iX(),f2=i(),RQ=wQ(),dX=jQ(),s$=Y0(),UD=AD(),g2=OD(),wD=(Q,X)=>new RegExp(Q,X);wD.code="new RegExp";var h2=["removeAdditional","useDefaults","coerceTypes"],u2=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),l2={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."},m2={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},qD=200;function c2(Q){var X,W,Y,$,J,G,H,B,z,K,L,V,F,D,A,O,U,j,w,T,P,z0,w0,v1,_6;let F1=Q.strict,x6=(X=Q.code)===null||X===void 0?void 0:X.optimize,K4=x6===!0||x6===void 0?1:x6||0,L4=(Y=(W=Q.code)===null||W===void 0?void 0:W.regExp)!==null&&Y!==void 0?Y:wD,SW=($=Q.uriResolver)!==null&&$!==void 0?$:g2.default;return{strictSchema:(G=(J=Q.strictSchema)!==null&&J!==void 0?J:F1)!==null&&G!==void 0?G:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:F1)!==null&&B!==void 0?B:!0,strictTypes:(K=(z=Q.strictTypes)!==null&&z!==void 0?z:F1)!==null&&K!==void 0?K:"log",strictTuples:(V=(L=Q.strictTuples)!==null&&L!==void 0?L:F1)!==null&&V!==void 0?V:"log",strictRequired:(D=(F=Q.strictRequired)!==null&&F!==void 0?F:F1)!==null&&D!==void 0?D:!1,code:Q.code?{...Q.code,optimize:K4,regExp:L4}:{optimize:K4,regExp:L4},loopRequired:(A=Q.loopRequired)!==null&&A!==void 0?A:qD,loopEnum:(O=Q.loopEnum)!==null&&O!==void 0?O:qD,meta:(U=Q.meta)!==null&&U!==void 0?U:!0,messages:(j=Q.messages)!==null&&j!==void 0?j:!0,inlineRefs:(w=Q.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(T=Q.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(P=Q.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(z0=Q.validateSchema)!==null&&z0!==void 0?z0:!0,validateFormats:(w0=Q.validateFormats)!==null&&w0!==void 0?w0:!0,unicodeRegExp:(v1=Q.unicodeRegExp)!==null&&v1!==void 0?v1:!0,int32range:(_6=Q.int32range)!==null&&_6!==void 0?_6:!0,uriResolver:SW}}class nX{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...c2(Q)};let{es5:X,lines:W}=this.opts.code;this.scope=new f2.ValueScope({scope:{},prefixes:u2,es5:X,lines:W}),this.logger=r2(Q.logger);let Y=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,y2.getRules)(),ND.call(this,l2,Q,"NOT SUPPORTED"),ND.call(this,m2,Q,"DEPRECATED","warn"),this._metaOpts=n2.call(this),Q.formats)i2.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)d2.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);p2.call(this),Q.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:W}=this.opts,Y=UD;if(W==="id")Y={...UD},Y.id=Y.$id,delete Y.$id;if(X&&Q)this.addMetaSchema(Y,Y[W],!1)}defaultMeta(){let{meta:Q,schemaId:X}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[X]||Q:void 0}validate(Q,X){let W;if(typeof Q=="string"){if(W=this.getSchema(Q),!W)throw Error(`no schema with key or ref "${Q}"`)}else W=this.compile(Q);let Y=W(X);if(!("$async"in W))this.errors=W.errors;return Y}compile(Q,X){let W=this._addSchema(Q,X);return W.validate||this._compileSchemaEnv(W)}compileAsync(Q,X){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:W}=this.opts;return Y.call(this,Q,X);async function Y(z,K){await $.call(this,z.$schema);let L=this._addSchema(z,K);return L.validate||J.call(this,L)}async function $(z){if(z&&!this.getSchema(z))await Y.call(this,{$ref:z},!0)}async function J(z){try{return this._compileSchemaEnv(z)}catch(K){if(!(K instanceof jD.default))throw K;return G.call(this,K),await H.call(this,K.missingSchema),J.call(this,z)}}function G({missingSchema:z,missingRef:K}){if(this.refs[z])throw Error(`AnySchema ${z} is loaded but ${K} cannot be resolved`)}async function H(z){let K=await B.call(this,z);if(!this.refs[z])await $.call(this,K.$schema);if(!this.refs[z])this.addSchema(K,z,X)}async function B(z){let K=this._loading[z];if(K)return K;try{return await(this._loading[z]=W(z))}finally{delete this._loading[z]}}}addSchema(Q,X,W,Y=this.opts.validateSchema){if(Array.isArray(Q)){for(let J of Q)this.addSchema(J,void 0,W,Y);return this}let $;if(typeof Q==="object"){let{schemaId:J}=this.opts;if($=Q[J],$!==void 0&&typeof $!="string")throw Error(`schema ${J} must be string`)}return X=(0,RQ.normalizeId)(X||$),this._checkUnique(X),this.schemas[X]=this._addSchema(Q,W,X,Y,!0),this}addMetaSchema(Q,X,W=this.opts.validateSchema){return this.addSchema(Q,X,!0,W),this}validateSchema(Q,X){if(typeof Q=="boolean")return!0;let W;if(W=Q.$schema,W!==void 0&&typeof W!="string")throw Error("$schema must be a string");if(W=W||this.opts.defaultMeta||this.defaultMeta(),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Y=this.validate(W,Q);if(!Y&&X){let $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw Error($)}return Y}getSchema(Q){let X;while(typeof(X=MD.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:W}=this.opts,Y=new SQ.SchemaEnv({schema:{},schemaId:W});if(X=SQ.resolveSchema.call(this,Y,Q),!X)return;this.refs[Q]=X}return X.validate||this._compileSchemaEnv(X)}removeSchema(Q){if(Q instanceof RegExp)return this._removeAllSchemas(this.schemas,Q),this._removeAllSchemas(this.refs,Q),this;switch(typeof Q){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let X=MD.call(this,Q);if(typeof X=="object")this._cache.delete(X.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let X=Q;this._cache.delete(X);let W=Q[this.opts.schemaId];if(W)W=(0,RQ.normalizeId)(W),delete this.schemas[W],delete this.refs[W];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let X of Q)this.addKeyword(X);return this}addKeyword(Q,X){let W;if(typeof Q=="string"){if(W=Q,typeof X=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),X.keyword=W}else if(typeof Q=="object"&&X===void 0){if(X=Q,W=X.keyword,Array.isArray(W)&&!W.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(a2.call(this,W,X),!X)return(0,s$.eachItem)(W,($)=>a$.call(this,$)),this;e2.call(this,X);let Y={...X,type:(0,dX.getJSONTypes)(X.type),schemaType:(0,dX.getJSONTypes)(X.schemaType)};return(0,s$.eachItem)(W,Y.type.length===0?($)=>a$.call(this,$,Y):($)=>Y.type.forEach((J)=>a$.call(this,$,Y,J))),this}getKeyword(Q){let X=this.RULES.all[Q];return typeof X=="object"?X.definition:!!X}removeKeyword(Q){let{RULES:X}=this;delete X.keywords[Q],delete X.all[Q];for(let W of X.rules){let Y=W.rules.findIndex(($)=>$.keyword===Q);if(Y>=0)W.rules.splice(Y,1)}return this}addFormat(Q,X){if(typeof X=="string")X=new RegExp(X);return this.formats[Q]=X,this}errorsText(Q=this.errors,{separator:X=", ",dataVar:W="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((Y)=>`${W}${Y.instancePath} ${Y.message}`).reduce((Y,$)=>Y+X+$)}$dataMetaSchema(Q,X){let W=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let Y of X){let $=Y.split("/").slice(1),J=Q;for(let G of $)J=J[G];for(let G in W){let H=W[G];if(typeof H!="object")continue;let{$data:B}=H.definition,z=J[G];if(B&&z)J[G]=bD(z)}}return Q}_removeAllSchemas(Q,X){for(let W in Q){let Y=Q[W];if(!X||X.test(W)){if(typeof Y=="string")delete Q[W];else if(Y&&!Y.meta)this._cache.delete(Y.schema),delete Q[W]}}}_addSchema(Q,X,W,Y=this.opts.validateSchema,$=this.opts.addUsedSchema){let J,{schemaId:G}=this.opts;if(typeof Q=="object")J=Q[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let H=this._cache.get(Q);if(H!==void 0)return H;W=(0,RQ.normalizeId)(J||W);let B=RQ.getSchemaRefs.call(this,Q,W);if(H=new SQ.SchemaEnv({schema:Q,schemaId:G,meta:X,baseId:W,localRefs:B}),this._cache.set(H.schema,H),$&&!W.startsWith("#")){if(W)this._checkUnique(W);this.refs[W]=H}if(Y)this.validateSchema(Q,!0);return H}_checkUnique(Q){if(this.schemas[Q]||this.refs[Q])throw Error(`schema with key or id "${Q}" already exists`)}_compileSchemaEnv(Q){if(Q.meta)this._compileMetaSchema(Q);else SQ.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let X=this.opts;this.opts=this._metaOpts;try{SQ.compileSchema.call(this,Q)}finally{this.opts=X}}}nX.ValidationError=x2.default;nX.MissingRefError=jD.default;J6.default=nX;function ND(Q,X,W,Y="error"){for(let $ in Q){let J=$;if(J in X)this.logger[Y](`${W}: option ${$}. ${Q[J]}`)}}function MD(Q){return Q=(0,RQ.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function p2(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let X in Q)this.addSchema(Q[X],X)}function i2(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function d2(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let X in Q){let W=Q[X];if(!W.keyword)W.keyword=X;this.addKeyword(W)}}function n2(){let Q={...this.opts};for(let X of h2)delete Q[X];return Q}var o2={log(){},warn(){},error(){}};function r2(Q){if(Q===!1)return o2;if(Q===void 0)return console;if(Q.log&&Q.warn&&Q.error)return Q;throw Error("logger must implement log, warn and error methods")}var t2=/^[a-z_$][a-z0-9_$:-]*$/i;function a2(Q,X){let{RULES:W}=this;if((0,s$.eachItem)(Q,(Y)=>{if(W.keywords[Y])throw Error(`Keyword ${Y} is already defined`);if(!t2.test(Y))throw Error(`Keyword ${Y} has invalid name`)}),!X)return;if(X.$data&&!(("code"in X)||("validate"in X)))throw Error('$data keyword must have "code" or "validate" function')}function a$(Q,X,W){var Y;let $=X===null||X===void 0?void 0:X.post;if(W&&$)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=$?J.post:J.rules.find(({type:B})=>B===W);if(!G)G={type:W,rules:[]},J.rules.push(G);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,dX.getJSONTypes)(X.type),schemaType:(0,dX.getJSONTypes)(X.schemaType)}};if(X.before)s2.call(this,G,H,X.before);else G.rules.push(H);J.all[Q]=H,(Y=X.implements)===null||Y===void 0||Y.forEach((B)=>this.addKeyword(B))}function s2(Q,X,W){let Y=Q.rules.findIndex(($)=>$.keyword===W);if(Y>=0)Q.rules.splice(Y,0,X);else Q.rules.push(X),this.logger.warn(`rule ${W} is not defined`)}function e2(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=bD(X);Q.validateSchema=this.compile(X,!0)}var Qv={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function bD(Q){return{anyOf:[Q,Qv]}}});var ID=M((PD)=>{Object.defineProperty(PD,"__esModule",{value:!0});var Yv={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};PD.default=Yv});var kD=M((CD)=>{Object.defineProperty(CD,"__esModule",{value:!0});CD.callRef=CD.getValidate=void 0;var Jv=IQ(),ZD=K1(),W1=i(),e9=Y6(),SD=iX(),oX=Y0(),Gv={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:W,it:Y}=Q,{baseId:$,schemaEnv:J,validateName:G,opts:H,self:B}=Y,{root:z}=J;if((W==="#"||W==="#/")&&$===z.baseId)return L();let K=SD.resolveRef.call(B,z,$,W);if(K===void 0)throw new Jv.default(Y.opts.uriResolver,$,W);if(K instanceof SD.SchemaEnv)return V(K);return F(K);function L(){if(J===z)return rX(Q,G,J,J.$async);let D=X.scopeValue("root",{ref:z});return rX(Q,W1._`${D}.validate`,z,z.$async)}function V(D){let A=RD(Q,D);rX(Q,A,D,D.$async)}function F(D){let A=X.scopeValue("schema",H.code.source===!0?{ref:D,code:(0,W1.stringify)(D)}:{ref:D}),O=X.name("valid"),U=Q.subschema({schema:D,dataTypes:[],schemaPath:W1.nil,topSchemaRef:A,errSchemaPath:W},O);Q.mergeEvaluated(U),Q.ok(O)}}};function RD(Q,X){let{gen:W}=Q;return X.validate?W.scopeValue("validate",{ref:X.validate}):W1._`${W.scopeValue("wrapper",{ref:X})}.validate`}CD.getValidate=RD;function rX(Q,X,W,Y){let{gen:$,it:J}=Q,{allErrors:G,schemaEnv:H,opts:B}=J,z=B.passContext?e9.default.this:W1.nil;if(Y)K();else L();function K(){if(!H.$async)throw Error("async schema referenced by sync schema");let D=$.let("valid");$.try(()=>{if($.code(W1._`await ${(0,ZD.callValidateCode)(Q,X,z)}`),F(X),!G)$.assign(D,!0)},(A)=>{if($.if(W1._`!(${A} instanceof ${J.ValidationError})`,()=>$.throw(A)),V(A),!G)$.assign(D,!1)}),Q.ok(D)}function L(){Q.result((0,ZD.callValidateCode)(Q,X,z),()=>F(X),()=>V(X))}function V(D){let A=W1._`${D}.errors`;$.assign(e9.default.vErrors,W1._`${e9.default.vErrors} === null ? ${A} : ${e9.default.vErrors}.concat(${A})`),$.assign(e9.default.errors,W1._`${e9.default.vErrors}.length`)}function F(D){var A;if(!J.opts.unevaluated)return;let O=(A=W===null||W===void 0?void 0:W.validate)===null||A===void 0?void 0:A.evaluated;if(J.props!==!0)if(O&&!O.dynamicProps){if(O.props!==void 0)J.props=oX.mergeEvaluated.props($,O.props,J.props)}else{let U=$.var("props",W1._`${D}.evaluated.props`);J.props=oX.mergeEvaluated.props($,U,J.props,W1.Name)}if(J.items!==!0)if(O&&!O.dynamicItems){if(O.items!==void 0)J.items=oX.mergeEvaluated.items($,O.items,J.items)}else{let U=$.var("items",W1._`${D}.evaluated.items`);J.items=oX.mergeEvaluated.items($,U,J.items,W1.Name)}}}CD.callRef=rX;CD.default=Gv});var _D=M((vD)=>{Object.defineProperty(vD,"__esModule",{value:!0});var zv=ID(),Kv=kD(),Lv=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",zv.default,Kv.default];vD.default=Lv});var yD=M((xD)=>{Object.defineProperty(xD,"__esModule",{value:!0});var tX=i(),R6=tX.operators,aX={maximum:{okStr:"<=",ok:R6.LTE,fail:R6.GT},minimum:{okStr:">=",ok:R6.GTE,fail:R6.LT},exclusiveMaximum:{okStr:"<",ok:R6.LT,fail:R6.GTE},exclusiveMinimum:{okStr:">",ok:R6.GT,fail:R6.LTE}},Av={message:({keyword:Q,schemaCode:X})=>tX.str`must be ${aX[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>tX._`{comparison: ${aX[Q].okStr}, limit: ${X}}`},Dv={keyword:Object.keys(aX),type:"number",schemaType:"number",$data:!0,error:Av,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q;Q.fail$data(tX._`${W} ${aX[X].fail} ${Y} || isNaN(${W})`)}};xD.default=Dv});var gD=M((fD)=>{Object.defineProperty(fD,"__esModule",{value:!0});var CQ=i(),Ov={message:({schemaCode:Q})=>CQ.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>CQ._`{multipleOf: ${Q}}`},Uv={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ov,code(Q){let{gen:X,data:W,schemaCode:Y,it:$}=Q,J=$.opts.multipleOfPrecision,G=X.let("res"),H=J?CQ._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:CQ._`${G} !== parseInt(${G})`;Q.fail$data(CQ._`(${Y} === 0 || (${G} = ${W}/${Y}, ${H}))`)}};fD.default=Uv});var lD=M((uD)=>{Object.defineProperty(uD,"__esModule",{value:!0});function hD(Q){let X=Q.length,W=0,Y=0,$;while(Y<X)if(W++,$=Q.charCodeAt(Y++),$>=55296&&$<=56319&&Y<X){if($=Q.charCodeAt(Y),($&64512)===56320)Y++}return W}uD.default=hD;hD.code='require("ajv/dist/runtime/ucs2length").default'});var cD=M((mD)=>{Object.defineProperty(mD,"__esModule",{value:!0});var J9=i(),Mv=Y0(),jv=lD(),wv={message({keyword:Q,schemaCode:X}){let W=Q==="maxLength"?"more":"fewer";return J9.str`must NOT have ${W} than ${X} characters`},params:({schemaCode:Q})=>J9._`{limit: ${Q}}`},bv={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:wv,code(Q){let{keyword:X,data:W,schemaCode:Y,it:$}=Q,J=X==="maxLength"?J9.operators.GT:J9.operators.LT,G=$.opts.unicode===!1?J9._`${W}.length`:J9._`${(0,Mv.useFunc)(Q.gen,jv.default)}(${W})`;Q.fail$data(J9._`${G} ${J} ${Y}`)}};mD.default=bv});var iD=M((pD)=>{Object.defineProperty(pD,"__esModule",{value:!0});var Pv=K1(),sX=i(),Iv={message:({schemaCode:Q})=>sX.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>sX._`{pattern: ${Q}}`},Zv={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Iv,code(Q){let{data:X,$data:W,schema:Y,schemaCode:$,it:J}=Q,G=J.opts.unicodeRegExp?"u":"",H=W?sX._`(new RegExp(${$}, ${G}))`:(0,Pv.usePattern)(Q,Y);Q.fail$data(sX._`!${H}.test(${X})`)}};pD.default=Zv});var nD=M((dD)=>{Object.defineProperty(dD,"__esModule",{value:!0});var TQ=i(),Rv={message({keyword:Q,schemaCode:X}){let W=Q==="maxProperties"?"more":"fewer";return TQ.str`must NOT have ${W} than ${X} properties`},params:({schemaCode:Q})=>TQ._`{limit: ${Q}}`},Cv={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Rv,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q,$=X==="maxProperties"?TQ.operators.GT:TQ.operators.LT;Q.fail$data(TQ._`Object.keys(${W}).length ${$} ${Y}`)}};dD.default=Cv});var rD=M((oD)=>{Object.defineProperty(oD,"__esModule",{value:!0});var kQ=K1(),vQ=i(),kv=Y0(),vv={message:({params:{missingProperty:Q}})=>vQ.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>vQ._`{missingProperty: ${Q}}`},_v={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vv,code(Q){let{gen:X,schema:W,schemaCode:Y,data:$,$data:J,it:G}=Q,{opts:H}=G;if(!J&&W.length===0)return;let B=W.length>=H.loopRequired;if(G.allErrors)z();else K();if(H.strictRequired){let F=Q.parentSchema.properties,{definedProperties:D}=Q.it;for(let A of W)if((F===null||F===void 0?void 0:F[A])===void 0&&!D.has(A)){let O=G.schemaEnv.baseId+G.errSchemaPath,U=`required property "${A}" is not defined at "${O}" (strictRequired)`;(0,kv.checkStrictMode)(G,U,G.opts.strictRequired)}}function z(){if(B||J)Q.block$data(vQ.nil,L);else for(let F of W)(0,kQ.checkReportMissingProp)(Q,F)}function K(){let F=X.let("missing");if(B||J){let D=X.let("valid",!0);Q.block$data(D,()=>V(F,D)),Q.ok(D)}else X.if((0,kQ.checkMissingProp)(Q,W,F)),(0,kQ.reportMissingProp)(Q,F),X.else()}function L(){X.forOf("prop",Y,(F)=>{Q.setParams({missingProperty:F}),X.if((0,kQ.noPropertyInData)(X,$,F,H.ownProperties),()=>Q.error())})}function V(F,D){Q.setParams({missingProperty:F}),X.forOf(F,Y,()=>{X.assign(D,(0,kQ.propertyInData)(X,$,F,H.ownProperties)),X.if((0,vQ.not)(D),()=>{Q.error(),X.break()})},vQ.nil)}}};oD.default=_v});var aD=M((tD)=>{Object.defineProperty(tD,"__esModule",{value:!0});var _Q=i(),yv={message({keyword:Q,schemaCode:X}){let W=Q==="maxItems"?"more":"fewer";return _Q.str`must NOT have ${W} than ${X} items`},params:({schemaCode:Q})=>_Q._`{limit: ${Q}}`},fv={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:yv,code(Q){let{keyword:X,data:W,schemaCode:Y}=Q,$=X==="maxItems"?_Q.operators.GT:_Q.operators.LT;Q.fail$data(_Q._`${W}.length ${$} ${Y}`)}};tD.default=fv});var eX=M((eD)=>{Object.defineProperty(eD,"__esModule",{value:!0});var sD=e4();sD.code='require("ajv/dist/runtime/equal").default';eD.default=sD});var XV=M((QV)=>{Object.defineProperty(QV,"__esModule",{value:!0});var e$=jQ(),_0=i(),uv=Y0(),lv=eX(),mv={message:({params:{i:Q,j:X}})=>_0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>_0._`{i: ${Q}, j: ${X}}`},cv={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mv,code(Q){let{gen:X,data:W,$data:Y,schema:$,parentSchema:J,schemaCode:G,it:H}=Q;if(!Y&&!$)return;let B=X.let("valid"),z=J.items?(0,e$.getSchemaTypes)(J.items):[];Q.block$data(B,K,_0._`${G} === false`),Q.ok(B);function K(){let D=X.let("i",_0._`${W}.length`),A=X.let("j");Q.setParams({i:D,j:A}),X.assign(B,!0),X.if(_0._`${D} > 1`,()=>(L()?V:F)(D,A))}function L(){return z.length>0&&!z.some((D)=>D==="object"||D==="array")}function V(D,A){let O=X.name("item"),U=(0,e$.checkDataTypes)(z,O,H.opts.strictNumbers,e$.DataType.Wrong),j=X.const("indices",_0._`{}`);X.for(_0._`;${D}--;`,()=>{if(X.let(O,_0._`${W}[${D}]`),X.if(U,_0._`continue`),z.length>1)X.if(_0._`typeof ${O} == "string"`,_0._`${O} += "_"`);X.if(_0._`typeof ${j}[${O}] == "number"`,()=>{X.assign(A,_0._`${j}[${O}]`),Q.error(),X.assign(B,!1).break()}).code(_0._`${j}[${O}] = ${D}`)})}function F(D,A){let O=(0,uv.useFunc)(X,lv.default),U=X.name("outer");X.label(U).for(_0._`;${D}--;`,()=>X.for(_0._`${A} = ${D}; ${A}--;`,()=>X.if(_0._`${O}(${W}[${D}], ${W}[${A}])`,()=>{Q.error(),X.assign(B,!1).break(U)})))}}};QV.default=cv});var YV=M((WV)=>{Object.defineProperty(WV,"__esModule",{value:!0});var QJ=i(),iv=Y0(),dv=eX(),nv={message:"must be equal to constant",params:({schemaCode:Q})=>QJ._`{allowedValue: ${Q}}`},ov={keyword:"const",$data:!0,error:nv,code(Q){let{gen:X,data:W,$data:Y,schemaCode:$,schema:J}=Q;if(Y||J&&typeof J=="object")Q.fail$data(QJ._`!${(0,iv.useFunc)(X,dv.default)}(${W}, ${$})`);else Q.fail(QJ._`${J} !== ${W}`)}};WV.default=ov});var JV=M(($V)=>{Object.defineProperty($V,"__esModule",{value:!0});var xQ=i(),tv=Y0(),av=eX(),sv={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>xQ._`{allowedValues: ${Q}}`},ev={keyword:"enum",schemaType:"array",$data:!0,error:sv,code(Q){let{gen:X,data:W,$data:Y,schema:$,schemaCode:J,it:G}=Q;if(!Y&&$.length===0)throw Error("enum must have non-empty array");let H=$.length>=G.opts.loopEnum,B,z=()=>B!==null&&B!==void 0?B:B=(0,tv.useFunc)(X,av.default),K;if(H||Y)K=X.let("valid"),Q.block$data(K,L);else{if(!Array.isArray($))throw Error("ajv implementation error");let F=X.const("vSchema",J);K=(0,xQ.or)(...$.map((D,A)=>V(F,A)))}Q.pass(K);function L(){X.assign(K,!1),X.forOf("v",J,(F)=>X.if(xQ._`${z()}(${W}, ${F})`,()=>X.assign(K,!0).break()))}function V(F,D){let A=$[D];return typeof A==="object"&&A!==null?xQ._`${z()}(${W}, ${F}[${D}])`:xQ._`${W} === ${A}`}}};$V.default=ev});var HV=M((GV)=>{Object.defineProperty(GV,"__esModule",{value:!0});var X_=yD(),W_=gD(),Y_=cD(),$_=iD(),J_=nD(),G_=rD(),H_=aD(),B_=XV(),z_=YV(),K_=JV(),L_=[X_.default,W_.default,Y_.default,$_.default,J_.default,G_.default,H_.default,B_.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},z_.default,K_.default];GV.default=L_});var WJ=M((zV)=>{Object.defineProperty(zV,"__esModule",{value:!0});zV.validateAdditionalItems=void 0;var G9=i(),XJ=Y0(),A_={message:({params:{len:Q}})=>G9.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>G9._`{limit: ${Q}}`},D_={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:A_,code(Q){let{parentSchema:X,it:W}=Q,{items:Y}=X;if(!Array.isArray(Y)){(0,XJ.checkStrictMode)(W,'"additionalItems" is ignored when "items" is not an array of schemas');return}BV(Q,Y)}};function BV(Q,X){let{gen:W,schema:Y,data:$,keyword:J,it:G}=Q;G.items=!0;let H=W.const("len",G9._`${$}.length`);if(Y===!1)Q.setParams({len:X.length}),Q.pass(G9._`${H} <= ${X.length}`);else if(typeof Y=="object"&&!(0,XJ.alwaysValidSchema)(G,Y)){let z=W.var("valid",G9._`${H} <= ${X.length}`);W.if((0,G9.not)(z),()=>B(z)),Q.ok(z)}function B(z){W.forRange("i",X.length,H,(K)=>{if(Q.subschema({keyword:J,dataProp:K,dataPropType:XJ.Type.Num},z),!G.allErrors)W.if((0,G9.not)(z),()=>W.break())})}}zV.validateAdditionalItems=BV;zV.default=D_});var YJ=M((AV)=>{Object.defineProperty(AV,"__esModule",{value:!0});AV.validateTuple=void 0;var LV=i(),QW=Y0(),O_=K1(),U_={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:W}=Q;if(Array.isArray(X))return FV(Q,"additionalItems",X);if(W.items=!0,(0,QW.alwaysValidSchema)(W,X))return;Q.ok((0,O_.validateArray)(Q))}};function FV(Q,X,W=Q.schema){let{gen:Y,parentSchema:$,data:J,keyword:G,it:H}=Q;if(K($),H.opts.unevaluated&&W.length&&H.items!==!0)H.items=QW.mergeEvaluated.items(Y,W.length,H.items);let B=Y.name("valid"),z=Y.const("len",LV._`${J}.length`);W.forEach((L,V)=>{if((0,QW.alwaysValidSchema)(H,L))return;Y.if(LV._`${z} > ${V}`,()=>Q.subschema({keyword:G,schemaProp:V,dataProp:V},B)),Q.ok(B)});function K(L){let{opts:V,errSchemaPath:F}=H,D=W.length,A=D===L.minItems&&(D===L.maxItems||L[X]===!1);if(V.strictTuples&&!A){let O=`"${G}" is ${D}-tuple, but minItems or maxItems/${X} are not specified or different at path "${F}"`;(0,QW.checkStrictMode)(H,O,V.strictTuples)}}}AV.validateTuple=FV;AV.default=U_});var OV=M((VV)=>{Object.defineProperty(VV,"__esModule",{value:!0});var N_=YJ(),M_={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,N_.validateTuple)(Q,"items")};VV.default=M_});var NV=M((qV)=>{Object.defineProperty(qV,"__esModule",{value:!0});var UV=i(),w_=Y0(),b_=K1(),E_=WJ(),P_={message:({params:{len:Q}})=>UV.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>UV._`{limit: ${Q}}`},I_={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:P_,code(Q){let{schema:X,parentSchema:W,it:Y}=Q,{prefixItems:$}=W;if(Y.items=!0,(0,w_.alwaysValidSchema)(Y,X))return;if($)(0,E_.validateAdditionalItems)(Q,$);else Q.ok((0,b_.validateArray)(Q))}};qV.default=I_});var jV=M((MV)=>{Object.defineProperty(MV,"__esModule",{value:!0});var L1=i(),XW=Y0(),S_={message:({params:{min:Q,max:X}})=>X===void 0?L1.str`must contain at least ${Q} valid item(s)`:L1.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?L1._`{minContains: ${Q}}`:L1._`{minContains: ${Q}, maxContains: ${X}}`},R_={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:S_,code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,it:J}=Q,G,H,{minContains:B,maxContains:z}=Y;if(J.opts.next)G=B===void 0?1:B,H=z;else G=1;let K=X.const("len",L1._`${$}.length`);if(Q.setParams({min:G,max:H}),H===void 0&&G===0){(0,XW.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&G>H){(0,XW.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,XW.alwaysValidSchema)(J,W)){let A=L1._`${K} >= ${G}`;if(H!==void 0)A=L1._`${A} && ${K} <= ${H}`;Q.pass(A);return}J.items=!0;let L=X.name("valid");if(H===void 0&&G===1)F(L,()=>X.if(L,()=>X.break()));else if(G===0){if(X.let(L,!0),H!==void 0)X.if(L1._`${$}.length > 0`,V)}else X.let(L,!1),V();Q.result(L,()=>Q.reset());function V(){let A=X.name("_valid"),O=X.let("count",0);F(A,()=>X.if(A,()=>D(O)))}function F(A,O){X.forRange("i",0,K,(U)=>{Q.subschema({keyword:"contains",dataProp:U,dataPropType:XW.Type.Num,compositeRule:!0},A),O()})}function D(A){if(X.code(L1._`${A}++`),H===void 0)X.if(L1._`${A} >= ${G}`,()=>X.assign(L,!0).break());else if(X.if(L1._`${A} > ${H}`,()=>X.assign(L,!1).break()),G===1)X.assign(L,!0);else X.if(L1._`${A} >= ${G}`,()=>X.assign(L,!0))}}};MV.default=R_});var ZV=M((EV)=>{Object.defineProperty(EV,"__esModule",{value:!0});EV.validateSchemaDeps=EV.validatePropertyDeps=EV.error=void 0;var $J=i(),T_=Y0(),yQ=K1();EV.error={message:({params:{property:Q,depsCount:X,deps:W}})=>{let Y=X===1?"property":"properties";return $J.str`must have ${Y} ${W} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:W,missingProperty:Y}})=>$J._`{property: ${Q},
14
- missingProperty: ${Y},
15
- depsCount: ${X},
16
- deps: ${W}}`};var k_={keyword:"dependencies",type:"object",schemaType:"object",error:EV.error,code(Q){let[X,W]=v_(Q);wV(Q,X),bV(Q,W)}};function v_({schema:Q}){let X={},W={};for(let Y in Q){if(Y==="__proto__")continue;let $=Array.isArray(Q[Y])?X:W;$[Y]=Q[Y]}return[X,W]}function wV(Q,X=Q.schema){let{gen:W,data:Y,it:$}=Q;if(Object.keys(X).length===0)return;let J=W.let("missing");for(let G in X){let H=X[G];if(H.length===0)continue;let B=(0,yQ.propertyInData)(W,Y,G,$.opts.ownProperties);if(Q.setParams({property:G,depsCount:H.length,deps:H.join(", ")}),$.allErrors)W.if(B,()=>{for(let z of H)(0,yQ.checkReportMissingProp)(Q,z)});else W.if($J._`${B} && (${(0,yQ.checkMissingProp)(Q,H,J)})`),(0,yQ.reportMissingProp)(Q,J),W.else()}}EV.validatePropertyDeps=wV;function bV(Q,X=Q.schema){let{gen:W,data:Y,keyword:$,it:J}=Q,G=W.name("valid");for(let H in X){if((0,T_.alwaysValidSchema)(J,X[H]))continue;W.if((0,yQ.propertyInData)(W,Y,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:$,schemaProp:H},G);Q.mergeValidEvaluated(B,G)},()=>W.var(G,!0)),Q.ok(G)}}EV.validateSchemaDeps=bV;EV.default=k_});var CV=M((RV)=>{Object.defineProperty(RV,"__esModule",{value:!0});var SV=i(),y_=Y0(),f_={message:"property name must be valid",params:({params:Q})=>SV._`{propertyName: ${Q.propertyName}}`},g_={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:f_,code(Q){let{gen:X,schema:W,data:Y,it:$}=Q;if((0,y_.alwaysValidSchema)($,W))return;let J=X.name("valid");X.forIn("key",Y,(G)=>{Q.setParams({propertyName:G}),Q.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),X.if((0,SV.not)(J),()=>{if(Q.error(!0),!$.allErrors)X.break()})}),Q.ok(J)}};RV.default=g_});var JJ=M((TV)=>{Object.defineProperty(TV,"__esModule",{value:!0});var WW=K1(),T1=i(),u_=Y6(),YW=Y0(),l_={message:"must NOT have additional properties",params:({params:Q})=>T1._`{additionalProperty: ${Q.additionalProperty}}`},m_={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:l_,code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,errsCount:J,it:G}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:H,opts:B}=G;if(G.props=!0,B.removeAdditional!=="all"&&(0,YW.alwaysValidSchema)(G,W))return;let z=(0,WW.allSchemaProperties)(Y.properties),K=(0,WW.allSchemaProperties)(Y.patternProperties);L(),Q.ok(T1._`${J} === ${u_.default.errors}`);function L(){X.forIn("key",$,(O)=>{if(!z.length&&!K.length)D(O);else X.if(V(O),()=>D(O))})}function V(O){let U;if(z.length>8){let j=(0,YW.schemaRefOrVal)(G,Y.properties,"properties");U=(0,WW.isOwnProperty)(X,j,O)}else if(z.length)U=(0,T1.or)(...z.map((j)=>T1._`${O} === ${j}`));else U=T1.nil;if(K.length)U=(0,T1.or)(U,...K.map((j)=>T1._`${(0,WW.usePattern)(Q,j)}.test(${O})`));return(0,T1.not)(U)}function F(O){X.code(T1._`delete ${$}[${O}]`)}function D(O){if(B.removeAdditional==="all"||B.removeAdditional&&W===!1){F(O);return}if(W===!1){if(Q.setParams({additionalProperty:O}),Q.error(),!H)X.break();return}if(typeof W=="object"&&!(0,YW.alwaysValidSchema)(G,W)){let U=X.name("valid");if(B.removeAdditional==="failing")A(O,U,!1),X.if((0,T1.not)(U),()=>{Q.reset(),F(O)});else if(A(O,U),!H)X.if((0,T1.not)(U),()=>X.break())}}function A(O,U,j){let w={keyword:"additionalProperties",dataProp:O,dataPropType:YW.Type.Str};if(j===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(w,U)}}};TV.default=m_});var xV=M((_V)=>{Object.defineProperty(_V,"__esModule",{value:!0});var p_=PQ(),kV=K1(),GJ=Y0(),vV=JJ(),i_={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:W,parentSchema:Y,data:$,it:J}=Q;if(J.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)vV.default.code(new p_.KeywordCxt(J,vV.default,"additionalProperties"));let G=(0,kV.allSchemaProperties)(W);for(let L of G)J.definedProperties.add(L);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=GJ.mergeEvaluated.props(X,(0,GJ.toHash)(G),J.props);let H=G.filter((L)=>!(0,GJ.alwaysValidSchema)(J,W[L]));if(H.length===0)return;let B=X.name("valid");for(let L of H){if(z(L))K(L);else{if(X.if((0,kV.propertyInData)(X,$,L,J.opts.ownProperties)),K(L),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(L),Q.ok(B)}function z(L){return J.opts.useDefaults&&!J.compositeRule&&W[L].default!==void 0}function K(L){Q.subschema({keyword:"properties",schemaProp:L,dataProp:L},B)}}};_V.default=i_});var uV=M((hV)=>{Object.defineProperty(hV,"__esModule",{value:!0});var yV=K1(),$W=i(),fV=Y0(),gV=Y0(),n_={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:W,data:Y,parentSchema:$,it:J}=Q,{opts:G}=J,H=(0,yV.allSchemaProperties)(W),B=H.filter((A)=>(0,fV.alwaysValidSchema)(J,W[A]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let z=G.strictSchema&&!G.allowMatchingProperties&&$.properties,K=X.name("valid");if(J.props!==!0&&!(J.props instanceof $W.Name))J.props=(0,gV.evaluatedPropsToName)(X,J.props);let{props:L}=J;V();function V(){for(let A of H){if(z)F(A);if(J.allErrors)D(A);else X.var(K,!0),D(A),X.if(K)}}function F(A){for(let O in z)if(new RegExp(A).test(O))(0,fV.checkStrictMode)(J,`property ${O} matches pattern ${A} (use allowMatchingProperties)`)}function D(A){X.forIn("key",Y,(O)=>{X.if($W._`${(0,yV.usePattern)(Q,A)}.test(${O})`,()=>{let U=B.includes(A);if(!U)Q.subschema({keyword:"patternProperties",schemaProp:A,dataProp:O,dataPropType:gV.Type.Str},K);if(J.opts.unevaluated&&L!==!0)X.assign($W._`${L}[${O}]`,!0);else if(!U&&!J.allErrors)X.if((0,$W.not)(K),()=>X.break())})})}}};hV.default=n_});var mV=M((lV)=>{Object.defineProperty(lV,"__esModule",{value:!0});var r_=Y0(),t_={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:W,it:Y}=Q;if((0,r_.alwaysValidSchema)(Y,W)){Q.fail();return}let $=X.name("valid");Q.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},$),Q.failResult($,()=>Q.reset(),()=>Q.error())},error:{message:"must NOT be valid"}};lV.default=t_});var pV=M((cV)=>{Object.defineProperty(cV,"__esModule",{value:!0});var s_=K1(),e_={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:s_.validateUnion,error:{message:"must match a schema in anyOf"}};cV.default=e_});var dV=M((iV)=>{Object.defineProperty(iV,"__esModule",{value:!0});var JW=i(),Xx=Y0(),Wx={message:"must match exactly one schema in oneOf",params:({params:Q})=>JW._`{passingSchemas: ${Q.passing}}`},Yx={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Wx,code(Q){let{gen:X,schema:W,parentSchema:Y,it:$}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");if($.opts.discriminator&&Y.discriminator)return;let J=W,G=X.let("valid",!1),H=X.let("passing",null),B=X.name("_valid");Q.setParams({passing:H}),X.block(z),Q.result(G,()=>Q.reset(),()=>Q.error(!0));function z(){J.forEach((K,L)=>{let V;if((0,Xx.alwaysValidSchema)($,K))X.var(B,!0);else V=Q.subschema({keyword:"oneOf",schemaProp:L,compositeRule:!0},B);if(L>0)X.if(JW._`${B} && ${G}`).assign(G,!1).assign(H,JW._`[${H}, ${L}]`).else();X.if(B,()=>{if(X.assign(G,!0),X.assign(H,L),V)Q.mergeEvaluated(V,JW.Name)})})}}};iV.default=Yx});var oV=M((nV)=>{Object.defineProperty(nV,"__esModule",{value:!0});var Jx=Y0(),Gx={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:W,it:Y}=Q;if(!Array.isArray(W))throw Error("ajv implementation error");let $=X.name("valid");W.forEach((J,G)=>{if((0,Jx.alwaysValidSchema)(Y,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:G},$);Q.ok($),Q.mergeEvaluated(H)})}};nV.default=Gx});var sV=M((aV)=>{Object.defineProperty(aV,"__esModule",{value:!0});var GW=i(),tV=Y0(),Bx={message:({params:Q})=>GW.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>GW._`{failingKeyword: ${Q.ifClause}}`},zx={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Bx,code(Q){let{gen:X,parentSchema:W,it:Y}=Q;if(W.then===void 0&&W.else===void 0)(0,tV.checkStrictMode)(Y,'"if" without "then" and "else" is ignored');let $=rV(Y,"then"),J=rV(Y,"else");if(!$&&!J)return;let G=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),$&&J){let K=X.let("ifClause");Q.setParams({ifClause:K}),X.if(H,z("then",K),z("else",K))}else if($)X.if(H,z("then"));else X.if((0,GW.not)(H),z("else"));Q.pass(G,()=>Q.error(!0));function B(){let K=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(K)}function z(K,L){return()=>{let V=Q.subschema({keyword:K},H);if(X.assign(G,H),Q.mergeValidEvaluated(V,G),L)X.assign(L,GW._`${K}`);else Q.setParams({ifClause:K})}}}};function rV(Q,X){let W=Q.schema[X];return W!==void 0&&!(0,tV.alwaysValidSchema)(Q,W)}aV.default=zx});var QO=M((eV)=>{Object.defineProperty(eV,"__esModule",{value:!0});var Lx=Y0(),Fx={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:W}){if(X.if===void 0)(0,Lx.checkStrictMode)(W,`"${Q}" without "if" is ignored`)}};eV.default=Fx});var WO=M((XO)=>{Object.defineProperty(XO,"__esModule",{value:!0});var Dx=WJ(),Vx=OV(),Ox=YJ(),Ux=NV(),qx=jV(),Nx=ZV(),Mx=CV(),jx=JJ(),wx=xV(),bx=uV(),Ex=mV(),Px=pV(),Ix=dV(),Zx=oV(),Sx=sV(),Rx=QO();function Cx(Q=!1){let X=[Ex.default,Px.default,Ix.default,Zx.default,Sx.default,Rx.default,Mx.default,jx.default,Nx.default,wx.default,bx.default];if(Q)X.push(Vx.default,Ux.default);else X.push(Dx.default,Ox.default);return X.push(qx.default),X}XO.default=Cx});var $O=M((YO)=>{Object.defineProperty(YO,"__esModule",{value:!0});var E0=i(),kx={message:({schemaCode:Q})=>E0.str`must match format "${Q}"`,params:({schemaCode:Q})=>E0._`{format: ${Q}}`},vx={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:kx,code(Q,X){let{gen:W,data:Y,$data:$,schema:J,schemaCode:G,it:H}=Q,{opts:B,errSchemaPath:z,schemaEnv:K,self:L}=H;if(!B.validateFormats)return;if($)V();else F();function V(){let D=W.scopeValue("formats",{ref:L.formats,code:B.code.formats}),A=W.const("fDef",E0._`${D}[${G}]`),O=W.let("fType"),U=W.let("format");W.if(E0._`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>W.assign(O,E0._`${A}.type || "string"`).assign(U,E0._`${A}.validate`),()=>W.assign(O,E0._`"string"`).assign(U,A)),Q.fail$data((0,E0.or)(j(),w()));function j(){if(B.strictSchema===!1)return E0.nil;return E0._`${G} && !${U}`}function w(){let T=K.$async?E0._`(${A}.async ? await ${U}(${Y}) : ${U}(${Y}))`:E0._`${U}(${Y})`,P=E0._`(typeof ${U} == "function" ? ${T} : ${U}.test(${Y}))`;return E0._`${U} && ${U} !== true && ${O} === ${X} && !${P}`}}function F(){let D=L.formats[J];if(!D){j();return}if(D===!0)return;let[A,O,U]=w(D);if(A===X)Q.pass(T());function j(){if(B.strictSchema===!1){L.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${J}" ignored in schema at path "${z}"`}}function w(P){let z0=P instanceof RegExp?(0,E0.regexpCode)(P):B.code.formats?E0._`${B.code.formats}${(0,E0.getProperty)(J)}`:void 0,w0=W.scopeValue("formats",{key:J,ref:P,code:z0});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,E0._`${w0}.validate`];return["string",P,w0]}function T(){if(typeof D=="object"&&!(D instanceof RegExp)&&D.async){if(!K.$async)throw Error("async format in sync schema");return E0._`await ${U}(${Y})`}return typeof O=="function"?E0._`${U}(${Y})`:E0._`${U}.test(${Y})`}}}};YO.default=vx});var GO=M((JO)=>{Object.defineProperty(JO,"__esModule",{value:!0});var xx=$O(),yx=[xx.default];JO.default=yx});var zO=M((HO)=>{Object.defineProperty(HO,"__esModule",{value:!0});HO.contentVocabulary=HO.metadataVocabulary=void 0;HO.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];HO.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var FO=M((LO)=>{Object.defineProperty(LO,"__esModule",{value:!0});var hx=_D(),ux=HV(),lx=WO(),mx=GO(),KO=zO(),cx=[hx.default,ux.default,(0,lx.default)(),mx.default,KO.metadataVocabulary,KO.contentVocabulary];LO.default=cx});var OO=M((DO)=>{Object.defineProperty(DO,"__esModule",{value:!0});DO.DiscrError=void 0;var AO;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(AO||(DO.DiscrError=AO={}))});var NO=M((qO)=>{Object.defineProperty(qO,"__esModule",{value:!0});var Q4=i(),HJ=OO(),UO=iX(),ix=IQ(),dx=Y0(),nx={message:({params:{discrError:Q,tagName:X}})=>Q===HJ.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:W}})=>Q4._`{error: ${Q}, tag: ${W}, tagValue: ${X}}`},ox={keyword:"discriminator",type:"object",schemaType:"object",error:nx,code(Q){let{gen:X,data:W,schema:Y,parentSchema:$,it:J}=Q,{oneOf:G}=$;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let H=Y.propertyName;if(typeof H!="string")throw Error("discriminator: requires propertyName");if(Y.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let B=X.let("valid",!1),z=X.const("tag",Q4._`${W}${(0,Q4.getProperty)(H)}`);X.if(Q4._`typeof ${z} == "string"`,()=>K(),()=>Q.error(!1,{discrError:HJ.DiscrError.Tag,tag:z,tagName:H})),Q.ok(B);function K(){let F=V();X.if(!1);for(let D in F)X.elseIf(Q4._`${z} === ${D}`),X.assign(B,L(F[D]));X.else(),Q.error(!1,{discrError:HJ.DiscrError.Mapping,tag:z,tagName:H}),X.endIf()}function L(F){let D=X.name("valid"),A=Q.subschema({keyword:"oneOf",schemaProp:F},D);return Q.mergeEvaluated(A,Q4.Name),D}function V(){var F;let D={},A=U($),O=!0;for(let T=0;T<G.length;T++){let P=G[T];if((P===null||P===void 0?void 0:P.$ref)&&!(0,dx.schemaHasRulesButRef)(P,J.self.RULES)){let w0=P.$ref;if(P=UO.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,w0),P instanceof UO.SchemaEnv)P=P.schema;if(P===void 0)throw new ix.default(J.opts.uriResolver,J.baseId,w0)}let z0=(F=P===null||P===void 0?void 0:P.properties)===null||F===void 0?void 0:F[H];if(typeof z0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);O=O&&(A||U(P)),j(z0,T)}if(!O)throw Error(`discriminator: "${H}" must be required`);return D;function U({required:T}){return Array.isArray(T)&&T.includes(H)}function j(T,P){if(T.const)w(T.const,P);else if(T.enum)for(let z0 of T.enum)w(z0,P);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function w(T,P){if(typeof T!="string"||T in D)throw Error(`discriminator: "${H}" values must be unique strings`);D[T]=P}}}};qO.default=ox});var MO=M((Ii,tx)=>{tx.exports={$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 wO=M((Y1,BJ)=>{Object.defineProperty(Y1,"__esModule",{value:!0});Y1.MissingRefError=Y1.ValidationError=Y1.CodeGen=Y1.Name=Y1.nil=Y1.stringify=Y1.str=Y1._=Y1.KeywordCxt=Y1.Ajv=void 0;var ax=ED(),sx=FO(),ex=NO(),jO=MO(),Qy=["/properties"],HW="http://json-schema.org/draft-07/schema";class fQ extends ax.default{_addVocabularies(){if(super._addVocabularies(),sx.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(ex.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(jO,Qy):jO;this.addMetaSchema(Q,HW,!1),this.refs["http://json-schema.org/schema"]=HW}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(HW)?HW:void 0)}}Y1.Ajv=fQ;BJ.exports=Y1=fQ;BJ.exports.Ajv=fQ;Object.defineProperty(Y1,"__esModule",{value:!0});Y1.default=fQ;var Xy=PQ();Object.defineProperty(Y1,"KeywordCxt",{enumerable:!0,get:function(){return Xy.KeywordCxt}});var X4=i();Object.defineProperty(Y1,"_",{enumerable:!0,get:function(){return X4._}});Object.defineProperty(Y1,"str",{enumerable:!0,get:function(){return X4.str}});Object.defineProperty(Y1,"stringify",{enumerable:!0,get:function(){return X4.stringify}});Object.defineProperty(Y1,"nil",{enumerable:!0,get:function(){return X4.nil}});Object.defineProperty(Y1,"Name",{enumerable:!0,get:function(){return X4.Name}});Object.defineProperty(Y1,"CodeGen",{enumerable:!0,get:function(){return X4.CodeGen}});var Wy=cX();Object.defineProperty(Y1,"ValidationError",{enumerable:!0,get:function(){return Wy.default}});var Yy=IQ();Object.defineProperty(Y1,"MissingRefError",{enumerable:!0,get:function(){return Yy.default}})});var EO=M((bO)=>{Object.defineProperty(bO,"__esModule",{value:!0});bO.formatLimitDefinition=void 0;var Gy=wO(),k1=i(),C6=k1.operators,BW={formatMaximum:{okStr:"<=",ok:C6.LTE,fail:C6.GT},formatMinimum:{okStr:">=",ok:C6.GTE,fail:C6.LT},formatExclusiveMaximum:{okStr:"<",ok:C6.LT,fail:C6.GTE},formatExclusiveMinimum:{okStr:">",ok:C6.GT,fail:C6.LTE}},Hy={message:({keyword:Q,schemaCode:X})=>k1.str`should be ${BW[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>k1._`{comparison: ${BW[Q].okStr}, limit: ${X}}`};bO.formatLimitDefinition={keyword:Object.keys(BW),type:"string",schemaType:"string",$data:!0,error:Hy,code(Q){let{gen:X,data:W,schemaCode:Y,keyword:$,it:J}=Q,{opts:G,self:H}=J;if(!G.validateFormats)return;let B=new Gy.KeywordCxt(J,H.RULES.all.format.definition,"format");if(B.$data)z();else K();function z(){let V=X.scopeValue("formats",{ref:H.formats,code:G.code.formats}),F=X.const("fmt",k1._`${V}[${B.schemaCode}]`);Q.fail$data((0,k1.or)(k1._`typeof ${F} != "object"`,k1._`${F} instanceof RegExp`,k1._`typeof ${F}.compare != "function"`,L(F)))}function K(){let V=B.schema,F=H.formats[V];if(!F||F===!0)return;if(typeof F!="object"||F instanceof RegExp||typeof F.compare!="function")throw Error(`"${$}": format "${V}" does not define "compare" function`);let D=X.scopeValue("formats",{key:V,ref:F,code:G.code.formats?k1._`${G.code.formats}${(0,k1.getProperty)(V)}`:void 0});Q.fail$data(L(D))}function L(V){return k1._`${V}.compare(${W}, ${Y}) ${BW[$].fail} 0`}},dependencies:["format"]};var By=(Q)=>{return Q.addKeyword(bO.formatLimitDefinition),Q};bO.default=By});var SO=M((gQ,ZO)=>{Object.defineProperty(gQ,"__esModule",{value:!0});var W4=MF(),Ky=EO(),KJ=i(),PO=new KJ.Name("fullFormats"),Ly=new KJ.Name("fastFormats"),LJ=(Q,X={keywords:!0})=>{if(Array.isArray(X))return IO(Q,X,W4.fullFormats,PO),Q;let[W,Y]=X.mode==="fast"?[W4.fastFormats,Ly]:[W4.fullFormats,PO],$=X.formats||W4.formatNames;if(IO(Q,$,W,Y),X.keywords)(0,Ky.default)(Q);return Q};LJ.get=(Q,X="full")=>{let Y=(X==="fast"?W4.fastFormats:W4.fullFormats)[Q];if(!Y)throw Error(`Unknown format "${Q}"`);return Y};function IO(Q,X,W,Y){var $,J;($=(J=Q.opts.code).formats)!==null&&$!==void 0||(J.formats=KJ._`require("ajv-formats/dist/formats").${Y}`);for(let G of X)Q.addFormat(G,W[G])}ZO.exports=gQ=LJ;Object.defineProperty(gQ,"__esModule",{value:!0});gQ.default=LJ});var e={};pQ(e,{void:()=>oU,util:()=>o,unknown:()=>dU,union:()=>aU,undefined:()=>cU,tuple:()=>Qq,transformer:()=>Kq,symbol:()=>mU,string:()=>aJ,strictObject:()=>tU,setErrorMap:()=>AU,set:()=>Yq,record:()=>Xq,quotelessJson:()=>LU,promise:()=>zq,preprocess:()=>Aq,pipeline:()=>Dq,ostring:()=>Vq,optional:()=>Lq,onumber:()=>Oq,oboolean:()=>Uq,objectUtil:()=>TW,object:()=>_W,number:()=>sJ,nullable:()=>Fq,null:()=>pU,never:()=>nU,nativeEnum:()=>Bq,nan:()=>hU,map:()=>Wq,makeIssue:()=>F4,literal:()=>Gq,lazy:()=>Jq,late:()=>fU,isValid:()=>G6,isDirty:()=>dQ,isAsync:()=>L9,isAborted:()=>iQ,intersection:()=>eU,instanceof:()=>gU,getParsedType:()=>_1,getErrorMap:()=>K9,function:()=>$q,enum:()=>Hq,effect:()=>Kq,discriminatedUnion:()=>sU,defaultErrorMap:()=>p1,datetimeRegex:()=>oJ,date:()=>lU,custom:()=>tJ,coerce:()=>qq,boolean:()=>eJ,bigint:()=>uU,array:()=>rU,any:()=>iU,addIssueToContext:()=>C,ZodVoid:()=>D4,ZodUnknown:()=>H6,ZodUnion:()=>U9,ZodUndefined:()=>V9,ZodType:()=>d,ZodTuple:()=>y1,ZodTransformer:()=>O1,ZodSymbol:()=>A4,ZodString:()=>A1,ZodSet:()=>h6,ZodSchema:()=>d,ZodRecord:()=>V4,ZodReadonly:()=>E9,ZodPromise:()=>u6,ZodPipeline:()=>q4,ZodParsedType:()=>I,ZodOptional:()=>$1,ZodObject:()=>M0,ZodNumber:()=>B6,ZodNullable:()=>d1,ZodNull:()=>O9,ZodNever:()=>x1,ZodNativeEnum:()=>j9,ZodNaN:()=>U4,ZodMap:()=>O4,ZodLiteral:()=>M9,ZodLazy:()=>N9,ZodIssueCode:()=>b,ZodIntersection:()=>q9,ZodFunction:()=>A9,ZodFirstPartyTypeKind:()=>E,ZodError:()=>i0,ZodEnum:()=>K6,ZodEffects:()=>O1,ZodDiscriminatedUnion:()=>nQ,ZodDefault:()=>w9,ZodDate:()=>f6,ZodCatch:()=>b9,ZodBranded:()=>oQ,ZodBoolean:()=>D9,ZodBigInt:()=>z6,ZodArray:()=>D1,ZodAny:()=>g6,Schema:()=>d,ParseStatus:()=>S0,OK:()=>y0,NEVER:()=>Nq,INVALID:()=>g,EMPTY_PATH:()=>DU,DIRTY:()=>y6,BRAND:()=>yU});var o;(function(Q){Q.assertEqual=($)=>{};function X($){}Q.assertIs=X;function W($){throw Error()}Q.assertNever=W,Q.arrayToEnum=($)=>{let J={};for(let G of $)J[G]=G;return J},Q.getValidEnumValues=($)=>{let J=Q.objectKeys($).filter((H)=>typeof $[$[H]]!=="number"),G={};for(let H of J)G[H]=$[H];return Q.objectValues(G)},Q.objectValues=($)=>{return Q.objectKeys($).map(function(J){return $[J]})},Q.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let J=[];for(let G in $)if(Object.prototype.hasOwnProperty.call($,G))J.push(G);return J},Q.find=($,J)=>{for(let G of $)if(J(G))return G;return},Q.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function Y($,J=" | "){return $.map((G)=>typeof G==="string"?`'${G}'`:G).join(J)}Q.joinValues=Y,Q.jsonStringifyReplacer=($,J)=>{if(typeof J==="bigint")return J.toString();return J}})(o||(o={}));var TW;(function(Q){Q.mergeShapes=(X,W)=>{return{...X,...W}}})(TW||(TW={}));var I=o.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_1=(Q)=>{switch(typeof Q){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(Q)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":if(Array.isArray(Q))return I.array;if(Q===null)return I.null;if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return I.promise;if(typeof Map<"u"&&Q instanceof Map)return I.map;if(typeof Set<"u"&&Q instanceof Set)return I.set;if(typeof Date<"u"&&Q instanceof Date)return I.date;return I.object;default:return I.unknown}};var b=o.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"]),LU=(Q)=>{return JSON.stringify(Q,null,2).replace(/"([^"]+)":/g,"$1:")};class i0 extends Error{get errors(){return this.issues}constructor(Q){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=Q}format(Q){let X=Q||function($){return $.message},W={_errors:[]},Y=($)=>{for(let J of $.issues)if(J.code==="invalid_union")J.unionErrors.map(Y);else if(J.code==="invalid_return_type")Y(J.returnTypeError);else if(J.code==="invalid_arguments")Y(J.argumentsError);else if(J.path.length===0)W._errors.push(X(J));else{let G=W,H=0;while(H<J.path.length){let B=J.path[H];if(H!==J.path.length-1)G[B]=G[B]||{_errors:[]};else G[B]=G[B]||{_errors:[]},G[B]._errors.push(X(J));G=G[B],H++}}};return Y(this),W}static assert(Q){if(!(Q instanceof i0))throw Error(`Not a ZodError: ${Q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,o.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(Q=(X)=>X.message){let X={},W=[];for(let Y of this.issues)if(Y.path.length>0){let $=Y.path[0];X[$]=X[$]||[],X[$].push(Q(Y))}else W.push(Q(Y));return{formErrors:W,fieldErrors:X}}get formErrors(){return this.flatten()}}i0.create=(Q)=>{return new i0(Q)};var FU=(Q,X)=>{let W;switch(Q.code){case b.invalid_type:if(Q.received===I.undefined)W="Required";else W=`Expected ${Q.expected}, received ${Q.received}`;break;case b.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(Q.expected,o.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:W=`Unrecognized key(s) in object: ${o.joinValues(Q.keys,", ")}`;break;case b.invalid_union:W="Invalid input";break;case b.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${o.joinValues(Q.options)}`;break;case b.invalid_enum_value:W=`Invalid enum value. Expected ${o.joinValues(Q.options)}, received '${Q.received}'`;break;case b.invalid_arguments:W="Invalid function arguments";break;case b.invalid_return_type:W="Invalid function return type";break;case b.invalid_date:W="Invalid date";break;case b.invalid_string:if(typeof Q.validation==="object")if("includes"in Q.validation){if(W=`Invalid input: must include "${Q.validation.includes}"`,typeof Q.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${Q.validation.position}`}else if("startsWith"in Q.validation)W=`Invalid input: must start with "${Q.validation.startsWith}"`;else if("endsWith"in Q.validation)W=`Invalid input: must end with "${Q.validation.endsWith}"`;else o.assertNever(Q.validation);else if(Q.validation!=="regex")W=`Invalid ${Q.validation}`;else W="Invalid";break;case b.too_small:if(Q.type==="array")W=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at least":"more than"} ${Q.minimum} element(s)`;else if(Q.type==="string")W=`String must contain ${Q.exact?"exactly":Q.inclusive?"at least":"over"} ${Q.minimum} character(s)`;else if(Q.type==="number")W=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="bigint")W=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="date")W=`Date must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(Q.minimum))}`;else W="Invalid input";break;case b.too_big:if(Q.type==="array")W=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at most":"less than"} ${Q.maximum} element(s)`;else if(Q.type==="string")W=`String must contain ${Q.exact?"exactly":Q.inclusive?"at most":"under"} ${Q.maximum} character(s)`;else if(Q.type==="number")W=`Number must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="bigint")W=`BigInt must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="date")W=`Date must be ${Q.exact?"exactly":Q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(Q.maximum))}`;else W="Invalid input";break;case b.custom:W="Invalid input";break;case b.invalid_intersection_types:W="Intersection results could not be merged";break;case b.not_multiple_of:W=`Number must be a multiple of ${Q.multipleOf}`;break;case b.not_finite:W="Number must be finite";break;default:W=X.defaultError,o.assertNever(Q)}return{message:W}},p1=FU;var cJ=p1;function AU(Q){cJ=Q}function K9(){return cJ}var F4=(Q)=>{let{data:X,path:W,errorMaps:Y,issueData:$}=Q,J=[...W,...$.path||[]],G={...$,path:J};if($.message!==void 0)return{...$,path:J,message:$.message};let H="",B=Y.filter((z)=>!!z).slice().reverse();for(let z of B)H=z(G,{data:X,defaultError:H}).message;return{...$,path:J,message:H}},DU=[];function C(Q,X){let W=K9(),Y=F4({issueData:X,data:Q.data,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,W,W===p1?void 0:p1].filter(($)=>!!$)});Q.common.issues.push(Y)}class S0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(Q,X){let W=[];for(let Y of X){if(Y.status==="aborted")return g;if(Y.status==="dirty")Q.dirty();W.push(Y.value)}return{status:Q.value,value:W}}static async mergeObjectAsync(Q,X){let W=[];for(let Y of X){let $=await Y.key,J=await Y.value;W.push({key:$,value:J})}return S0.mergeObjectSync(Q,W)}static mergeObjectSync(Q,X){let W={};for(let Y of X){let{key:$,value:J}=Y;if($.status==="aborted")return g;if(J.status==="aborted")return g;if($.status==="dirty")Q.dirty();if(J.status==="dirty")Q.dirty();if($.value!=="__proto__"&&(typeof J.value<"u"||Y.alwaysSet))W[$.value]=J.value}return{status:Q.value,value:W}}}var g=Object.freeze({status:"aborted"}),y6=(Q)=>({status:"dirty",value:Q}),y0=(Q)=>({status:"valid",value:Q}),iQ=(Q)=>Q.status==="aborted",dQ=(Q)=>Q.status==="dirty",G6=(Q)=>Q.status==="valid",L9=(Q)=>typeof Promise<"u"&&Q instanceof Promise;var v;(function(Q){Q.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},Q.toString=(X)=>typeof X==="string"?X:X?.message})(v||(v={}));class V1{constructor(Q,X,W,Y){this._cachedPath=[],this.parent=Q,this.data=X,this._path=W,this._key=Y}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var pJ=(Q,X)=>{if(G6(X))return{success:!0,data:X.value};else{if(!Q.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new i0(Q.common.issues);return this._error=W,this._error}}}};function m(Q){if(!Q)return{};let{errorMap:X,invalid_type_error:W,required_error:Y,description:$}=Q;if(X&&(W||Y))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:$};return{errorMap:(G,H)=>{let{message:B}=Q;if(G.code==="invalid_enum_value")return{message:B??H.defaultError};if(typeof H.data>"u")return{message:B??Y??H.defaultError};if(G.code!=="invalid_type")return{message:H.defaultError};return{message:B??W??H.defaultError}},description:$}}class d{get description(){return this._def.description}_getType(Q){return _1(Q.data)}_getOrReturnCtx(Q,X){return X||{common:Q.parent.common,data:Q.data,parsedType:_1(Q.data),schemaErrorMap:this._def.errorMap,path:Q.path,parent:Q.parent}}_processInputParams(Q){return{status:new S0,ctx:{common:Q.parent.common,data:Q.data,parsedType:_1(Q.data),schemaErrorMap:this._def.errorMap,path:Q.path,parent:Q.parent}}}_parseSync(Q){let X=this._parse(Q);if(L9(X))throw Error("Synchronous parse encountered promise.");return X}_parseAsync(Q){let X=this._parse(Q);return Promise.resolve(X)}parse(Q,X){let W=this.safeParse(Q,X);if(W.success)return W.data;throw W.error}safeParse(Q,X){let W={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:_1(Q)},Y=this._parseSync({data:Q,path:W.path,parent:W});return pJ(W,Y)}"~validate"(Q){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:_1(Q)};if(!this["~standard"].async)try{let W=this._parseSync({data:Q,path:[],parent:X});return G6(W)?{value:W.value}:{issues:X.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:Q,path:[],parent:X}).then((W)=>G6(W)?{value:W.value}:{issues:X.common.issues})}async parseAsync(Q,X){let W=await this.safeParseAsync(Q,X);if(W.success)return W.data;throw W.error}async safeParseAsync(Q,X){let W={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:_1(Q)},Y=this._parse({data:Q,path:W.path,parent:W}),$=await(L9(Y)?Y:Promise.resolve(Y));return pJ(W,$)}refine(Q,X){let W=(Y)=>{if(typeof X==="string"||typeof X>"u")return{message:X};else if(typeof X==="function")return X(Y);else return X};return this._refinement((Y,$)=>{let J=Q(Y),G=()=>$.addIssue({code:b.custom,...W(Y)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((H)=>{if(!H)return G(),!1;else return!0});if(!J)return G(),!1;else return!0})}refinement(Q,X){return this._refinement((W,Y)=>{if(!Q(W))return Y.addIssue(typeof X==="function"?X(W,Y):X),!1;else return!0})}_refinement(Q){return new O1({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:Q}})}superRefine(Q){return this._refinement(Q)}constructor(Q){this.spa=this.safeParseAsync,this._def=Q,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:(X)=>this["~validate"](X)}}optional(){return $1.create(this,this._def)}nullable(){return d1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D1.create(this)}promise(){return u6.create(this,this._def)}or(Q){return U9.create([this,Q],this._def)}and(Q){return q9.create(this,Q,this._def)}transform(Q){return new O1({...m(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:Q}})}default(Q){let X=typeof Q==="function"?Q:()=>Q;return new w9({...m(this._def),innerType:this,defaultValue:X,typeName:E.ZodDefault})}brand(){return new oQ({typeName:E.ZodBranded,type:this,...m(this._def)})}catch(Q){let X=typeof Q==="function"?Q:()=>Q;return new b9({...m(this._def),innerType:this,catchValue:X,typeName:E.ZodCatch})}describe(Q){return new this.constructor({...this._def,description:Q})}pipe(Q){return q4.create(this,Q)}readonly(){return E9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var VU=/^c[^\s-]{8,}$/i,OU=/^[0-9a-z]+$/,UU=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qU=/^[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,NU=/^[a-z0-9_-]{21}$/i,MU=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jU=/^[-+]?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)?)??$/,wU=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bU="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kW,EU=/^(?:(?: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])$/,PU=/^(?:(?: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])$/,IU=/^(([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]))$/,ZU=/^(([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])$/,SU=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,RU=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dJ="((\\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])))",CU=new RegExp(`^${dJ}$`);function nJ(Q){let X="[0-5]\\d";if(Q.precision)X=`${X}\\.\\d{${Q.precision}}`;else if(Q.precision==null)X=`${X}(\\.\\d+)?`;let W=Q.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${W}`}function TU(Q){return new RegExp(`^${nJ(Q)}$`)}function oJ(Q){let X=`${dJ}T${nJ(Q)}`,W=[];if(W.push(Q.local?"Z?":"Z"),Q.offset)W.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${W.join("|")})`,new RegExp(`^${X}$`)}function kU(Q,X){if((X==="v4"||!X)&&EU.test(Q))return!0;if((X==="v6"||!X)&&IU.test(Q))return!0;return!1}function vU(Q,X){if(!MU.test(Q))return!1;try{let[W]=Q.split(".");if(!W)return!1;let Y=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),$=JSON.parse(atob(Y));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(X&&$.alg!==X)return!1;return!0}catch{return!1}}function _U(Q,X){if((X==="v4"||!X)&&PU.test(Q))return!0;if((X==="v6"||!X)&&ZU.test(Q))return!0;return!1}class A1 extends d{_parse(Q){if(this._def.coerce)Q.data=String(Q.data);if(this._getType(Q)!==I.string){let $=this._getOrReturnCtx(Q);return C($,{code:b.invalid_type,expected:I.string,received:$.parsedType}),g}let W=new S0,Y=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.length<$.value)Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),W.dirty()}else if($.kind==="max"){if(Q.data.length>$.value)Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),W.dirty()}else if($.kind==="length"){let J=Q.data.length>$.value,G=Q.data.length<$.value;if(J||G){if(Y=this._getOrReturnCtx(Q,Y),J)C(Y,{code:b.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(G)C(Y,{code:b.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});W.dirty()}}else if($.kind==="email"){if(!wU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"email",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="emoji"){if(!kW)kW=new RegExp(bU,"u");if(!kW.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"emoji",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="uuid"){if(!qU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"uuid",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="nanoid"){if(!NU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"nanoid",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="cuid"){if(!VU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"cuid",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="cuid2"){if(!OU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"cuid2",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="ulid"){if(!UU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"ulid",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="url")try{new URL(Q.data)}catch{Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"url",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"regex",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="trim")Q.data=Q.data.trim();else if($.kind==="includes"){if(!Q.data.includes($.value,$.position))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),W.dirty()}else if($.kind==="toLowerCase")Q.data=Q.data.toLowerCase();else if($.kind==="toUpperCase")Q.data=Q.data.toUpperCase();else if($.kind==="startsWith"){if(!Q.data.startsWith($.value))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:{startsWith:$.value},message:$.message}),W.dirty()}else if($.kind==="endsWith"){if(!Q.data.endsWith($.value))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:{endsWith:$.value},message:$.message}),W.dirty()}else if($.kind==="datetime"){if(!oJ($).test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:"datetime",message:$.message}),W.dirty()}else if($.kind==="date"){if(!CU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:"date",message:$.message}),W.dirty()}else if($.kind==="time"){if(!TU($).test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.invalid_string,validation:"time",message:$.message}),W.dirty()}else if($.kind==="duration"){if(!jU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"duration",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="ip"){if(!kU(Q.data,$.version))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"ip",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="jwt"){if(!vU(Q.data,$.alg))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"jwt",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="cidr"){if(!_U(Q.data,$.version))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"cidr",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="base64"){if(!SU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"base64",code:b.invalid_string,message:$.message}),W.dirty()}else if($.kind==="base64url"){if(!RU.test(Q.data))Y=this._getOrReturnCtx(Q,Y),C(Y,{validation:"base64url",code:b.invalid_string,message:$.message}),W.dirty()}else o.assertNever($);return{status:W.value,value:Q.data}}_regex(Q,X,W){return this.refinement((Y)=>Q.test(Y),{validation:X,code:b.invalid_string,...v.errToObj(W)})}_addCheck(Q){return new A1({...this._def,checks:[...this._def.checks,Q]})}email(Q){return this._addCheck({kind:"email",...v.errToObj(Q)})}url(Q){return this._addCheck({kind:"url",...v.errToObj(Q)})}emoji(Q){return this._addCheck({kind:"emoji",...v.errToObj(Q)})}uuid(Q){return this._addCheck({kind:"uuid",...v.errToObj(Q)})}nanoid(Q){return this._addCheck({kind:"nanoid",...v.errToObj(Q)})}cuid(Q){return this._addCheck({kind:"cuid",...v.errToObj(Q)})}cuid2(Q){return this._addCheck({kind:"cuid2",...v.errToObj(Q)})}ulid(Q){return this._addCheck({kind:"ulid",...v.errToObj(Q)})}base64(Q){return this._addCheck({kind:"base64",...v.errToObj(Q)})}base64url(Q){return this._addCheck({kind:"base64url",...v.errToObj(Q)})}jwt(Q){return this._addCheck({kind:"jwt",...v.errToObj(Q)})}ip(Q){return this._addCheck({kind:"ip",...v.errToObj(Q)})}cidr(Q){return this._addCheck({kind:"cidr",...v.errToObj(Q)})}datetime(Q){if(typeof Q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:Q});return this._addCheck({kind:"datetime",precision:typeof Q?.precision>"u"?null:Q?.precision,offset:Q?.offset??!1,local:Q?.local??!1,...v.errToObj(Q?.message)})}date(Q){return this._addCheck({kind:"date",message:Q})}time(Q){if(typeof Q==="string")return this._addCheck({kind:"time",precision:null,message:Q});return this._addCheck({kind:"time",precision:typeof Q?.precision>"u"?null:Q?.precision,...v.errToObj(Q?.message)})}duration(Q){return this._addCheck({kind:"duration",...v.errToObj(Q)})}regex(Q,X){return this._addCheck({kind:"regex",regex:Q,...v.errToObj(X)})}includes(Q,X){return this._addCheck({kind:"includes",value:Q,position:X?.position,...v.errToObj(X?.message)})}startsWith(Q,X){return this._addCheck({kind:"startsWith",value:Q,...v.errToObj(X)})}endsWith(Q,X){return this._addCheck({kind:"endsWith",value:Q,...v.errToObj(X)})}min(Q,X){return this._addCheck({kind:"min",value:Q,...v.errToObj(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q,...v.errToObj(X)})}length(Q,X){return this._addCheck({kind:"length",value:Q,...v.errToObj(X)})}nonempty(Q){return this.min(1,v.errToObj(Q))}trim(){return new A1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new A1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new A1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((Q)=>Q.kind==="datetime")}get isDate(){return!!this._def.checks.find((Q)=>Q.kind==="date")}get isTime(){return!!this._def.checks.find((Q)=>Q.kind==="time")}get isDuration(){return!!this._def.checks.find((Q)=>Q.kind==="duration")}get isEmail(){return!!this._def.checks.find((Q)=>Q.kind==="email")}get isURL(){return!!this._def.checks.find((Q)=>Q.kind==="url")}get isEmoji(){return!!this._def.checks.find((Q)=>Q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((Q)=>Q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((Q)=>Q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((Q)=>Q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((Q)=>Q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((Q)=>Q.kind==="ulid")}get isIP(){return!!this._def.checks.find((Q)=>Q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((Q)=>Q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((Q)=>Q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((Q)=>Q.kind==="base64url")}get minLength(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxLength(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}}A1.create=(Q)=>{return new A1({checks:[],typeName:E.ZodString,coerce:Q?.coerce??!1,...m(Q)})};function xU(Q,X){let W=(Q.toString().split(".")[1]||"").length,Y=(X.toString().split(".")[1]||"").length,$=W>Y?W:Y,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}class B6 extends d{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(Q){if(this._def.coerce)Q.data=Number(Q.data);if(this._getType(Q)!==I.number){let $=this._getOrReturnCtx(Q);return C($,{code:b.invalid_type,expected:I.number,received:$.parsedType}),g}let W=void 0,Y=new S0;for(let $ of this._def.checks)if($.kind==="int"){if(!o.isInteger(Q.data))W=this._getOrReturnCtx(Q,W),C(W,{code:b.invalid_type,expected:"integer",received:"float",message:$.message}),Y.dirty()}else if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)W=this._getOrReturnCtx(Q,W),C(W,{code:b.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)W=this._getOrReturnCtx(Q,W),C(W,{code:b.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="multipleOf"){if(xU(Q.data,$.value)!==0)W=this._getOrReturnCtx(Q,W),C(W,{code:b.not_multiple_of,multipleOf:$.value,message:$.message}),Y.dirty()}else if($.kind==="finite"){if(!Number.isFinite(Q.data))W=this._getOrReturnCtx(Q,W),C(W,{code:b.not_finite,message:$.message}),Y.dirty()}else o.assertNever($);return{status:Y.value,value:Q.data}}gte(Q,X){return this.setLimit("min",Q,!0,v.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,v.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,v.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,v.toString(X))}setLimit(Q,X,W,Y){return new B6({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:W,message:v.toString(Y)}]})}_addCheck(Q){return new B6({...this._def,checks:[...this._def.checks,Q]})}int(Q){return this._addCheck({kind:"int",message:v.toString(Q)})}positive(Q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:v.toString(X)})}finite(Q){return this._addCheck({kind:"finite",message:v.toString(Q)})}safe(Q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(Q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(Q)})}get minValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}get isInt(){return!!this._def.checks.find((Q)=>Q.kind==="int"||Q.kind==="multipleOf"&&o.isInteger(Q.value))}get isFinite(){let Q=null,X=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(X===null||W.value>X)X=W.value}else if(W.kind==="max"){if(Q===null||W.value<Q)Q=W.value}return Number.isFinite(X)&&Number.isFinite(Q)}}B6.create=(Q)=>{return new B6({checks:[],typeName:E.ZodNumber,coerce:Q?.coerce||!1,...m(Q)})};class z6 extends d{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(Q){if(this._def.coerce)try{Q.data=BigInt(Q.data)}catch{return this._getInvalidInput(Q)}if(this._getType(Q)!==I.bigint)return this._getInvalidInput(Q);let W=void 0,Y=new S0;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)W=this._getOrReturnCtx(Q,W),C(W,{code:b.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),Y.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)W=this._getOrReturnCtx(Q,W),C(W,{code:b.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),Y.dirty()}else if($.kind==="multipleOf"){if(Q.data%$.value!==BigInt(0))W=this._getOrReturnCtx(Q,W),C(W,{code:b.not_multiple_of,multipleOf:$.value,message:$.message}),Y.dirty()}else o.assertNever($);return{status:Y.value,value:Q.data}}_getInvalidInput(Q){let X=this._getOrReturnCtx(Q);return C(X,{code:b.invalid_type,expected:I.bigint,received:X.parsedType}),g}gte(Q,X){return this.setLimit("min",Q,!0,v.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,v.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,v.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,v.toString(X))}setLimit(Q,X,W,Y){return new z6({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:W,message:v.toString(Y)}]})}_addCheck(Q){return new z6({...this._def,checks:[...this._def.checks,Q]})}positive(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:v.toString(X)})}get minValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}}z6.create=(Q)=>{return new z6({checks:[],typeName:E.ZodBigInt,coerce:Q?.coerce??!1,...m(Q)})};class D9 extends d{_parse(Q){if(this._def.coerce)Q.data=Boolean(Q.data);if(this._getType(Q)!==I.boolean){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.boolean,received:W.parsedType}),g}return y0(Q.data)}}D9.create=(Q)=>{return new D9({typeName:E.ZodBoolean,coerce:Q?.coerce||!1,...m(Q)})};class f6 extends d{_parse(Q){if(this._def.coerce)Q.data=new Date(Q.data);if(this._getType(Q)!==I.date){let $=this._getOrReturnCtx(Q);return C($,{code:b.invalid_type,expected:I.date,received:$.parsedType}),g}if(Number.isNaN(Q.data.getTime())){let $=this._getOrReturnCtx(Q);return C($,{code:b.invalid_date}),g}let W=new S0,Y=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.getTime()<$.value)Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),W.dirty()}else if($.kind==="max"){if(Q.data.getTime()>$.value)Y=this._getOrReturnCtx(Q,Y),C(Y,{code:b.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),W.dirty()}else o.assertNever($);return{status:W.value,value:new Date(Q.data.getTime())}}_addCheck(Q){return new f6({...this._def,checks:[...this._def.checks,Q]})}min(Q,X){return this._addCheck({kind:"min",value:Q.getTime(),message:v.toString(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q.getTime(),message:v.toString(X)})}get minDate(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q!=null?new Date(Q):null}get maxDate(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q!=null?new Date(Q):null}}f6.create=(Q)=>{return new f6({checks:[],coerce:Q?.coerce||!1,typeName:E.ZodDate,...m(Q)})};class A4 extends d{_parse(Q){if(this._getType(Q)!==I.symbol){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.symbol,received:W.parsedType}),g}return y0(Q.data)}}A4.create=(Q)=>{return new A4({typeName:E.ZodSymbol,...m(Q)})};class V9 extends d{_parse(Q){if(this._getType(Q)!==I.undefined){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.undefined,received:W.parsedType}),g}return y0(Q.data)}}V9.create=(Q)=>{return new V9({typeName:E.ZodUndefined,...m(Q)})};class O9 extends d{_parse(Q){if(this._getType(Q)!==I.null){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.null,received:W.parsedType}),g}return y0(Q.data)}}O9.create=(Q)=>{return new O9({typeName:E.ZodNull,...m(Q)})};class g6 extends d{constructor(){super(...arguments);this._any=!0}_parse(Q){return y0(Q.data)}}g6.create=(Q)=>{return new g6({typeName:E.ZodAny,...m(Q)})};class H6 extends d{constructor(){super(...arguments);this._unknown=!0}_parse(Q){return y0(Q.data)}}H6.create=(Q)=>{return new H6({typeName:E.ZodUnknown,...m(Q)})};class x1 extends d{_parse(Q){let X=this._getOrReturnCtx(Q);return C(X,{code:b.invalid_type,expected:I.never,received:X.parsedType}),g}}x1.create=(Q)=>{return new x1({typeName:E.ZodNever,...m(Q)})};class D4 extends d{_parse(Q){if(this._getType(Q)!==I.undefined){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.void,received:W.parsedType}),g}return y0(Q.data)}}D4.create=(Q)=>{return new D4({typeName:E.ZodVoid,...m(Q)})};class D1 extends d{_parse(Q){let{ctx:X,status:W}=this._processInputParams(Q),Y=this._def;if(X.parsedType!==I.array)return C(X,{code:b.invalid_type,expected:I.array,received:X.parsedType}),g;if(Y.exactLength!==null){let J=X.data.length>Y.exactLength.value,G=X.data.length<Y.exactLength.value;if(J||G)C(X,{code:J?b.too_big:b.too_small,minimum:G?Y.exactLength.value:void 0,maximum:J?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),W.dirty()}if(Y.minLength!==null){if(X.data.length<Y.minLength.value)C(X,{code:b.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),W.dirty()}if(Y.maxLength!==null){if(X.data.length>Y.maxLength.value)C(X,{code:b.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),W.dirty()}if(X.common.async)return Promise.all([...X.data].map((J,G)=>{return Y.type._parseAsync(new V1(X,J,X.path,G))})).then((J)=>{return S0.mergeArray(W,J)});let $=[...X.data].map((J,G)=>{return Y.type._parseSync(new V1(X,J,X.path,G))});return S0.mergeArray(W,$)}get element(){return this._def.type}min(Q,X){return new D1({...this._def,minLength:{value:Q,message:v.toString(X)}})}max(Q,X){return new D1({...this._def,maxLength:{value:Q,message:v.toString(X)}})}length(Q,X){return new D1({...this._def,exactLength:{value:Q,message:v.toString(X)}})}nonempty(Q){return this.min(1,Q)}}D1.create=(Q,X)=>{return new D1({type:Q,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...m(X)})};function F9(Q){if(Q instanceof M0){let X={};for(let W in Q.shape){let Y=Q.shape[W];X[W]=$1.create(F9(Y))}return new M0({...Q._def,shape:()=>X})}else if(Q instanceof D1)return new D1({...Q._def,type:F9(Q.element)});else if(Q instanceof $1)return $1.create(F9(Q.unwrap()));else if(Q instanceof d1)return d1.create(F9(Q.unwrap()));else if(Q instanceof y1)return y1.create(Q.items.map((X)=>F9(X)));else return Q}class M0 extends d{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let Q=this._def.shape(),X=o.objectKeys(Q);return this._cached={shape:Q,keys:X},this._cached}_parse(Q){if(this._getType(Q)!==I.object){let B=this._getOrReturnCtx(Q);return C(B,{code:b.invalid_type,expected:I.object,received:B.parsedType}),g}let{status:W,ctx:Y}=this._processInputParams(Q),{shape:$,keys:J}=this._getCached(),G=[];if(!(this._def.catchall instanceof x1&&this._def.unknownKeys==="strip")){for(let B in Y.data)if(!J.includes(B))G.push(B)}let H=[];for(let B of J){let z=$[B],K=Y.data[B];H.push({key:{status:"valid",value:B},value:z._parse(new V1(Y,K,Y.path,B)),alwaysSet:B in Y.data})}if(this._def.catchall instanceof x1){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of G)H.push({key:{status:"valid",value:z},value:{status:"valid",value:Y.data[z]}});else if(B==="strict"){if(G.length>0)C(Y,{code:b.unrecognized_keys,keys:G}),W.dirty()}else if(B==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of G){let K=Y.data[z];H.push({key:{status:"valid",value:z},value:B._parse(new V1(Y,K,Y.path,z)),alwaysSet:z in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of H){let K=await z.key,L=await z.value;B.push({key:K,value:L,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return S0.mergeObjectSync(W,B)});else return S0.mergeObjectSync(W,H)}get shape(){return this._def.shape()}strict(Q){return v.errToObj,new M0({...this._def,unknownKeys:"strict",...Q!==void 0?{errorMap:(X,W)=>{let Y=this._def.errorMap?.(X,W).message??W.defaultError;if(X.code==="unrecognized_keys")return{message:v.errToObj(Q).message??Y};return{message:Y}}}:{}})}strip(){return new M0({...this._def,unknownKeys:"strip"})}passthrough(){return new M0({...this._def,unknownKeys:"passthrough"})}extend(Q){return new M0({...this._def,shape:()=>({...this._def.shape(),...Q})})}merge(Q){return new M0({unknownKeys:Q._def.unknownKeys,catchall:Q._def.catchall,shape:()=>({...this._def.shape(),...Q._def.shape()}),typeName:E.ZodObject})}setKey(Q,X){return this.augment({[Q]:X})}catchall(Q){return new M0({...this._def,catchall:Q})}pick(Q){let X={};for(let W of o.objectKeys(Q))if(Q[W]&&this.shape[W])X[W]=this.shape[W];return new M0({...this._def,shape:()=>X})}omit(Q){let X={};for(let W of o.objectKeys(this.shape))if(!Q[W])X[W]=this.shape[W];return new M0({...this._def,shape:()=>X})}deepPartial(){return F9(this)}partial(Q){let X={};for(let W of o.objectKeys(this.shape)){let Y=this.shape[W];if(Q&&!Q[W])X[W]=Y;else X[W]=Y.optional()}return new M0({...this._def,shape:()=>X})}required(Q){let X={};for(let W of o.objectKeys(this.shape))if(Q&&!Q[W])X[W]=this.shape[W];else{let $=this.shape[W];while($ instanceof $1)$=$._def.innerType;X[W]=$}return new M0({...this._def,shape:()=>X})}keyof(){return rJ(o.objectKeys(this.shape))}}M0.create=(Q,X)=>{return new M0({shape:()=>Q,unknownKeys:"strip",catchall:x1.create(),typeName:E.ZodObject,...m(X)})};M0.strictCreate=(Q,X)=>{return new M0({shape:()=>Q,unknownKeys:"strict",catchall:x1.create(),typeName:E.ZodObject,...m(X)})};M0.lazycreate=(Q,X)=>{return new M0({shape:Q,unknownKeys:"strip",catchall:x1.create(),typeName:E.ZodObject,...m(X)})};class U9 extends d{_parse(Q){let{ctx:X}=this._processInputParams(Q),W=this._def.options;function Y($){for(let G of $)if(G.result.status==="valid")return G.result;for(let G of $)if(G.result.status==="dirty")return X.common.issues.push(...G.ctx.common.issues),G.result;let J=$.map((G)=>new i0(G.ctx.common.issues));return C(X,{code:b.invalid_union,unionErrors:J}),g}if(X.common.async)return Promise.all(W.map(async($)=>{let J={...X,common:{...X.common,issues:[]},parent:null};return{result:await $._parseAsync({data:X.data,path:X.path,parent:J}),ctx:J}})).then(Y);else{let $=void 0,J=[];for(let H of W){let B={...X,common:{...X.common,issues:[]},parent:null},z=H._parseSync({data:X.data,path:X.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!$)$={result:z,ctx:B};if(B.common.issues.length)J.push(B.common.issues)}if($)return X.common.issues.push(...$.ctx.common.issues),$.result;let G=J.map((H)=>new i0(H));return C(X,{code:b.invalid_union,unionErrors:G}),g}}get options(){return this._def.options}}U9.create=(Q,X)=>{return new U9({options:Q,typeName:E.ZodUnion,...m(X)})};var i1=(Q)=>{if(Q instanceof N9)return i1(Q.schema);else if(Q instanceof O1)return i1(Q.innerType());else if(Q instanceof M9)return[Q.value];else if(Q instanceof K6)return Q.options;else if(Q instanceof j9)return o.objectValues(Q.enum);else if(Q instanceof w9)return i1(Q._def.innerType);else if(Q instanceof V9)return[void 0];else if(Q instanceof O9)return[null];else if(Q instanceof $1)return[void 0,...i1(Q.unwrap())];else if(Q instanceof d1)return[null,...i1(Q.unwrap())];else if(Q instanceof oQ)return i1(Q.unwrap());else if(Q instanceof E9)return i1(Q.unwrap());else if(Q instanceof b9)return i1(Q._def.innerType);else return[]};class nQ extends d{_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==I.object)return C(X,{code:b.invalid_type,expected:I.object,received:X.parsedType}),g;let W=this.discriminator,Y=X.data[W],$=this.optionsMap.get(Y);if(!$)return C(X,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),g;if(X.common.async)return $._parseAsync({data:X.data,path:X.path,parent:X});else return $._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(Q,X,W){let Y=new Map;for(let $ of X){let J=i1($.shape[Q]);if(!J.length)throw Error(`A discriminator value for key \`${Q}\` could not be extracted from all schema options`);for(let G of J){if(Y.has(G))throw Error(`Discriminator property ${String(Q)} has duplicate value ${String(G)}`);Y.set(G,$)}}return new nQ({typeName:E.ZodDiscriminatedUnion,discriminator:Q,options:X,optionsMap:Y,...m(W)})}}function vW(Q,X){let W=_1(Q),Y=_1(X);if(Q===X)return{valid:!0,data:Q};else if(W===I.object&&Y===I.object){let $=o.objectKeys(X),J=o.objectKeys(Q).filter((H)=>$.indexOf(H)!==-1),G={...Q,...X};for(let H of J){let B=vW(Q[H],X[H]);if(!B.valid)return{valid:!1};G[H]=B.data}return{valid:!0,data:G}}else if(W===I.array&&Y===I.array){if(Q.length!==X.length)return{valid:!1};let $=[];for(let J=0;J<Q.length;J++){let G=Q[J],H=X[J],B=vW(G,H);if(!B.valid)return{valid:!1};$.push(B.data)}return{valid:!0,data:$}}else if(W===I.date&&Y===I.date&&+Q===+X)return{valid:!0,data:Q};else return{valid:!1}}class q9 extends d{_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q),Y=($,J)=>{if(iQ($)||iQ(J))return g;let G=vW($.value,J.value);if(!G.valid)return C(W,{code:b.invalid_intersection_types}),g;if(dQ($)||dQ(J))X.dirty();return{status:X.value,value:G.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([$,J])=>Y($,J));else return Y(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}q9.create=(Q,X,W)=>{return new q9({left:Q,right:X,typeName:E.ZodIntersection,...m(W)})};class y1 extends d{_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q);if(W.parsedType!==I.array)return C(W,{code:b.invalid_type,expected:I.array,received:W.parsedType}),g;if(W.data.length<this._def.items.length)return C(W,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;if(!this._def.rest&&W.data.length>this._def.items.length)C(W,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let $=[...W.data].map((J,G)=>{let H=this._def.items[G]||this._def.rest;if(!H)return null;return H._parse(new V1(W,J,W.path,G))}).filter((J)=>!!J);if(W.common.async)return Promise.all($).then((J)=>{return S0.mergeArray(X,J)});else return S0.mergeArray(X,$)}get items(){return this._def.items}rest(Q){return new y1({...this._def,rest:Q})}}y1.create=(Q,X)=>{if(!Array.isArray(Q))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new y1({items:Q,typeName:E.ZodTuple,rest:null,...m(X)})};class V4 extends d{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q);if(W.parsedType!==I.object)return C(W,{code:b.invalid_type,expected:I.object,received:W.parsedType}),g;let Y=[],$=this._def.keyType,J=this._def.valueType;for(let G in W.data)Y.push({key:$._parse(new V1(W,G,W.path,G)),value:J._parse(new V1(W,W.data[G],W.path,G)),alwaysSet:G in W.data});if(W.common.async)return S0.mergeObjectAsync(X,Y);else return S0.mergeObjectSync(X,Y)}get element(){return this._def.valueType}static create(Q,X,W){if(X instanceof d)return new V4({keyType:Q,valueType:X,typeName:E.ZodRecord,...m(W)});return new V4({keyType:A1.create(),valueType:Q,typeName:E.ZodRecord,...m(X)})}}class O4 extends d{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q);if(W.parsedType!==I.map)return C(W,{code:b.invalid_type,expected:I.map,received:W.parsedType}),g;let Y=this._def.keyType,$=this._def.valueType,J=[...W.data.entries()].map(([G,H],B)=>{return{key:Y._parse(new V1(W,G,W.path,[B,"key"])),value:$._parse(new V1(W,H,W.path,[B,"value"]))}});if(W.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let H of J){let B=await H.key,z=await H.value;if(B.status==="aborted"||z.status==="aborted")return g;if(B.status==="dirty"||z.status==="dirty")X.dirty();G.set(B.value,z.value)}return{status:X.value,value:G}})}else{let G=new Map;for(let H of J){let{key:B,value:z}=H;if(B.status==="aborted"||z.status==="aborted")return g;if(B.status==="dirty"||z.status==="dirty")X.dirty();G.set(B.value,z.value)}return{status:X.value,value:G}}}}O4.create=(Q,X,W)=>{return new O4({valueType:X,keyType:Q,typeName:E.ZodMap,...m(W)})};class h6 extends d{_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q);if(W.parsedType!==I.set)return C(W,{code:b.invalid_type,expected:I.set,received:W.parsedType}),g;let Y=this._def;if(Y.minSize!==null){if(W.data.size<Y.minSize.value)C(W,{code:b.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),X.dirty()}if(Y.maxSize!==null){if(W.data.size>Y.maxSize.value)C(W,{code:b.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),X.dirty()}let $=this._def.valueType;function J(H){let B=new Set;for(let z of H){if(z.status==="aborted")return g;if(z.status==="dirty")X.dirty();B.add(z.value)}return{status:X.value,value:B}}let G=[...W.data.values()].map((H,B)=>$._parse(new V1(W,H,W.path,B)));if(W.common.async)return Promise.all(G).then((H)=>J(H));else return J(G)}min(Q,X){return new h6({...this._def,minSize:{value:Q,message:v.toString(X)}})}max(Q,X){return new h6({...this._def,maxSize:{value:Q,message:v.toString(X)}})}size(Q,X){return this.min(Q,X).max(Q,X)}nonempty(Q){return this.min(1,Q)}}h6.create=(Q,X)=>{return new h6({valueType:Q,minSize:null,maxSize:null,typeName:E.ZodSet,...m(X)})};class A9 extends d{constructor(){super(...arguments);this.validate=this.implement}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==I.function)return C(X,{code:b.invalid_type,expected:I.function,received:X.parsedType}),g;function W(G,H){return F4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,K9(),p1].filter((B)=>!!B),issueData:{code:b.invalid_arguments,argumentsError:H}})}function Y(G,H){return F4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,K9(),p1].filter((B)=>!!B),issueData:{code:b.invalid_return_type,returnTypeError:H}})}let $={errorMap:X.common.contextualErrorMap},J=X.data;if(this._def.returns instanceof u6){let G=this;return y0(async function(...H){let B=new i0([]),z=await G._def.args.parseAsync(H,$).catch((V)=>{throw B.addIssue(W(H,V)),B}),K=await Reflect.apply(J,this,z);return await G._def.returns._def.type.parseAsync(K,$).catch((V)=>{throw B.addIssue(Y(K,V)),B})})}else{let G=this;return y0(function(...H){let B=G._def.args.safeParse(H,$);if(!B.success)throw new i0([W(H,B.error)]);let z=Reflect.apply(J,this,B.data),K=G._def.returns.safeParse(z,$);if(!K.success)throw new i0([Y(z,K.error)]);return K.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...Q){return new A9({...this._def,args:y1.create(Q).rest(H6.create())})}returns(Q){return new A9({...this._def,returns:Q})}implement(Q){return this.parse(Q)}strictImplement(Q){return this.parse(Q)}static create(Q,X,W){return new A9({args:Q?Q:y1.create([]).rest(H6.create()),returns:X||H6.create(),typeName:E.ZodFunction,...m(W)})}}class N9 extends d{get schema(){return this._def.getter()}_parse(Q){let{ctx:X}=this._processInputParams(Q);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}}N9.create=(Q,X)=>{return new N9({getter:Q,typeName:E.ZodLazy,...m(X)})};class M9 extends d{_parse(Q){if(Q.data!==this._def.value){let X=this._getOrReturnCtx(Q);return C(X,{received:X.data,code:b.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:Q.data}}get value(){return this._def.value}}M9.create=(Q,X)=>{return new M9({value:Q,typeName:E.ZodLiteral,...m(X)})};function rJ(Q,X){return new K6({values:Q,typeName:E.ZodEnum,...m(X)})}class K6 extends d{_parse(Q){if(typeof Q.data!=="string"){let X=this._getOrReturnCtx(Q),W=this._def.values;return C(X,{expected:o.joinValues(W),received:X.parsedType,code:b.invalid_type}),g}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(Q.data)){let X=this._getOrReturnCtx(Q),W=this._def.values;return C(X,{received:X.data,code:b.invalid_enum_value,options:W}),g}return y0(Q.data)}get options(){return this._def.values}get enum(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}get Values(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}get Enum(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}extract(Q,X=this._def){return K6.create(Q,{...this._def,...X})}exclude(Q,X=this._def){return K6.create(this.options.filter((W)=>!Q.includes(W)),{...this._def,...X})}}K6.create=rJ;class j9 extends d{_parse(Q){let X=o.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(Q);if(W.parsedType!==I.string&&W.parsedType!==I.number){let Y=o.objectValues(X);return C(W,{expected:o.joinValues(Y),received:W.parsedType,code:b.invalid_type}),g}if(!this._cache)this._cache=new Set(o.getValidEnumValues(this._def.values));if(!this._cache.has(Q.data)){let Y=o.objectValues(X);return C(W,{received:W.data,code:b.invalid_enum_value,options:Y}),g}return y0(Q.data)}get enum(){return this._def.values}}j9.create=(Q,X)=>{return new j9({values:Q,typeName:E.ZodNativeEnum,...m(X)})};class u6 extends d{unwrap(){return this._def.type}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==I.promise&&X.common.async===!1)return C(X,{code:b.invalid_type,expected:I.promise,received:X.parsedType}),g;let W=X.parsedType===I.promise?X.data:Promise.resolve(X.data);return y0(W.then((Y)=>{return this._def.type.parseAsync(Y,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}u6.create=(Q,X)=>{return new u6({type:Q,typeName:E.ZodPromise,...m(X)})};class O1 extends d{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q),Y=this._def.effect||null,$={addIssue:(J)=>{if(C(W,J),J.fatal)X.abort();else X.dirty()},get path(){return W.path}};if($.addIssue=$.addIssue.bind($),Y.type==="preprocess"){let J=Y.transform(W.data,$);if(W.common.async)return Promise.resolve(J).then(async(G)=>{if(X.value==="aborted")return g;let H=await this._def.schema._parseAsync({data:G,path:W.path,parent:W});if(H.status==="aborted")return g;if(H.status==="dirty")return y6(H.value);if(X.value==="dirty")return y6(H.value);return H});else{if(X.value==="aborted")return g;let G=this._def.schema._parseSync({data:J,path:W.path,parent:W});if(G.status==="aborted")return g;if(G.status==="dirty")return y6(G.value);if(X.value==="dirty")return y6(G.value);return G}}if(Y.type==="refinement"){let J=(G)=>{let H=Y.refinement(G,$);if(W.common.async)return Promise.resolve(H);if(H instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(W.common.async===!1){let G=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(G.status==="aborted")return g;if(G.status==="dirty")X.dirty();return J(G.value),{status:X.value,value:G.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((G)=>{if(G.status==="aborted")return g;if(G.status==="dirty")X.dirty();return J(G.value).then(()=>{return{status:X.value,value:G.value}})})}if(Y.type==="transform")if(W.common.async===!1){let J=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!G6(J))return g;let G=Y.transform(J.value,$);if(G instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:G}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((J)=>{if(!G6(J))return g;return Promise.resolve(Y.transform(J.value,$)).then((G)=>({status:X.value,value:G}))});o.assertNever(Y)}}O1.create=(Q,X,W)=>{return new O1({schema:Q,typeName:E.ZodEffects,effect:X,...m(W)})};O1.createWithPreprocess=(Q,X,W)=>{return new O1({schema:X,effect:{type:"preprocess",transform:Q},typeName:E.ZodEffects,...m(W)})};class $1 extends d{_parse(Q){if(this._getType(Q)===I.undefined)return y0(void 0);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}$1.create=(Q,X)=>{return new $1({innerType:Q,typeName:E.ZodOptional,...m(X)})};class d1 extends d{_parse(Q){if(this._getType(Q)===I.null)return y0(null);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}d1.create=(Q,X)=>{return new d1({innerType:Q,typeName:E.ZodNullable,...m(X)})};class w9 extends d{_parse(Q){let{ctx:X}=this._processInputParams(Q),W=X.data;if(X.parsedType===I.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}w9.create=(Q,X)=>{return new w9({innerType:Q,typeName:E.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...m(X)})};class b9 extends d{_parse(Q){let{ctx:X}=this._processInputParams(Q),W={...X,common:{...X.common,issues:[]}},Y=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(L9(Y))return Y.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new i0(W.common.issues)},input:W.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new i0(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}b9.create=(Q,X)=>{return new b9({innerType:Q,typeName:E.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...m(X)})};class U4 extends d{_parse(Q){if(this._getType(Q)!==I.nan){let W=this._getOrReturnCtx(Q);return C(W,{code:b.invalid_type,expected:I.nan,received:W.parsedType}),g}return{status:"valid",value:Q.data}}}U4.create=(Q)=>{return new U4({typeName:E.ZodNaN,...m(Q)})};var yU=Symbol("zod_brand");class oQ extends d{_parse(Q){let{ctx:X}=this._processInputParams(Q),W=X.data;return this._def.type._parse({data:W,path:X.path,parent:X})}unwrap(){return this._def.type}}class q4 extends d{_parse(Q){let{status:X,ctx:W}=this._processInputParams(Q);if(W.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if($.status==="aborted")return g;if($.status==="dirty")return X.dirty(),y6($.value);else return this._def.out._parseAsync({data:$.value,path:W.path,parent:W})})();else{let Y=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return g;if(Y.status==="dirty")return X.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:W.path,parent:W})}}static create(Q,X){return new q4({in:Q,out:X,typeName:E.ZodPipeline})}}class E9 extends d{_parse(Q){let X=this._def.innerType._parse(Q),W=(Y)=>{if(G6(Y))Y.value=Object.freeze(Y.value);return Y};return L9(X)?X.then((Y)=>W(Y)):W(X)}unwrap(){return this._def.innerType}}E9.create=(Q,X)=>{return new E9({innerType:Q,typeName:E.ZodReadonly,...m(X)})};function iJ(Q,X){let W=typeof Q==="function"?Q(X):typeof Q==="string"?{message:Q}:Q;return typeof W==="string"?{message:W}:W}function tJ(Q,X={},W){if(Q)return g6.create().superRefine((Y,$)=>{let J=Q(Y);if(J instanceof Promise)return J.then((G)=>{if(!G){let H=iJ(X,Y),B=H.fatal??W??!0;$.addIssue({code:"custom",...H,fatal:B})}});if(!J){let G=iJ(X,Y),H=G.fatal??W??!0;$.addIssue({code:"custom",...G,fatal:H})}return});return g6.create()}var fU={object:M0.lazycreate},E;(function(Q){Q.ZodString="ZodString",Q.ZodNumber="ZodNumber",Q.ZodNaN="ZodNaN",Q.ZodBigInt="ZodBigInt",Q.ZodBoolean="ZodBoolean",Q.ZodDate="ZodDate",Q.ZodSymbol="ZodSymbol",Q.ZodUndefined="ZodUndefined",Q.ZodNull="ZodNull",Q.ZodAny="ZodAny",Q.ZodUnknown="ZodUnknown",Q.ZodNever="ZodNever",Q.ZodVoid="ZodVoid",Q.ZodArray="ZodArray",Q.ZodObject="ZodObject",Q.ZodUnion="ZodUnion",Q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Q.ZodIntersection="ZodIntersection",Q.ZodTuple="ZodTuple",Q.ZodRecord="ZodRecord",Q.ZodMap="ZodMap",Q.ZodSet="ZodSet",Q.ZodFunction="ZodFunction",Q.ZodLazy="ZodLazy",Q.ZodLiteral="ZodLiteral",Q.ZodEnum="ZodEnum",Q.ZodEffects="ZodEffects",Q.ZodNativeEnum="ZodNativeEnum",Q.ZodOptional="ZodOptional",Q.ZodNullable="ZodNullable",Q.ZodDefault="ZodDefault",Q.ZodCatch="ZodCatch",Q.ZodPromise="ZodPromise",Q.ZodBranded="ZodBranded",Q.ZodPipeline="ZodPipeline",Q.ZodReadonly="ZodReadonly"})(E||(E={}));var gU=(Q,X={message:`Input not instance of ${Q.name}`})=>tJ((W)=>W instanceof Q,X),aJ=A1.create,sJ=B6.create,hU=U4.create,uU=z6.create,eJ=D9.create,lU=f6.create,mU=A4.create,cU=V9.create,pU=O9.create,iU=g6.create,dU=H6.create,nU=x1.create,oU=D4.create,rU=D1.create,_W=M0.create,tU=M0.strictCreate,aU=U9.create,sU=nQ.create,eU=q9.create,Qq=y1.create,Xq=V4.create,Wq=O4.create,Yq=h6.create,$q=A9.create,Jq=N9.create,Gq=M9.create,Hq=K6.create,Bq=j9.create,zq=u6.create,Kq=O1.create,Lq=$1.create,Fq=d1.create,Aq=O1.createWithPreprocess,Dq=q4.create,Vq=()=>aJ().optional(),Oq=()=>sJ().optional(),Uq=()=>eJ().optional(),qq={string:(Q)=>A1.create({...Q,coerce:!0}),number:(Q)=>B6.create({...Q,coerce:!0}),boolean:(Q)=>D9.create({...Q,coerce:!0}),bigint:(Q)=>z6.create({...Q,coerce:!0}),date:(Q)=>f6.create({...Q,coerce:!0})};var Nq=g;var tQ=Object.freeze({status:"aborted"});function N(Q,X,W){function Y(H,B){var z;Object.defineProperty(H,"_zod",{value:H._zod??{},enumerable:!1}),(z=H._zod).traits??(z.traits=new Set),H._zod.traits.add(Q),X(H,B);for(let K in G.prototype)if(!(K in H))Object.defineProperty(H,K,{value:G.prototype[K].bind(H)});H._zod.constr=G,H._zod.def=B}let $=W?.Parent??Object;class J extends ${}Object.defineProperty(J,"name",{value:Q});function G(H){var B;let z=W?.Parent?new J:this;Y(z,H),(B=z._zod).deferred??(B.deferred=[]);for(let K of z._zod.deferred)K();return z}return Object.defineProperty(G,"init",{value:Y}),Object.defineProperty(G,Symbol.hasInstance,{value:(H)=>{if(W?.Parent&&H instanceof W.Parent)return!0;return H?._zod?.traits?.has(Q)}}),Object.defineProperty(G,"name",{value:Q}),G}var QG=Symbol("zod_brand");class L6 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var rQ={};function d0(Q){if(Q)Object.assign(rQ,Q);return rQ}var r={};pQ(r,{unwrapMessage:()=>N4,stringifyPrimitive:()=>eQ,required:()=>yq,randomString:()=>Zq,propertyKeyTypes:()=>uW,promiseAllObject:()=>Iq,primitiveTypes:()=>XG,prefixIssues:()=>f1,pick:()=>Tq,partial:()=>xq,optionalKeys:()=>lW,omit:()=>kq,numKeys:()=>Sq,nullish:()=>w4,normalizeParams:()=>f,merge:()=>_q,jsonStringifyReplacer:()=>yW,joinValues:()=>aQ,issue:()=>cW,isPlainObject:()=>I9,isObject:()=>P9,getSizableOrigin:()=>YG,getParsedType:()=>Rq,getLengthableOrigin:()=>E4,getEnumValues:()=>M4,getElementAtPath:()=>Pq,floatSafeRemainder:()=>fW,finalizeIssue:()=>U1,extend:()=>vq,escapeRegex:()=>F6,esc:()=>l6,defineLazy:()=>K0,createTransparentProxy:()=>Cq,clone:()=>n0,cleanRegex:()=>b4,cleanEnum:()=>fq,captureStackTrace:()=>sQ,cached:()=>j4,assignProp:()=>gW,assertNotEqual:()=>jq,assertNever:()=>bq,assertIs:()=>wq,assertEqual:()=>Mq,assert:()=>Eq,allowsEval:()=>hW,aborted:()=>m6,NUMBER_FORMAT_RANGES:()=>mW,Class:()=>$G,BIGINT_FORMAT_RANGES:()=>WG});function Mq(Q){return Q}function jq(Q){return Q}function wq(Q){}function bq(Q){throw Error()}function Eq(Q){}function M4(Q){let X=Object.values(Q).filter((Y)=>typeof Y==="number");return Object.entries(Q).filter(([Y,$])=>X.indexOf(+Y)===-1).map(([Y,$])=>$)}function aQ(Q,X="|"){return Q.map((W)=>eQ(W)).join(X)}function yW(Q,X){if(typeof X==="bigint")return X.toString();return X}function j4(Q){return{get value(){{let W=Q();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function w4(Q){return Q===null||Q===void 0}function b4(Q){let X=Q.startsWith("^")?1:0,W=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,W)}function fW(Q,X){let W=(Q.toString().split(".")[1]||"").length,Y=(X.toString().split(".")[1]||"").length,$=W>Y?W:Y,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}function K0(Q,X,W){Object.defineProperty(Q,X,{get(){{let $=W();return Q[X]=$,$}throw Error("cached value already set")},set($){Object.defineProperty(Q,X,{value:$})},configurable:!0})}function gW(Q,X,W){Object.defineProperty(Q,X,{value:W,writable:!0,enumerable:!0,configurable:!0})}function Pq(Q,X){if(!X)return Q;return X.reduce((W,Y)=>W?.[Y],Q)}function Iq(Q){let X=Object.keys(Q),W=X.map((Y)=>Q[Y]);return Promise.all(W).then((Y)=>{let $={};for(let J=0;J<X.length;J++)$[X[J]]=Y[J];return $})}function Zq(Q=10){let W="";for(let Y=0;Y<Q;Y++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function l6(Q){return JSON.stringify(Q)}var sQ=Error.captureStackTrace?Error.captureStackTrace:(...Q)=>{};function P9(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var hW=j4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function I9(Q){if(P9(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let W=X.prototype;if(P9(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function Sq(Q){let X=0;for(let W in Q)if(Object.prototype.hasOwnProperty.call(Q,W))X++;return X}var Rq=(Q)=>{let X=typeof Q;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(Q)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return"promise";if(typeof Map<"u"&&Q instanceof Map)return"map";if(typeof Set<"u"&&Q instanceof Set)return"set";if(typeof Date<"u"&&Q instanceof Date)return"date";if(typeof File<"u"&&Q instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},uW=new Set(["string","number","symbol"]),XG=new Set(["string","number","bigint","boolean","symbol","undefined"]);function F6(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n0(Q,X,W){let Y=new Q._zod.constr(X??Q._zod.def);if(!X||W?.parent)Y._zod.parent=Q;return Y}function f(Q){let X=Q;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function Cq(Q){let X;return new Proxy({},{get(W,Y,$){return X??(X=Q()),Reflect.get(X,Y,$)},set(W,Y,$,J){return X??(X=Q()),Reflect.set(X,Y,$,J)},has(W,Y){return X??(X=Q()),Reflect.has(X,Y)},deleteProperty(W,Y){return X??(X=Q()),Reflect.deleteProperty(X,Y)},ownKeys(W){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(W,Y){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,Y)},defineProperty(W,Y,$){return X??(X=Q()),Reflect.defineProperty(X,Y,$)}})}function eQ(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function lW(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var mW={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},WG={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Tq(Q,X){let W={},Y=Q._zod.def;for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;W[$]=Y.shape[$]}return n0(Q,{...Q._zod.def,shape:W,checks:[]})}function kq(Q,X){let W={...Q._zod.def.shape},Y=Q._zod.def;for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;delete W[$]}return n0(Q,{...Q._zod.def,shape:W,checks:[]})}function vq(Q,X){if(!I9(X))throw Error("Invalid input to extend: expected a plain object");let W={...Q._zod.def,get shape(){let Y={...Q._zod.def.shape,...X};return gW(this,"shape",Y),Y},checks:[]};return n0(Q,W)}function _q(Q,X){return n0(Q,{...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return gW(this,"shape",W),W},catchall:X._zod.def.catchall,checks:[]})}function xq(Q,X,W){let Y=X._zod.def.shape,$={...Y};if(W)for(let J in W){if(!(J in Y))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;$[J]=Q?new Q({type:"optional",innerType:Y[J]}):Y[J]}else for(let J in Y)$[J]=Q?new Q({type:"optional",innerType:Y[J]}):Y[J];return n0(X,{...X._zod.def,shape:$,checks:[]})}function yq(Q,X,W){let Y=X._zod.def.shape,$={...Y};if(W)for(let J in W){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;$[J]=new Q({type:"nonoptional",innerType:Y[J]})}else for(let J in Y)$[J]=new Q({type:"nonoptional",innerType:Y[J]});return n0(X,{...X._zod.def,shape:$,checks:[]})}function m6(Q,X=0){for(let W=X;W<Q.issues.length;W++)if(Q.issues[W]?.continue!==!0)return!0;return!1}function f1(Q,X){return X.map((W)=>{var Y;return(Y=W).path??(Y.path=[]),W.path.unshift(Q),W})}function N4(Q){return typeof Q==="string"?Q:Q?.message}function U1(Q,X,W){let Y={...Q,path:Q.path??[]};if(!Q.message){let $=N4(Q.inst?._zod.def?.error?.(Q))??N4(X?.error?.(Q))??N4(W.customError?.(Q))??N4(W.localeError?.(Q))??"Invalid input";Y.message=$}if(delete Y.inst,delete Y.continue,!X?.reportInput)delete Y.input;return Y}function YG(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function E4(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function cW(...Q){let[X,W,Y]=Q;if(typeof X==="string")return{message:X,code:"custom",input:W,inst:Y};return{...X}}function fq(Q){return Object.entries(Q).filter(([X,W])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class $G{constructor(...Q){}}var JG=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Object.defineProperty(Q,"message",{get(){return JSON.stringify(X,yW,2)},enumerable:!0}),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},Q8=N("$ZodError",JG),P4=N("$ZodError",JG,{Parent:Error});function X8(Q,X=(W)=>W.message){let W={},Y=[];for(let $ of Q.issues)if($.path.length>0)W[$.path[0]]=W[$.path[0]]||[],W[$.path[0]].push(X($));else Y.push(X($));return{formErrors:Y,fieldErrors:W}}function W8(Q,X){let W=X||function(J){return J.message},Y={_errors:[]},$=(J)=>{for(let G of J.issues)if(G.code==="invalid_union"&&G.errors.length)G.errors.map((H)=>$({issues:H}));else if(G.code==="invalid_key")$({issues:G.issues});else if(G.code==="invalid_element")$({issues:G.issues});else if(G.path.length===0)Y._errors.push(W(G));else{let H=Y,B=0;while(B<G.path.length){let z=G.path[B];if(B!==G.path.length-1)H[z]=H[z]||{_errors:[]};else H[z]=H[z]||{_errors:[]},H[z]._errors.push(W(G));H=H[z],B++}}};return $(Q),Y}var pW=(Q)=>(X,W,Y,$)=>{let J=Y?Object.assign(Y,{async:!1}):{async:!1},G=X._zod.run({value:W,issues:[]},J);if(G instanceof Promise)throw new L6;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>U1(B,J,d0())));throw sQ(H,$?.callee),H}return G.value},iW=pW(P4),dW=(Q)=>async(X,W,Y,$)=>{let J=Y?Object.assign(Y,{async:!0}):{async:!0},G=X._zod.run({value:W,issues:[]},J);if(G instanceof Promise)G=await G;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>U1(B,J,d0())));throw sQ(H,$?.callee),H}return G.value},nW=dW(P4),oW=(Q)=>(X,W,Y)=>{let $=Y?{...Y,async:!1}:{async:!1},J=X._zod.run({value:W,issues:[]},$);if(J instanceof Promise)throw new L6;return J.issues.length?{success:!1,error:new(Q??Q8)(J.issues.map((G)=>U1(G,$,d0())))}:{success:!0,data:J.value}},c6=oW(P4),rW=(Q)=>async(X,W,Y)=>{let $=Y?Object.assign(Y,{async:!0}):{async:!0},J=X._zod.run({value:W,issues:[]},$);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map((G)=>U1(G,$,d0())))}:{success:!0,data:J.value}},p6=rW(P4);var GG=/^[cC][^\s-]{8,}$/,HG=/^[0-9a-z]+$/,BG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,zG=/^[0-9a-vA-V]{20}$/,KG=/^[A-Za-z0-9]{27}$/,LG=/^[a-zA-Z0-9_-]{21}$/,FG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var AG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tW=(Q)=>{if(!Q)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${Q}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var DG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function VG(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var OG=/^(?:(?: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])$/,UG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,qG=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,NG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,MG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,aW=/^[A-Za-z0-9_-]*$/,jG=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var wG=/^\+(?:[0-9]){6,14}[0-9]$/,bG="(?:(?:\\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])))",EG=new RegExp(`^${bG}$`);function PG(Q){return typeof Q.precision==="number"?Q.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":Q.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${Q.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function IG(Q){return new RegExp(`^${PG(Q)}$`)}function ZG(Q){let X=PG({precision:Q.precision}),W=["Z"];if(Q.local)W.push("");if(Q.offset)W.push("([+-]\\d{2}:\\d{2})");let Y=`${X}(?:${W.join("|")})`;return new RegExp(`^${bG}T(?:${Y})$`)}var SG=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},RG=/^\d+n?$/,CG=/^\d+$/,TG=/^-?\d+(?:\.\d+)?/i,kG=/true|false/i,vG=/null/i;var _G=/^[^A-Z]*$/,xG=/^[^a-z]*$/;var R0=N("$ZodCheck",(Q,X)=>{var W;Q._zod??(Q._zod={}),Q._zod.def=X,(W=Q._zod).onattach??(W.onattach=[])}),yG={number:"number",bigint:"bigint",object:"date"},sW=N("$ZodCheckLessThan",(Q,X)=>{R0.init(Q,X);let W=yG[typeof X.value];Q._zod.onattach.push((Y)=>{let $=Y._zod.bag,J=(X.inclusive?$.maximum:$.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)$.maximum=X.value;else $.exclusiveMaximum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value<=X.value:Y.value<X.value)return;Y.issues.push({origin:W,code:"too_big",maximum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),eW=N("$ZodCheckGreaterThan",(Q,X)=>{R0.init(Q,X);let W=yG[typeof X.value];Q._zod.onattach.push((Y)=>{let $=Y._zod.bag,J=(X.inclusive?$.minimum:$.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)$.minimum=X.value;else $.exclusiveMinimum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value>=X.value:Y.value>X.value)return;Y.issues.push({origin:W,code:"too_small",minimum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),fG=N("$ZodCheckMultipleOf",(Q,X)=>{R0.init(Q,X),Q._zod.onattach.push((W)=>{var Y;(Y=W._zod.bag).multipleOf??(Y.multipleOf=X.value)}),Q._zod.check=(W)=>{if(typeof W.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%X.value===BigInt(0):fW(W.value,X.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:X.value,input:W.value,inst:Q,continue:!X.abort})}}),gG=N("$ZodCheckNumberFormat",(Q,X)=>{R0.init(Q,X),X.format=X.format||"float64";let W=X.format?.includes("int"),Y=W?"int":"number",[$,J]=mW[X.format];Q._zod.onattach.push((G)=>{let H=G._zod.bag;if(H.format=X.format,H.minimum=$,H.maximum=J,W)H.pattern=CG}),Q._zod.check=(G)=>{let H=G.value;if(W){if(!Number.isInteger(H)){G.issues.push({expected:Y,format:X.format,code:"invalid_type",input:H,inst:Q});return}if(!Number.isSafeInteger(H)){if(H>0)G.issues.push({input:H,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});else G.issues.push({input:H,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});return}}if(H<$)G.issues.push({origin:"number",input:H,code:"too_small",minimum:$,inclusive:!0,inst:Q,continue:!X.abort});if(H>J)G.issues.push({origin:"number",input:H,code:"too_big",maximum:J,inst:Q})}});var hG=N("$ZodCheckMaxLength",(Q,X)=>{var W;R0.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let $=Y.value;return!w4($)&&$.length!==void 0}),Q._zod.onattach.push((Y)=>{let $=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<$)Y._zod.bag.maximum=X.maximum}),Q._zod.check=(Y)=>{let $=Y.value;if($.length<=X.maximum)return;let G=E4($);Y.issues.push({origin:G,code:"too_big",maximum:X.maximum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),uG=N("$ZodCheckMinLength",(Q,X)=>{var W;R0.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let $=Y.value;return!w4($)&&$.length!==void 0}),Q._zod.onattach.push((Y)=>{let $=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>$)Y._zod.bag.minimum=X.minimum}),Q._zod.check=(Y)=>{let $=Y.value;if($.length>=X.minimum)return;let G=E4($);Y.issues.push({origin:G,code:"too_small",minimum:X.minimum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),lG=N("$ZodCheckLengthEquals",(Q,X)=>{var W;R0.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let $=Y.value;return!w4($)&&$.length!==void 0}),Q._zod.onattach.push((Y)=>{let $=Y._zod.bag;$.minimum=X.length,$.maximum=X.length,$.length=X.length}),Q._zod.check=(Y)=>{let $=Y.value,J=$.length;if(J===X.length)return;let G=E4($),H=J>X.length;Y.issues.push({origin:G,...H?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Y.value,inst:Q,continue:!X.abort})}}),Z4=N("$ZodCheckStringFormat",(Q,X)=>{var W,Y;if(R0.init(Q,X),Q._zod.onattach.push(($)=>{let J=$._zod.bag;if(J.format=X.format,X.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(X.pattern)}),X.pattern)(W=Q._zod).check??(W.check=($)=>{if(X.pattern.lastIndex=0,X.pattern.test($.value))return;$.issues.push({origin:"string",code:"invalid_format",format:X.format,input:$.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(Y=Q._zod).check??(Y.check=()=>{})}),mG=N("$ZodCheckRegex",(Q,X)=>{Z4.init(Q,X),Q._zod.check=(W)=>{if(X.pattern.lastIndex=0,X.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:X.pattern.toString(),inst:Q,continue:!X.abort})}}),cG=N("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=_G),Z4.init(Q,X)}),pG=N("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=xG),Z4.init(Q,X)}),iG=N("$ZodCheckIncludes",(Q,X)=>{R0.init(Q,X);let W=F6(X.includes),Y=new RegExp(typeof X.position==="number"?`^.{${X.position}}${W}`:W);X.pattern=Y,Q._zod.onattach.push(($)=>{let J=$._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),Q._zod.check=($)=>{if($.value.includes(X.includes,X.position))return;$.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:$.value,inst:Q,continue:!X.abort})}}),dG=N("$ZodCheckStartsWith",(Q,X)=>{R0.init(Q,X);let W=new RegExp(`^${F6(X.prefix)}.*`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let $=Y._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.startsWith(X.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Y.value,inst:Q,continue:!X.abort})}}),nG=N("$ZodCheckEndsWith",(Q,X)=>{R0.init(Q,X);let W=new RegExp(`.*${F6(X.suffix)}$`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let $=Y._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.endsWith(X.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Y.value,inst:Q,continue:!X.abort})}});var oG=N("$ZodCheckOverwrite",(Q,X)=>{R0.init(Q,X),Q._zod.check=(W)=>{W.value=X.tx(W.value)}});class QY{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let W=Q.split(`
17
- `).filter((J)=>J),Y=Math.min(...W.map((J)=>J.length-J.trimStart().length)),$=W.map((J)=>J.slice(Y)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of $)this.content.push(J)}compile(){let Q=Function,X=this?.args,Y=[...(this?.content??[""]).map(($)=>` ${$}`)];return new Q(...X,Y.join(`
18
- `))}}var tG={major:4,minor:0,patch:0};var J0=N("$ZodType",(Q,X)=>{var W;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=tG;let Y=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))Y.unshift(Q);for(let $ of Y)for(let J of $._zod.onattach)J(Q);if(Y.length===0)(W=Q._zod).deferred??(W.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let $=(J,G,H)=>{let B=m6(J),z;for(let K of G){if(K._zod.def.when){if(!K._zod.def.when(J))continue}else if(B)continue;let L=J.issues.length,V=K._zod.check(J);if(V instanceof Promise&&H?.async===!1)throw new L6;if(z||V instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await V,J.issues.length===L)return;if(!B)B=m6(J,L)});else{if(J.issues.length===L)continue;if(!B)B=m6(J,L)}}if(z)return z.then(()=>{return J});return J};Q._zod.run=(J,G)=>{let H=Q._zod.parse(J,G);if(H instanceof Promise){if(G.async===!1)throw new L6;return H.then((B)=>$(B,Y,G))}return $(H,Y,G)}}Q["~standard"]={validate:($)=>{try{let J=c6(Q,$);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return p6(Q,$).then((G)=>G.success?{value:G.data}:{issues:G.error?.issues})}},vendor:"zod",version:1}}),S4=N("$ZodString",(Q,X)=>{J0.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??SG(Q._zod.bag),Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=String(W.value)}catch($){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:Q}),W}}),L0=N("$ZodStringFormat",(Q,X)=>{Z4.init(Q,X),S4.init(Q,X)}),WY=N("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=AG),L0.init(Q,X)}),YY=N("$ZodUUID",(Q,X)=>{if(X.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Y===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=tW(Y))}else X.pattern??(X.pattern=tW());L0.init(Q,X)}),$Y=N("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=DG),L0.init(Q,X)}),JY=N("$ZodURL",(Q,X)=>{L0.init(Q,X),Q._zod.check=(W)=>{try{let Y=W.value,$=new URL(Y),J=$.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test($.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:jG.source,input:W.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test($.protocol.endsWith(":")?$.protocol.slice(0,-1):$.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:W.value,inst:Q,continue:!X.abort})}if(!Y.endsWith("/")&&J.endsWith("/"))W.value=J.slice(0,-1);else W.value=J;return}catch(Y){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:Q,continue:!X.abort})}}}),GY=N("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=VG()),L0.init(Q,X)}),HY=N("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=LG),L0.init(Q,X)}),BY=N("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=GG),L0.init(Q,X)}),zY=N("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=HG),L0.init(Q,X)}),KY=N("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=BG),L0.init(Q,X)}),LY=N("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=zG),L0.init(Q,X)}),FY=N("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=KG),L0.init(Q,X)}),GH=N("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=ZG(X)),L0.init(Q,X)}),HH=N("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=EG),L0.init(Q,X)}),BH=N("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=IG(X)),L0.init(Q,X)}),zH=N("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=FG),L0.init(Q,X)}),AY=N("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=OG),L0.init(Q,X),Q._zod.onattach.push((W)=>{let Y=W._zod.bag;Y.format="ipv4"})}),DY=N("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=UG),L0.init(Q,X),Q._zod.onattach.push((W)=>{let Y=W._zod.bag;Y.format="ipv6"}),Q._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:Q,continue:!X.abort})}}}),VY=N("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=qG),L0.init(Q,X)}),OY=N("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=NG),L0.init(Q,X),Q._zod.check=(W)=>{let[Y,$]=W.value.split("/");try{if(!$)throw Error();let J=Number($);if(`${J}`!==$)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${Y}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:Q,continue:!X.abort})}}});function KH(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var UY=N("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=MG),L0.init(Q,X),Q._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64"}),Q._zod.check=(W)=>{if(KH(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:Q,continue:!X.abort})}});function hq(Q){if(!aW.test(Q))return!1;let X=Q.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),W=X.padEnd(Math.ceil(X.length/4)*4,"=");return KH(W)}var qY=N("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=aW),L0.init(Q,X),Q._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64url"}),Q._zod.check=(W)=>{if(hq(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:Q,continue:!X.abort})}}),NY=N("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=wG),L0.init(Q,X)});function uq(Q,X=null){try{let W=Q.split(".");if(W.length!==3)return!1;let[Y]=W;if(!Y)return!1;let $=JSON.parse(atob(Y));if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(X&&(!("alg"in $)||$.alg!==X))return!1;return!0}catch{return!1}}var MY=N("$ZodJWT",(Q,X)=>{L0.init(Q,X),Q._zod.check=(W)=>{if(uq(W.value,X.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:Q,continue:!X.abort})}});var $8=N("$ZodNumber",(Q,X)=>{J0.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??TG,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Number(W.value)}catch(G){}let $=W.value;if(typeof $==="number"&&!Number.isNaN($)&&Number.isFinite($))return W;let J=typeof $==="number"?Number.isNaN($)?"NaN":!Number.isFinite($)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:$,inst:Q,...J?{received:J}:{}}),W}}),jY=N("$ZodNumber",(Q,X)=>{gG.init(Q,X),$8.init(Q,X)}),wY=N("$ZodBoolean",(Q,X)=>{J0.init(Q,X),Q._zod.pattern=kG,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Boolean(W.value)}catch(J){}let $=W.value;if(typeof $==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:$,inst:Q}),W}}),bY=N("$ZodBigInt",(Q,X)=>{J0.init(Q,X),Q._zod.pattern=RG,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=BigInt(W.value)}catch($){}if(typeof W.value==="bigint")return W;return W.issues.push({expected:"bigint",code:"invalid_type",input:W.value,inst:Q}),W}});var EY=N("$ZodNull",(Q,X)=>{J0.init(Q,X),Q._zod.pattern=vG,Q._zod.values=new Set([null]),Q._zod.parse=(W,Y)=>{let $=W.value;if($===null)return W;return W.issues.push({expected:"null",code:"invalid_type",input:$,inst:Q}),W}}),PY=N("$ZodAny",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W)=>W}),IY=N("$ZodUnknown",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W)=>W}),ZY=N("$ZodNever",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:Q}),W}});var SY=N("$ZodDate",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=new Date(W.value)}catch(H){}let $=W.value,J=$ instanceof Date;if(J&&!Number.isNaN($.getTime()))return W;return W.issues.push({expected:"date",code:"invalid_type",input:$,...J?{received:"Invalid Date"}:{},inst:Q}),W}});function aG(Q,X,W){if(Q.issues.length)X.issues.push(...f1(W,Q.issues));X.value[W]=Q.value}var RY=N("$ZodArray",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{let $=W.value;if(!Array.isArray($))return W.issues.push({expected:"array",code:"invalid_type",input:$,inst:Q}),W;W.value=Array($.length);let J=[];for(let G=0;G<$.length;G++){let H=$[G],B=X.element._zod.run({value:H,issues:[]},Y);if(B instanceof Promise)J.push(B.then((z)=>aG(z,W,G)));else aG(B,W,G)}if(J.length)return Promise.all(J).then(()=>W);return W}});function Y8(Q,X,W){if(Q.issues.length)X.issues.push(...f1(W,Q.issues));X.value[W]=Q.value}function sG(Q,X,W,Y){if(Q.issues.length)if(Y[W]===void 0)if(W in Y)X.value[W]=void 0;else X.value[W]=Q.value;else X.issues.push(...f1(W,Q.issues));else if(Q.value===void 0){if(W in Y)X.value[W]=void 0}else X.value[W]=Q.value}var J8=N("$ZodObject",(Q,X)=>{J0.init(Q,X);let W=j4(()=>{let L=Object.keys(X.shape);for(let F of L)if(!(X.shape[F]instanceof J0))throw Error(`Invalid element at key "${F}": expected a Zod schema`);let V=lW(X.shape);return{shape:X.shape,keys:L,keySet:new Set(L),numKeys:L.length,optionalKeys:new Set(V)}});K0(Q._zod,"propValues",()=>{let L=X.shape,V={};for(let F in L){let D=L[F]._zod;if(D.values){V[F]??(V[F]=new Set);for(let A of D.values)V[F].add(A)}}return V});let Y=(L)=>{let V=new QY(["shape","payload","ctx"]),F=W.value,D=(j)=>{let w=l6(j);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};V.write("const input = payload.value;");let A=Object.create(null),O=0;for(let j of F.keys)A[j]=`key_${O++}`;V.write("const newResult = {}");for(let j of F.keys)if(F.optionalKeys.has(j)){let w=A[j];V.write(`const ${w} = ${D(j)};`);let T=l6(j);V.write(`
19
- if (${w}.issues.length) {
20
- if (input[${T}] === undefined) {
21
- if (${T} in input) {
22
- newResult[${T}] = undefined;
23
- }
24
- } else {
25
- payload.issues = payload.issues.concat(
26
- ${w}.issues.map((iss) => ({
27
- ...iss,
28
- path: iss.path ? [${T}, ...iss.path] : [${T}],
29
- }))
30
- );
31
- }
32
- } else if (${w}.value === undefined) {
33
- if (${T} in input) newResult[${T}] = undefined;
34
- } else {
35
- newResult[${T}] = ${w}.value;
36
- }
37
- `)}else{let w=A[j];V.write(`const ${w} = ${D(j)};`),V.write(`
38
- if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
39
- ...iss,
40
- path: iss.path ? [${l6(j)}, ...iss.path] : [${l6(j)}]
41
- })));`),V.write(`newResult[${l6(j)}] = ${w}.value`)}V.write("payload.value = newResult;"),V.write("return payload;");let U=V.compile();return(j,w)=>U(L,j,w)},$,J=P9,G=!rQ.jitless,B=G&&hW.value,z=X.catchall,K;Q._zod.parse=(L,V)=>{K??(K=W.value);let F=L.value;if(!J(F))return L.issues.push({expected:"object",code:"invalid_type",input:F,inst:Q}),L;let D=[];if(G&&B&&V?.async===!1&&V.jitless!==!0){if(!$)$=Y(X.shape);L=$(L,V)}else{L.value={};let w=K.shape;for(let T of K.keys){let P=w[T],z0=P._zod.run({value:F[T],issues:[]},V),w0=P._zod.optin==="optional"&&P._zod.optout==="optional";if(z0 instanceof Promise)D.push(z0.then((v1)=>w0?sG(v1,L,T,F):Y8(v1,L,T)));else if(w0)sG(z0,L,T,F);else Y8(z0,L,T)}}if(!z)return D.length?Promise.all(D).then(()=>L):L;let A=[],O=K.keySet,U=z._zod,j=U.def.type;for(let w of Object.keys(F)){if(O.has(w))continue;if(j==="never"){A.push(w);continue}let T=U.run({value:F[w],issues:[]},V);if(T instanceof Promise)D.push(T.then((P)=>Y8(P,L,w)));else Y8(T,L,w)}if(A.length)L.issues.push({code:"unrecognized_keys",keys:A,input:F,inst:Q});if(!D.length)return L;return Promise.all(D).then(()=>{return L})}});function eG(Q,X,W,Y){for(let $ of Q)if($.issues.length===0)return X.value=$.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:W,errors:Q.map(($)=>$.issues.map((J)=>U1(J,Y,d0())))}),X}var G8=N("$ZodUnion",(Q,X)=>{J0.init(Q,X),K0(Q._zod,"optin",()=>X.options.some((W)=>W._zod.optin==="optional")?"optional":void 0),K0(Q._zod,"optout",()=>X.options.some((W)=>W._zod.optout==="optional")?"optional":void 0),K0(Q._zod,"values",()=>{if(X.options.every((W)=>W._zod.values))return new Set(X.options.flatMap((W)=>Array.from(W._zod.values)));return}),K0(Q._zod,"pattern",()=>{if(X.options.every((W)=>W._zod.pattern)){let W=X.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${W.map((Y)=>b4(Y.source)).join("|")})$`)}return}),Q._zod.parse=(W,Y)=>{let $=!1,J=[];for(let G of X.options){let H=G._zod.run({value:W.value,issues:[]},Y);if(H instanceof Promise)J.push(H),$=!0;else{if(H.issues.length===0)return H;J.push(H)}}if(!$)return eG(J,W,Q,Y);return Promise.all(J).then((G)=>{return eG(G,W,Q,Y)})}}),CY=N("$ZodDiscriminatedUnion",(Q,X)=>{G8.init(Q,X);let W=Q._zod.parse;K0(Q._zod,"propValues",()=>{let $={};for(let J of X.options){let G=J._zod.propValues;if(!G||Object.keys(G).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[H,B]of Object.entries(G)){if(!$[H])$[H]=new Set;for(let z of B)$[H].add(z)}}return $});let Y=j4(()=>{let $=X.options,J=new Map;for(let G of $){let H=G._zod.propValues[X.discriminator];if(!H||H.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(G)}"`);for(let B of H){if(J.has(B))throw Error(`Duplicate discriminator value "${String(B)}"`);J.set(B,G)}}return J});Q._zod.parse=($,J)=>{let G=$.value;if(!P9(G))return $.issues.push({code:"invalid_type",expected:"object",input:G,inst:Q}),$;let H=Y.value.get(G?.[X.discriminator]);if(H)return H._zod.run($,J);if(X.unionFallback)return W($,J);return $.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:G,path:[X.discriminator],inst:Q}),$}}),TY=N("$ZodIntersection",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{let $=W.value,J=X.left._zod.run({value:$,issues:[]},Y),G=X.right._zod.run({value:$,issues:[]},Y);if(J instanceof Promise||G instanceof Promise)return Promise.all([J,G]).then(([B,z])=>{return QH(W,B,z)});return QH(W,J,G)}});function XY(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(I9(Q)&&I9(X)){let W=Object.keys(X),Y=Object.keys(Q).filter((J)=>W.indexOf(J)!==-1),$={...Q,...X};for(let J of Y){let G=XY(Q[J],X[J]);if(!G.valid)return{valid:!1,mergeErrorPath:[J,...G.mergeErrorPath]};$[J]=G.data}return{valid:!0,data:$}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let Y=0;Y<Q.length;Y++){let $=Q[Y],J=X[Y],G=XY($,J);if(!G.valid)return{valid:!1,mergeErrorPath:[Y,...G.mergeErrorPath]};W.push(G.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function QH(Q,X,W){if(X.issues.length)Q.issues.push(...X.issues);if(W.issues.length)Q.issues.push(...W.issues);if(m6(Q))return Q;let Y=XY(X.value,W.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return Q.value=Y.data,Q}var kY=N("$ZodRecord",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{let $=W.value;if(!I9($))return W.issues.push({expected:"record",code:"invalid_type",input:$,inst:Q}),W;let J=[];if(X.keyType._zod.values){let G=X.keyType._zod.values;W.value={};for(let B of G)if(typeof B==="string"||typeof B==="number"||typeof B==="symbol"){let z=X.valueType._zod.run({value:$[B],issues:[]},Y);if(z instanceof Promise)J.push(z.then((K)=>{if(K.issues.length)W.issues.push(...f1(B,K.issues));W.value[B]=K.value}));else{if(z.issues.length)W.issues.push(...f1(B,z.issues));W.value[B]=z.value}}let H;for(let B in $)if(!G.has(B))H=H??[],H.push(B);if(H&&H.length>0)W.issues.push({code:"unrecognized_keys",input:$,inst:Q,keys:H})}else{W.value={};for(let G of Reflect.ownKeys($)){if(G==="__proto__")continue;let H=X.keyType._zod.run({value:G,issues:[]},Y);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:H.issues.map((z)=>U1(z,Y,d0())),input:G,path:[G],inst:Q}),W.value[H.value]=H.value;continue}let B=X.valueType._zod.run({value:$[G],issues:[]},Y);if(B instanceof Promise)J.push(B.then((z)=>{if(z.issues.length)W.issues.push(...f1(G,z.issues));W.value[H.value]=z.value}));else{if(B.issues.length)W.issues.push(...f1(G,B.issues));W.value[H.value]=B.value}}}if(J.length)return Promise.all(J).then(()=>W);return W}});var vY=N("$ZodEnum",(Q,X)=>{J0.init(Q,X);let W=M4(X.entries);Q._zod.values=new Set(W),Q._zod.pattern=new RegExp(`^(${W.filter((Y)=>uW.has(typeof Y)).map((Y)=>typeof Y==="string"?F6(Y):Y.toString()).join("|")})$`),Q._zod.parse=(Y,$)=>{let J=Y.value;if(Q._zod.values.has(J))return Y;return Y.issues.push({code:"invalid_value",values:W,input:J,inst:Q}),Y}}),_Y=N("$ZodLiteral",(Q,X)=>{J0.init(Q,X),Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((W)=>typeof W==="string"?F6(W):W?W.toString():String(W)).join("|")})$`),Q._zod.parse=(W,Y)=>{let $=W.value;if(Q._zod.values.has($))return W;return W.issues.push({code:"invalid_value",values:X.values,input:$,inst:Q}),W}});var xY=N("$ZodTransform",(Q,X)=>{J0.init(Q,X),Q._zod.parse=(W,Y)=>{let $=X.transform(W.value,W);if(Y.async)return($ instanceof Promise?$:Promise.resolve($)).then((G)=>{return W.value=G,W});if($ instanceof Promise)throw new L6;return W.value=$,W}}),yY=N("$ZodOptional",(Q,X)=>{J0.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",K0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),K0(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${b4(W.source)})?$`):void 0}),Q._zod.parse=(W,Y)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(W,Y);if(W.value===void 0)return W;return X.innerType._zod.run(W,Y)}}),fY=N("$ZodNullable",(Q,X)=>{J0.init(Q,X),K0(Q._zod,"optin",()=>X.innerType._zod.optin),K0(Q._zod,"optout",()=>X.innerType._zod.optout),K0(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${b4(W.source)}|null)$`):void 0}),K0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(W,Y)=>{if(W.value===null)return W;return X.innerType._zod.run(W,Y)}}),gY=N("$ZodDefault",(Q,X)=>{J0.init(Q,X),Q._zod.optin="optional",K0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(W.value===void 0)return W.value=X.defaultValue,W;let $=X.innerType._zod.run(W,Y);if($ instanceof Promise)return $.then((J)=>XH(J,X));return XH($,X)}});function XH(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var hY=N("$ZodPrefault",(Q,X)=>{J0.init(Q,X),Q._zod.optin="optional",K0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(W.value===void 0)W.value=X.defaultValue;return X.innerType._zod.run(W,Y)}}),uY=N("$ZodNonOptional",(Q,X)=>{J0.init(Q,X),K0(Q._zod,"values",()=>{let W=X.innerType._zod.values;return W?new Set([...W].filter((Y)=>Y!==void 0)):void 0}),Q._zod.parse=(W,Y)=>{let $=X.innerType._zod.run(W,Y);if($ instanceof Promise)return $.then((J)=>WH(J,Q));return WH($,Q)}});function WH(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var lY=N("$ZodCatch",(Q,X)=>{J0.init(Q,X),Q._zod.optin="optional",K0(Q._zod,"optout",()=>X.innerType._zod.optout),K0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{let $=X.innerType._zod.run(W,Y);if($ instanceof Promise)return $.then((J)=>{if(W.value=J.value,J.issues.length)W.value=X.catchValue({...W,error:{issues:J.issues.map((G)=>U1(G,Y,d0()))},input:W.value}),W.issues=[];return W});if(W.value=$.value,$.issues.length)W.value=X.catchValue({...W,error:{issues:$.issues.map((J)=>U1(J,Y,d0()))},input:W.value}),W.issues=[];return W}});var mY=N("$ZodPipe",(Q,X)=>{J0.init(Q,X),K0(Q._zod,"values",()=>X.in._zod.values),K0(Q._zod,"optin",()=>X.in._zod.optin),K0(Q._zod,"optout",()=>X.out._zod.optout),Q._zod.parse=(W,Y)=>{let $=X.in._zod.run(W,Y);if($ instanceof Promise)return $.then((J)=>YH(J,X,Y));return YH($,X,Y)}});function YH(Q,X,W){if(m6(Q))return Q;return X.out._zod.run({value:Q.value,issues:Q.issues},W)}var cY=N("$ZodReadonly",(Q,X)=>{J0.init(Q,X),K0(Q._zod,"propValues",()=>X.innerType._zod.propValues),K0(Q._zod,"values",()=>X.innerType._zod.values),K0(Q._zod,"optin",()=>X.innerType._zod.optin),K0(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(W,Y)=>{let $=X.innerType._zod.run(W,Y);if($ instanceof Promise)return $.then($H);return $H($)}});function $H(Q){return Q.value=Object.freeze(Q.value),Q}var pY=N("$ZodCustom",(Q,X)=>{R0.init(Q,X),J0.init(Q,X),Q._zod.parse=(W,Y)=>{return W},Q._zod.check=(W)=>{let Y=W.value,$=X.fn(Y);if($ instanceof Promise)return $.then((J)=>JH(J,W,Y,Q));JH($,W,Y,Q);return}});function JH(Q,X,W,Y){if(!Q){let $={code:"custom",input:W,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)$.params=Y._zod.def.params;X.issues.push(cW($))}}var lq=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},mq=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(Y){return Q[Y]??null}let W={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(Y)=>{switch(Y.code){case"invalid_type":return`Invalid input: expected ${Y.expected}, received ${lq(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Invalid input: expected ${eQ(Y.values[0])}`;return`Invalid option: expected one of ${aQ(Y.values,"|")}`;case"too_big":{let $=Y.inclusive?"<=":"<",J=X(Y.origin);if(J)return`Too big: expected ${Y.origin??"value"} to have ${$}${Y.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${Y.origin??"value"} to be ${$}${Y.maximum.toString()}`}case"too_small":{let $=Y.inclusive?">=":">",J=X(Y.origin);if(J)return`Too small: expected ${Y.origin} to have ${$}${Y.minimum.toString()} ${J.unit}`;return`Too small: expected ${Y.origin} to be ${$}${Y.minimum.toString()}`}case"invalid_format":{let $=Y;if($.format==="starts_with")return`Invalid string: must start with "${$.prefix}"`;if($.format==="ends_with")return`Invalid string: must end with "${$.suffix}"`;if($.format==="includes")return`Invalid string: must include "${$.includes}"`;if($.format==="regex")return`Invalid string: must match pattern ${$.pattern}`;return`Invalid ${W[$.format]??Y.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${Y.divisor}`;case"unrecognized_keys":return`Unrecognized key${Y.keys.length>1?"s":""}: ${aQ(Y.keys,", ")}`;case"invalid_key":return`Invalid key in ${Y.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${Y.origin}`;default:return"Invalid input"}}};function iY(){return{localeError:mq()}}var LH=Symbol("ZodOutput"),FH=Symbol("ZodInput");class H8{constructor(){this._map=new Map,this._idmap=new Map}add(Q,...X){let W=X[0];if(this._map.set(Q,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,Q)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let W={...this.get(X)??{}};return delete W.id,{...W,...this._map.get(Q)}}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function dY(){return new H8}var n1=dY();function nY(Q,X){return new Q({type:"string",...f(X)})}function AH(Q,X){return new Q({type:"string",coerce:!0,...f(X)})}function oY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...f(X)})}function B8(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...f(X)})}function rY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...f(X)})}function tY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(X)})}function aY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(X)})}function sY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(X)})}function z8(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...f(X)})}function eY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...f(X)})}function Q7(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(X)})}function X7(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...f(X)})}function W7(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(X)})}function Y7(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...f(X)})}function $7(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...f(X)})}function J7(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(X)})}function G7(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(X)})}function H7(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(X)})}function B7(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(X)})}function z7(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(X)})}function K7(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...f(X)})}function L7(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...f(X)})}function F7(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...f(X)})}function A7(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...f(X)})}function DH(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(X)})}function VH(Q,X){return new Q({type:"string",format:"date",check:"string_format",...f(X)})}function OH(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...f(X)})}function UH(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...f(X)})}function D7(Q,X){return new Q({type:"number",checks:[],...f(X)})}function qH(Q,X){return new Q({type:"number",coerce:!0,checks:[],...f(X)})}function V7(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...f(X)})}function O7(Q,X){return new Q({type:"boolean",...f(X)})}function NH(Q,X){return new Q({type:"boolean",coerce:!0,...f(X)})}function MH(Q,X){return new Q({type:"bigint",coerce:!0,...f(X)})}function U7(Q,X){return new Q({type:"null",...f(X)})}function q7(Q){return new Q({type:"any"})}function N7(Q){return new Q({type:"unknown"})}function M7(Q,X){return new Q({type:"never",...f(X)})}function jH(Q,X){return new Q({type:"date",coerce:!0,...f(X)})}function Z9(Q,X){return new sW({check:"less_than",...f(X),value:Q,inclusive:!1})}function o1(Q,X){return new sW({check:"less_than",...f(X),value:Q,inclusive:!0})}function S9(Q,X){return new eW({check:"greater_than",...f(X),value:Q,inclusive:!1})}function q1(Q,X){return new eW({check:"greater_than",...f(X),value:Q,inclusive:!0})}function R4(Q,X){return new fG({check:"multiple_of",...f(X),value:Q})}function K8(Q,X){return new hG({check:"max_length",...f(X),maximum:Q})}function R9(Q,X){return new uG({check:"min_length",...f(X),minimum:Q})}function L8(Q,X){return new lG({check:"length_equals",...f(X),length:Q})}function j7(Q,X){return new mG({check:"string_format",format:"regex",...f(X),pattern:Q})}function w7(Q){return new cG({check:"string_format",format:"lowercase",...f(Q)})}function b7(Q){return new pG({check:"string_format",format:"uppercase",...f(Q)})}function E7(Q,X){return new iG({check:"string_format",format:"includes",...f(X),includes:Q})}function P7(Q,X){return new dG({check:"string_format",format:"starts_with",...f(X),prefix:Q})}function I7(Q,X){return new nG({check:"string_format",format:"ends_with",...f(X),suffix:Q})}function i6(Q){return new oG({check:"overwrite",tx:Q})}function Z7(Q){return i6((X)=>X.normalize(Q))}function S7(){return i6((Q)=>Q.trim())}function R7(){return i6((Q)=>Q.toLowerCase())}function C7(){return i6((Q)=>Q.toUpperCase())}function wH(Q,X,W){return new Q({type:"array",element:X,...f(W)})}function T7(Q,X,W){let Y=f(W);return Y.abort??(Y.abort=!0),new Q({type:"custom",check:"custom",fn:X,...Y})}function k7(Q,X,W){return new Q({type:"custom",check:"custom",fn:X,...f(W)})}class v7{constructor(Q){this.counter=0,this.metadataRegistry=Q?.metadata??n1,this.target=Q?.target??"draft-2020-12",this.unrepresentable=Q?.unrepresentable??"throw",this.override=Q?.override??(()=>{}),this.io=Q?.io??"output",this.seen=new Map}process(Q,X={path:[],schemaPath:[]}){var W;let Y=Q._zod.def,$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},J=this.seen.get(Q);if(J){if(J.count++,X.schemaPath.includes(Q))J.cycle=X.path;return J.schema}let G={schema:{},count:1,cycle:void 0,path:X.path};this.seen.set(Q,G);let H=Q._zod.toJSONSchema?.();if(H)G.schema=H;else{let K={...X,schemaPath:[...X.schemaPath,Q],path:X.path},L=Q._zod.parent;if(L)G.ref=L,this.process(L,K),this.seen.get(L).isParent=!0;else{let V=G.schema;switch(Y.type){case"string":{let F=V;F.type="string";let{minimum:D,maximum:A,format:O,patterns:U,contentEncoding:j}=Q._zod.bag;if(typeof D==="number")F.minLength=D;if(typeof A==="number")F.maxLength=A;if(O){if(F.format=$[O]??O,F.format==="")delete F.format}if(j)F.contentEncoding=j;if(U&&U.size>0){let w=[...U];if(w.length===1)F.pattern=w[0].source;else if(w.length>1)G.schema.allOf=[...w.map((T)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:T.source}))]}break}case"number":{let F=V,{minimum:D,maximum:A,format:O,multipleOf:U,exclusiveMaximum:j,exclusiveMinimum:w}=Q._zod.bag;if(typeof O==="string"&&O.includes("int"))F.type="integer";else F.type="number";if(typeof w==="number")F.exclusiveMinimum=w;if(typeof D==="number"){if(F.minimum=D,typeof w==="number")if(w>=D)delete F.minimum;else delete F.exclusiveMinimum}if(typeof j==="number")F.exclusiveMaximum=j;if(typeof A==="number"){if(F.maximum=A,typeof j==="number")if(j<=A)delete F.maximum;else delete F.exclusiveMaximum}if(typeof U==="number")F.multipleOf=U;break}case"boolean":{let F=V;F.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{V.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{V.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let F=V,{minimum:D,maximum:A}=Q._zod.bag;if(typeof D==="number")F.minItems=D;if(typeof A==="number")F.maxItems=A;F.type="array",F.items=this.process(Y.element,{...K,path:[...K.path,"items"]});break}case"object":{let F=V;F.type="object",F.properties={};let D=Y.shape;for(let U in D)F.properties[U]=this.process(D[U],{...K,path:[...K.path,"properties",U]});let A=new Set(Object.keys(D)),O=new Set([...A].filter((U)=>{let j=Y.shape[U]._zod;if(this.io==="input")return j.optin===void 0;else return j.optout===void 0}));if(O.size>0)F.required=Array.from(O);if(Y.catchall?._zod.def.type==="never")F.additionalProperties=!1;else if(!Y.catchall){if(this.io==="output")F.additionalProperties=!1}else if(Y.catchall)F.additionalProperties=this.process(Y.catchall,{...K,path:[...K.path,"additionalProperties"]});break}case"union":{let F=V;F.anyOf=Y.options.map((D,A)=>this.process(D,{...K,path:[...K.path,"anyOf",A]}));break}case"intersection":{let F=V,D=this.process(Y.left,{...K,path:[...K.path,"allOf",0]}),A=this.process(Y.right,{...K,path:[...K.path,"allOf",1]}),O=(j)=>("allOf"in j)&&Object.keys(j).length===1,U=[...O(D)?D.allOf:[D],...O(A)?A.allOf:[A]];F.allOf=U;break}case"tuple":{let F=V;F.type="array";let D=Y.items.map((U,j)=>this.process(U,{...K,path:[...K.path,"prefixItems",j]}));if(this.target==="draft-2020-12")F.prefixItems=D;else F.items=D;if(Y.rest){let U=this.process(Y.rest,{...K,path:[...K.path,"items"]});if(this.target==="draft-2020-12")F.items=U;else F.additionalItems=U}if(Y.rest)F.items=this.process(Y.rest,{...K,path:[...K.path,"items"]});let{minimum:A,maximum:O}=Q._zod.bag;if(typeof A==="number")F.minItems=A;if(typeof O==="number")F.maxItems=O;break}case"record":{let F=V;F.type="object",F.propertyNames=this.process(Y.keyType,{...K,path:[...K.path,"propertyNames"]}),F.additionalProperties=this.process(Y.valueType,{...K,path:[...K.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let F=V,D=M4(Y.entries);if(D.every((A)=>typeof A==="number"))F.type="number";if(D.every((A)=>typeof A==="string"))F.type="string";F.enum=D;break}case"literal":{let F=V,D=[];for(let A of Y.values)if(A===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else D.push(Number(A));else D.push(A);if(D.length===0);else if(D.length===1){let A=D[0];F.type=A===null?"null":typeof A,F.const=A}else{if(D.every((A)=>typeof A==="number"))F.type="number";if(D.every((A)=>typeof A==="string"))F.type="string";if(D.every((A)=>typeof A==="boolean"))F.type="string";if(D.every((A)=>A===null))F.type="null";F.enum=D}break}case"file":{let F=V,D={type:"string",format:"binary",contentEncoding:"binary"},{minimum:A,maximum:O,mime:U}=Q._zod.bag;if(A!==void 0)D.minLength=A;if(O!==void 0)D.maxLength=O;if(U)if(U.length===1)D.contentMediaType=U[0],Object.assign(F,D);else F.anyOf=U.map((j)=>{return{...D,contentMediaType:j}});else Object.assign(F,D);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let F=this.process(Y.innerType,K);V.anyOf=[F,{type:"null"}];break}case"nonoptional":{this.process(Y.innerType,K),G.ref=Y.innerType;break}case"success":{let F=V;F.type="boolean";break}case"default":{this.process(Y.innerType,K),G.ref=Y.innerType,V.default=JSON.parse(JSON.stringify(Y.defaultValue));break}case"prefault":{if(this.process(Y.innerType,K),G.ref=Y.innerType,this.io==="input")V._prefault=JSON.parse(JSON.stringify(Y.defaultValue));break}case"catch":{this.process(Y.innerType,K),G.ref=Y.innerType;let F;try{F=Y.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}V.default=F;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let F=V,D=Q._zod.pattern;if(!D)throw Error("Pattern not found in template literal");F.type="string",F.pattern=D.source;break}case"pipe":{let F=this.io==="input"?Y.in._zod.def.type==="transform"?Y.out:Y.in:Y.out;this.process(F,K),G.ref=F;break}case"readonly":{this.process(Y.innerType,K),G.ref=Y.innerType,V.readOnly=!0;break}case"promise":{this.process(Y.innerType,K),G.ref=Y.innerType;break}case"optional":{this.process(Y.innerType,K),G.ref=Y.innerType;break}case"lazy":{let F=Q._zod.innerType;this.process(F,K),G.ref=F;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let B=this.metadataRegistry.get(Q);if(B)Object.assign(G.schema,B);if(this.io==="input"&&I0(Q))delete G.schema.examples,delete G.schema.default;if(this.io==="input"&&G.schema._prefault)(W=G.schema).default??(W.default=G.schema._prefault);return delete G.schema._prefault,this.seen.get(Q).schema}emit(Q,X){let W={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},Y=this.seen.get(Q);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let $=(z)=>{let K=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let D=W.external.registry.get(z[0])?.id,A=W.external.uri??((U)=>U);if(D)return{ref:A(D)};let O=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=O,{defId:O,ref:`${A("__shared")}#/${K}/${O}`}}if(z[1]===Y)return{ref:"#"};let V=`${"#"}/${K}/`,F=z[1].schema.id??`__schema${this.counter++}`;return{defId:F,ref:V+F}},J=(z)=>{if(z[1].schema.$ref)return;let K=z[1],{ref:L,defId:V}=$(z);if(K.def={...K.schema},V)K.defId=V;let F=K.schema;for(let D in F)delete F[D];F.$ref=L};if(W.cycles==="throw")for(let z of this.seen.entries()){let K=z[1];if(K.cycle)throw Error(`Cycle detected: #/${K.cycle?.join("/")}/<root>
42
-
43
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of this.seen.entries()){let K=z[1];if(Q===z[0]){J(z);continue}if(W.external){let V=W.external.registry.get(z[0])?.id;if(Q!==z[0]&&V){J(z);continue}}if(this.metadataRegistry.get(z[0])?.id){J(z);continue}if(K.cycle){J(z);continue}if(K.count>1){if(W.reused==="ref"){J(z);continue}}}let G=(z,K)=>{let L=this.seen.get(z),V=L.def??L.schema,F={...V};if(L.ref===null)return;let D=L.ref;if(L.ref=null,D){G(D,K);let A=this.seen.get(D).schema;if(A.$ref&&K.target==="draft-7")V.allOf=V.allOf??[],V.allOf.push(A);else Object.assign(V,A),Object.assign(V,F)}if(!L.isParent)this.override({zodSchema:z,jsonSchema:V,path:L.path??[]})};for(let z of[...this.seen.entries()].reverse())G(z[0],{target:this.target});let H={};if(this.target==="draft-2020-12")H.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")H.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(W.external?.uri){let z=W.external.registry.get(Q)?.id;if(!z)throw Error("Schema is missing an `id` property");H.$id=W.external.uri(z)}Object.assign(H,Y.def);let B=W.external?.defs??{};for(let z of this.seen.entries()){let K=z[1];if(K.def&&K.defId)B[K.defId]=K.def}if(W.external);else if(Object.keys(B).length>0)if(this.target==="draft-2020-12")H.$defs=B;else H.definitions=B;try{return JSON.parse(JSON.stringify(H))}catch(z){throw Error("Error converting schema to JSON.")}}}function F8(Q,X){if(Q instanceof H8){let Y=new v7(X),$={};for(let H of Q._idmap.entries()){let[B,z]=H;Y.process(z)}let J={},G={registry:Q,uri:X?.uri,defs:$};for(let H of Q._idmap.entries()){let[B,z]=H;J[B]=Y.emit(z,{...X,external:G})}if(Object.keys($).length>0){let H=Y.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[H]:$}}return{schemas:J}}let W=new v7(X);return W.process(Q),W.emit(Q,X)}function I0(Q,X){let W=X??{seen:new Set};if(W.seen.has(Q))return!1;W.seen.add(Q);let $=Q._zod.def;switch($.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return I0($.element,W);case"object":{for(let J in $.shape)if(I0($.shape[J],W))return!0;return!1}case"union":{for(let J of $.options)if(I0(J,W))return!0;return!1}case"intersection":return I0($.left,W)||I0($.right,W);case"tuple":{for(let J of $.items)if(I0(J,W))return!0;if($.rest&&I0($.rest,W))return!0;return!1}case"record":return I0($.keyType,W)||I0($.valueType,W);case"map":return I0($.keyType,W)||I0($.valueType,W);case"set":return I0($.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return I0($.innerType,W);case"lazy":return I0($.getter(),W);case"default":return I0($.innerType,W);case"prefault":return I0($.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return I0($.in,W)||I0($.out,W);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${$.type}`)}var NN=N("ZodMiniType",(Q,X)=>{if(!Q._zod)throw Error("Uninitialized schema in ZodMiniType.");J0.init(Q,X),Q.def=X,Q.parse=(W,Y)=>iW(Q,W,Y,{callee:Q.parse}),Q.safeParse=(W,Y)=>c6(Q,W,Y),Q.parseAsync=async(W,Y)=>nW(Q,W,Y,{callee:Q.parseAsync}),Q.safeParseAsync=async(W,Y)=>p6(Q,W,Y),Q.check=(...W)=>{return Q.clone({...X,checks:[...X.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},Q.clone=(W,Y)=>n0(Q,W,Y),Q.brand=()=>Q,Q.register=(W,Y)=>{return W.add(Q,Y),Q}});var MN=N("ZodMiniObject",(Q,X)=>{J8.init(Q,X),NN.init(Q,X),r.defineLazy(Q,"shape",()=>X.shape)});function _7(Q,X){let W={type:"object",get shape(){return r.assignProp(this,"shape",{...Q}),this.shape},...r.normalizeParams(X)};return new MN(W)}function o0(Q){return!!Q._zod}function d6(Q){let X=Object.values(Q);if(X.length===0)return _7({});let W=X.every(o0),Y=X.every(($)=>!o0($));if(W)return _7(Q);if(Y)return _W(Q);throw Error("Mixed Zod versions detected in object shape.")}function h0(Q,X){if(o0(Q))return c6(Q,X);return Q.safeParse(X)}async function A8(Q,X){if(o0(Q))return await p6(Q,X);return await Q.safeParseAsync(X)}function g1(Q){if(!Q)return;let X;if(o0(Q))X=Q._zod?.def?.shape;else X=Q.shape;if(!X)return;if(typeof X==="function")try{return X()}catch{return}return X}function C9(Q){if(!Q)return;if(typeof Q==="object"){let X=Q,W=Q;if(!X._def&&!W._zod){let Y=Object.values(Q);if(Y.length>0&&Y.every(($)=>typeof $==="object"&&$!==null&&($._def!==void 0||$._zod!==void 0||typeof $.parse==="function")))return d6(Q)}}if(o0(Q)){let W=Q._zod?.def;if(W&&(W.type==="object"||W.shape!==void 0))return Q}else if(Q.shape!==void 0)return Q;return}function D8(Q){if(Q&&typeof Q==="object"){if("message"in Q&&typeof Q.message==="string")return Q.message;if("issues"in Q&&Array.isArray(Q.issues)&&Q.issues.length>0){let X=Q.issues[0];if(X&&typeof X==="object"&&"message"in X)return String(X.message)}try{return JSON.stringify(Q)}catch{return String(Q)}}return String(Q)}function EH(Q){return Q.description}function PH(Q){if(o0(Q))return Q._zod?.def?.type==="optional";let X=Q;if(typeof Q.isOptional==="function")return Q.isOptional();return X._def?.typeName==="ZodOptional"}function V8(Q){if(o0(Q)){let J=Q._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let W=Q._def;if(W){if(W.value!==void 0)return W.value;if(Array.isArray(W.values)&&W.values.length>0)return W.values[0]}let Y=Q.value;if(Y!==void 0)return Y;return}var C4={};pQ(C4,{time:()=>f7,duration:()=>g7,datetime:()=>x7,date:()=>y7,ZodISOTime:()=>SH,ZodISODuration:()=>RH,ZodISODateTime:()=>IH,ZodISODate:()=>ZH});var IH=N("ZodISODateTime",(Q,X)=>{GH.init(Q,X),O0.init(Q,X)});function x7(Q){return DH(IH,Q)}var ZH=N("ZodISODate",(Q,X)=>{HH.init(Q,X),O0.init(Q,X)});function y7(Q){return VH(ZH,Q)}var SH=N("ZodISOTime",(Q,X)=>{BH.init(Q,X),O0.init(Q,X)});function f7(Q){return OH(SH,Q)}var RH=N("ZodISODuration",(Q,X)=>{zH.init(Q,X),O0.init(Q,X)});function g7(Q){return UH(RH,Q)}var TH=(Q,X)=>{Q8.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(W)=>W8(Q,W)},flatten:{value:(W)=>X8(Q,W)},addIssue:{value:(W)=>Q.issues.push(W)},addIssues:{value:(W)=>Q.issues.push(...W)},isEmpty:{get(){return Q.issues.length===0}}})},cg=N("ZodError",TH),T4=N("ZodError",TH,{Parent:Error});var kH=pW(T4),vH=dW(T4),_H=oW(T4),xH=rW(T4);var F0=N("ZodType",(Q,X)=>{return J0.init(Q,X),Q.def=X,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...W)=>{return Q.clone({...X,checks:[...X.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},Q.clone=(W,Y)=>n0(Q,W,Y),Q.brand=()=>Q,Q.register=(W,Y)=>{return W.add(Q,Y),Q},Q.parse=(W,Y)=>kH(Q,W,Y,{callee:Q.parse}),Q.safeParse=(W,Y)=>_H(Q,W,Y),Q.parseAsync=async(W,Y)=>vH(Q,W,Y,{callee:Q.parseAsync}),Q.safeParseAsync=async(W,Y)=>xH(Q,W,Y),Q.spa=Q.safeParseAsync,Q.refine=(W,Y)=>Q.check(qM(W,Y)),Q.superRefine=(W)=>Q.check(NM(W)),Q.overwrite=(W)=>Q.check(i6(W)),Q.optional=()=>j0(Q),Q.nullable=()=>gH(Q),Q.nullish=()=>j0(gH(Q)),Q.nonoptional=(W)=>LM(Q,W),Q.array=()=>Z(Q),Q.or=(W)=>A0([Q,W]),Q.and=(W)=>q8(Q,W),Q.transform=(W)=>u7(Q,nH(W)),Q.default=(W)=>BM(Q,W),Q.prefault=(W)=>KM(Q,W),Q.catch=(W)=>AM(Q,W),Q.pipe=(W)=>u7(Q,W),Q.readonly=()=>OM(Q),Q.describe=(W)=>{let Y=Q.clone();return n1.add(Y,{description:W}),Y},Object.defineProperty(Q,"description",{get(){return n1.get(Q)?.description},configurable:!0}),Q.meta=(...W)=>{if(W.length===0)return n1.get(Q);let Y=Q.clone();return n1.add(Y,W[0]),Y},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),hH=N("_ZodString",(Q,X)=>{S4.init(Q,X),F0.init(Q,X);let W=Q._zod.bag;Q.format=W.format??null,Q.minLength=W.minimum??null,Q.maxLength=W.maximum??null,Q.regex=(...Y)=>Q.check(j7(...Y)),Q.includes=(...Y)=>Q.check(E7(...Y)),Q.startsWith=(...Y)=>Q.check(P7(...Y)),Q.endsWith=(...Y)=>Q.check(I7(...Y)),Q.min=(...Y)=>Q.check(R9(...Y)),Q.max=(...Y)=>Q.check(K8(...Y)),Q.length=(...Y)=>Q.check(L8(...Y)),Q.nonempty=(...Y)=>Q.check(R9(1,...Y)),Q.lowercase=(Y)=>Q.check(w7(Y)),Q.uppercase=(Y)=>Q.check(b7(Y)),Q.trim=()=>Q.check(S7()),Q.normalize=(...Y)=>Q.check(Z7(...Y)),Q.toLowerCase=()=>Q.check(R7()),Q.toUpperCase=()=>Q.check(C7())}),l7=N("ZodString",(Q,X)=>{S4.init(Q,X),hH.init(Q,X),Q.email=(W)=>Q.check(oY(kN,W)),Q.url=(W)=>Q.check(z8(uH,W)),Q.jwt=(W)=>Q.check(A7(nN,W)),Q.emoji=(W)=>Q.check(eY(vN,W)),Q.guid=(W)=>Q.check(B8(yH,W)),Q.uuid=(W)=>Q.check(rY(O8,W)),Q.uuidv4=(W)=>Q.check(tY(O8,W)),Q.uuidv6=(W)=>Q.check(aY(O8,W)),Q.uuidv7=(W)=>Q.check(sY(O8,W)),Q.nanoid=(W)=>Q.check(Q7(_N,W)),Q.guid=(W)=>Q.check(B8(yH,W)),Q.cuid=(W)=>Q.check(X7(xN,W)),Q.cuid2=(W)=>Q.check(W7(yN,W)),Q.ulid=(W)=>Q.check(Y7(fN,W)),Q.base64=(W)=>Q.check(K7(pN,W)),Q.base64url=(W)=>Q.check(L7(iN,W)),Q.xid=(W)=>Q.check($7(gN,W)),Q.ksuid=(W)=>Q.check(J7(hN,W)),Q.ipv4=(W)=>Q.check(G7(uN,W)),Q.ipv6=(W)=>Q.check(H7(lN,W)),Q.cidrv4=(W)=>Q.check(B7(mN,W)),Q.cidrv6=(W)=>Q.check(z7(cN,W)),Q.e164=(W)=>Q.check(F7(dN,W)),Q.datetime=(W)=>Q.check(x7(W)),Q.date=(W)=>Q.check(y7(W)),Q.time=(W)=>Q.check(f7(W)),Q.duration=(W)=>Q.check(g7(W))});function q(Q){return nY(l7,Q)}var O0=N("ZodStringFormat",(Q,X)=>{L0.init(Q,X),hH.init(Q,X)}),kN=N("ZodEmail",(Q,X)=>{$Y.init(Q,X),O0.init(Q,X)});var yH=N("ZodGUID",(Q,X)=>{WY.init(Q,X),O0.init(Q,X)});var O8=N("ZodUUID",(Q,X)=>{YY.init(Q,X),O0.init(Q,X)});var uH=N("ZodURL",(Q,X)=>{JY.init(Q,X),O0.init(Q,X)});function lH(Q){return z8(uH,Q)}var vN=N("ZodEmoji",(Q,X)=>{GY.init(Q,X),O0.init(Q,X)});var _N=N("ZodNanoID",(Q,X)=>{HY.init(Q,X),O0.init(Q,X)});var xN=N("ZodCUID",(Q,X)=>{BY.init(Q,X),O0.init(Q,X)});var yN=N("ZodCUID2",(Q,X)=>{zY.init(Q,X),O0.init(Q,X)});var fN=N("ZodULID",(Q,X)=>{KY.init(Q,X),O0.init(Q,X)});var gN=N("ZodXID",(Q,X)=>{LY.init(Q,X),O0.init(Q,X)});var hN=N("ZodKSUID",(Q,X)=>{FY.init(Q,X),O0.init(Q,X)});var uN=N("ZodIPv4",(Q,X)=>{AY.init(Q,X),O0.init(Q,X)});var lN=N("ZodIPv6",(Q,X)=>{DY.init(Q,X),O0.init(Q,X)});var mN=N("ZodCIDRv4",(Q,X)=>{VY.init(Q,X),O0.init(Q,X)});var cN=N("ZodCIDRv6",(Q,X)=>{OY.init(Q,X),O0.init(Q,X)});var pN=N("ZodBase64",(Q,X)=>{UY.init(Q,X),O0.init(Q,X)});var iN=N("ZodBase64URL",(Q,X)=>{qY.init(Q,X),O0.init(Q,X)});var dN=N("ZodE164",(Q,X)=>{NY.init(Q,X),O0.init(Q,X)});var nN=N("ZodJWT",(Q,X)=>{MY.init(Q,X),O0.init(Q,X)});var U8=N("ZodNumber",(Q,X)=>{$8.init(Q,X),F0.init(Q,X),Q.gt=(Y,$)=>Q.check(S9(Y,$)),Q.gte=(Y,$)=>Q.check(q1(Y,$)),Q.min=(Y,$)=>Q.check(q1(Y,$)),Q.lt=(Y,$)=>Q.check(Z9(Y,$)),Q.lte=(Y,$)=>Q.check(o1(Y,$)),Q.max=(Y,$)=>Q.check(o1(Y,$)),Q.int=(Y)=>Q.check(fH(Y)),Q.safe=(Y)=>Q.check(fH(Y)),Q.positive=(Y)=>Q.check(S9(0,Y)),Q.nonnegative=(Y)=>Q.check(q1(0,Y)),Q.negative=(Y)=>Q.check(Z9(0,Y)),Q.nonpositive=(Y)=>Q.check(o1(0,Y)),Q.multipleOf=(Y,$)=>Q.check(R4(Y,$)),Q.step=(Y,$)=>Q.check(R4(Y,$)),Q.finite=()=>Q;let W=Q._zod.bag;Q.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),Q.isFinite=!0,Q.format=W.format??null});function $0(Q){return D7(U8,Q)}var oN=N("ZodNumberFormat",(Q,X)=>{jY.init(Q,X),U8.init(Q,X)});function fH(Q){return V7(oN,Q)}var m7=N("ZodBoolean",(Q,X)=>{wY.init(Q,X),F0.init(Q,X)});function G0(Q){return O7(m7,Q)}var mH=N("ZodBigInt",(Q,X)=>{bY.init(Q,X),F0.init(Q,X),Q.gte=(Y,$)=>Q.check(q1(Y,$)),Q.min=(Y,$)=>Q.check(q1(Y,$)),Q.gt=(Y,$)=>Q.check(S9(Y,$)),Q.gte=(Y,$)=>Q.check(q1(Y,$)),Q.min=(Y,$)=>Q.check(q1(Y,$)),Q.lt=(Y,$)=>Q.check(Z9(Y,$)),Q.lte=(Y,$)=>Q.check(o1(Y,$)),Q.max=(Y,$)=>Q.check(o1(Y,$)),Q.positive=(Y)=>Q.check(S9(BigInt(0),Y)),Q.negative=(Y)=>Q.check(Z9(BigInt(0),Y)),Q.nonpositive=(Y)=>Q.check(o1(BigInt(0),Y)),Q.nonnegative=(Y)=>Q.check(q1(BigInt(0),Y)),Q.multipleOf=(Y,$)=>Q.check(R4(Y,$));let W=Q._zod.bag;Q.minValue=W.minimum??null,Q.maxValue=W.maximum??null,Q.format=W.format??null});var rN=N("ZodNull",(Q,X)=>{EY.init(Q,X),F0.init(Q,X)});function c7(Q){return U7(rN,Q)}var tN=N("ZodAny",(Q,X)=>{PY.init(Q,X),F0.init(Q,X)});function cH(){return q7(tN)}var aN=N("ZodUnknown",(Q,X)=>{IY.init(Q,X),F0.init(Q,X)});function U0(){return N7(aN)}var sN=N("ZodNever",(Q,X)=>{ZY.init(Q,X),F0.init(Q,X)});function eN(Q){return M7(sN,Q)}var pH=N("ZodDate",(Q,X)=>{SY.init(Q,X),F0.init(Q,X),Q.min=(Y,$)=>Q.check(q1(Y,$)),Q.max=(Y,$)=>Q.check(o1(Y,$));let W=Q._zod.bag;Q.minDate=W.minimum?new Date(W.minimum):null,Q.maxDate=W.maximum?new Date(W.maximum):null});var QM=N("ZodArray",(Q,X)=>{RY.init(Q,X),F0.init(Q,X),Q.element=X.element,Q.min=(W,Y)=>Q.check(R9(W,Y)),Q.nonempty=(W)=>Q.check(R9(1,W)),Q.max=(W,Y)=>Q.check(K8(W,Y)),Q.length=(W,Y)=>Q.check(L8(W,Y)),Q.unwrap=()=>Q.element});function Z(Q,X){return wH(QM,Q,X)}var iH=N("ZodObject",(Q,X)=>{J8.init(Q,X),F0.init(Q,X),r.defineLazy(Q,"shape",()=>X.shape),Q.keyof=()=>r0(Object.keys(Q._zod.def.shape)),Q.catchall=(W)=>Q.clone({...Q._zod.def,catchall:W}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:U0()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:U0()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:eN()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(W)=>{return r.extend(Q,W)},Q.merge=(W)=>r.merge(Q,W),Q.pick=(W)=>r.pick(Q,W),Q.omit=(W)=>r.omit(Q,W),Q.partial=(...W)=>r.partial(oH,Q,W[0]),Q.required=(...W)=>r.required(rH,Q,W[0])});function R(Q,X){let W={type:"object",get shape(){return r.assignProp(this,"shape",{...Q}),this.shape},...r.normalizeParams(X)};return new iH(W)}function Z0(Q,X){return new iH({type:"object",get shape(){return r.assignProp(this,"shape",{...Q}),this.shape},catchall:U0(),...r.normalizeParams(X)})}var dH=N("ZodUnion",(Q,X)=>{G8.init(Q,X),F0.init(Q,X),Q.options=X.options});function A0(Q,X){return new dH({type:"union",options:Q,...r.normalizeParams(X)})}var XM=N("ZodDiscriminatedUnion",(Q,X)=>{dH.init(Q,X),CY.init(Q,X)});function p7(Q,X,W){return new XM({type:"union",options:X,discriminator:Q,...r.normalizeParams(W)})}var WM=N("ZodIntersection",(Q,X)=>{TY.init(Q,X),F0.init(Q,X)});function q8(Q,X){return new WM({type:"intersection",left:Q,right:X})}var YM=N("ZodRecord",(Q,X)=>{kY.init(Q,X),F0.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function q0(Q,X,W){return new YM({type:"record",keyType:Q,valueType:X,...r.normalizeParams(W)})}var h7=N("ZodEnum",(Q,X)=>{vY.init(Q,X),F0.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let W=new Set(Object.keys(X.entries));Q.extract=(Y,$)=>{let J={};for(let G of Y)if(W.has(G))J[G]=X.entries[G];else throw Error(`Key ${G} not found in enum`);return new h7({...X,checks:[],...r.normalizeParams($),entries:J})},Q.exclude=(Y,$)=>{let J={...X.entries};for(let G of Y)if(W.has(G))delete J[G];else throw Error(`Key ${G} not found in enum`);return new h7({...X,checks:[],...r.normalizeParams($),entries:J})}});function r0(Q,X){let W=Array.isArray(Q)?Object.fromEntries(Q.map((Y)=>[Y,Y])):Q;return new h7({type:"enum",entries:W,...r.normalizeParams(X)})}var $M=N("ZodLiteral",(Q,X)=>{_Y.init(Q,X),F0.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function _(Q,X){return new $M({type:"literal",values:Array.isArray(Q)?Q:[Q],...r.normalizeParams(X)})}var JM=N("ZodTransform",(Q,X)=>{xY.init(Q,X),F0.init(Q,X),Q._zod.parse=(W,Y)=>{W.addIssue=(J)=>{if(typeof J==="string")W.issues.push(r.issue(J,W.value,X));else{let G=J;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=W.value),G.inst??(G.inst=Q),G.continue??(G.continue=!0),W.issues.push(r.issue(G))}};let $=X.transform(W.value,W);if($ instanceof Promise)return $.then((J)=>{return W.value=J,W});return W.value=$,W}});function nH(Q){return new JM({type:"transform",transform:Q})}var oH=N("ZodOptional",(Q,X)=>{yY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function j0(Q){return new oH({type:"optional",innerType:Q})}var GM=N("ZodNullable",(Q,X)=>{fY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function gH(Q){return new GM({type:"nullable",innerType:Q})}var HM=N("ZodDefault",(Q,X)=>{gY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function BM(Q,X){return new HM({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var zM=N("ZodPrefault",(Q,X)=>{hY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function KM(Q,X){return new zM({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var rH=N("ZodNonOptional",(Q,X)=>{uY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function LM(Q,X){return new rH({type:"nonoptional",innerType:Q,...r.normalizeParams(X)})}var FM=N("ZodCatch",(Q,X)=>{lY.init(Q,X),F0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function AM(Q,X){return new FM({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var DM=N("ZodPipe",(Q,X)=>{mY.init(Q,X),F0.init(Q,X),Q.in=X.in,Q.out=X.out});function u7(Q,X){return new DM({type:"pipe",in:Q,out:X})}var VM=N("ZodReadonly",(Q,X)=>{cY.init(Q,X),F0.init(Q,X)});function OM(Q){return new VM({type:"readonly",innerType:Q})}var tH=N("ZodCustom",(Q,X)=>{pY.init(Q,X),F0.init(Q,X)});function UM(Q){let X=new R0({check:"custom"});return X._zod.check=Q,X}function aH(Q,X){return T7(tH,Q??(()=>!0),X)}function qM(Q,X={}){return k7(tH,Q,X)}function NM(Q){let X=UM((W)=>{return W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(r.issue(Y,W.value,X._zod.def));else{let $=Y;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=W.value),$.inst??($.inst=X),$.continue??($.continue=!X._zod.def.abort),W.issues.push(r.issue($))}},Q(W.value,W)});return X}function i7(Q,X){return u7(nH(Q),X)}var sH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var N8={};pQ(N8,{string:()=>MM,number:()=>jM,date:()=>EM,boolean:()=>wM,bigint:()=>bM});function MM(Q){return AH(l7,Q)}function jM(Q){return qH(U8,Q)}function wM(Q){return NH(m7,Q)}function bM(Q){return MH(mH,Q)}function EM(Q){return jH(pH,Q)}d0(iY());var D6="2025-11-25",eH="2025-03-26",n6=[D6,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],V6="io.modelcontextprotocol/related-task",j8="2.0",C0=aH((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),Q3=A0([q(),$0().int()]),X3=q(),Yh=Z0({ttl:A0([$0(),c7()]).optional(),pollInterval:$0().optional()}),IM=R({ttl:$0().optional()}),ZM=R({taskId:q()}),d7=Z0({progressToken:Q3.optional(),[V6]:ZM.optional()}),J1=R({_meta:d7.optional()}),k4=J1.extend({task:IM.optional()}),W3=(Q)=>k4.safeParse(Q).success,T0=R({method:q(),params:J1.loose().optional()}),G1=R({_meta:d7.optional()}),H1=R({method:q(),params:G1.loose().optional()}),k0=Z0({_meta:d7.optional()}),w8=A0([q(),$0().int()]),Y3=R({jsonrpc:_(j8),id:w8,...T0.shape}).strict(),h1=(Q)=>Y3.safeParse(Q).success,$3=R({jsonrpc:_(j8),...H1.shape}).strict(),J3=(Q)=>$3.safeParse(Q).success,n7=R({jsonrpc:_(j8),id:w8,result:k0}).strict(),N1=(Q)=>n7.safeParse(Q).success;var k;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(k||(k={}));var o7=R({jsonrpc:_(j8),id:w8.optional(),error:R({code:$0().int(),message:q(),data:U0().optional()})}).strict();var k9=(Q)=>o7.safeParse(Q).success;var o6=A0([Y3,$3,n7,o7]),$h=A0([n7,o7]),r1=k0.strict(),SM=G1.extend({requestId:w8.optional(),reason:q().optional()}),b8=H1.extend({method:_("notifications/cancelled"),params:SM}),RM=R({src:q(),mimeType:q().optional(),sizes:Z(q()).optional(),theme:r0(["light","dark"]).optional()}),v4=R({icons:Z(RM).optional()}),T9=R({name:q(),title:q().optional()}),G3=T9.extend({...T9.shape,...v4.shape,version:q(),websiteUrl:q().optional(),description:q().optional()}),CM=q8(R({applyDefaults:G0().optional()}),q0(q(),U0())),TM=i7((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},q8(R({form:CM.optional(),url:C0.optional()}),q0(q(),U0()).optional())),kM=Z0({list:C0.optional(),cancel:C0.optional(),requests:Z0({sampling:Z0({createMessage:C0.optional()}).optional(),elicitation:Z0({create:C0.optional()}).optional()}).optional()}),vM=Z0({list:C0.optional(),cancel:C0.optional(),requests:Z0({tools:Z0({call:C0.optional()}).optional()}).optional()}),_M=R({experimental:q0(q(),C0).optional(),sampling:R({context:C0.optional(),tools:C0.optional()}).optional(),elicitation:TM.optional(),roots:R({listChanged:G0().optional()}).optional(),tasks:kM.optional()}),xM=J1.extend({protocolVersion:q(),capabilities:_M,clientInfo:G3}),E8=T0.extend({method:_("initialize"),params:xM}),r7=(Q)=>E8.safeParse(Q).success,yM=R({experimental:q0(q(),C0).optional(),logging:C0.optional(),completions:C0.optional(),prompts:R({listChanged:G0().optional()}).optional(),resources:R({subscribe:G0().optional(),listChanged:G0().optional()}).optional(),tools:R({listChanged:G0().optional()}).optional(),tasks:vM.optional()}),t7=k0.extend({protocolVersion:q(),capabilities:yM,serverInfo:G3,instructions:q().optional()}),P8=H1.extend({method:_("notifications/initialized"),params:G1.optional()}),H3=(Q)=>P8.safeParse(Q).success,I8=T0.extend({method:_("ping"),params:J1.optional()}),fM=R({progress:$0(),total:j0($0()),message:j0(q())}),gM=R({...G1.shape,...fM.shape,progressToken:Q3}),Z8=H1.extend({method:_("notifications/progress"),params:gM}),hM=J1.extend({cursor:X3.optional()}),_4=T0.extend({params:hM.optional()}),x4=k0.extend({nextCursor:X3.optional()}),uM=r0(["working","input_required","completed","failed","cancelled"]),y4=R({taskId:q(),status:uM,ttl:A0([$0(),c7()]),createdAt:q(),lastUpdatedAt:q(),pollInterval:j0($0()),statusMessage:j0(q())}),t1=k0.extend({task:y4}),lM=G1.merge(y4),f4=H1.extend({method:_("notifications/tasks/status"),params:lM}),S8=T0.extend({method:_("tasks/get"),params:J1.extend({taskId:q()})}),R8=k0.merge(y4),C8=T0.extend({method:_("tasks/result"),params:J1.extend({taskId:q()})}),Jh=k0.loose(),T8=_4.extend({method:_("tasks/list")}),k8=x4.extend({tasks:Z(y4)}),v8=T0.extend({method:_("tasks/cancel"),params:J1.extend({taskId:q()})}),B3=k0.merge(y4),z3=R({uri:q(),mimeType:j0(q()),_meta:q0(q(),U0()).optional()}),K3=z3.extend({text:q()}),a7=q().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),L3=z3.extend({blob:a7}),g4=r0(["user","assistant"]),v9=R({audience:Z(g4).optional(),priority:$0().min(0).max(1).optional(),lastModified:C4.datetime({offset:!0}).optional()}),F3=R({...T9.shape,...v4.shape,uri:q(),description:j0(q()),mimeType:j0(q()),annotations:v9.optional(),_meta:j0(Z0({}))}),mM=R({...T9.shape,...v4.shape,uriTemplate:q(),description:j0(q()),mimeType:j0(q()),annotations:v9.optional(),_meta:j0(Z0({}))}),_8=_4.extend({method:_("resources/list")}),s7=x4.extend({resources:Z(F3)}),x8=_4.extend({method:_("resources/templates/list")}),e7=x4.extend({resourceTemplates:Z(mM)}),Q5=J1.extend({uri:q()}),cM=Q5,y8=T0.extend({method:_("resources/read"),params:cM}),X5=k0.extend({contents:Z(A0([K3,L3]))}),h4=H1.extend({method:_("notifications/resources/list_changed"),params:G1.optional()}),pM=Q5,iM=T0.extend({method:_("resources/subscribe"),params:pM}),dM=Q5,nM=T0.extend({method:_("resources/unsubscribe"),params:dM}),oM=G1.extend({uri:q()}),W5=H1.extend({method:_("notifications/resources/updated"),params:oM}),rM=R({name:q(),description:j0(q()),required:j0(G0())}),tM=R({...T9.shape,...v4.shape,description:j0(q()),arguments:j0(Z(rM)),_meta:j0(Z0({}))}),f8=_4.extend({method:_("prompts/list")}),Y5=x4.extend({prompts:Z(tM)}),aM=J1.extend({name:q(),arguments:q0(q(),q()).optional()}),g8=T0.extend({method:_("prompts/get"),params:aM}),$5=R({type:_("text"),text:q(),annotations:v9.optional(),_meta:q0(q(),U0()).optional()}),J5=R({type:_("image"),data:a7,mimeType:q(),annotations:v9.optional(),_meta:q0(q(),U0()).optional()}),G5=R({type:_("audio"),data:a7,mimeType:q(),annotations:v9.optional(),_meta:q0(q(),U0()).optional()}),sM=R({type:_("tool_use"),name:q(),id:q(),input:q0(q(),U0()),_meta:q0(q(),U0()).optional()}),eM=R({type:_("resource"),resource:A0([K3,L3]),annotations:v9.optional(),_meta:q0(q(),U0()).optional()}),Qj=F3.extend({type:_("resource_link")}),H5=A0([$5,J5,G5,Qj,eM]),Xj=R({role:g4,content:H5}),B5=k0.extend({description:q().optional(),messages:Z(Xj)}),u4=H1.extend({method:_("notifications/prompts/list_changed"),params:G1.optional()}),Wj=R({title:q().optional(),readOnlyHint:G0().optional(),destructiveHint:G0().optional(),idempotentHint:G0().optional(),openWorldHint:G0().optional()}),Yj=R({taskSupport:r0(["required","optional","forbidden"]).optional()}),A3=R({...T9.shape,...v4.shape,description:q().optional(),inputSchema:R({type:_("object"),properties:q0(q(),C0).optional(),required:Z(q()).optional()}).catchall(U0()),outputSchema:R({type:_("object"),properties:q0(q(),C0).optional(),required:Z(q()).optional()}).catchall(U0()).optional(),annotations:Wj.optional(),execution:Yj.optional(),_meta:q0(q(),U0()).optional()}),h8=_4.extend({method:_("tools/list")}),z5=x4.extend({tools:Z(A3)}),O6=k0.extend({content:Z(H5).default([]),structuredContent:q0(q(),U0()).optional(),isError:G0().optional()}),Gh=O6.or(k0.extend({toolResult:U0()})),$j=k4.extend({name:q(),arguments:q0(q(),U0()).optional()}),_9=T0.extend({method:_("tools/call"),params:$j}),l4=H1.extend({method:_("notifications/tools/list_changed"),params:G1.optional()}),D3=R({autoRefresh:G0().default(!0),debounceMs:$0().int().nonnegative().default(300)}),m4=r0(["debug","info","notice","warning","error","critical","alert","emergency"]),Jj=J1.extend({level:m4}),K5=T0.extend({method:_("logging/setLevel"),params:Jj}),Gj=G1.extend({level:m4,logger:q().optional(),data:U0()}),L5=H1.extend({method:_("notifications/message"),params:Gj}),Hj=R({name:q().optional()}),Bj=R({hints:Z(Hj).optional(),costPriority:$0().min(0).max(1).optional(),speedPriority:$0().min(0).max(1).optional(),intelligencePriority:$0().min(0).max(1).optional()}),zj=R({mode:r0(["auto","required","none"]).optional()}),Kj=R({type:_("tool_result"),toolUseId:q().describe("The unique identifier for the corresponding tool call."),content:Z(H5).default([]),structuredContent:R({}).loose().optional(),isError:G0().optional(),_meta:q0(q(),U0()).optional()}),Lj=p7("type",[$5,J5,G5]),M8=p7("type",[$5,J5,G5,sM,Kj]),Fj=R({role:g4,content:A0([M8,Z(M8)]),_meta:q0(q(),U0()).optional()}),Aj=k4.extend({messages:Z(Fj),modelPreferences:Bj.optional(),systemPrompt:q().optional(),includeContext:r0(["none","thisServer","allServers"]).optional(),temperature:$0().optional(),maxTokens:$0().int(),stopSequences:Z(q()).optional(),metadata:C0.optional(),tools:Z(A3).optional(),toolChoice:zj.optional()}),c4=T0.extend({method:_("sampling/createMessage"),params:Aj}),p4=k0.extend({model:q(),stopReason:j0(r0(["endTurn","stopSequence","maxTokens"]).or(q())),role:g4,content:Lj}),F5=k0.extend({model:q(),stopReason:j0(r0(["endTurn","stopSequence","maxTokens","toolUse"]).or(q())),role:g4,content:A0([M8,Z(M8)])}),Dj=R({type:_("boolean"),title:q().optional(),description:q().optional(),default:G0().optional()}),Vj=R({type:_("string"),title:q().optional(),description:q().optional(),minLength:$0().optional(),maxLength:$0().optional(),format:r0(["email","uri","date","date-time"]).optional(),default:q().optional()}),Oj=R({type:r0(["number","integer"]),title:q().optional(),description:q().optional(),minimum:$0().optional(),maximum:$0().optional(),default:$0().optional()}),Uj=R({type:_("string"),title:q().optional(),description:q().optional(),enum:Z(q()),default:q().optional()}),qj=R({type:_("string"),title:q().optional(),description:q().optional(),oneOf:Z(R({const:q(),title:q()})),default:q().optional()}),Nj=R({type:_("string"),title:q().optional(),description:q().optional(),enum:Z(q()),enumNames:Z(q()).optional(),default:q().optional()}),Mj=A0([Uj,qj]),jj=R({type:_("array"),title:q().optional(),description:q().optional(),minItems:$0().optional(),maxItems:$0().optional(),items:R({type:_("string"),enum:Z(q())}),default:Z(q()).optional()}),wj=R({type:_("array"),title:q().optional(),description:q().optional(),minItems:$0().optional(),maxItems:$0().optional(),items:R({anyOf:Z(R({const:q(),title:q()}))}),default:Z(q()).optional()}),bj=A0([jj,wj]),Ej=A0([Nj,Mj,bj]),Pj=A0([Ej,Dj,Vj,Oj]),Ij=k4.extend({mode:_("form").optional(),message:q(),requestedSchema:R({type:_("object"),properties:q0(q(),Pj),required:Z(q()).optional()})}),Zj=k4.extend({mode:_("url"),message:q(),elicitationId:q(),url:q().url()}),Sj=A0([Ij,Zj]),i4=T0.extend({method:_("elicitation/create"),params:Sj}),Rj=G1.extend({elicitationId:q()}),Cj=H1.extend({method:_("notifications/elicitation/complete"),params:Rj}),x9=k0.extend({action:r0(["accept","decline","cancel"]),content:i7((Q)=>Q===null?void 0:Q,q0(q(),A0([q(),$0(),G0(),Z(q())])).optional())}),Tj=R({type:_("ref/resource"),uri:q()});var kj=R({type:_("ref/prompt"),name:q()}),vj=J1.extend({ref:A0([kj,Tj]),argument:R({name:q(),value:q()}),context:R({arguments:q0(q(),q()).optional()}).optional()}),u8=T0.extend({method:_("completion/complete"),params:vj});function V3(Q){if(Q.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${Q.params.ref.type}`)}function O3(Q){if(Q.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${Q.params.ref.type}`)}var A5=k0.extend({completion:Z0({values:Z(q()).max(100),total:j0($0().int()),hasMore:j0(G0())})}),_j=R({uri:q().startsWith("file://"),name:q().optional(),_meta:q0(q(),U0()).optional()}),xj=T0.extend({method:_("roots/list"),params:J1.optional()}),D5=k0.extend({roots:Z(_j)}),yj=H1.extend({method:_("notifications/roots/list_changed"),params:G1.optional()}),Hh=A0([I8,E8,u8,K5,g8,f8,_8,x8,y8,iM,nM,_9,h8,S8,C8,T8,v8]),Bh=A0([b8,Z8,P8,yj,f4]),zh=A0([r1,p4,F5,x9,D5,R8,k8,t1]),Kh=A0([I8,c4,i4,xj,S8,C8,T8,v8]),Lh=A0([b8,Z8,L5,W5,h4,l4,u4,f4,Cj]),Fh=A0([r1,t7,A5,B5,Y5,s7,e7,X5,O6,z5,R8,k8,t1]);class S extends Error{constructor(Q,X,W){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=W,this.name="McpError"}static fromError(Q,X,W){if(Q===k.UrlElicitationRequired&&W){let Y=W;if(Y.elicitations)return new U3(Y.elicitations,X)}return new S(Q,X,W)}}class U3 extends S{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(k.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function U6(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var N3=Symbol("Let zodToJsonSchema decide on which parser to use");var q3={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"},M3=(Q)=>typeof Q==="string"?{...q3,name:Q}:{...q3,...Q};var j3=(Q)=>{let X=M3(Q),W=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([Y,$])=>[$._def,{def:$._def,path:[...X.basePath,X.definitionPath,Y],jsonSchema:void 0}]))}};function V5(Q,X,W,Y){if(!Y?.errorMessages)return;if(W)Q.errorMessage={...Q.errorMessage,[X]:W}}function t(Q,X,W,Y,$){Q[X]=W,V5(Q,X,Y,$)}var l8=(Q,X)=>{let W=0;for(;W<Q.length&&W<X.length;W++)if(Q[W]!==X[W])break;return[(Q.length-W).toString(),...X.slice(W)].join("/")};function N0(Q){if(Q.target!=="openAi")return{};let X=[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName];return Q.flags.hasReferencedOpenAiAnyType=!0,{$ref:Q.$refStrategy==="relative"?l8(X,Q.currentPath):X.join("/")}}function w3(Q,X){let W={type:"array"};if(Q.type?._def&&Q.type?._def?.typeName!==E.ZodAny)W.items=h(Q.type._def,{...X,currentPath:[...X.currentPath,"items"]});if(Q.minLength)t(W,"minItems",Q.minLength.value,Q.minLength.message,X);if(Q.maxLength)t(W,"maxItems",Q.maxLength.value,Q.maxLength.message,X);if(Q.exactLength)t(W,"minItems",Q.exactLength.value,Q.exactLength.message,X),t(W,"maxItems",Q.exactLength.value,Q.exactLength.message,X);return W}function b3(Q,X){let W={type:"integer",format:"int64"};if(!Q.checks)return W;for(let Y of Q.checks)switch(Y.kind){case"min":if(X.target==="jsonSchema7")if(Y.inclusive)t(W,"minimum",Y.value,Y.message,X);else t(W,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)W.exclusiveMinimum=!0;t(W,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)t(W,"maximum",Y.value,Y.message,X);else t(W,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)W.exclusiveMaximum=!0;t(W,"maximum",Y.value,Y.message,X)}break;case"multipleOf":t(W,"multipleOf",Y.value,Y.message,X);break}return W}function E3(){return{type:"boolean"}}function m8(Q,X){return h(Q.type._def,X)}var P3=(Q,X)=>{return h(Q.innerType._def,X)};function O5(Q,X,W){let Y=W??X.dateStrategy;if(Array.isArray(Y))return{anyOf:Y.map(($,J)=>O5(Q,X,$))};switch(Y){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return fj(Q,X)}}var fj=(Q,X)=>{let W={type:"integer",format:"unix-time"};if(X.target==="openApi3")return W;for(let Y of Q.checks)switch(Y.kind){case"min":t(W,"minimum",Y.value,Y.message,X);break;case"max":t(W,"maximum",Y.value,Y.message,X);break}return W};function I3(Q,X){return{...h(Q.innerType._def,X),default:Q.defaultValue()}}function Z3(Q,X){return X.effectStrategy==="input"?h(Q.schema._def,X):N0(X)}function S3(Q){return{type:"string",enum:Array.from(Q.values)}}var gj=(Q)=>{if("type"in Q&&Q.type==="string")return!1;return"allOf"in Q};function R3(Q,X){let W=[h(Q.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),h(Q.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((J)=>!!J),Y=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,$=[];return W.forEach((J)=>{if(gj(J)){if($.push(...J.allOf),J.unevaluatedProperties===void 0)Y=void 0}else{let G=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:H,...B}=J;G=B}else Y=void 0;$.push(G)}}),$.length?{allOf:$,...Y}:void 0}function C3(Q,X){let W=typeof Q.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(Q.value)?"array":"object"};if(X.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[Q.value]};return{type:W==="bigint"?"integer":W,const:Q.value}}var U5=void 0,M1={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:()=>{if(U5===void 0)U5=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return U5},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 c8(Q,X){let W={type:"string"};if(Q.checks)for(let Y of Q.checks)switch(Y.kind){case"min":t(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,X);break;case"max":t(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,X);break;case"email":switch(X.emailStrategy){case"format:email":j1(W,"email",Y.message,X);break;case"format:idn-email":j1(W,"idn-email",Y.message,X);break;case"pattern:zod":u0(W,M1.email,Y.message,X);break}break;case"url":j1(W,"uri",Y.message,X);break;case"uuid":j1(W,"uuid",Y.message,X);break;case"regex":u0(W,Y.regex,Y.message,X);break;case"cuid":u0(W,M1.cuid,Y.message,X);break;case"cuid2":u0(W,M1.cuid2,Y.message,X);break;case"startsWith":u0(W,RegExp(`^${q5(Y.value,X)}`),Y.message,X);break;case"endsWith":u0(W,RegExp(`${q5(Y.value,X)}$`),Y.message,X);break;case"datetime":j1(W,"date-time",Y.message,X);break;case"date":j1(W,"date",Y.message,X);break;case"time":j1(W,"time",Y.message,X);break;case"duration":j1(W,"duration",Y.message,X);break;case"length":t(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,X),t(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,X);break;case"includes":{u0(W,RegExp(q5(Y.value,X)),Y.message,X);break}case"ip":{if(Y.version!=="v6")j1(W,"ipv4",Y.message,X);if(Y.version!=="v4")j1(W,"ipv6",Y.message,X);break}case"base64url":u0(W,M1.base64url,Y.message,X);break;case"jwt":u0(W,M1.jwt,Y.message,X);break;case"cidr":{if(Y.version!=="v6")u0(W,M1.ipv4Cidr,Y.message,X);if(Y.version!=="v4")u0(W,M1.ipv6Cidr,Y.message,X);break}case"emoji":u0(W,M1.emoji(),Y.message,X);break;case"ulid":{u0(W,M1.ulid,Y.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{j1(W,"binary",Y.message,X);break}case"contentEncoding:base64":{t(W,"contentEncoding","base64",Y.message,X);break}case"pattern:zod":{u0(W,M1.base64,Y.message,X);break}}break}case"nanoid":u0(W,M1.nanoid,Y.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:(($)=>{})(Y)}return W}function q5(Q,X){return X.patternStrategy==="escape"?uj(Q):Q}var hj=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function uj(Q){let X="";for(let W=0;W<Q.length;W++){if(!hj.has(Q[W]))X+="\\";X+=Q[W]}return X}function j1(Q,X,W,Y){if(Q.format||Q.anyOf?.some(($)=>$.format)){if(!Q.anyOf)Q.anyOf=[];if(Q.format){if(Q.anyOf.push({format:Q.format,...Q.errorMessage&&Y.errorMessages&&{errorMessage:{format:Q.errorMessage.format}}}),delete Q.format,Q.errorMessage){if(delete Q.errorMessage.format,Object.keys(Q.errorMessage).length===0)delete Q.errorMessage}}Q.anyOf.push({format:X,...W&&Y.errorMessages&&{errorMessage:{format:W}}})}else t(Q,"format",X,W,Y)}function u0(Q,X,W,Y){if(Q.pattern||Q.allOf?.some(($)=>$.pattern)){if(!Q.allOf)Q.allOf=[];if(Q.pattern){if(Q.allOf.push({pattern:Q.pattern,...Q.errorMessage&&Y.errorMessages&&{errorMessage:{pattern:Q.errorMessage.pattern}}}),delete Q.pattern,Q.errorMessage){if(delete Q.errorMessage.pattern,Object.keys(Q.errorMessage).length===0)delete Q.errorMessage}}Q.allOf.push({pattern:T3(X,Y),...W&&Y.errorMessages&&{errorMessage:{pattern:W}}})}else t(Q,"pattern",T3(X,Y),W,Y)}function T3(Q,X){if(!X.applyRegexFlags||!Q.flags)return Q.source;let W={i:Q.flags.includes("i"),m:Q.flags.includes("m"),s:Q.flags.includes("s")},Y=W.i?Q.source.toLowerCase():Q.source,$="",J=!1,G=!1,H=!1;for(let B=0;B<Y.length;B++){if(J){$+=Y[B],J=!1;continue}if(W.i){if(G){if(Y[B].match(/[a-z]/)){if(H)$+=Y[B],$+=`${Y[B-2]}-${Y[B]}`.toUpperCase(),H=!1;else if(Y[B+1]==="-"&&Y[B+2]?.match(/[a-z]/))$+=Y[B],H=!0;else $+=`${Y[B]}${Y[B].toUpperCase()}`;continue}}else if(Y[B].match(/[a-z]/)){$+=`[${Y[B]}${Y[B].toUpperCase()}]`;continue}}if(W.m){if(Y[B]==="^"){$+=`(^|(?<=[\r
44
- ]))`;continue}else if(Y[B]==="$"){$+=`($|(?=[\r
45
- ]))`;continue}}if(W.s&&Y[B]==="."){$+=G?`${Y[B]}\r
46
- `:`[${Y[B]}\r
47
- ]`;continue}if($+=Y[B],Y[B]==="\\")J=!0;else if(G&&Y[B]==="]")G=!1;else if(!G&&Y[B]==="[")G=!0}try{new RegExp($)}catch{return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),Q.source}return $}function p8(Q,X){if(X.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(X.target==="openApi3"&&Q.keyType?._def.typeName===E.ZodEnum)return{type:"object",required:Q.keyType._def.values,properties:Q.keyType._def.values.reduce((Y,$)=>({...Y,[$]:h(Q.valueType._def,{...X,currentPath:[...X.currentPath,"properties",$]})??N0(X)}),{}),additionalProperties:X.rejectedAdditionalProperties};let W={type:"object",additionalProperties:h(Q.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return W;if(Q.keyType?._def.typeName===E.ZodString&&Q.keyType._def.checks?.length){let{type:Y,...$}=c8(Q.keyType._def,X);return{...W,propertyNames:$}}else if(Q.keyType?._def.typeName===E.ZodEnum)return{...W,propertyNames:{enum:Q.keyType._def.values}};else if(Q.keyType?._def.typeName===E.ZodBranded&&Q.keyType._def.type._def.typeName===E.ZodString&&Q.keyType._def.type._def.checks?.length){let{type:Y,...$}=m8(Q.keyType._def,X);return{...W,propertyNames:$}}return W}function k3(Q,X){if(X.mapStrategy==="record")return p8(Q,X);let W=h(Q.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||N0(X),Y=h(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||N0(X);return{type:"array",maxItems:125,items:{type:"array",items:[W,Y],minItems:2,maxItems:2}}}function v3(Q){let X=Q.values,Y=Object.keys(Q.values).filter((J)=>{return typeof X[X[J]]!=="number"}).map((J)=>X[J]),$=Array.from(new Set(Y.map((J)=>typeof J)));return{type:$.length===1?$[0]==="string"?"string":"number":["string","number"],enum:Y}}function _3(Q){return Q.target==="openAi"?void 0:{not:N0({...Q,currentPath:[...Q.currentPath,"not"]})}}function x3(Q){return Q.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var d4={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function f3(Q,X){if(X.target==="openApi3")return y3(Q,X);let W=Q.options instanceof Map?Array.from(Q.options.values()):Q.options;if(W.every((Y)=>(Y._def.typeName in d4)&&(!Y._def.checks||!Y._def.checks.length))){let Y=W.reduce(($,J)=>{let G=d4[J._def.typeName];return G&&!$.includes(G)?[...$,G]:$},[]);return{type:Y.length>1?Y:Y[0]}}else if(W.every((Y)=>Y._def.typeName==="ZodLiteral"&&!Y.description)){let Y=W.reduce(($,J)=>{let G=typeof J._def.value;switch(G){case"string":case"number":case"boolean":return[...$,G];case"bigint":return[...$,"integer"];case"object":if(J._def.value===null)return[...$,"null"];case"symbol":case"undefined":case"function":default:return $}},[]);if(Y.length===W.length){let $=Y.filter((J,G,H)=>H.indexOf(J)===G);return{type:$.length>1?$:$[0],enum:W.reduce((J,G)=>{return J.includes(G._def.value)?J:[...J,G._def.value]},[])}}}else if(W.every((Y)=>Y._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((Y,$)=>[...Y,...$._def.values.filter((J)=>!Y.includes(J))],[])};return y3(Q,X)}var y3=(Q,X)=>{let W=(Q.options instanceof Map?Array.from(Q.options.values()):Q.options).map((Y,$)=>h(Y._def,{...X,currentPath:[...X.currentPath,"anyOf",`${$}`]})).filter((Y)=>!!Y&&(!X.strictUnions||typeof Y==="object"&&Object.keys(Y).length>0));return W.length?{anyOf:W}:void 0};function g3(Q,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(Q.innerType._def.typeName)&&(!Q.innerType._def.checks||!Q.innerType._def.checks.length)){if(X.target==="openApi3")return{type:d4[Q.innerType._def.typeName],nullable:!0};return{type:[d4[Q.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let Y=h(Q.innerType._def,{...X,currentPath:[...X.currentPath]});if(Y&&"$ref"in Y)return{allOf:[Y],nullable:!0};return Y&&{...Y,nullable:!0}}let W=h(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function h3(Q,X){let W={type:"number"};if(!Q.checks)return W;for(let Y of Q.checks)switch(Y.kind){case"int":W.type="integer",V5(W,"type",Y.message,X);break;case"min":if(X.target==="jsonSchema7")if(Y.inclusive)t(W,"minimum",Y.value,Y.message,X);else t(W,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)W.exclusiveMinimum=!0;t(W,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)t(W,"maximum",Y.value,Y.message,X);else t(W,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)W.exclusiveMaximum=!0;t(W,"maximum",Y.value,Y.message,X)}break;case"multipleOf":t(W,"multipleOf",Y.value,Y.message,X);break}return W}function u3(Q,X){let W=X.target==="openAi",Y={type:"object",properties:{}},$=[],J=Q.shape();for(let H in J){let B=J[H];if(B===void 0||B._def===void 0)continue;let z=mj(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let K=h(B._def,{...X,currentPath:[...X.currentPath,"properties",H],propertyPath:[...X.currentPath,"properties",H]});if(K===void 0)continue;if(Y.properties[H]=K,!z)$.push(H)}if($.length)Y.required=$;let G=lj(Q,X);if(G!==void 0)Y.additionalProperties=G;return Y}function lj(Q,X){if(Q.catchall._def.typeName!=="ZodNever")return h(Q.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch(Q.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function mj(Q){try{return Q.isOptional()}catch{return!0}}var l3=(Q,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return h(Q.innerType._def,X);let W=h(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return W?{anyOf:[{not:N0(X)},W]}:N0(X)};var m3=(Q,X)=>{if(X.pipeStrategy==="input")return h(Q.in._def,X);else if(X.pipeStrategy==="output")return h(Q.out._def,X);let W=h(Q.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Y=h(Q.out._def,{...X,currentPath:[...X.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,Y].filter(($)=>$!==void 0)}};function c3(Q,X){return h(Q.type._def,X)}function p3(Q,X){let Y={type:"array",uniqueItems:!0,items:h(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if(Q.minSize)t(Y,"minItems",Q.minSize.value,Q.minSize.message,X);if(Q.maxSize)t(Y,"maxItems",Q.maxSize.value,Q.maxSize.message,X);return Y}function i3(Q,X){if(Q.rest)return{type:"array",minItems:Q.items.length,items:Q.items.map((W,Y)=>h(W._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((W,Y)=>Y===void 0?W:[...W,Y],[]),additionalItems:h(Q.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:Q.items.length,maxItems:Q.items.length,items:Q.items.map((W,Y)=>h(W._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((W,Y)=>Y===void 0?W:[...W,Y],[])}}function d3(Q){return{not:N0(Q)}}function n3(Q){return N0(Q)}var o3=(Q,X)=>{return h(Q.innerType._def,X)};var r3=(Q,X,W)=>{switch(X){case E.ZodString:return c8(Q,W);case E.ZodNumber:return h3(Q,W);case E.ZodObject:return u3(Q,W);case E.ZodBigInt:return b3(Q,W);case E.ZodBoolean:return E3();case E.ZodDate:return O5(Q,W);case E.ZodUndefined:return d3(W);case E.ZodNull:return x3(W);case E.ZodArray:return w3(Q,W);case E.ZodUnion:case E.ZodDiscriminatedUnion:return f3(Q,W);case E.ZodIntersection:return R3(Q,W);case E.ZodTuple:return i3(Q,W);case E.ZodRecord:return p8(Q,W);case E.ZodLiteral:return C3(Q,W);case E.ZodEnum:return S3(Q);case E.ZodNativeEnum:return v3(Q);case E.ZodNullable:return g3(Q,W);case E.ZodOptional:return l3(Q,W);case E.ZodMap:return k3(Q,W);case E.ZodSet:return p3(Q,W);case E.ZodLazy:return()=>Q.getter()._def;case E.ZodPromise:return c3(Q,W);case E.ZodNaN:case E.ZodNever:return _3(W);case E.ZodEffects:return Z3(Q,W);case E.ZodAny:return N0(W);case E.ZodUnknown:return n3(W);case E.ZodDefault:return I3(Q,W);case E.ZodBranded:return m8(Q,W);case E.ZodReadonly:return o3(Q,W);case E.ZodCatch:return P3(Q,W);case E.ZodPipeline:return m3(Q,W);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return((Y)=>{return})(X)}};function h(Q,X,W=!1){let Y=X.seen.get(Q);if(X.override){let H=X.override?.(Q,X,Y,W);if(H!==N3)return H}if(Y&&!W){let H=cj(Y,X);if(H!==void 0)return H}let $={def:Q,path:X.currentPath,jsonSchema:void 0};X.seen.set(Q,$);let J=r3(Q,Q.typeName,X),G=typeof J==="function"?h(J(),X):J;if(G)pj(Q,X,G);if(X.postProcess){let H=X.postProcess(G,Q,X);return $.jsonSchema=G,H}return $.jsonSchema=G,G}var cj=(Q,X)=>{switch(X.$refStrategy){case"root":return{$ref:Q.path.join("/")};case"relative":return{$ref:l8(X.currentPath,Q.path)};case"none":case"seen":{if(Q.path.length<X.currentPath.length&&Q.path.every((W,Y)=>X.currentPath[Y]===W))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),N0(X);return X.$refStrategy==="seen"?N0(X):void 0}}},pj=(Q,X,W)=>{if(Q.description){if(W.description=Q.description,X.markdownDescription)W.markdownDescription=Q.description}return W};var N5=(Q,X)=>{let W=j3(X),Y=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((B,[z,K])=>({...B,[z]:h(K._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??N0(W)}),{}):void 0,$=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,J=h(Q._def,$===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,$]},!1)??N0(W),G=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(G!==void 0)J.title=G;if(W.flags.hasReferencedOpenAiAnyType){if(!Y)Y={};if(!Y[W.openAiAnyTypeName])Y[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let H=$===void 0?Y?{...J,[W.definitionPath]:Y}:J:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,$].join("/"),[W.definitionPath]:{...Y,[$]:J}};if(W.target==="jsonSchema7")H.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")H.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in H)||("oneOf"in H)||("allOf"in H)||("type"in H)&&Array.isArray(H.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return H};function ij(Q){if(!Q)return"draft-7";if(Q==="jsonSchema7"||Q==="draft-7")return"draft-7";if(Q==="jsonSchema2019-09"||Q==="draft-2020-12")return"draft-2020-12";return"draft-7"}function M5(Q,X){if(o0(Q))return F8(Q,{target:ij(X?.target),io:X?.pipeStrategy??"input"});return N5(Q,{strictUnions:X?.strictUnions??!0,pipeStrategy:X?.pipeStrategy??"input"})}function j5(Q){let W=g1(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let Y=V8(W);if(typeof Y!=="string")throw Error("Schema method literal must be a string");return Y}function w5(Q,X){let W=h0(Q,X);if(!W.success)throw W.error;return W.data}var dj=60000;class n4{constructor(Q){if(this._options=Q,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._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(b8,(X)=>{this._oncancel(X)}),this.setNotificationHandler(Z8,(X)=>{this._onprogress(X)}),this.setRequestHandler(I8,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(S8,async(X,W)=>{let Y=await this._taskStore.getTask(X.params.taskId,W.sessionId);if(!Y)throw new S(k.InvalidParams,"Failed to retrieve task: Task not found");return{...Y}}),this.setRequestHandler(C8,async(X,W)=>{let Y=async()=>{let $=X.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue($,W.sessionId)){if(G.type==="response"||G.type==="error"){let H=G.message,B=H.id,z=this._requestResolvers.get(B);if(z)if(this._requestResolvers.delete(B),G.type==="response")z(H);else{let K=H,L=new S(K.error.code,K.error.message,K.error.data);z(L)}else{let K=G.type==="response"?"Response":"Error";this._onerror(Error(`${K} handler missing for request ${B}`))}continue}await this._transport?.send(G.message,{relatedRequestId:W.requestId})}}let J=await this._taskStore.getTask($,W.sessionId);if(!J)throw new S(k.InvalidParams,`Task not found: ${$}`);if(!U6(J.status))return await this._waitForTaskUpdate($,W.signal),await Y();if(U6(J.status)){let G=await this._taskStore.getTaskResult($,W.sessionId);return this._clearTaskQueue($),{...G,_meta:{...G._meta,[V6]:{taskId:$}}}}return await Y()};return await Y()}),this.setRequestHandler(T8,async(X,W)=>{try{let{tasks:Y,nextCursor:$}=await this._taskStore.listTasks(X.params?.cursor,W.sessionId);return{tasks:Y,nextCursor:$,_meta:{}}}catch(Y){throw new S(k.InvalidParams,`Failed to list tasks: ${Y instanceof Error?Y.message:String(Y)}`)}}),this.setRequestHandler(v8,async(X,W)=>{try{let Y=await this._taskStore.getTask(X.params.taskId,W.sessionId);if(!Y)throw new S(k.InvalidParams,`Task not found: ${X.params.taskId}`);if(U6(Y.status))throw new S(k.InvalidParams,`Cannot cancel task in terminal status: ${Y.status}`);await this._taskStore.updateTaskStatus(X.params.taskId,"cancelled","Client cancelled task execution.",W.sessionId),this._clearTaskQueue(X.params.taskId);let $=await this._taskStore.getTask(X.params.taskId,W.sessionId);if(!$)throw new S(k.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...$}}catch(Y){if(Y instanceof S)throw Y;throw new S(k.InvalidRequest,`Failed to cancel task: ${Y instanceof Error?Y.message:String(Y)}`)}})}async _oncancel(Q){if(!Q.params.requestId)return;this._requestHandlerAbortControllers.get(Q.params.requestId)?.abort(Q.params.reason)}_setupTimeout(Q,X,W,Y,$=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(Y,X),startTime:Date.now(),timeout:X,maxTotalTimeout:W,resetTimeoutOnProgress:$,onTimeout:Y})}_resetTimeout(Q){let X=this._timeoutInfo.get(Q);if(!X)return!1;let W=Date.now()-X.startTime;if(X.maxTotalTimeout&&W>=X.maxTotalTimeout)throw this._timeoutInfo.delete(Q),S.fromError(k.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:W});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(Q){let X=this._timeoutInfo.get(Q);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let W=this.transport?.onerror;this._transport.onerror=($)=>{W?.($),this._onerror($)};let Y=this._transport?.onmessage;this._transport.onmessage=($,J)=>{if(Y?.($,J),N1($)||k9($))this._onresponse($);else if(h1($))this._onrequest($,J);else if(J3($))this._onnotification($);else this._onerror(Error(`Unknown message type: ${JSON.stringify($)}`))},await this._transport.start()}_onclose(){let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let X=S.fromError(k.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let W of Q.values())W(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((W)=>this._onerror(Error(`Uncaught error in notification handler: ${W}`)))}_onrequest(Q,X){let W=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,Y=this._transport,$=Q.params?._meta?.[V6]?.taskId;if(W===void 0){let z={jsonrpc:"2.0",id:Q.id,error:{code:k.MethodNotFound,message:"Method not found"}};if($&&this._taskMessageQueue)this._enqueueTaskMessage($,{type:"error",message:z,timestamp:Date.now()},Y?.sessionId).catch((K)=>this._onerror(Error(`Failed to enqueue error response: ${K}`)));else Y?.send(z).catch((K)=>this._onerror(Error(`Failed to send an error response: ${K}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let G=W3(Q.params)?Q.params.task:void 0,H=this._taskStore?this.requestTaskStore(Q,Y?.sessionId):void 0,B={signal:J.signal,sessionId:Y?.sessionId,_meta:Q.params?._meta,sendNotification:async(z)=>{let K={relatedRequestId:Q.id};if($)K.relatedTask={taskId:$};await this.notification(z,K)},sendRequest:async(z,K,L)=>{let V={...L,relatedRequestId:Q.id};if($&&!V.relatedTask)V.relatedTask={taskId:$};let F=V.relatedTask?.taskId??$;if(F&&H)await H.updateTaskStatus(F,"input_required");return await this.request(z,K,V)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:$,taskStore:H,taskRequestedTtl:G?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(G)this.assertTaskHandlerCapability(Q.method)}).then(()=>W(Q,B)).then(async(z)=>{if(J.signal.aborted)return;let K={result:z,jsonrpc:"2.0",id:Q.id};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"response",message:K,timestamp:Date.now()},Y?.sessionId);else await Y?.send(K)},async(z)=>{if(J.signal.aborted)return;let K={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(z.code)?z.code:k.InternalError,message:z.message??"Internal error",...z.data!==void 0&&{data:z.data}}};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"error",message:K,timestamp:Date.now()},Y?.sessionId);else await Y?.send(K)}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...W}=Q.params,Y=Number(X),$=this._progressHandlers.get(Y);if(!$){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(Y),G=this._timeoutInfo.get(Y);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(H){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),J(H);return}$(W)}_onresponse(Q){let X=Number(Q.id),W=this._requestResolvers.get(X);if(W){if(this._requestResolvers.delete(X),N1(Q))W(Q);else{let J=new S(Q.error.code,Q.error.message,Q.error.data);W(J)}return}let Y=this._responseHandlers.get(X);if(Y===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let $=!1;if(N1(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let G=J.task;if(typeof G.taskId==="string")$=!0,this._taskProgressTokens.set(G.taskId,X)}}if(!$)this._progressHandlers.delete(X);if(N1(Q))Y(Q);else{let J=S.fromError(Q.error.code,Q.error.message,Q.error.data);Y(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,W){let{task:Y}=W??{};if(!Y){try{yield{type:"result",result:await this.request(Q,X,W)}}catch(J){yield{type:"error",error:J instanceof S?J:new S(k.InternalError,String(J))}}return}let $;try{let J=await this.request(Q,t1,W);if(J.task)$=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new S(k.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:$},W);if(yield{type:"taskStatus",task:G},U6(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:$},X,W)};else if(G.status==="failed")yield{type:"error",error:new S(k.InternalError,`Task ${$} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new S(k.InternalError,`Task ${$} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:$},X,W)};return}let H=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,H)),W?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof S?J:new S(k.InternalError,String(J))}}}request(Q,X,W){let{relatedRequestId:Y,resumptionToken:$,onresumptiontoken:J,task:G,relatedTask:H}=W??{};return new Promise((B,z)=>{let K=(U)=>{z(U)};if(!this._transport){K(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),G)this.assertTaskCapability(Q.method)}catch(U){K(U);return}W?.signal?.throwIfAborted();let L=this._requestMessageId++,V={...Q,jsonrpc:"2.0",id:L};if(W?.onprogress)this._progressHandlers.set(L,W.onprogress),V.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:L}};if(G)V.params={...V.params,task:G};if(H)V.params={...V.params,_meta:{...V.params?._meta||{},[V6]:H}};let F=(U)=>{this._responseHandlers.delete(L),this._progressHandlers.delete(L),this._cleanupTimeout(L),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:L,reason:String(U)}},{relatedRequestId:Y,resumptionToken:$,onresumptiontoken:J}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let j=U instanceof S?U:new S(k.RequestTimeout,String(U));z(j)};this._responseHandlers.set(L,(U)=>{if(W?.signal?.aborted)return;if(U instanceof Error)return z(U);try{let j=h0(X,U.result);if(!j.success)z(j.error);else B(j.data)}catch(j){z(j)}}),W?.signal?.addEventListener("abort",()=>{F(W?.signal?.reason)});let D=W?.timeout??dj,A=()=>F(S.fromError(k.RequestTimeout,"Request timed out",{timeout:D}));this._setupTimeout(L,D,W?.maxTotalTimeout,A,W?.resetTimeoutOnProgress??!1);let O=H?.taskId;if(O){let U=(j)=>{let w=this._responseHandlers.get(L);if(w)w(j);else this._onerror(Error(`Response handler missing for side-channeled request ${L}`))};this._requestResolvers.set(L,U),this._enqueueTaskMessage(O,{type:"request",message:V,timestamp:Date.now()}).catch((j)=>{this._cleanupTimeout(L),z(j)})}else this._transport.send(V,{relatedRequestId:Y,resumptionToken:$,onresumptiontoken:J}).catch((U)=>{this._cleanupTimeout(L),z(U)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},R8,X)}async getTaskResult(Q,X,W){return this.request({method:"tasks/result",params:Q},X,W)}async listTasks(Q,X){return this.request({method:"tasks/list",params:Q},k8,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},B3,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let W=X?.relatedTask?.taskId;if(W){let G={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[V6]:X.relatedTask}}};await this._enqueueTaskMessage(W,{type:"notification",message:G,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let G={...Q,jsonrpc:"2.0"};if(X?.relatedTask)G={...G,params:{...G.params,_meta:{...G.params?._meta||{},[V6]:X.relatedTask}}};this._transport?.send(G,X).catch((H)=>this._onerror(H))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[V6]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let W=j5(Q);this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(Y,$)=>{let J=w5(Q,Y);return Promise.resolve(X(J,$))})}removeRequestHandler(Q){this._requestHandlers.delete(Q)}assertCanSetRequestHandler(Q){if(this._requestHandlers.has(Q))throw Error(`A request handler for ${Q} already exists, which would be overridden`)}setNotificationHandler(Q,X){let W=j5(Q);this._notificationHandlers.set(W,(Y)=>{let $=w5(Q,Y);return Promise.resolve(X($))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let X=this._taskProgressTokens.get(Q);if(X!==void 0)this._progressHandlers.delete(X),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,X,W){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let Y=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(Q,X,W,Y)}async _clearTaskQueue(Q,X){if(this._taskMessageQueue){let W=await this._taskMessageQueue.dequeueAll(Q,X);for(let Y of W)if(Y.type==="request"&&h1(Y.message)){let $=Y.message.id,J=this._requestResolvers.get($);if(J)J(new S(k.InternalError,"Task cancelled or completed")),this._requestResolvers.delete($);else this._onerror(Error(`Resolver missing for request ${$} during task ${Q} cleanup`))}}}async _waitForTaskUpdate(Q,X){let W=this._options?.defaultTaskPollInterval??1000;try{let Y=await this._taskStore?.getTask(Q);if(Y?.pollInterval)W=Y.pollInterval}catch{}return new Promise((Y,$)=>{if(X.aborted){$(new S(k.InvalidRequest,"Request cancelled"));return}let J=setTimeout(Y,W);X.addEventListener("abort",()=>{clearTimeout(J),$(new S(k.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,X){let W=this._taskStore;if(!W)throw Error("No task store configured");return{createTask:async(Y)=>{if(!Q)throw Error("No request provided");return await W.createTask(Y,Q.id,{method:Q.method,params:Q.params},X)},getTask:async(Y)=>{let $=await W.getTask(Y,X);if(!$)throw new S(k.InvalidParams,"Failed to retrieve task: Task not found");return $},storeTaskResult:async(Y,$,J)=>{await W.storeTaskResult(Y,$,J,X);let G=await W.getTask(Y,X);if(G){let H=f4.parse({method:"notifications/tasks/status",params:G});if(await this.notification(H),U6(G.status))this._cleanupTaskProgressHandler(Y)}},getTaskResult:(Y)=>{return W.getTaskResult(Y,X)},updateTaskStatus:async(Y,$,J)=>{let G=await W.getTask(Y,X);if(!G)throw new S(k.InvalidParams,`Task "${Y}" not found - it may have been cleaned up`);if(U6(G.status))throw new S(k.InvalidParams,`Cannot update task "${Y}" from terminal status "${G.status}" to "${$}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await W.updateTaskStatus(Y,$,J,X);let H=await W.getTask(Y,X);if(H){let B=f4.parse({method:"notifications/tasks/status",params:H});if(await this.notification(B),U6(H.status))this._cleanupTaskProgressHandler(Y)}},listTasks:(Y)=>{return W.listTasks(Y,X)}}}}function t3(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function i8(Q,X){let W={...Q};for(let Y in X){let $=Y,J=X[$];if(J===void 0)continue;let G=W[$];if(t3(G)&&t3(J))W[$]={...G,...J};else W[$]=J}return W}var RO=CW(KF(),1),CO=CW(SO(),1);function Fy(){let Q=new RO.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return CO.default(Q),Q}class hQ{constructor(Q){this._ajv=Q??Fy()}getValidator(Q){let X="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(W)=>{if(X(W))return{valid:!0,data:W,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(X.errors)}}}}class FJ{constructor(Q){this._server=Q}requestStream(Q,X,W){return this._server.requestStream(Q,X,W)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,W){return this._server.getTaskResult({taskId:Q},X,W)}async listTasks(Q,X){return this._server.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._server.cancelTask({taskId:Q},X)}}function zW(Q,X,W){if(!Q)throw Error(`${W} does not support task creation (required for ${X})`);switch(X){case"tools/call":if(!Q.tools?.call)throw Error(`${W} does not support task creation for tools/call (required for ${X})`);break;default:break}}function KW(Q,X,W){if(!Q)throw Error(`${W} does not support task creation (required for ${X})`);switch(X){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${W} does not support task creation for sampling/createMessage (required for ${X})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${W} does not support task creation for elicitation/create (required for ${X})`);break;default:break}}class AJ extends n4{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(m4.options.map((W,Y)=>[W,Y])),this.isMessageIgnored=(W,Y)=>{let $=this._loggingLevels.get(Y);return $?this.LOG_LEVEL_SEVERITY.get(W)<this.LOG_LEVEL_SEVERITY.get($):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new hQ,this.setRequestHandler(E8,(W)=>this._oninitialize(W)),this.setNotificationHandler(P8,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(K5,async(W,Y)=>{let $=Y.sessionId||Y.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=W.params,G=m4.safeParse(J);if(G.success)this._loggingLevels.set($,G.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new FJ(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=i8(this._capabilities,Q)}setRequestHandler(Q,X){let Y=g1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let $;if(o0(Y)){let G=Y;$=G._zod?.def?.value??G.value}else{let G=Y;$=G._def?.value??G.value}if(typeof $!=="string")throw Error("Schema method literal must be a string");if($==="tools/call"){let G=async(H,B)=>{let z=h0(_9,H);if(!z.success){let F=z.error instanceof Error?z.error.message:String(z.error);throw new S(k.InvalidParams,`Invalid tools/call request: ${F}`)}let{params:K}=z.data,L=await Promise.resolve(X(H,B));if(K.task){let F=h0(t1,L);if(!F.success){let D=F.error instanceof Error?F.error.message:String(F.error);throw new S(k.InvalidParams,`Invalid task creation result: ${D}`)}return F.data}let V=h0(O6,L);if(!V.success){let F=V.error instanceof Error?V.error.message:String(V.error);throw new S(k.InvalidParams,`Invalid tools/call result: ${F}`)}return V.data};return super.setRequestHandler(Q,G)}return super.setRequestHandler(Q,X)}assertCapabilityForMethod(Q){switch(Q){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${Q})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${Q})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${Q})`);break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${Q})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${Q})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${Q})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${Q})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${Q})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${Q})`);break;case"ping":case"initialize":break}}assertTaskCapability(Q){KW(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;zW(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let X=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:n6.includes(X)?X:D6,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"},r1)}async createMessage(Q,X){if(Q.tools||Q.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(Q.messages.length>0){let W=Q.messages[Q.messages.length-1],Y=Array.isArray(W.content)?W.content:[W.content],$=Y.some((B)=>B.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,G=J?Array.isArray(J.content)?J.content:[J.content]:[],H=G.some((B)=>B.type==="tool_use");if($){if(Y.some((B)=>B.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!H)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(H){let B=new Set(G.filter((K)=>K.type==="tool_use").map((K)=>K.id)),z=new Set(Y.filter((K)=>K.type==="tool_result").map((K)=>K.toolUseId));if(B.size!==z.size||![...B].every((K)=>z.has(K)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},F5,X);return this.request({method:"sampling/createMessage",params:Q},p4,X)}async elicitInput(Q,X){switch(Q.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let Y=Q;return this.request({method:"elicitation/create",params:Y},x9,X)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let Y=Q.mode==="form"?Q:{...Q,mode:"form"},$=await this.request({method:"elicitation/create",params:Y},x9,X);if($.action==="accept"&&$.content&&Y.requestedSchema)try{let G=this._jsonSchemaValidator.getValidator(Y.requestedSchema)($.content);if(!G.valid)throw new S(k.InvalidParams,`Elicitation response content does not match requested schema: ${G.errorMessage}`)}catch(J){if(J instanceof S)throw J;throw new S(k.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return $}}}createElicitationCompletionNotifier(Q,X){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:Q}},X)}async listRoots(Q,X){return this.request({method:"roots/list",params:Q},D5,X)}async sendLoggingMessage(Q,X){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,X))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}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"})}}var kO=Symbol.for("mcp.completable");function DJ(Q){return!!Q&&typeof Q==="object"&&kO in Q}function vO(Q){return Q[kO]?.complete}var TO;(function(Q){Q.Completable="McpCompletable"})(TO||(TO={}));var Ay=/^[A-Za-z0-9._-]{1,128}$/;function Dy(Q){let X=[];if(Q.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(Q.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${Q.length})`]};if(Q.includes(" "))X.push("Tool name contains spaces, which may cause parsing issues");if(Q.includes(","))X.push("Tool name contains commas, which may cause parsing issues");if(Q.startsWith("-")||Q.endsWith("-"))X.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(Q.startsWith(".")||Q.endsWith("."))X.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Ay.test(Q)){let W=Q.split("").filter((Y)=>!/[A-Za-z0-9._-]/.test(Y)).filter((Y,$,J)=>J.indexOf(Y)===$);return X.push(`Tool name contains invalid characters: ${W.map((Y)=>`"${Y}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:X}}return{isValid:!0,warnings:X}}function Vy(Q,X){if(X.length>0){console.warn(`Tool name validation warning for "${Q}":`);for(let W of X)console.warn(` - ${W}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function VJ(Q){let X=Dy(Q);return Vy(Q,X.warnings),X.isValid}class OJ{constructor(Q){this._mcpServer=Q}registerToolTask(Q,X,W){let Y={taskSupport:"required",...X.execution};if(Y.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${Q}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(Q,X.title,X.description,X.inputSchema,X.outputSchema,X.annotations,Y,X._meta,W)}}class qJ{constructor(Q,X){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new AJ(Q,X)}get experimental(){if(!this._experimental)this._experimental={tasks:new OJ(this)};return this._experimental}async connect(Q){return await this.server.connect(Q)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(T6(h8)),this.server.assertCanSetRequestHandler(T6(_9)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(h8,()=>({tools:Object.entries(this._registeredTools).filter(([,Q])=>Q.enabled).map(([Q,X])=>{let W={name:Q,title:X.title,description:X.description,inputSchema:(()=>{let Y=C9(X.inputSchema);return Y?M5(Y,{strictUnions:!0,pipeStrategy:"input"}):Oy})(),annotations:X.annotations,execution:X.execution,_meta:X._meta};if(X.outputSchema){let Y=C9(X.outputSchema);if(Y)W.outputSchema=M5(Y,{strictUnions:!0,pipeStrategy:"output"})}return W})})),this.server.setRequestHandler(_9,async(Q,X)=>{try{let W=this._registeredTools[Q.params.name];if(!W)throw new S(k.InvalidParams,`Tool ${Q.params.name} not found`);if(!W.enabled)throw new S(k.InvalidParams,`Tool ${Q.params.name} disabled`);let Y=!!Q.params.task,$=W.execution?.taskSupport,J="createTask"in W.handler;if(($==="required"||$==="optional")&&!J)throw new S(k.InternalError,`Tool ${Q.params.name} has taskSupport '${$}' but was not registered with registerToolTask`);if($==="required"&&!Y)throw new S(k.MethodNotFound,`Tool ${Q.params.name} requires task augmentation (taskSupport: 'required')`);if($==="optional"&&!Y&&J)return await this.handleAutomaticTaskPolling(W,Q,X);let G=await this.validateToolInput(W,Q.params.arguments,Q.params.name),H=await this.executeToolHandler(W,G,X);if(Y)return H;return await this.validateToolOutput(W,H,Q.params.name),H}catch(W){if(W instanceof S){if(W.code===k.UrlElicitationRequired)throw W}return this.createToolError(W instanceof Error?W.message:String(W))}}),this._toolHandlersInitialized=!0}createToolError(Q){return{content:[{type:"text",text:Q}],isError:!0}}async validateToolInput(Q,X,W){if(!Q.inputSchema)return;let $=C9(Q.inputSchema)??Q.inputSchema,J=await A8($,X);if(!J.success){let G="error"in J?J.error:"Unknown error",H=D8(G);throw new S(k.InvalidParams,`Input validation error: Invalid arguments for tool ${W}: ${H}`)}return J.data}async validateToolOutput(Q,X,W){if(!Q.outputSchema)return;if(!("content"in X))return;if(X.isError)return;if(!X.structuredContent)throw new S(k.InvalidParams,`Output validation error: Tool ${W} has an output schema but no structured content was provided`);let Y=C9(Q.outputSchema),$=await A8(Y,X.structuredContent);if(!$.success){let J="error"in $?$.error:"Unknown error",G=D8(J);throw new S(k.InvalidParams,`Output validation error: Invalid structured content for tool ${W}: ${G}`)}}async executeToolHandler(Q,X,W){let Y=Q.handler;if("createTask"in Y){if(!W.taskStore)throw Error("No task store provided.");let J={...W,taskStore:W.taskStore};if(Q.inputSchema)return await Promise.resolve(Y.createTask(X,J));else return await Promise.resolve(Y.createTask(J))}if(Q.inputSchema)return await Promise.resolve(Y(X,W));else return await Promise.resolve(Y(W))}async handleAutomaticTaskPolling(Q,X,W){if(!W.taskStore)throw Error("No task store provided for task-capable tool.");let Y=await this.validateToolInput(Q,X.params.arguments,X.params.name),$=Q.handler,J={...W,taskStore:W.taskStore},G=Y?await Promise.resolve($.createTask(Y,J)):await Promise.resolve($.createTask(J)),H=G.task.taskId,B=G.task,z=B.pollInterval??5000;while(B.status!=="completed"&&B.status!=="failed"&&B.status!=="cancelled"){await new Promise((L)=>setTimeout(L,z));let K=await W.taskStore.getTask(H);if(!K)throw new S(k.InternalError,`Task ${H} not found during polling`);B=K}return await W.taskStore.getTaskResult(H)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(T6(u8)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(u8,async(Q)=>{switch(Q.params.ref.type){case"ref/prompt":return V3(Q),this.handlePromptCompletion(Q,Q.params.ref);case"ref/resource":return O3(Q),this.handleResourceCompletion(Q,Q.params.ref);default:throw new S(k.InvalidParams,`Invalid completion reference: ${Q.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(Q,X){let W=this._registeredPrompts[X.name];if(!W)throw new S(k.InvalidParams,`Prompt ${X.name} not found`);if(!W.enabled)throw new S(k.InvalidParams,`Prompt ${X.name} disabled`);if(!W.argsSchema)return uQ;let $=g1(W.argsSchema)?.[Q.params.argument.name];if(!DJ($))return uQ;let J=vO($);if(!J)return uQ;let G=await J(Q.params.argument.value,Q.params.context);return xO(G)}async handleResourceCompletion(Q,X){let W=Object.values(this._registeredResourceTemplates).find((J)=>J.resourceTemplate.uriTemplate.toString()===X.uri);if(!W){if(this._registeredResources[X.uri])return uQ;throw new S(k.InvalidParams,`Resource template ${Q.params.ref.uri} not found`)}let Y=W.resourceTemplate.completeCallback(Q.params.argument.name);if(!Y)return uQ;let $=await Y(Q.params.argument.value,Q.params.context);return xO($)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(T6(_8)),this.server.assertCanSetRequestHandler(T6(x8)),this.server.assertCanSetRequestHandler(T6(y8)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(_8,async(Q,X)=>{let W=Object.entries(this._registeredResources).filter(([$,J])=>J.enabled).map(([$,J])=>({uri:$,name:J.name,...J.metadata})),Y=[];for(let $ of Object.values(this._registeredResourceTemplates)){if(!$.resourceTemplate.listCallback)continue;let J=await $.resourceTemplate.listCallback(X);for(let G of J.resources)Y.push({...$.metadata,...G})}return{resources:[...W,...Y]}}),this.server.setRequestHandler(x8,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,W])=>({name:X,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(y8,async(Q,X)=>{let W=new URL(Q.params.uri),Y=this._registeredResources[W.toString()];if(Y){if(!Y.enabled)throw new S(k.InvalidParams,`Resource ${W} disabled`);return Y.readCallback(W,X)}for(let $ of Object.values(this._registeredResourceTemplates)){let J=$.resourceTemplate.uriTemplate.match(W.toString());if(J)return $.readCallback(W,J,X)}throw new S(k.InvalidParams,`Resource ${W} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(T6(f8)),this.server.assertCanSetRequestHandler(T6(g8)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(f8,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,Q])=>Q.enabled).map(([Q,X])=>{return{name:Q,title:X.title,description:X.description,arguments:X.argsSchema?qy(X.argsSchema):void 0}})})),this.server.setRequestHandler(g8,async(Q,X)=>{let W=this._registeredPrompts[Q.params.name];if(!W)throw new S(k.InvalidParams,`Prompt ${Q.params.name} not found`);if(!W.enabled)throw new S(k.InvalidParams,`Prompt ${Q.params.name} disabled`);if(W.argsSchema){let Y=C9(W.argsSchema),$=await A8(Y,Q.params.arguments);if(!$.success){let H="error"in $?$.error:"Unknown error",B=D8(H);throw new S(k.InvalidParams,`Invalid arguments for prompt ${Q.params.name}: ${B}`)}let J=$.data,G=W.callback;return await Promise.resolve(G(J,X))}else{let Y=W.callback;return await Promise.resolve(Y(X))}}),this._promptHandlersInitialized=!0}resource(Q,X,...W){let Y;if(typeof W[0]==="object")Y=W.shift();let $=W[0];if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let J=this._createRegisteredResource(Q,void 0,X,Y,$);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}else{if(this._registeredResourceTemplates[Q])throw Error(`Resource template ${Q} is already registered`);let J=this._createRegisteredResourceTemplate(Q,void 0,X,Y,$);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}}registerResource(Q,X,W,Y){if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let $=this._createRegisteredResource(Q,W.title,X,W,Y);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}else{if(this._registeredResourceTemplates[Q])throw Error(`Resource template ${Q} is already registered`);let $=this._createRegisteredResourceTemplate(Q,W.title,X,W,Y);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}}_createRegisteredResource(Q,X,W,Y,$){let J={name:Q,title:X,metadata:Y,readCallback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({uri:null}),update:(G)=>{if(typeof G.uri<"u"&&G.uri!==W){if(delete this._registeredResources[W],G.uri)this._registeredResources[G.uri]=J}if(typeof G.name<"u")J.name=G.name;if(typeof G.title<"u")J.title=G.title;if(typeof G.metadata<"u")J.metadata=G.metadata;if(typeof G.callback<"u")J.readCallback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=J,J}_createRegisteredResourceTemplate(Q,X,W,Y,$){let J={resourceTemplate:W,title:X,metadata:Y,readCallback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(B)=>{if(typeof B.name<"u"&&B.name!==Q){if(delete this._registeredResourceTemplates[Q],B.name)this._registeredResourceTemplates[B.name]=J}if(typeof B.title<"u")J.title=B.title;if(typeof B.template<"u")J.resourceTemplate=B.template;if(typeof B.metadata<"u")J.metadata=B.metadata;if(typeof B.callback<"u")J.readCallback=B.callback;if(typeof B.enabled<"u")J.enabled=B.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[Q]=J;let G=W.uriTemplate.variableNames;if(Array.isArray(G)&&G.some((B)=>!!W.completeCallback(B)))this.setCompletionRequestHandler();return J}_createRegisteredPrompt(Q,X,W,Y,$){let J={title:X,description:W,argsSchema:Y===void 0?void 0:d6(Y),callback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(G)=>{if(typeof G.name<"u"&&G.name!==Q){if(delete this._registeredPrompts[Q],G.name)this._registeredPrompts[G.name]=J}if(typeof G.title<"u")J.title=G.title;if(typeof G.description<"u")J.description=G.description;if(typeof G.argsSchema<"u")J.argsSchema=d6(G.argsSchema);if(typeof G.callback<"u")J.callback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[Q]=J,Y){if(Object.values(Y).some((H)=>{let B=H instanceof $1?H._def?.innerType:H;return DJ(B)}))this.setCompletionRequestHandler()}return J}_createRegisteredTool(Q,X,W,Y,$,J,G,H,B){VJ(Q);let z={title:X,description:W,inputSchema:_O(Y),outputSchema:_O($),annotations:J,execution:G,_meta:H,handler:B,enabled:!0,disable:()=>z.update({enabled:!1}),enable:()=>z.update({enabled:!0}),remove:()=>z.update({name:null}),update:(K)=>{if(typeof K.name<"u"&&K.name!==Q){if(typeof K.name==="string")VJ(K.name);if(delete this._registeredTools[Q],K.name)this._registeredTools[K.name]=z}if(typeof K.title<"u")z.title=K.title;if(typeof K.description<"u")z.description=K.description;if(typeof K.paramsSchema<"u")z.inputSchema=d6(K.paramsSchema);if(typeof K.outputSchema<"u")z.outputSchema=d6(K.outputSchema);if(typeof K.callback<"u")z.handler=K.callback;if(typeof K.annotations<"u")z.annotations=K.annotations;if(typeof K._meta<"u")z._meta=K._meta;if(typeof K.enabled<"u")z.enabled=K.enabled;this.sendToolListChanged()}};return this._registeredTools[Q]=z,this.setToolRequestHandlers(),this.sendToolListChanged(),z}tool(Q,...X){if(this._registeredTools[Q])throw Error(`Tool ${Q} is already registered`);let W,Y,$,J;if(typeof X[0]==="string")W=X.shift();if(X.length>1){let H=X[0];if(UJ(H)){if(Y=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!UJ(X[0]))J=X.shift()}else if(typeof H==="object"&&H!==null)J=X.shift()}let G=X[0];return this._createRegisteredTool(Q,void 0,W,Y,$,J,{taskSupport:"forbidden"},void 0,G)}registerTool(Q,X,W){if(this._registeredTools[Q])throw Error(`Tool ${Q} is already registered`);let{title:Y,description:$,inputSchema:J,outputSchema:G,annotations:H,_meta:B}=X;return this._createRegisteredTool(Q,Y,$,J,G,H,{taskSupport:"forbidden"},B,W)}prompt(Q,...X){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let W;if(typeof X[0]==="string")W=X.shift();let Y;if(X.length>1)Y=X.shift();let $=X[0],J=this._createRegisteredPrompt(Q,void 0,W,Y,$);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),J}registerPrompt(Q,X,W){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let{title:Y,description:$,argsSchema:J}=X,G=this._createRegisteredPrompt(Q,Y,$,J,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),G}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(Q,X){return this.server.sendLoggingMessage(Q,X)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var Oy={type:"object",properties:{}};function yO(Q){return Q!==null&&typeof Q==="object"&&"parse"in Q&&typeof Q.parse==="function"&&"safeParse"in Q&&typeof Q.safeParse==="function"}function Uy(Q){return"_def"in Q||"_zod"in Q||yO(Q)}function UJ(Q){if(typeof Q!=="object"||Q===null)return!1;if(Uy(Q))return!1;if(Object.keys(Q).length===0)return!0;return Object.values(Q).some(yO)}function _O(Q){if(!Q)return;if(UJ(Q))return d6(Q);return Q}function qy(Q){let X=g1(Q);if(!X)return[];return Object.entries(X).map(([W,Y])=>{let $=EH(Y),J=PH(Y);return{name:W,description:$,required:!J}})}function T6(Q){let W=g1(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let Y=V8(W);if(typeof Y==="string")return Y;throw Error("Schema method literal must be a string")}function xO(Q){return{completion:{values:Q.slice(0,100),total:Q.length,hasMore:Q.length>100}}}var uQ={completion:{values:[],hasMore:!1}};import{Http2ServerRequest as Ny}from"http2";import{Http2ServerRequest as NJ}from"http2";import{Readable as fO}from"stream";import Ty from"crypto";var H9=class extends Error{constructor(Q,X){super(Q,X);this.name="RequestError"}},My=(Q)=>{if(Q instanceof H9)return Q;return new H9(Q.message,{cause:Q})},jy=global.Request,lQ=class extends jy{constructor(Q,X){if(typeof Q==="object"&&J4 in Q)Q=Q[J4]();if(typeof X?.body?.getReader<"u")X.duplex??="half";super(Q,X)}},wy=(Q)=>{let X=[],W=Q.rawHeaders;for(let Y=0;Y<W.length;Y+=2){let{[Y]:$,[Y+1]:J}=W;if($.charCodeAt(0)!==58)X.push([$,J])}return new Headers(X)},hO=Symbol("wrapBodyStream"),by=(Q,X,W,Y,$)=>{let J={method:Q,headers:W,signal:$.signal};if(Q==="TRACE"){J.method="GET";let G=new lQ(X,J);return Object.defineProperty(G,"method",{get(){return"TRACE"}}),G}if(!(Q==="GET"||Q==="HEAD"))if("rawBody"in Y&&Y.rawBody instanceof Buffer)J.body=new ReadableStream({start(G){G.enqueue(Y.rawBody),G.close()}});else if(Y[hO]){let G;J.body=new ReadableStream({async pull(H){try{G||=fO.toWeb(Y).getReader();let{done:B,value:z}=await G.read();if(B)H.close();else H.enqueue(z)}catch(B){H.error(B)}}})}else J.body=fO.toWeb(Y);return new lQ(X,J)},J4=Symbol("getRequestCache"),Ey=Symbol("requestCache"),LW=Symbol("incomingKey"),FW=Symbol("urlKey"),Py=Symbol("headersKey"),$4=Symbol("abortControllerKey"),Iy=Symbol("getAbortController"),AW={get method(){return this[LW].method||"GET"},get url(){return this[FW]},get headers(){return this[Py]||=wy(this[LW])},[Iy](){return this[J4](),this[$4]},[J4](){return this[$4]||=new AbortController,this[Ey]||=by(this.method,this[FW],this.headers,this[LW],this[$4])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((Q)=>{Object.defineProperty(AW,Q,{get(){return this[J4]()[Q]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((Q)=>{Object.defineProperty(AW,Q,{value:function(){return this[J4]()[Q]()}})});Object.setPrototypeOf(AW,lQ.prototype);var Zy=(Q,X)=>{let W=Object.create(AW);W[LW]=Q;let Y=Q.url||"";if(Y[0]!=="/"&&(Y.startsWith("http://")||Y.startsWith("https://"))){if(Q instanceof NJ)throw new H9("Absolute URL for :path is not allowed in HTTP/2");try{let H=new URL(Y);W[FW]=H.href}catch(H){throw new H9("Invalid absolute URL",{cause:H})}return W}let $=(Q instanceof NJ?Q.authority:Q.headers.host)||X;if(!$)throw new H9("Missing host header");let J;if(Q instanceof NJ){if(J=Q.scheme,!(J==="http"||J==="https"))throw new H9("Unsupported scheme")}else J=Q.socket&&Q.socket.encrypted?"https":"http";let G=new URL(`${J}://${$}${Y}`);if(G.hostname.length!==$.length&&G.hostname!==$.replace(/:\d+$/,""))throw new H9("Invalid host header");return W[FW]=G.href,W},gO=Symbol("responseCache"),Y4=Symbol("getResponseCache"),B9=Symbol("cache"),jJ=global.Response,mQ=class Q{#X;#Q;[Y4](){return delete this[B9],this[gO]||=new jJ(this.#X,this.#Q)}constructor(X,W){let Y;if(this.#X=X,W instanceof Q){let $=W[gO];if($){this.#Q=$,this[Y4]();return}else this.#Q=W.#Q,Y=new Headers(W.#Q.headers)}else this.#Q=W;if(typeof X==="string"||typeof X?.getReader<"u"||X instanceof Blob||X instanceof Uint8Array)Y||=W?.headers||{"content-type":"text/plain; charset=UTF-8"},this[B9]=[W?.status||200,X,Y]}get headers(){let X=this[B9];if(X){if(!(X[2]instanceof Headers))X[2]=new Headers(X[2]);return X[2]}return this[Y4]().headers}get status(){return this[B9]?.[0]??this[Y4]().status}get ok(){let X=this.status;return X>=200&&X<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((Q)=>{Object.defineProperty(mQ.prototype,Q,{get(){return this[Y4]()[Q]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach((Q)=>{Object.defineProperty(mQ.prototype,Q,{value:function(){return this[Y4]()[Q]()}})});Object.setPrototypeOf(mQ,jJ);Object.setPrototypeOf(mQ.prototype,jJ.prototype);async function Sy(Q){return Promise.race([Q,Promise.resolve().then(()=>Promise.resolve(void 0))])}function uO(Q,X,W){let Y=(H)=>{Q.cancel(H).catch(()=>{})};return X.on("close",Y),X.on("error",Y),(W??Q.read()).then(G,$),Q.closed.finally(()=>{X.off("close",Y),X.off("error",Y)});function $(H){if(H)X.destroy(H)}function J(){Q.read().then(G,$)}function G({done:H,value:B}){try{if(H)X.end();else if(!X.write(B))X.once("drain",J);else return Q.read().then(G,$)}catch(z){$(z)}}}function Ry(Q,X){if(Q.locked)throw TypeError("ReadableStream is locked.");else if(X.destroyed)return;return uO(Q.getReader(),X)}var lO=(Q)=>{let X={};if(!(Q instanceof Headers))Q=new Headers(Q??void 0);let W=[];for(let[Y,$]of Q)if(Y==="set-cookie")W.push($);else X[Y]=$;if(W.length>0)X["set-cookie"]=W;return X["content-type"]??="text/plain; charset=UTF-8",X},Cy="x-hono-already-sent",ky=global.fetch;if(typeof global.crypto>"u")global.crypto=Ty;global.fetch=(Q,X)=>{return X={compress:!1,...X},ky(Q,X)};var wJ=Symbol("outgoingEnded"),vy=()=>new Response(null,{status:400}),mO=(Q)=>new Response(null,{status:Q instanceof Error&&(Q.name==="TimeoutError"||Q.constructor.name==="TimeoutError")?504:500}),MJ=(Q,X)=>{let W=Q instanceof Error?Q:Error("unknown error",{cause:Q});if(W.code==="ERR_STREAM_PREMATURE_CLOSE")console.info("The user aborted a request.");else{if(console.error(Q),!X.headersSent)X.writeHead(500,{"Content-Type":"text/plain"});X.end(`Error: ${W.message}`),X.destroy(W)}},cO=(Q)=>{if("flushHeaders"in Q&&Q.writable)Q.flushHeaders()},pO=async(Q,X)=>{let[W,Y,$]=Q[B9];if($ instanceof Headers)$=lO($);if(typeof Y==="string")$["Content-Length"]=Buffer.byteLength(Y);else if(Y instanceof Uint8Array)$["Content-Length"]=Y.byteLength;else if(Y instanceof Blob)$["Content-Length"]=Y.size;if(X.writeHead(W,$),typeof Y==="string"||Y instanceof Uint8Array)X.end(Y);else if(Y instanceof Blob)X.end(new Uint8Array(await Y.arrayBuffer()));else cO(X),await Ry(Y,X)?.catch((J)=>MJ(J,X));X[wJ]?.()},_y=(Q)=>typeof Q.then==="function",xy=async(Q,X,W={})=>{if(_y(Q))if(W.errorHandler)try{Q=await Q}catch($){let J=await W.errorHandler($);if(!J)return;Q=J}else Q=await Q.catch(mO);if(B9 in Q)return pO(Q,X);let Y=lO(Q.headers);if(Q.body){let $=Q.body.getReader(),J=[],G=!1,H=void 0;if(Y["transfer-encoding"]!=="chunked"){let B=2;for(let z=0;z<B;z++){H||=$.read();let K=await Sy(H).catch((L)=>{console.error(L),G=!0});if(!K){if(z===1){await new Promise((L)=>setTimeout(L)),B=3;continue}break}if(H=void 0,K.value)J.push(K.value);if(K.done){G=!0;break}}if(G&&!("content-length"in Y))Y["content-length"]=J.reduce((z,K)=>z+K.length,0)}if(X.writeHead(Q.status,Y),J.forEach((B)=>{X.write(B)}),G)X.end();else{if(J.length===0)cO(X);await uO($,X,H)}}else if(Y[Cy]);else X.writeHead(Q.status,Y),X.end();X[wJ]?.()},bJ=(Q,X={})=>{let W=X.autoCleanupIncoming??!0;if(X.overrideGlobalObjects!==!1&&global.Request!==lQ)Object.defineProperty(global,"Request",{value:lQ}),Object.defineProperty(global,"Response",{value:mQ});return async(Y,$)=>{let J,G;try{G=Zy(Y,X.hostname);let H=!W||Y.method==="GET"||Y.method==="HEAD";if(!H){if(Y[hO]=!0,Y.on("end",()=>{H=!0}),Y instanceof Ny)$[wJ]=()=>{if(!H)setTimeout(()=>{if(!H)setTimeout(()=>{Y.destroy(),$.destroy()})})}}if($.on("close",()=>{if(G[$4]){if(Y.errored)G[$4].abort(Y.errored.toString());else if(!$.writableFinished)G[$4].abort("Client connection prematurely closed.")}if(!H)setTimeout(()=>{if(!H)setTimeout(()=>{Y.destroy()})})}),J=Q(G,{incoming:Y,outgoing:$}),B9 in J)return pO(J,$)}catch(H){if(!J)if(X.errorHandler){if(J=await X.errorHandler(G?H:My(H)),!J)return}else if(!G)J=vy();else J=mO(H);else return MJ(H,$)}try{return await xy(J,$,X)}catch(H){return MJ(H,$)}}};class EJ{constructor(Q={}){this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=Q.sessionIdGenerator,this._enableJsonResponse=Q.enableJsonResponse??!1,this._eventStore=Q.eventStore,this._onsessioninitialized=Q.onsessioninitialized,this._onsessionclosed=Q.onsessionclosed,this._allowedHosts=Q.allowedHosts,this._allowedOrigins=Q.allowedOrigins,this._enableDnsRebindingProtection=Q.enableDnsRebindingProtection??!1,this._retryInterval=Q.retryInterval}async start(){if(this._started)throw Error("Transport already started");this._started=!0}createJsonErrorResponse(Q,X,W,Y){let $={code:X,message:W};if(Y?.data!==void 0)$.data=Y.data;return new Response(JSON.stringify({jsonrpc:"2.0",error:$,id:null}),{status:Q,headers:{"Content-Type":"application/json",...Y?.headers}})}validateRequestHeaders(Q){if(!this._enableDnsRebindingProtection)return;if(this._allowedHosts&&this._allowedHosts.length>0){let X=Q.headers.get("host");if(!X||!this._allowedHosts.includes(X)){let W=`Invalid Host header: ${X}`;return this.onerror?.(Error(W)),this.createJsonErrorResponse(403,-32000,W)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let X=Q.headers.get("origin");if(X&&!this._allowedOrigins.includes(X)){let W=`Invalid Origin header: ${X}`;return this.onerror?.(Error(W)),this.createJsonErrorResponse(403,-32000,W)}}return}async handleRequest(Q,X){let W=this.validateRequestHeaders(Q);if(W)return W;switch(Q.method){case"POST":return this.handlePostRequest(Q,X);case"GET":return this.handleGetRequest(Q);case"DELETE":return this.handleDeleteRequest(Q);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(Q,X,W,Y){if(!this._eventStore)return;if(Y<"2025-11-25")return;let $=await this._eventStore.storeEvent(W,{}),J=`id: ${$}
48
- data:
49
-
50
- `;if(this._retryInterval!==void 0)J=`id: ${$}
51
- retry: ${this._retryInterval}
52
- data:
53
-
54
- `;Q.enqueue(X.encode(J))}async handleGetRequest(Q){if(!Q.headers.get("accept")?.includes("text/event-stream"))return this.createJsonErrorResponse(406,-32000,"Not Acceptable: Client must accept text/event-stream");let W=this.validateSession(Q);if(W)return W;let Y=this.validateProtocolVersion(Q);if(Y)return Y;if(this._eventStore){let B=Q.headers.get("last-event-id");if(B)return this.replayEvents(B)}if(this._streamMapping.get(this._standaloneSseStreamId)!==void 0)return this.createJsonErrorResponse(409,-32000,"Conflict: Only one SSE stream is allowed per session");let $=new TextEncoder,J,G=new ReadableStream({start:(B)=>{J=B},cancel:()=>{this._streamMapping.delete(this._standaloneSseStreamId)}}),H={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0)H["mcp-session-id"]=this.sessionId;return this._streamMapping.set(this._standaloneSseStreamId,{controller:J,encoder:$,cleanup:()=>{this._streamMapping.delete(this._standaloneSseStreamId);try{J.close()}catch{}}}),new Response(G,{headers:H})}async replayEvents(Q){if(!this._eventStore)return this.createJsonErrorResponse(400,-32000,"Event store not configured");try{let X;if(this._eventStore.getStreamIdForEventId){if(X=await this._eventStore.getStreamIdForEventId(Q),!X)return this.createJsonErrorResponse(400,-32000,"Invalid event ID format");if(this._streamMapping.get(X)!==void 0)return this.createJsonErrorResponse(409,-32000,"Conflict: Stream already has an active connection")}let W={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0)W["mcp-session-id"]=this.sessionId;let Y=new TextEncoder,$,J=new ReadableStream({start:(H)=>{$=H},cancel:()=>{}}),G=await this._eventStore.replayEventsAfter(Q,{send:async(H,B)=>{if(!this.writeSSEEvent($,Y,B,H)){this.onerror?.(Error("Failed replay events"));try{$.close()}catch{}}}});return this._streamMapping.set(G,{controller:$,encoder:Y,cleanup:()=>{this._streamMapping.delete(G);try{$.close()}catch{}}}),new Response(J,{headers:W})}catch(X){return this.onerror?.(X),this.createJsonErrorResponse(500,-32000,"Error replaying events")}}writeSSEEvent(Q,X,W,Y){try{let $=`event: message
55
- `;if(Y)$+=`id: ${Y}
56
- `;return $+=`data: ${JSON.stringify(W)}
57
-
58
- `,Q.enqueue(X.encode($)),!0}catch{return!1}}handleUnsupportedRequest(){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32000,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(Q,X){try{let W=Q.headers.get("accept");if(!W?.includes("application/json")||!W.includes("text/event-stream"))return this.createJsonErrorResponse(406,-32000,"Not Acceptable: Client must accept both application/json and text/event-stream");let Y=Q.headers.get("content-type");if(!Y||!Y.includes("application/json"))return this.createJsonErrorResponse(415,-32000,"Unsupported Media Type: Content-Type must be application/json");let $={headers:Object.fromEntries(Q.headers.entries())},J;if(X?.parsedBody!==void 0)J=X.parsedBody;else try{J=await Q.json()}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}let G;try{if(Array.isArray(J))G=J.map((O)=>o6.parse(O));else G=[o6.parse(J)]}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}let H=G.some(r7);if(H){if(this._initialized&&this.sessionId!==void 0)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(G.length>1)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");if(this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized)await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!H){let O=this.validateSession(Q);if(O)return O;let U=this.validateProtocolVersion(Q);if(U)return U}if(!G.some(h1)){for(let O of G)this.onmessage?.(O,{authInfo:X?.authInfo,requestInfo:$});return new Response(null,{status:202})}let z=crypto.randomUUID(),K=G.find((O)=>r7(O)),L=K?K.params.protocolVersion:Q.headers.get("mcp-protocol-version")??eH;if(this._enableJsonResponse)return new Promise((O)=>{this._streamMapping.set(z,{resolveJson:O,cleanup:()=>{this._streamMapping.delete(z)}});for(let U of G)if(h1(U))this._requestToStreamMapping.set(U.id,z);for(let U of G)this.onmessage?.(U,{authInfo:X?.authInfo,requestInfo:$})});let V=new TextEncoder,F,D=new ReadableStream({start:(O)=>{F=O},cancel:()=>{this._streamMapping.delete(z)}}),A={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};if(this.sessionId!==void 0)A["mcp-session-id"]=this.sessionId;for(let O of G)if(h1(O))this._streamMapping.set(z,{controller:F,encoder:V,cleanup:()=>{this._streamMapping.delete(z);try{F.close()}catch{}}}),this._requestToStreamMapping.set(O.id,z);await this.writePrimingEvent(F,V,z,L);for(let O of G){let U,j;if(h1(O)&&this._eventStore&&L>="2025-11-25")U=()=>{this.closeSSEStream(O.id)},j=()=>{this.closeStandaloneSSEStream()};this.onmessage?.(O,{authInfo:X?.authInfo,requestInfo:$,closeSSEStream:U,closeStandaloneSSEStream:j})}return new Response(D,{status:200,headers:A})}catch(W){return this.onerror?.(W),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(W)})}}async handleDeleteRequest(Q){let X=this.validateSession(Q);if(X)return X;let W=this.validateProtocolVersion(Q);if(W)return W;return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),await this.close(),new Response(null,{status:200})}validateSession(Q){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.createJsonErrorResponse(400,-32000,"Bad Request: Server not initialized");let X=Q.headers.get("mcp-session-id");if(!X)return this.createJsonErrorResponse(400,-32000,"Bad Request: Mcp-Session-Id header is required");if(X!==this.sessionId)return this.createJsonErrorResponse(404,-32001,"Session not found");return}validateProtocolVersion(Q){let X=Q.headers.get("mcp-protocol-version");if(X!==null&&!n6.includes(X))return this.createJsonErrorResponse(400,-32000,`Bad Request: Unsupported protocol version: ${X} (supported versions: ${n6.join(", ")})`);return}async close(){this._streamMapping.forEach(({cleanup:Q})=>{Q()}),this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}closeSSEStream(Q){let X=this._requestToStreamMapping.get(Q);if(!X)return;let W=this._streamMapping.get(X);if(W)W.cleanup()}closeStandaloneSSEStream(){let Q=this._streamMapping.get(this._standaloneSseStreamId);if(Q)Q.cleanup()}async send(Q,X){let W=X?.relatedRequestId;if(N1(Q)||k9(Q))W=Q.id;if(W===void 0){if(N1(Q)||k9(Q))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let J;if(this._eventStore)J=await this._eventStore.storeEvent(this._standaloneSseStreamId,Q);let G=this._streamMapping.get(this._standaloneSseStreamId);if(G===void 0)return;if(G.controller&&G.encoder)this.writeSSEEvent(G.controller,G.encoder,Q,J);return}let Y=this._requestToStreamMapping.get(W);if(!Y)throw Error(`No connection established for request ID: ${String(W)}`);let $=this._streamMapping.get(Y);if(!this._enableJsonResponse&&$?.controller&&$?.encoder){let J;if(this._eventStore)J=await this._eventStore.storeEvent(Y,Q);this.writeSSEEvent($.controller,$.encoder,Q,J)}if(N1(Q)||k9(Q)){this._requestResponseMap.set(W,Q);let J=Array.from(this._requestToStreamMapping.entries()).filter(([H,B])=>B===Y).map(([H])=>H);if(J.every((H)=>this._requestResponseMap.has(H))){if(!$)throw Error(`No connection established for request ID: ${String(W)}`);if(this._enableJsonResponse&&$.resolveJson){let H={"Content-Type":"application/json"};if(this.sessionId!==void 0)H["mcp-session-id"]=this.sessionId;let B=J.map((z)=>this._requestResponseMap.get(z));if(B.length===1)$.resolveJson(new Response(JSON.stringify(B[0]),{status:200,headers:H}));else $.resolveJson(new Response(JSON.stringify(B),{status:200,headers:H}))}else $.cleanup();for(let H of J)this._requestResponseMap.delete(H),this._requestToStreamMapping.delete(H)}}}}class PJ{constructor(Q={}){this._requestContext=new WeakMap,this._webStandardTransport=new EJ(Q),this._requestListener=bJ(async(X)=>{let W=this._requestContext.get(X);return this._webStandardTransport.handleRequest(X,{authInfo:W?.authInfo,parsedBody:W?.parsedBody})})}get sessionId(){return this._webStandardTransport.sessionId}set onclose(Q){this._webStandardTransport.onclose=Q}get onclose(){return this._webStandardTransport.onclose}set onerror(Q){this._webStandardTransport.onerror=Q}get onerror(){return this._webStandardTransport.onerror}set onmessage(Q){this._webStandardTransport.onmessage=Q}get onmessage(){return this._webStandardTransport.onmessage}async start(){return this._webStandardTransport.start()}async close(){return this._webStandardTransport.close()}async send(Q,X){return this._webStandardTransport.send(Q,X)}async handleRequest(Q,X,W){let Y=Q.auth;await bJ(async(J)=>{return this._webStandardTransport.handleRequest(J,{authInfo:Y,parsedBody:W})})(Q,X)}closeSSEStream(Q){this._webStandardTransport.closeSSEStream(Q)}closeStandaloneSSEStream(){this._webStandardTransport.closeStandaloneSSEStream()}}import{createServer as Lf}from"http";class IJ{constructor(Q){this._client=Q}async*callToolStream(Q,X=O6,W){let Y=this._client,$={...W,task:W?.task??(Y.isToolTask(Q.name)?{}:void 0)},J=Y.requestStream({method:"tools/call",params:Q},X,$),G=Y.getToolOutputValidator(Q.name);for await(let H of J){if(H.type==="result"&&G){let B=H.result;if(!B.structuredContent&&!B.isError){yield{type:"error",error:new S(k.InvalidRequest,`Tool ${Q.name} has an output schema but did not return structured content`)};return}if(B.structuredContent)try{let z=G(B.structuredContent);if(!z.valid){yield{type:"error",error:new S(k.InvalidParams,`Structured content does not match the tool's output schema: ${z.errorMessage}`)};return}}catch(z){if(z instanceof S){yield{type:"error",error:z};return}yield{type:"error",error:new S(k.InvalidParams,`Failed to validate structured content: ${z instanceof Error?z.message:String(z)}`)};return}}yield H}}async getTask(Q,X){return this._client.getTask({taskId:Q},X)}async getTaskResult(Q,X,W){return this._client.getTaskResult({taskId:Q},X,W)}async listTasks(Q,X){return this._client.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._client.cancelTask({taskId:Q},X)}requestStream(Q,X,W){return this._client.requestStream(Q,X,W)}}function DW(Q,X){if(!Q||X===null||typeof X!=="object")return;if(Q.type==="object"&&Q.properties&&typeof Q.properties==="object"){let W=X,Y=Q.properties;for(let $ of Object.keys(Y)){let J=Y[$];if(W[$]===void 0&&Object.prototype.hasOwnProperty.call(J,"default"))W[$]=J.default;if(W[$]!==void 0)DW(J,W[$])}}if(Array.isArray(Q.anyOf)){for(let W of Q.anyOf)if(typeof W!=="boolean")DW(W,X)}if(Array.isArray(Q.oneOf)){for(let W of Q.oneOf)if(typeof W!=="boolean")DW(W,X)}}function yy(Q){if(!Q)return{supportsFormMode:!1,supportsUrlMode:!1};let X=Q.form!==void 0,W=Q.url!==void 0;return{supportsFormMode:X||!X&&!W,supportsUrlMode:W}}class ZJ extends n4{constructor(Q,X){super(X);if(this._clientInfo=Q,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=X?.capabilities??{},this._jsonSchemaValidator=X?.jsonSchemaValidator??new hQ,X?.listChanged)this._pendingListChangedConfig=X.listChanged}_setupListChangedHandlers(Q){if(Q.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",l4,Q.tools,async()=>{return(await this.listTools()).tools});if(Q.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",u4,Q.prompts,async()=>{return(await this.listPrompts()).prompts});if(Q.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",h4,Q.resources,async()=>{return(await this.listResources()).resources})}get experimental(){if(!this._experimental)this._experimental={tasks:new IJ(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=i8(this._capabilities,Q)}setRequestHandler(Q,X){let Y=g1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let $;if(o0(Y)){let G=Y;$=G._zod?.def?.value??G.value}else{let G=Y;$=G._def?.value??G.value}if(typeof $!=="string")throw Error("Schema method literal must be a string");let J=$;if(J==="elicitation/create"){let G=async(H,B)=>{let z=h0(i4,H);if(!z.success){let U=z.error instanceof Error?z.error.message:String(z.error);throw new S(k.InvalidParams,`Invalid elicitation request: ${U}`)}let{params:K}=z.data;K.mode=K.mode??"form";let{supportsFormMode:L,supportsUrlMode:V}=yy(this._capabilities.elicitation);if(K.mode==="form"&&!L)throw new S(k.InvalidParams,"Client does not support form-mode elicitation requests");if(K.mode==="url"&&!V)throw new S(k.InvalidParams,"Client does not support URL-mode elicitation requests");let F=await Promise.resolve(X(H,B));if(K.task){let U=h0(t1,F);if(!U.success){let j=U.error instanceof Error?U.error.message:String(U.error);throw new S(k.InvalidParams,`Invalid task creation result: ${j}`)}return U.data}let D=h0(x9,F);if(!D.success){let U=D.error instanceof Error?D.error.message:String(D.error);throw new S(k.InvalidParams,`Invalid elicitation result: ${U}`)}let A=D.data,O=K.mode==="form"?K.requestedSchema:void 0;if(K.mode==="form"&&A.action==="accept"&&A.content&&O){if(this._capabilities.elicitation?.form?.applyDefaults)try{DW(O,A.content)}catch{}}return A};return super.setRequestHandler(Q,G)}if(J==="sampling/createMessage"){let G=async(H,B)=>{let z=h0(c4,H);if(!z.success){let F=z.error instanceof Error?z.error.message:String(z.error);throw new S(k.InvalidParams,`Invalid sampling request: ${F}`)}let{params:K}=z.data,L=await Promise.resolve(X(H,B));if(K.task){let F=h0(t1,L);if(!F.success){let D=F.error instanceof Error?F.error.message:String(F.error);throw new S(k.InvalidParams,`Invalid task creation result: ${D}`)}return F.data}let V=h0(p4,L);if(!V.success){let F=V.error instanceof Error?V.error.message:String(V.error);throw new S(k.InvalidParams,`Invalid sampling result: ${F}`)}return V.data};return super.setRequestHandler(Q,G)}return super.setRequestHandler(Q,X)}assertCapability(Q,X){if(!this._serverCapabilities?.[Q])throw Error(`Server does not support ${Q} (required for ${X})`)}async connect(Q,X){if(await super.connect(Q),Q.sessionId!==void 0)return;try{let W=await this.request({method:"initialize",params:{protocolVersion:D6,capabilities:this._capabilities,clientInfo:this._clientInfo}},t7,X);if(W===void 0)throw Error(`Server sent invalid initialize result: ${W}`);if(!n6.includes(W.protocolVersion))throw Error(`Server's protocol version is not supported: ${W.protocolVersion}`);if(this._serverCapabilities=W.capabilities,this._serverVersion=W.serverInfo,Q.setProtocolVersion)Q.setProtocolVersion(W.protocolVersion);if(this._instructions=W.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(W){throw this.close(),W}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(Q){switch(Q){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${Q})`);if(Q==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${Q})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${Q})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${Q})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${Q})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${Q})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${Q})`);break;case"ping":break}}assertTaskCapability(Q){zW(this._serverCapabilities?.tasks?.requests,Q,"Server")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;KW(this._capabilities.tasks?.requests,Q,"Client")}async ping(Q){return this.request({method:"ping"},r1,Q)}async complete(Q,X){return this.request({method:"completion/complete",params:Q},A5,X)}async setLoggingLevel(Q,X){return this.request({method:"logging/setLevel",params:{level:Q}},r1,X)}async getPrompt(Q,X){return this.request({method:"prompts/get",params:Q},B5,X)}async listPrompts(Q,X){return this.request({method:"prompts/list",params:Q},Y5,X)}async listResources(Q,X){return this.request({method:"resources/list",params:Q},s7,X)}async listResourceTemplates(Q,X){return this.request({method:"resources/templates/list",params:Q},e7,X)}async readResource(Q,X){return this.request({method:"resources/read",params:Q},X5,X)}async subscribeResource(Q,X){return this.request({method:"resources/subscribe",params:Q},r1,X)}async unsubscribeResource(Q,X){return this.request({method:"resources/unsubscribe",params:Q},r1,X)}async callTool(Q,X=O6,W){if(this.isToolTaskRequired(Q.name))throw new S(k.InvalidRequest,`Tool "${Q.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let Y=await this.request({method:"tools/call",params:Q},X,W),$=this.getToolOutputValidator(Q.name);if($){if(!Y.structuredContent&&!Y.isError)throw new S(k.InvalidRequest,`Tool ${Q.name} has an output schema but did not return structured content`);if(Y.structuredContent)try{let J=$(Y.structuredContent);if(!J.valid)throw new S(k.InvalidParams,`Structured content does not match the tool's output schema: ${J.errorMessage}`)}catch(J){if(J instanceof S)throw J;throw new S(k.InvalidParams,`Failed to validate structured content: ${J instanceof Error?J.message:String(J)}`)}}return Y}isToolTask(Q){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(Q)}isToolTaskRequired(Q){return this._cachedRequiredTaskTools.has(Q)}cacheToolMetadata(Q){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let X of Q){if(X.outputSchema){let Y=this._jsonSchemaValidator.getValidator(X.outputSchema);this._cachedToolOutputValidators.set(X.name,Y)}let W=X.execution?.taskSupport;if(W==="required"||W==="optional")this._cachedKnownTaskTools.add(X.name);if(W==="required")this._cachedRequiredTaskTools.add(X.name)}}getToolOutputValidator(Q){return this._cachedToolOutputValidators.get(Q)}async listTools(Q,X){let W=await this.request({method:"tools/list",params:Q},z5,X);return this.cacheToolMetadata(W.tools),W}_setupListChangedHandler(Q,X,W,Y){let $=D3.safeParse(W);if(!$.success)throw Error(`Invalid ${Q} listChanged options: ${$.error.message}`);if(typeof W.onChanged!=="function")throw Error(`Invalid ${Q} listChanged options: onChanged must be a function`);let{autoRefresh:J,debounceMs:G}=$.data,{onChanged:H}=W,B=async()=>{if(!J){H(null,null);return}try{let K=await Y();H(null,K)}catch(K){let L=K instanceof Error?K:Error(String(K));H(L,null)}},z=()=>{if(G){let K=this._listChangedDebounceTimers.get(Q);if(K)clearTimeout(K);let L=setTimeout(B,G);this._listChangedDebounceTimers.set(Q,L)}else B()};this.setNotificationHandler(X,z)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function VW(Q){if(!Q)return{};if(Q instanceof Headers)return Object.fromEntries(Q.entries());if(Array.isArray(Q))return Object.fromEntries(Q);return{...Q}}function iO(Q=fetch,X){if(!X)return Q;return async(W,Y)=>{let $={...X,...Y,headers:Y?.headers?{...VW(X.headers),...VW(Y.headers)}:X.headers};return Q(W,$)}}var SJ;SJ=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((Q)=>Q.webcrypto);async function fy(Q){return(await SJ).getRandomValues(new Uint8Array(Q))}async function gy(Q){let W=Math.pow(2,8)-Math.pow(2,8)%66,Y="";while(Y.length<Q){let $=await fy(Q-Y.length);for(let J of $)if(J<W)Y+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[J%66]}return Y}async function hy(Q){return await gy(Q)}async function uy(Q){let X=await(await SJ).subtle.digest("SHA-256",new TextEncoder().encode(Q));return btoa(String.fromCharCode(...new Uint8Array(X))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function RJ(Q){if(!Q)Q=43;if(Q<43||Q>128)throw`Expected a length between 43 and 128. Received ${Q}.`;let X=await hy(Q),W=await uy(X);return{code_verifier:X,code_challenge:W}}var x0=lH().superRefine((Q,X)=>{if(!URL.canParse(Q))return X.addIssue({code:sH.custom,message:"URL must be parseable",fatal:!0}),tQ}).refine((Q)=>{let X=new URL(Q);return X.protocol!=="javascript:"&&X.protocol!=="data:"&&X.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),nO=Z0({resource:q().url(),authorization_servers:Z(x0).optional(),jwks_uri:q().url().optional(),scopes_supported:Z(q()).optional(),bearer_methods_supported:Z(q()).optional(),resource_signing_alg_values_supported:Z(q()).optional(),resource_name:q().optional(),resource_documentation:q().optional(),resource_policy_uri:q().url().optional(),resource_tos_uri:q().url().optional(),tls_client_certificate_bound_access_tokens:G0().optional(),authorization_details_types_supported:Z(q()).optional(),dpop_signing_alg_values_supported:Z(q()).optional(),dpop_bound_access_tokens_required:G0().optional()}),CJ=Z0({issuer:q(),authorization_endpoint:x0,token_endpoint:x0,registration_endpoint:x0.optional(),scopes_supported:Z(q()).optional(),response_types_supported:Z(q()),response_modes_supported:Z(q()).optional(),grant_types_supported:Z(q()).optional(),token_endpoint_auth_methods_supported:Z(q()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(q()).optional(),service_documentation:x0.optional(),revocation_endpoint:x0.optional(),revocation_endpoint_auth_methods_supported:Z(q()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Z(q()).optional(),introspection_endpoint:q().optional(),introspection_endpoint_auth_methods_supported:Z(q()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Z(q()).optional(),code_challenge_methods_supported:Z(q()).optional(),client_id_metadata_document_supported:G0().optional()}),ly=Z0({issuer:q(),authorization_endpoint:x0,token_endpoint:x0,userinfo_endpoint:x0.optional(),jwks_uri:x0,registration_endpoint:x0.optional(),scopes_supported:Z(q()).optional(),response_types_supported:Z(q()),response_modes_supported:Z(q()).optional(),grant_types_supported:Z(q()).optional(),acr_values_supported:Z(q()).optional(),subject_types_supported:Z(q()),id_token_signing_alg_values_supported:Z(q()),id_token_encryption_alg_values_supported:Z(q()).optional(),id_token_encryption_enc_values_supported:Z(q()).optional(),userinfo_signing_alg_values_supported:Z(q()).optional(),userinfo_encryption_alg_values_supported:Z(q()).optional(),userinfo_encryption_enc_values_supported:Z(q()).optional(),request_object_signing_alg_values_supported:Z(q()).optional(),request_object_encryption_alg_values_supported:Z(q()).optional(),request_object_encryption_enc_values_supported:Z(q()).optional(),token_endpoint_auth_methods_supported:Z(q()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(q()).optional(),display_values_supported:Z(q()).optional(),claim_types_supported:Z(q()).optional(),claims_supported:Z(q()).optional(),service_documentation:q().optional(),claims_locales_supported:Z(q()).optional(),ui_locales_supported:Z(q()).optional(),claims_parameter_supported:G0().optional(),request_parameter_supported:G0().optional(),request_uri_parameter_supported:G0().optional(),require_request_uri_registration:G0().optional(),op_policy_uri:x0.optional(),op_tos_uri:x0.optional(),client_id_metadata_document_supported:G0().optional()}),oO=R({...ly.shape,...CJ.pick({code_challenge_methods_supported:!0}).shape}),rO=R({access_token:q(),id_token:q().optional(),token_type:q(),expires_in:N8.number().optional(),scope:q().optional(),refresh_token:q().optional()}).strip(),tO=R({error:q(),error_description:q().optional(),error_uri:q().optional()}),dO=x0.optional().or(_("").transform(()=>{return})),my=R({redirect_uris:Z(x0),token_endpoint_auth_method:q().optional(),grant_types:Z(q()).optional(),response_types:Z(q()).optional(),client_name:q().optional(),client_uri:x0.optional(),logo_uri:dO,scope:q().optional(),contacts:Z(q()).optional(),tos_uri:dO,policy_uri:q().optional(),jwks_uri:x0.optional(),jwks:cH().optional(),software_id:q().optional(),software_version:q().optional(),software_statement:q().optional()}).strip(),cy=R({client_id:q(),client_secret:q().optional(),client_id_issued_at:$0().optional(),client_secret_expires_at:$0().optional()}).strip(),aO=my.merge(cy),kd=R({error:q(),error_description:q().optional()}).strip(),vd=R({token:q(),token_type_hint:q().optional()}).strip();function sO(Q){let X=typeof Q==="string"?new URL(Q):new URL(Q.href);return X.hash="",X}function eO({requestedResource:Q,configuredResource:X}){let W=typeof Q==="string"?new URL(Q):new URL(Q.href),Y=typeof X==="string"?new URL(X):new URL(X.href);if(W.origin!==Y.origin)return!1;if(W.pathname.length<Y.pathname.length)return!1;let $=W.pathname.endsWith("/")?W.pathname:W.pathname+"/",J=Y.pathname.endsWith("/")?Y.pathname:Y.pathname+"/";return $.startsWith(J)}class P0 extends Error{constructor(Q,X){super(Q);this.errorUri=X,this.name=this.constructor.name}toResponseObject(){let Q={error:this.errorCode,error_description:this.message};if(this.errorUri)Q.error_uri=this.errorUri;return Q}get errorCode(){return this.constructor.errorCode}}class OW extends P0{}OW.errorCode="invalid_request";class G4 extends P0{}G4.errorCode="invalid_client";class H4 extends P0{}H4.errorCode="invalid_grant";class B4 extends P0{}B4.errorCode="unauthorized_client";class UW extends P0{}UW.errorCode="unsupported_grant_type";class qW extends P0{}qW.errorCode="invalid_scope";class NW extends P0{}NW.errorCode="access_denied";class k6 extends P0{}k6.errorCode="server_error";class MW extends P0{}MW.errorCode="temporarily_unavailable";class jW extends P0{}jW.errorCode="unsupported_response_type";class wW extends P0{}wW.errorCode="unsupported_token_type";class bW extends P0{}bW.errorCode="invalid_token";class EW extends P0{}EW.errorCode="method_not_allowed";class PW extends P0{}PW.errorCode="too_many_requests";class z4 extends P0{}z4.errorCode="invalid_client_metadata";class IW extends P0{}IW.errorCode="insufficient_scope";class ZW extends P0{}ZW.errorCode="invalid_target";var QU={[OW.errorCode]:OW,[G4.errorCode]:G4,[H4.errorCode]:H4,[B4.errorCode]:B4,[UW.errorCode]:UW,[qW.errorCode]:qW,[NW.errorCode]:NW,[k6.errorCode]:k6,[MW.errorCode]:MW,[jW.errorCode]:jW,[wW.errorCode]:wW,[bW.errorCode]:bW,[EW.errorCode]:EW,[PW.errorCode]:PW,[z4.errorCode]:z4,[IW.errorCode]:IW,[ZW.errorCode]:ZW};class v6 extends Error{constructor(Q){super(Q??"Unauthorized")}}function py(Q){return["client_secret_basic","client_secret_post","none"].includes(Q)}var TJ="code",kJ="S256";function iy(Q,X){let W=Q.client_secret!==void 0;if(X.length===0)return W?"client_secret_post":"none";if("token_endpoint_auth_method"in Q&&Q.token_endpoint_auth_method&&py(Q.token_endpoint_auth_method)&&X.includes(Q.token_endpoint_auth_method))return Q.token_endpoint_auth_method;if(W&&X.includes("client_secret_basic"))return"client_secret_basic";if(W&&X.includes("client_secret_post"))return"client_secret_post";if(X.includes("none"))return"none";return W?"client_secret_post":"none"}function dy(Q,X,W,Y){let{client_id:$,client_secret:J}=X;switch(Q){case"client_secret_basic":ny($,J,W);return;case"client_secret_post":oy($,J,Y);return;case"none":ry($,Y);return;default:throw Error(`Unsupported client authentication method: ${Q}`)}}function ny(Q,X,W){if(!X)throw Error("client_secret_basic authentication requires a client_secret");let Y=btoa(`${Q}:${X}`);W.set("Authorization",`Basic ${Y}`)}function oy(Q,X,W){if(W.set("client_id",Q),X)W.set("client_secret",X)}function ry(Q,X){X.set("client_id",Q)}async function WU(Q){let X=Q instanceof Response?Q.status:void 0,W=Q instanceof Response?await Q.text():Q;try{let Y=tO.parse(JSON.parse(W)),{error:$,error_description:J,error_uri:G}=Y;return new(QU[$]||k6)(J||"",G)}catch(Y){let $=`${X?`HTTP ${X}: `:""}Invalid OAuth error response: ${Y}. Raw body: ${W}`;return new k6($)}}async function cQ(Q,X){try{return await vJ(Q,X)}catch(W){if(W instanceof G4||W instanceof B4)return await Q.invalidateCredentials?.("all"),await vJ(Q,X);else if(W instanceof H4)return await Q.invalidateCredentials?.("tokens"),await vJ(Q,X);throw W}}async function vJ(Q,{serverUrl:X,authorizationCode:W,scope:Y,resourceMetadataUrl:$,fetchFn:J}){let G,H;try{if(G=await sy(X,{resourceMetadataUrl:$},J),G.authorization_servers&&G.authorization_servers.length>0)H=G.authorization_servers[0]}catch{}if(!H)H=new URL("/",X);let B=await ay(X,Q,G),z=await Yf(H,{fetchFn:J}),K=await Promise.resolve(Q.clientInformation());if(!K){if(W!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let O=z?.client_id_metadata_document_supported===!0,U=Q.clientMetadataUrl;if(U&&!ty(U))throw new z4(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${U}`);if(O&&U)K={client_id:U},await Q.saveClientInformation?.(K);else{if(!Q.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let w=await Bf(H,{metadata:z,clientMetadata:Q.clientMetadata,fetchFn:J});await Q.saveClientInformation(w),K=w}}let L=!Q.redirectUrl;if(W!==void 0||L){let O=await Hf(Q,H,{metadata:z,resource:B,authorizationCode:W,fetchFn:J});return await Q.saveTokens(O),"AUTHORIZED"}let V=await Q.tokens();if(V?.refresh_token)try{let O=await Gf(H,{metadata:z,clientInformation:K,refreshToken:V.refresh_token,resource:B,addClientAuthentication:Q.addClientAuthentication,fetchFn:J});return await Q.saveTokens(O),"AUTHORIZED"}catch(O){if(!(O instanceof P0)||O instanceof k6);else throw O}let F=Q.state?await Q.state():void 0,{authorizationUrl:D,codeVerifier:A}=await $f(H,{metadata:z,clientInformation:K,state:F,redirectUrl:Q.redirectUrl,scope:Y||G?.scopes_supported?.join(" ")||Q.clientMetadata.scope,resource:B});return await Q.saveCodeVerifier(A),await Q.redirectToAuthorization(D),"REDIRECT"}function ty(Q){if(!Q)return!1;try{let X=new URL(Q);return X.protocol==="https:"&&X.pathname!=="/"}catch{return!1}}async function ay(Q,X,W){let Y=sO(Q);if(X.validateResourceURL)return await X.validateResourceURL(Y,W?.resource);if(!W)return;if(!eO({requestedResource:Y,configuredResource:W.resource}))throw Error(`Protected resource ${W.resource} does not match expected ${Y} (or origin)`);return new URL(W.resource)}function xJ(Q){let X=Q.headers.get("WWW-Authenticate");if(!X)return{};let[W,Y]=X.split(" ");if(W.toLowerCase()!=="bearer"||!Y)return{};let $=_J(Q,"resource_metadata")||void 0,J;if($)try{J=new URL($)}catch{}let G=_J(Q,"scope")||void 0,H=_J(Q,"error")||void 0;return{resourceMetadataUrl:J,scope:G,error:H}}function _J(Q,X){let W=Q.headers.get("WWW-Authenticate");if(!W)return null;let Y=new RegExp(`${X}=(?:"([^"]+)"|([^\\s,]+))`),$=W.match(Y);if($)return $[1]||$[2];return null}async function sy(Q,X,W=fetch){let Y=await Xf(Q,"oauth-protected-resource",W,{protocolVersion:X?.protocolVersion,metadataUrl:X?.resourceMetadataUrl});if(!Y||Y.status===404)throw await Y?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!Y.ok)throw await Y.body?.cancel(),Error(`HTTP ${Y.status} trying to load well-known OAuth protected resource metadata.`);return nO.parse(await Y.json())}async function yJ(Q,X,W=fetch){try{return await W(Q,{headers:X})}catch(Y){if(Y instanceof TypeError)if(X)return yJ(Q,void 0,W);else return;throw Y}}function ey(Q,X="",W={}){if(X.endsWith("/"))X=X.slice(0,-1);return W.prependPathname?`${X}/.well-known/${Q}`:`/.well-known/${Q}${X}`}async function XU(Q,X,W=fetch){return await yJ(Q,{"MCP-Protocol-Version":X},W)}function Qf(Q,X){return!Q||Q.status>=400&&Q.status<500&&X!=="/"}async function Xf(Q,X,W,Y){let $=new URL(Q),J=Y?.protocolVersion??D6,G;if(Y?.metadataUrl)G=new URL(Y.metadataUrl);else{let B=ey(X,$.pathname);G=new URL(B,Y?.metadataServerUrl??$),G.search=$.search}let H=await XU(G,J,W);if(!Y?.metadataUrl&&Qf(H,$.pathname)){let B=new URL(`/.well-known/${X}`,$);H=await XU(B,J,W)}return H}function Wf(Q){let X=typeof Q==="string"?new URL(Q):Q,W=X.pathname!=="/",Y=[];if(!W)return Y.push({url:new URL("/.well-known/oauth-authorization-server",X.origin),type:"oauth"}),Y.push({url:new URL("/.well-known/openid-configuration",X.origin),type:"oidc"}),Y;let $=X.pathname;if($.endsWith("/"))$=$.slice(0,-1);return Y.push({url:new URL(`/.well-known/oauth-authorization-server${$}`,X.origin),type:"oauth"}),Y.push({url:new URL(`/.well-known/openid-configuration${$}`,X.origin),type:"oidc"}),Y.push({url:new URL(`${$}/.well-known/openid-configuration`,X.origin),type:"oidc"}),Y}async function Yf(Q,{fetchFn:X=fetch,protocolVersion:W=D6}={}){let Y={"MCP-Protocol-Version":W,Accept:"application/json"},$=Wf(Q);for(let{url:J,type:G}of $){let H=await yJ(J,Y,X);if(!H)continue;if(!H.ok){if(await H.body?.cancel(),H.status>=400&&H.status<500)continue;throw Error(`HTTP ${H.status} trying to load ${G==="oauth"?"OAuth":"OpenID provider"} metadata from ${J}`)}if(G==="oauth")return CJ.parse(await H.json());else return oO.parse(await H.json())}return}async function $f(Q,{metadata:X,clientInformation:W,redirectUrl:Y,scope:$,state:J,resource:G}){let H;if(X){if(H=new URL(X.authorization_endpoint),!X.response_types_supported.includes(TJ))throw Error(`Incompatible auth server: does not support response type ${TJ}`);if(X.code_challenge_methods_supported&&!X.code_challenge_methods_supported.includes(kJ))throw Error(`Incompatible auth server: does not support code challenge method ${kJ}`)}else H=new URL("/authorize",Q);let B=await RJ(),z=B.code_verifier,K=B.code_challenge;if(H.searchParams.set("response_type",TJ),H.searchParams.set("client_id",W.client_id),H.searchParams.set("code_challenge",K),H.searchParams.set("code_challenge_method",kJ),H.searchParams.set("redirect_uri",String(Y)),J)H.searchParams.set("state",J);if($)H.searchParams.set("scope",$);if($?.includes("offline_access"))H.searchParams.append("prompt","consent");if(G)H.searchParams.set("resource",G.href);return{authorizationUrl:H,codeVerifier:z}}function Jf(Q,X,W){return new URLSearchParams({grant_type:"authorization_code",code:Q,code_verifier:X,redirect_uri:String(W)})}async function YU(Q,{metadata:X,tokenRequestParams:W,clientInformation:Y,addClientAuthentication:$,resource:J,fetchFn:G}){let H=X?.token_endpoint?new URL(X.token_endpoint):new URL("/token",Q),B=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(J)W.set("resource",J.href);if($)await $(B,W,H,X);else if(Y){let K=X?.token_endpoint_auth_methods_supported??[],L=iy(Y,K);dy(L,Y,B,W)}let z=await(G??fetch)(H,{method:"POST",headers:B,body:W});if(!z.ok)throw await WU(z);return rO.parse(await z.json())}async function Gf(Q,{metadata:X,clientInformation:W,refreshToken:Y,resource:$,addClientAuthentication:J,fetchFn:G}){let H=new URLSearchParams({grant_type:"refresh_token",refresh_token:Y}),B=await YU(Q,{metadata:X,tokenRequestParams:H,clientInformation:W,addClientAuthentication:J,resource:$,fetchFn:G});return{refresh_token:Y,...B}}async function Hf(Q,X,{metadata:W,resource:Y,authorizationCode:$,fetchFn:J}={}){let G=Q.clientMetadata.scope,H;if(Q.prepareTokenRequest)H=await Q.prepareTokenRequest(G);if(!H){if(!$)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!Q.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let z=await Q.codeVerifier();H=Jf($,z,Q.redirectUrl)}let B=await Q.clientInformation();return YU(X,{metadata:W,tokenRequestParams:H,clientInformation:B??void 0,addClientAuthentication:Q.addClientAuthentication,resource:Y,fetchFn:J})}async function Bf(Q,{metadata:X,clientMetadata:W,fetchFn:Y}){let $;if(X){if(!X.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");$=new URL(X.registration_endpoint)}else $=new URL("/register",Q);let J=await(Y??fetch)($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)});if(!J.ok)throw await WU(J);return aO.parse(await J.json())}class gJ extends Error{constructor(Q,X){super(Q),this.name="ParseError",this.type=X.type,this.field=X.field,this.value=X.value,this.line=X.line}}function fJ(Q){}function $U(Q){if(typeof Q=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:X=fJ,onError:W=fJ,onRetry:Y=fJ,onComment:$}=Q,J="",G=!0,H,B="",z="";function K(A){let O=G?A.replace(/^\xEF\xBB\xBF/,""):A,[U,j]=zf(`${J}${O}`);for(let w of U)L(w);J=j,G=!1}function L(A){if(A===""){F();return}if(A.startsWith(":")){$&&$(A.slice(A.startsWith(": ")?2:1));return}let O=A.indexOf(":");if(O!==-1){let U=A.slice(0,O),j=A[O+1]===" "?2:1,w=A.slice(O+j);V(U,w,A);return}V(A,"",A)}function V(A,O,U){switch(A){case"event":z=O;break;case"data":B=`${B}${O}
59
- `;break;case"id":H=O.includes("\x00")?void 0:O;break;case"retry":/^\d+$/.test(O)?Y(parseInt(O,10)):W(new gJ(`Invalid \`retry\` value: "${O}"`,{type:"invalid-retry",value:O,line:U}));break;default:W(new gJ(`Unknown field "${A.length>20?`${A.slice(0,20)}…`:A}"`,{type:"unknown-field",field:A,value:O,line:U}));break}}function F(){B.length>0&&X({id:H,event:z||void 0,data:B.endsWith(`
60
- `)?B.slice(0,-1):B}),H=void 0,B="",z=""}function D(A={}){J&&A.consume&&L(J),G=!0,H=void 0,B="",z="",J=""}return{feed:K,reset:D}}function zf(Q){let X=[],W="",Y=0;for(;Y<Q.length;){let $=Q.indexOf("\r",Y),J=Q.indexOf(`
61
- `,Y),G=-1;if($!==-1&&J!==-1?G=Math.min($,J):$!==-1?$===Q.length-1?G=-1:G=$:J!==-1&&(G=J),G===-1){W=Q.slice(Y);break}else{let H=Q.slice(Y,G);X.push(H),Y=G+1,Q[Y-1]==="\r"&&Q[Y]===`
62
- `&&Y++}}return[X,W]}class hJ extends TransformStream{constructor({onError:Q,onRetry:X,onComment:W}={}){let Y;super({start($){Y=$U({onEvent:(J)=>{$.enqueue(J)},onError(J){Q==="terminate"?$.error(J):typeof Q=="function"&&Q(J)},onRetry:X,onComment:W})},transform($){Y.feed($)}})}}var Kf={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class z9 extends Error{constructor(Q,X){super(`Streamable HTTP error: ${X}`);this.code=Q}}class uJ{constructor(Q,X){this._hasCompletedAuthFlow=!1,this._url=Q,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=X?.requestInit,this._authProvider=X?.authProvider,this._fetch=X?.fetch,this._fetchWithInit=iO(X?.fetch,X?.requestInit),this._sessionId=X?.sessionId,this._reconnectionOptions=X?.reconnectionOptions??Kf}async _authThenStart(){if(!this._authProvider)throw new v6("No auth provider");let Q;try{Q=await cQ(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(X){throw this.onerror?.(X),X}if(Q!=="AUTHORIZED")throw new v6;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let Q={};if(this._authProvider){let W=await this._authProvider.tokens();if(W)Q.Authorization=`Bearer ${W.access_token}`}if(this._sessionId)Q["mcp-session-id"]=this._sessionId;if(this._protocolVersion)Q["mcp-protocol-version"]=this._protocolVersion;let X=VW(this._requestInit?.headers);return new Headers({...Q,...X})}async _startOrAuthSse(Q){let{resumptionToken:X}=Q;try{let W=await this._commonHeaders();if(W.set("Accept","text/event-stream"),X)W.set("last-event-id",X);let Y=await(this._fetch??fetch)(this._url,{method:"GET",headers:W,signal:this._abortController?.signal});if(!Y.ok){if(await Y.body?.cancel(),Y.status===401&&this._authProvider)return await this._authThenStart();if(Y.status===405)return;throw new z9(Y.status,`Failed to open SSE stream: ${Y.statusText}`)}this._handleSseStream(Y.body,Q,!0)}catch(W){throw this.onerror?.(W),W}}_getNextReconnectionDelay(Q){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let X=this._reconnectionOptions.initialReconnectionDelay,W=this._reconnectionOptions.reconnectionDelayGrowFactor,Y=this._reconnectionOptions.maxReconnectionDelay;return Math.min(X*Math.pow(W,Q),Y)}_scheduleReconnection(Q,X=0){let W=this._reconnectionOptions.maxRetries;if(X>=W){this.onerror?.(Error(`Maximum reconnection attempts (${W}) exceeded.`));return}let Y=this._getNextReconnectionDelay(X);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(Q).catch(($)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${$ instanceof Error?$.message:String($)}`)),this._scheduleReconnection(Q,X+1)})},Y)}_handleSseStream(Q,X,W){if(!Q)return;let{onresumptiontoken:Y,replayMessageId:$}=X,J,G=!1,H=!1;(async()=>{try{let z=Q.pipeThrough(new TextDecoderStream).pipeThrough(new hJ({onRetry:(V)=>{this._serverRetryMs=V}})).getReader();while(!0){let{value:V,done:F}=await z.read();if(F)break;if(V.id)J=V.id,G=!0,Y?.(V.id);if(!V.data)continue;if(!V.event||V.event==="message")try{let D=o6.parse(JSON.parse(V.data));if(N1(D)){if(H=!0,$!==void 0)D.id=$}this.onmessage?.(D)}catch(D){this.onerror?.(D)}}if((W||G)&&!H&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Y,replayMessageId:$},0)}catch(z){if(this.onerror?.(Error(`SSE stream disconnected: ${z}`)),(W||G)&&!H&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:J,onresumptiontoken:Y,replayMessageId:$},0)}catch(V){this.onerror?.(Error(`Failed to reconnect: ${V instanceof Error?V.message:String(V)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(Q){if(!this._authProvider)throw new v6("No auth provider");if(await cQ(this._authProvider,{serverUrl:this._url,authorizationCode:Q,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new v6("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(Q,X){try{let{resumptionToken:W,onresumptiontoken:Y}=X||{};if(W){this._startOrAuthSse({resumptionToken:W,replayMessageId:h1(Q)?Q.id:void 0}).catch((L)=>this.onerror?.(L));return}let $=await this._commonHeaders();$.set("content-type","application/json"),$.set("accept","application/json, text/event-stream");let J={...this._requestInit,method:"POST",headers:$,body:JSON.stringify(Q),signal:this._abortController?.signal},G=await(this._fetch??fetch)(this._url,J),H=G.headers.get("mcp-session-id");if(H)this._sessionId=H;if(!G.ok){let L=await G.text().catch(()=>null);if(G.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new z9(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:V,scope:F}=xJ(G);if(this._resourceMetadataUrl=V,this._scope=F,await cQ(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new v6;return this._hasCompletedAuthFlow=!0,this.send(Q)}if(G.status===403&&this._authProvider){let{resourceMetadataUrl:V,scope:F,error:D}=xJ(G);if(D==="insufficient_scope"){let A=G.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new z9(403,"Server returned 403 after trying upscoping");if(F)this._scope=F;if(V)this._resourceMetadataUrl=V;if(this._lastUpscopingHeader=A??void 0,await cQ(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new v6;return this.send(Q)}}throw new z9(G.status,`Error POSTing to endpoint: ${L}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,G.status===202){if(await G.body?.cancel(),H3(Q))this._startOrAuthSse({resumptionToken:void 0}).catch((L)=>this.onerror?.(L));return}let z=(Array.isArray(Q)?Q:[Q]).filter((L)=>("method"in L)&&("id"in L)&&L.id!==void 0).length>0,K=G.headers.get("content-type");if(z)if(K?.includes("text/event-stream"))this._handleSseStream(G.body,{onresumptiontoken:Y},!1);else if(K?.includes("application/json")){let L=await G.json(),V=Array.isArray(L)?L.map((F)=>o6.parse(F)):[o6.parse(L)];for(let F of V)this.onmessage?.(F)}else throw await G.body?.cancel(),new z9(-1,`Unexpected content type: ${K}`);else await G.body?.cancel()}catch(W){throw this.onerror?.(W),W}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let Q=await this._commonHeaders(),X={...this._requestInit,method:"DELETE",headers:Q,signal:this._abortController?.signal},W=await(this._fetch??fetch)(this._url,X);if(await W.body?.cancel(),!W.ok&&W.status!==405)throw new z9(W.status,`Failed to terminate session: ${W.statusText}`);this._sessionId=void 0}catch(Q){throw this.onerror?.(Q),Q}}setProtocolVersion(Q){this._protocolVersion=Q}get protocolVersion(){return this._protocolVersion}async resumeStream(Q,X){await this._startOrAuthSse({resumptionToken:Q,onresumptiontoken:X?.onresumptiontoken})}}class lJ{name;url;onStatusChange;onNotification;onLog;onSamplingRequest;onElicitationRequest;client=null;transport=null;status="disconnected";errorMessage;capabilities;isClosing=!1;constructor(Q){this.name=Q.name,this.url=Q.url,this.onStatusChange=Q.onStatusChange,this.onNotification=Q.onNotification,this.onLog=Q.onLog,this.onSamplingRequest=Q.onSamplingRequest,this.onElicitationRequest=Q.onElicitationRequest}getInfo(){let Q={name:this.name,url:this.url,status:this.status};if(this.errorMessage!==void 0)Q.error=this.errorMessage;if(this.capabilities!==void 0)Q.capabilities=this.capabilities;return Q}getName(){return this.name}getStatus(){return this.status}isConnected(){return this.status==="connected"}async connect(){if(this.status==="connected"||this.status==="connecting")return;this.setStatus("connecting");try{this.transport=new uJ(new URL(this.url)),this.client=new ZJ({name:"mcp-proxy",version:"0.1.0"},{capabilities:{sampling:{},elicitation:{form:{}}}}),this.setupNotificationHandler(),this.transport.onclose=()=>{if(!this.isClosing)this.setStatus("disconnected")},this.transport.onerror=(X)=>{if((X.name==="AbortError"||X.message.includes("AbortError"))&&(this.isClosing||this.status==="disconnected"))return;this.setStatus("error",X.message)},await this.client.connect(this.transport);let Q=this.client.getServerCapabilities();this.capabilities={tools:Q?.tools!==void 0,resources:Q?.resources!==void 0,prompts:Q?.prompts!==void 0,resourceTemplates:Q?.resources!==void 0},this.setStatus("connected")}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw this.setStatus("error",X),Q}}async disconnect(){if(this.isClosing=!0,this.transport)try{await this.transport.close()}catch{}this.client=null,this.transport=null,this.isClosing=!1,this.setStatus("disconnected")}async listTools(){let Q=this.getConnectedClient();if(!this.capabilities?.tools)return[];return(await Q.listTools()).tools}async callTool(Q,X={}){return await this.getConnectedClient().callTool({name:Q,arguments:X})}async listResources(){let Q=this.getConnectedClient();if(!this.capabilities?.resources)return[];return(await Q.listResources()).resources}async listResourceTemplates(){let Q=this.getConnectedClient();if(!this.capabilities?.resourceTemplates)return[];return(await Q.listResourceTemplates()).resourceTemplates}async readResource(Q){return await this.getConnectedClient().readResource({uri:Q})}async listPrompts(){let Q=this.getConnectedClient();if(!this.capabilities?.prompts)return[];return(await Q.listPrompts()).prompts}async getPrompt(Q,X={}){return await this.getConnectedClient().getPrompt({name:Q,arguments:X})}setupNotificationHandler(){if(!this.client)return;this.client.setNotificationHandler(l4,()=>{this.emitNotification("notifications/tools/list_changed")}),this.client.setNotificationHandler(h4,()=>{this.emitNotification("notifications/resources/list_changed")}),this.client.setNotificationHandler(W5,(Q)=>{this.emitNotification("notifications/resources/updated",Q.params)}),this.client.setNotificationHandler(u4,()=>{this.emitNotification("notifications/prompts/list_changed")}),this.client.setNotificationHandler(L5,(Q)=>{if(this.onLog)this.onLog({server:this.name,timestamp:new Date,level:Q.params.level,logger:Q.params.logger,data:Q.params.data})}),this.client.setRequestHandler(c4,(Q)=>{return new Promise((X,W)=>{if(this.onSamplingRequest)this.onSamplingRequest({id:crypto.randomUUID(),server:this.name,timestamp:new Date,params:Q.params,resolve:X,reject:W});else W(Error("Sampling not supported: no handler registered"))})}),this.client.setRequestHandler(i4,(Q)=>{return new Promise((X,W)=>{if(this.onElicitationRequest)this.onElicitationRequest({id:crypto.randomUUID(),server:this.name,timestamp:new Date,params:Q.params,resolve:X,reject:W});else W(Error("Elicitation not supported: no handler registered"))})})}emitNotification(Q,X){if(this.onNotification!==void 0)this.onNotification({server:this.name,timestamp:new Date,method:Q,params:X})}setStatus(Q,X){if(this.status=Q,Q==="error"&&X!==void 0)this.errorMessage=X;else this.errorMessage=void 0;if(this.onStatusChange!==void 0)this.onStatusChange(Q,X)}getConnectedClient(){if(!this.isConnected()||!this.client)throw Error(`Client '${this.name}' is not connected`);return this.client}}class mJ{clients=new Map;notifications=[];logs=[];pendingSamplingRequests=new Map;pendingElicitationRequests=new Map;onServerStatusChange;requestTimeoutMs;constructor(Q={}){this.onServerStatusChange=Q.onServerStatusChange,this.requestTimeoutMs=Q.requestTimeoutMs??300000}async addServer(Q){if(this.clients.has(Q.name))throw Error(`Server '${Q.name}' already exists`);let X=new lJ({name:Q.name,url:Q.url,onStatusChange:(W,Y)=>{this.handleStatusChange(Q.name,W,Y)},onNotification:(W)=>{this.notifications.push(W)},onLog:(W)=>{this.logs.push(W)},onSamplingRequest:(W)=>{this.handleIncomingSamplingRequest(W)},onElicitationRequest:(W)=>{this.handleIncomingElicitationRequest(W)}});this.clients.set(Q.name,X);try{await X.connect()}catch(W){let Y=W instanceof Error?W.message:String(W);this.handleStatusChange(Q.name,"error",Y)}}async removeServer(Q){let X=this.clients.get(Q);if(!X)throw Error(`Server '${Q}' not found`);for(let[W,Y]of this.pendingSamplingRequests)if(Y.server===Q)Y.reject(Error(`Server '${Q}' disconnected`)),this.pendingSamplingRequests.delete(W);for(let[W,Y]of this.pendingElicitationRequests)if(Y.server===Q)Y.reject(Error(`Server '${Q}' disconnected`)),this.pendingElicitationRequests.delete(W);await X.disconnect(),this.clients.delete(Q)}listServers(){let Q=[];for(let X of this.clients.values())Q.push(X.getInfo());return Q}getServer(Q){return this.clients.get(Q)?.getInfo()}hasServer(Q){return this.clients.has(Q)}async listTools(Q){let X=[];if(Q!==void 0){let Y=await this.getConnectedClient(Q).listTools();for(let $ of Y)X.push({...$,server:Q})}else for(let[W,Y]of this.clients)if(Y.isConnected())try{let $=await Y.listTools();for(let J of $)X.push({...J,server:W})}catch{}return X}async executeTool(Q,X,W={}){return await this.getConnectedClient(Q).callTool(X,W)}async listResources(Q){let X=[];if(Q!==void 0){let Y=await this.getConnectedClient(Q).listResources();for(let $ of Y)X.push({...$,server:Q})}else for(let[W,Y]of this.clients)if(Y.isConnected())try{let $=await Y.listResources();for(let J of $)X.push({...J,server:W})}catch{}return X}async listResourceTemplates(Q){let X=[];if(Q!==void 0){let Y=await this.getConnectedClient(Q).listResourceTemplates();for(let $ of Y)X.push({...$,server:Q})}else for(let[W,Y]of this.clients)if(Y.isConnected())try{let $=await Y.listResourceTemplates();for(let J of $)X.push({...J,server:W})}catch{}return X}async readResource(Q,X){return this.getConnectedClient(Q).readResource(X)}async listPrompts(Q){let X=[];if(Q!==void 0){let Y=await this.getConnectedClient(Q).listPrompts();for(let $ of Y)X.push({...$,server:Q})}else for(let[W,Y]of this.clients)if(Y.isConnected())try{let $=await Y.listPrompts();for(let J of $)X.push({...J,server:W})}catch{}return X}async getPrompt(Q,X,W={}){return this.getConnectedClient(Q).getPrompt(X,W)}getNotifications(){let Q=[...this.notifications];return this.notifications.length=0,Q}getNotificationCount(){return this.notifications.length}async shutdown(){for(let X of this.pendingSamplingRequests.values())X.reject(Error("Registry shutting down"));this.pendingSamplingRequests.clear();for(let X of this.pendingElicitationRequests.values())X.reject(Error("Registry shutting down"));this.pendingElicitationRequests.clear();let Q=[];for(let X of this.clients.values())Q.push(X.disconnect());await Promise.all(Q),this.clients.clear(),this.notifications.length=0,this.logs.length=0}getLogs(){let Q=[...this.logs];return this.logs.length=0,Q}getLogCount(){return this.logs.length}getPendingSamplingRequests(){return Array.from(this.pendingSamplingRequests.values()).map((Q)=>({id:Q.id,server:Q.server,timestamp:Q.timestamp,params:Q.params}))}getPendingSamplingRequestCount(){return this.pendingSamplingRequests.size}respondToSamplingRequest(Q,X){let W=this.pendingSamplingRequests.get(Q);if(!W)throw Error(`Sampling request '${Q}' not found or already completed`);this.pendingSamplingRequests.delete(Q),W.resolve(X)}rejectSamplingRequest(Q,X){let W=this.pendingSamplingRequests.get(Q);if(!W)throw Error(`Sampling request '${Q}' not found or already completed`);this.pendingSamplingRequests.delete(Q),W.reject(Error(X))}getPendingElicitationRequests(){return Array.from(this.pendingElicitationRequests.values()).map((Q)=>({id:Q.id,server:Q.server,timestamp:Q.timestamp,params:Q.params}))}getPendingElicitationRequestCount(){return this.pendingElicitationRequests.size}respondToElicitationRequest(Q,X){let W=this.pendingElicitationRequests.get(Q);if(!W)throw Error(`Elicitation request '${Q}' not found or already completed`);this.pendingElicitationRequests.delete(Q),W.resolve(X)}rejectElicitationRequest(Q,X){let W=this.pendingElicitationRequests.get(Q);if(!W)throw Error(`Elicitation request '${Q}' not found or already completed`);this.pendingElicitationRequests.delete(Q),W.reject(Error(X))}handleIncomingSamplingRequest(Q){this.pendingSamplingRequests.set(Q.id,Q),setTimeout(()=>{let X=this.pendingSamplingRequests.get(Q.id);if(X)this.pendingSamplingRequests.delete(Q.id),X.reject(Error(`Sampling request timed out after ${String(this.requestTimeoutMs)}ms`))},this.requestTimeoutMs)}handleIncomingElicitationRequest(Q){this.pendingElicitationRequests.set(Q.id,Q),setTimeout(()=>{let X=this.pendingElicitationRequests.get(Q.id);if(X)this.pendingElicitationRequests.delete(Q.id),X.reject(Error(`Elicitation request timed out after ${String(this.requestTimeoutMs)}ms`))},this.requestTimeoutMs)}getConnectedClient(Q){let X=this.clients.get(Q);if(!X)throw Error(`Server '${Q}' not found`);if(!X.isConnected())throw Error(`Server '${Q}' is not connected`);return X}handleStatusChange(Q,X,W){if(this.onServerStatusChange!==void 0){let Y=this.clients.get(Q);if(Y)this.onServerStatusChange(Q,Y.getInfo())}if(W!==void 0)console.error(`[${Q}] ${X}: ${W}`)}}import{readFileSync as Ff}from"fs";function Af(){let Q=process.argv.slice(2),X,W=Number(process.env.PORT)||8080;for(let Y=0;Y<Q.length;Y++){let $=Q[Y];if($==="--config"&&Q[Y+1])X=Q[Y+1],Y++;else if($?.startsWith("--config="))X=$.slice(9);else if($==="--port"&&Q[Y+1])W=Number(Q[Y+1]),Y++;else if($?.startsWith("--port="))W=Number($.slice(7))}return{configPath:X,port:W}}function Df(Q){let X=Ff(Q,"utf-8");return JSON.parse(X)}function Vf(Q){let X=new qJ({name:"mcp-proxy",version:"0.1.0"});return X.registerTool("add_server",{description:"Connect to a backend MCP server",inputSchema:{name:e.string().describe("Unique name for this server"),url:e.string().url().describe("HTTP URL of the MCP server endpoint")}},async({name:W,url:Y})=>{try{return await Q.addServer({name:W,url:Y}),{content:[{type:"text",text:`Connected to server '${W}' at ${Y}`}]}}catch($){return{content:[{type:"text",text:`Failed to add server: ${$ instanceof Error?$.message:String($)}`}]}}}),X.registerTool("remove_server",{description:"Disconnect from a backend MCP server",inputSchema:{name:e.string().describe("Name of the server to remove")}},async({name:W})=>{try{return await Q.removeServer(W),{content:[{type:"text",text:`Disconnected from server '${W}'`}]}}catch(Y){return{content:[{type:"text",text:`Failed to remove server: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),X.registerTool("list_servers",{description:"List all connected backend MCP servers with their status",inputSchema:{}},()=>{let W=Q.listServers();if(W.length===0)return{content:[{type:"text",text:"No servers connected"}]};return{content:[{type:"text",text:JSON.stringify(W,null,2)}]}}),X.registerTool("list_tools",{description:"List tools available from backend servers",inputSchema:{server:e.string().default(".*").describe("Regex pattern to match server names (default: .*)"),tool:e.string().default(".*").describe("Regex pattern to match tool names (default: .*)")}},async({server:W,tool:Y})=>{try{let $=new RegExp(W),J=new RegExp(Y),H=(await Q.listTools()).filter((z)=>$.test(z.server)&&J.test(z.name));if(H.length===0)return{content:[{type:"text",text:"No tools available"}]};let B=H.map((z)=>({server:z.server,name:z.name,description:z.description,inputSchema:z.inputSchema}));return{content:[{type:"text",text:JSON.stringify(B,null,2)}]}}catch($){return{content:[{type:"text",text:`Failed to list tools: ${$ instanceof Error?$.message:String($)}`}]}}}),X.registerTool("execute_tool",{description:"Execute a tool on a specific backend server",inputSchema:{server:e.string().describe("Name of the backend server"),tool:e.string().describe("Name of the tool to execute"),args:e.record(e.unknown()).optional().describe("Arguments to pass to the tool")}},async({server:W,tool:Y,args:$})=>{try{let J=await Q.executeTool(W,Y,$??{});return{content:J.content,isError:J.isError}}catch(J){return{content:[{type:"text",text:`Failed to execute tool: ${J instanceof Error?J.message:String(J)}`}]}}}),X.registerTool("get_notifications",{description:"Get and clear buffered notifications from backend servers",inputSchema:{}},()=>{let W=Q.getNotifications();if(W.length===0)return{content:[{type:"text",text:"No notifications"}]};let Y=W.map(($)=>({server:$.server,method:$.method,timestamp:$.timestamp.toISOString(),params:$.params}));return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}),X.registerTool("get_logs",{description:"Get and clear buffered log messages from backend servers",inputSchema:{}},()=>{let W=Q.getLogs();if(W.length===0)return{content:[{type:"text",text:"No log messages"}]};let Y=W.map(($)=>({server:$.server,level:$.level,logger:$.logger,timestamp:$.timestamp.toISOString(),data:$.data}));return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}),X.registerTool("get_sampling_requests",{description:"Get pending sampling requests from backend servers that need LLM responses. These are requests from MCP servers asking for LLM completions.",inputSchema:{}},()=>{let W=Q.getPendingSamplingRequests();if(W.length===0)return{content:[{type:"text",text:"No pending sampling requests"}]};let Y=W.map(($)=>({id:$.id,server:$.server,timestamp:$.timestamp.toISOString(),maxTokens:$.params.maxTokens,systemPrompt:$.params.systemPrompt,temperature:$.params.temperature,messages:$.params.messages,modelPreferences:$.params.modelPreferences,tools:$.params.tools?.map((J)=>({name:J.name,description:J.description}))}));return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}),X.registerTool("respond_to_sampling",{description:"Respond to a pending sampling request with an LLM result",inputSchema:{request_id:e.string().describe("The ID of the sampling request to respond to"),role:e.enum(["user","assistant"]).describe("The role of the message"),content:e.string().describe("The text content of the response"),model:e.string().describe("The model that generated the response"),stop_reason:e.enum(["endTurn","maxTokens","stopSequence","toolUse"]).optional().describe("Why the model stopped generating")}},({request_id:W,role:Y,content:$,model:J,stop_reason:G})=>{try{return Q.respondToSamplingRequest(W,{role:Y,content:{type:"text",text:$},model:J,stopReason:G}),{content:[{type:"text",text:`Responded to sampling request '${W}'`}]}}catch(H){return{content:[{type:"text",text:`Failed to respond: ${H instanceof Error?H.message:String(H)}`}]}}}),X.registerTool("get_elicitations",{description:"Get pending elicitation requests from backend servers that need user input. These are requests from MCP servers asking for form data or user confirmation.",inputSchema:{}},()=>{let W=Q.getPendingElicitationRequests();if(W.length===0)return{content:[{type:"text",text:"No pending elicitation requests"}]};let Y=W.map(($)=>({id:$.id,server:$.server,timestamp:$.timestamp.toISOString(),mode:"mode"in $.params?$.params.mode:"form",message:$.params.message,requestedSchema:"requestedSchema"in $.params?$.params.requestedSchema:void 0,elicitationId:"elicitationId"in $.params?$.params.elicitationId:void 0,url:"url"in $.params?$.params.url:void 0}));return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}),X.registerTool("respond_to_elicitation",{description:"Respond to a pending elicitation request with user input",inputSchema:{request_id:e.string().describe("The ID of the elicitation request to respond to"),action:e.enum(["accept","decline","cancel"]).describe("The user's action: accept (with content), decline, or cancel"),content:e.record(e.union([e.string(),e.number(),e.boolean(),e.array(e.string())])).optional().describe("The form field values (required if action is 'accept' for form mode)")}},({request_id:W,action:Y,content:$})=>{try{return Q.respondToElicitationRequest(W,{action:Y,content:$}),{content:[{type:"text",text:`Responded to elicitation request '${W}' with action '${Y}'`}]}}catch(J){return{content:[{type:"text",text:`Failed to respond: ${J instanceof Error?J.message:String(J)}`}]}}}),X.registerTool("list_resources",{description:"List resources available from backend servers",inputSchema:{server:e.string().optional().describe("Server name to filter by (omit for all servers)")}},async({server:W})=>{try{let Y=await Q.listResources(W);if(Y.length===0)return{content:[{type:"text",text:"No resources available"}]};let $=Y.map((J)=>({server:J.server,uri:J.uri,name:J.name,description:J.description,mimeType:J.mimeType}));return{content:[{type:"text",text:JSON.stringify($,null,2)}]}}catch(Y){return{content:[{type:"text",text:`Failed to list resources: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),X.registerTool("read_resource",{description:"Read a specific resource from a backend server",inputSchema:{server:e.string().describe("Name of the backend server"),uri:e.string().describe("URI of the resource to read")}},async({server:W,uri:Y})=>{try{let J=(await Q.readResource(W,Y)).contents.map((G)=>{if("text"in G&&typeof G.text==="string")return{uri:G.uri,mimeType:G.mimeType,text:G.text};else if("blob"in G&&typeof G.blob==="string")return{uri:G.uri,mimeType:G.mimeType,blob:`[base64 data, ${String(G.blob.length)} chars]`};return G});return{content:[{type:"text",text:JSON.stringify({contents:J},null,2)}]}}catch($){return{content:[{type:"text",text:`Failed to read resource: ${$ instanceof Error?$.message:String($)}`}]}}}),X.registerTool("list_prompts",{description:"List prompts available from backend servers",inputSchema:{server:e.string().optional().describe("Server name to filter by (omit for all servers)")}},async({server:W})=>{try{let Y=await Q.listPrompts(W);if(Y.length===0)return{content:[{type:"text",text:"No prompts available"}]};let $=Y.map((J)=>({server:J.server,name:J.name,description:J.description,arguments:J.arguments}));return{content:[{type:"text",text:JSON.stringify($,null,2)}]}}catch(Y){return{content:[{type:"text",text:`Failed to list prompts: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),X.registerTool("get_prompt",{description:"Get a specific prompt from a backend server",inputSchema:{server:e.string().describe("Name of the backend server"),name:e.string().describe("Name of the prompt to get"),arguments:e.record(e.string()).optional().describe("Arguments to pass to the prompt")}},async({server:W,name:Y,arguments:$})=>{try{let J=await Q.getPrompt(W,Y,$??{});return{content:[{type:"text",text:JSON.stringify(J,null,2)}]}}catch(J){return{content:[{type:"text",text:`Failed to get prompt: ${J instanceof Error?J.message:String(J)}`}]}}}),X}async function Of(){let{configPath:Q,port:X}=Af(),W=new mJ({onServerStatusChange:(H,B)=>{console.log(`[${H}] Status: ${B.status}${B.error?` - ${B.error}`:""}`)}});if(Q)try{let H=Df(Q);console.log(`Loading ${String(H.servers.length)} server(s) from ${Q}`);for(let B of H.servers)console.log(` Adding ${B.name} at ${B.url}`),await W.addServer(B)}catch(H){console.error(`Failed to load config: ${H instanceof Error?H.message:String(H)}`),process.exit(1)}let Y=Vf(W),$=new Map,J=Lf((H,B)=>{let z=H.headers.host??"localhost";if(new URL(H.url??"/",`http://${z}`).pathname!=="/mcp"){B.writeHead(404,{"Content-Type":"application/json"}),B.end(JSON.stringify({error:"Not found"}));return}let L=H.headers["mcp-session-id"];if(H.method==="POST"){let V=L?$.get(L):void 0;if(!V){let F=new PJ({sessionIdGenerator:()=>crypto.randomUUID(),onsessioninitialized:(D)=>{$.set(D,F),console.log(`Session initialized: ${D}`)}});V=F,Y.connect(F)}V.handleRequest(H,B)}else if(H.method==="GET"){if(!L){B.writeHead(400,{"Content-Type":"application/json"}),B.end(JSON.stringify({error:"Missing mcp-session-id header"}));return}let V=$.get(L);if(!V){B.writeHead(404,{"Content-Type":"application/json"}),B.end(JSON.stringify({error:"Session not found"}));return}V.handleRequest(H,B)}else if(H.method==="DELETE"){if(L&&$.has(L))$.get(L)?.close(),$.delete(L),console.log(`Session closed: ${L}`);B.writeHead(200),B.end()}else B.writeHead(405,{"Content-Type":"application/json"}),B.end(JSON.stringify({error:"Method not allowed"}))}),G=()=>{console.log(`
63
- Shutting down...`),W.shutdown();for(let H of $.values())H.close();J.close(),process.exit(0)};process.on("SIGINT",G),process.on("SIGTERM",G),J.listen(X,()=>{console.log(`MCP Proxy Server running at http://localhost:${String(X)}/mcp`),console.log("Available tools:"),console.log(" Server management: add_server, remove_server, list_servers"),console.log(" Tools: list_tools, execute_tool"),console.log(" Resources: list_resources, read_resource"),console.log(" Prompts: list_prompts, get_prompt"),console.log(" Notifications: get_notifications, get_logs"),console.log(" Sampling: get_sampling_requests, respond_to_sampling"),console.log(" Elicitation: get_elicitations, respond_to_elicitation")})}Of();