@stophy/mcp 1.0.5 → 1.2.0

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/index.js CHANGED
@@ -1,42 +1,46 @@
1
1
  #!/usr/bin/env node
2
- var TB=Object.create;var{getPrototypeOf:ZB,defineProperty:S8,getOwnPropertyNames:vB}=Object;var kB=Object.prototype.hasOwnProperty;function _B(Q){return this[Q]}var xB,gB,SW=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var $=X?xB??=new WeakMap:gB??=new WeakMap,J=$.get(Q);if(J)return J}Y=Q!=null?TB(ZB(Q)):{};let G=X||!Q||!Q.__esModule?S8(Y,"default",{value:Q,enumerable:!0}):Y;for(let H of vB(Q))if(!kB.call(G,H))S8(G,H,{get:_B.bind(Q,H),enumerable:!0});if(W)$.set(Q,G);return G};var P=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var yB=(Q)=>Q;function hB(Q,X){this[Q]=yB.bind(null,X)}var P8=(Q,X)=>{for(var Y in X)S8(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:hB.bind(X,Y)})};var w4=P((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});P7.regexpCode=P7.getEsmExportName=P7.getProperty=P7.safeStringify=P7.stringify=P7.strConcat=P7.addCodeArg=P7.str=P7._=P7.nil=P7._Code=P7.Name=P7.IDENTIFIER=P7._CodeOrName=void 0;class l9{}P7._CodeOrName=l9;P7.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class P6 extends l9{constructor(Q){super();if(!P7.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}}}P7.Name=P6;class a0 extends l9{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,Y)=>`${X}${Y}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((X,Y)=>{if(Y instanceof P6)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}P7._Code=a0;P7.nil=new a0("");function E7(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)DY(Y,X[W]),Y.push(Q[++W]);return new a0(Y)}P7._=E7;var KY=new a0("+");function S7(Q,...X){let Y=[N4(Q[0])],W=0;while(W<X.length)Y.push(KY),DY(Y,X[W]),Y.push(KY,N4(Q[++W]));return hL(Y),new a0(Y)}P7.str=S7;function DY(Q,X){if(X instanceof a0)Q.push(...X._items);else if(X instanceof P6)Q.push(X);else Q.push(lL(X))}P7.addCodeArg=DY;function hL(Q){let X=1;while(X<Q.length-1){if(Q[X]===KY){let Y=fL(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function fL(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof P6||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 P6))return`"${Q}${X.slice(1)}`;return}function uL(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:S7`${Q}${X}`}P7.strConcat=uL;function lL(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:N4(Array.isArray(Q)?Q.join(","):Q)}function mL(Q){return new a0(N4(Q))}P7.stringify=mL;function N4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}P7.safeStringify=N4;function cL(Q){return typeof Q=="string"&&P7.IDENTIFIER.test(Q)?new a0(`.${Q}`):E7`[${Q}]`}P7.getProperty=cL;function pL(Q){if(typeof Q=="string"&&P7.IDENTIFIER.test(Q))return new a0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}P7.getEsmExportName=pL;function iL(Q){return new a0(Q.toString())}P7.regexpCode=iL});var VY=P((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.ValueScope=T7.ValueScopeName=T7.Scope=T7.varKinds=T7.UsedValueState=void 0;var C0=w4();class R7 extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var c9;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(c9||(T7.UsedValueState=c9={}));T7.varKinds={const:new C0.Name("const"),let:new C0.Name("let"),var:new C0.Name("var")};class qY{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof C0.Name?Q:this.name(Q)}name(Q){return new C0.Name(this._newName(Q))}_newName(Q){let X=this._names[Q]||this._nameGroup(Q);return`${Q}${X.index++}`}_nameGroup(Q){var X,Y;if(((Y=(X=this._parent)===null||X===void 0?void 0:X._prefixes)===null||Y===void 0?void 0:Y.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}}}T7.Scope=qY;class FY extends C0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=C0._`.${new C0.Name(X)}[${Y}]`}}T7.ValueScopeName=FY;var $q=C0._`\n`;class C7 extends qY{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?$q:C0.nil}}get(){return this._scope}name(Q){return new FY(Q,this._newName(Q))}value(Q,X){var Y;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:$}=W,J=(Y=X.key)!==null&&Y!==void 0?Y: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,W);let H=this._scope[$]||(this._scope[$]=[]),B=H.length;return H[B]=X.ref,W.setValue(X,{property:$,itemIndex:B}),W}getValue(Q,X){let Y=this._values[Q];if(!Y)return;return Y.get(X)}scopeRefs(Q,X=this._values){return this._reduceValues(X,(Y)=>{if(Y.scopePath===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return C0._`${Q}${Y.scopePath}`})}scopeCode(Q=this._values,X,Y){return this._reduceValues(Q,(W)=>{if(W.value===void 0)throw Error(`CodeGen: name "${W}" has no value`);return W.value.code},X,Y)}_reduceValues(Q,X,Y={},W){let $=C0.nil;for(let J in Q){let G=Q[J];if(!G)continue;let H=Y[J]=Y[J]||new Map;G.forEach((B)=>{if(H.has(B))return;H.set(B,c9.Started);let z=X(B);if(z){let A=this.opts.es5?T7.varKinds.var:T7.varKinds.const;$=C0._`${$}${A} ${B} = ${z};${this.opts._n}`}else if(z=W===null||W===void 0?void 0:W(B))$=C0._`${$}${z}${this.opts._n}`;else throw new R7(B);H.set(B,c9.Completed)})}return $}}T7.ValueScope=C7});var l=P((T0)=>{Object.defineProperty(T0,"__esModule",{value:!0});T0.or=T0.and=T0.not=T0.CodeGen=T0.operators=T0.varKinds=T0.ValueScopeName=T0.ValueScope=T0.Scope=T0.Name=T0.regexpCode=T0.stringify=T0.getProperty=T0.nil=T0.strConcat=T0.str=T0._=void 0;var d=w4(),s0=VY(),R1=w4();Object.defineProperty(T0,"_",{enumerable:!0,get:function(){return R1._}});Object.defineProperty(T0,"str",{enumerable:!0,get:function(){return R1.str}});Object.defineProperty(T0,"strConcat",{enumerable:!0,get:function(){return R1.strConcat}});Object.defineProperty(T0,"nil",{enumerable:!0,get:function(){return R1.nil}});Object.defineProperty(T0,"getProperty",{enumerable:!0,get:function(){return R1.getProperty}});Object.defineProperty(T0,"stringify",{enumerable:!0,get:function(){return R1.stringify}});Object.defineProperty(T0,"regexpCode",{enumerable:!0,get:function(){return R1.regexpCode}});Object.defineProperty(T0,"Name",{enumerable:!0,get:function(){return R1.Name}});var r9=VY();Object.defineProperty(T0,"Scope",{enumerable:!0,get:function(){return r9.Scope}});Object.defineProperty(T0,"ValueScope",{enumerable:!0,get:function(){return r9.ValueScope}});Object.defineProperty(T0,"ValueScopeName",{enumerable:!0,get:function(){return r9.ValueScopeName}});Object.defineProperty(T0,"varKinds",{enumerable:!0,get:function(){return r9.varKinds}});T0.operators={GT:new d._Code(">"),GTE:new d._Code(">="),LT:new d._Code("<"),LTE:new d._Code("<="),EQ:new d._Code("==="),NEQ:new d._Code("!=="),NOT:new d._Code("!"),OR:new d._Code("||"),AND:new d._Code("&&"),ADD:new d._Code("+")};class C1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class v7 extends C1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?s0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${Y} ${this.name}${W};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=R6(this.rhs,Q,X);return this}get names(){return this.rhs instanceof d._CodeOrName?this.rhs.names:{}}}class NY extends C1{constructor(Q,X,Y){super();this.lhs=Q,this.rhs=X,this.sideEffects=Y}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof d.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=R6(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof d.Name?{}:{...this.lhs.names};return o9(Q,this.rhs)}}class k7 extends NY{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class _7 extends C1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class x7 extends C1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class g7 extends C1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class y7 extends C1{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=R6(this.code,Q,X),this}get names(){return this.code instanceof d._CodeOrName?this.code.names:{}}}class t9 extends C1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,Y)=>X+Y.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let Y=Q[X].optimizeNodes();if(Array.isArray(Y))Q.splice(X,1,...Y);else if(Y)Q[X]=Y;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:Y}=this,W=Y.length;while(W--){let $=Y[W];if($.optimizeNames(Q,X))continue;Bq(Q,$.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>o1(Q,X.names),{})}}class T1 extends t9{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class h7 extends t9{}class M4 extends T1{}M4.kind="else";class D1 extends T1{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 Y=X.optimizeNodes();X=this.else=Array.isArray(Y)?new M4(Y):Y}if(X){if(Q===!1)return X instanceof D1?X:X.nodes;if(this.nodes.length)return this;return new D1(c7(Q),X instanceof D1?[X]:X.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,X){var Y;if(this.else=(Y=this.else)===null||Y===void 0?void 0:Y.optimizeNames(Q,X),!(super.optimizeNames(Q,X)||this.else))return;return this.condition=R6(this.condition,Q,X),this}get names(){let Q=super.names;if(o9(Q,this.condition),this.else)o1(Q,this.else.names);return Q}}D1.kind="if";class I6 extends T1{}I6.kind="for";class f7 extends I6{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=R6(this.iteration,Q,X),this}get names(){return o1(super.names,this.iteration.names)}}class u7 extends I6{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?s0.varKinds.var:this.varKind,{name:Y,from:W,to:$}=this;return`for(${X} ${Y}=${W}; ${Y}<${$}; ${Y}++)`+super.render(Q)}get names(){let Q=o9(super.names,this.from);return o9(Q,this.to)}}class UY extends I6{constructor(Q,X,Y,W){super();this.loop=Q,this.varKind=X,this.name=Y,this.iterable=W}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=R6(this.iterable,Q,X),this}get names(){return o1(super.names,this.iterable.names)}}class p9 extends T1{constructor(Q,X,Y){super();this.name=Q,this.args=X,this.async=Y}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}p9.kind="func";class i9 extends t9{render(Q){return"return "+super.render(Q)}}i9.kind="return";class l7 extends T1{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 Y,W;return super.optimizeNames(Q,X),(Y=this.catch)===null||Y===void 0||Y.optimizeNames(Q,X),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)o1(Q,this.catch.names);if(this.finally)o1(Q,this.finally.names);return Q}}class n9 extends T1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}n9.kind="catch";class d9 extends T1{render(Q){return"finally"+super.render(Q)}}d9.kind="finally";class m7{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
3
- `:""},this._extScope=Q,this._scope=new s0.Scope({parent:Q}),this._nodes=[new h7]}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 Y=this._extScope.value(Q,X);return(this._values[Y.prefix]||(this._values[Y.prefix]=new Set)).add(Y),Y}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,Y,W){let $=this._scope.toName(X);if(Y!==void 0&&W)this._constants[$.str]=Y;return this._leafNode(new v7(Q,$,Y)),$}const(Q,X,Y){return this._def(s0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(s0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(s0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new NY(Q,X,Y))}add(Q,X){return this._leafNode(new k7(Q,T0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==d.nil)this._leafNode(new y7(Q));return this}object(...Q){let X=["{"];for(let[Y,W]of Q){if(X.length>1)X.push(",");if(X.push(Y),Y!==W||this.opts.es5)X.push(":"),(0,d.addCodeArg)(X,W)}return X.push("}"),new d._Code(X)}if(Q,X,Y){if(this._blockNode(new D1(Q)),X&&Y)this.code(X).else().code(Y).endIf();else if(X)this.code(X).endIf();else if(Y)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new D1(Q))}else(){return this._elseNode(new M4)}endIf(){return this._endBlockNode(D1,M4)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new f7(Q),X)}forRange(Q,X,Y,W,$=this.opts.es5?s0.varKinds.var:s0.varKinds.let){let J=this._scope.toName(Q);return this._for(new u7($,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=s0.varKinds.const){let $=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof d.Name?X:this.var("_arr",X);return this.forRange("_i",0,d._`${J}.length`,(G)=>{this.var($,d._`${J}[${G}]`),Y($)})}return this._for(new UY("of",W,$,X),()=>Y($))}forIn(Q,X,Y,W=this.opts.es5?s0.varKinds.var:s0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,d._`Object.keys(${X})`,Y);let $=this._scope.toName(Q);return this._for(new UY("in",W,$,X),()=>Y($))}endFor(){return this._endBlockNode(I6)}label(Q){return this._leafNode(new _7(Q))}break(Q){return this._leafNode(new x7(Q))}return(Q){let X=new i9;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(i9)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new l7;if(this._blockNode(W),this.code(Q),X){let $=this.name("e");this._currNode=W.catch=new n9($),X($)}if(Y)this._currNode=W.finally=new d9,this.code(Y);return this._endBlockNode(n9,d9)}throw(Q){return this._leafNode(new g7(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 Y=this._nodes.length-X;if(Y<0||Q!==void 0&&Y!==Q)throw Error(`CodeGen: wrong number of nodes: ${Y} vs ${Q} expected`);return this._nodes.length=X,this}func(Q,X=d.nil,Y,W){if(this._blockNode(new p9(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(p9)}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 Y=this._currNode;if(Y instanceof Q||X&&Y 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 D1))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}}T0.CodeGen=m7;function o1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function o9(Q,X){return X instanceof d._CodeOrName?o1(Q,X.names):Q}function R6(Q,X,Y){if(Q instanceof d.Name)return W(Q);if(!$(Q))return Q;return new d._Code(Q._items.reduce((J,G)=>{if(G instanceof d.Name)G=W(G);if(G instanceof d._Code)J.push(...G._items);else J.push(G);return J},[]));function W(J){let G=Y[J.str];if(G===void 0||X[J.str]!==1)return J;return delete X[J.str],G}function $(J){return J instanceof d._Code&&J._items.some((G)=>G instanceof d.Name&&X[G.str]===1&&Y[G.str]!==void 0)}}function Bq(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function c7(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:d._`!${OY(Q)}`}T0.not=c7;var zq=p7(T0.operators.AND);function Aq(...Q){return Q.reduce(zq)}T0.and=Aq;var Kq=p7(T0.operators.OR);function Dq(...Q){return Q.reduce(Kq)}T0.or=Dq;function p7(Q){return(X,Y)=>X===d.nil?Y:Y===d.nil?X:d._`${OY(X)} ${Q} ${OY(Y)}`}function OY(Q){return Q instanceof d.Name?Q:d._`(${Q})`}});var o=P((e7)=>{Object.defineProperty(e7,"__esModule",{value:!0});e7.checkStrictMode=e7.getErrorPath=e7.Type=e7.useFunc=e7.setEvaluated=e7.evaluatedPropsToName=e7.mergeEvaluated=e7.eachItem=e7.unescapeJsonPointer=e7.escapeJsonPointer=e7.escapeFragment=e7.unescapeFragment=e7.schemaRefOrVal=e7.schemaHasRulesButRef=e7.schemaHasRules=e7.checkUnknownRules=e7.alwaysValidSchema=e7.toHash=void 0;var e=l(),Vq=w4();function Uq(Q){let X={};for(let Y of Q)X[Y]=!0;return X}e7.toHash=Uq;function Oq(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return o7(Q,X),!r7(X,Q.self.RULES.all)}e7.alwaysValidSchema=Oq;function o7(Q,X=Q.schema){let{opts:Y,self:W}=Q;if(!Y.strictSchema)return;if(typeof X==="boolean")return;let $=W.RULES.keywords;for(let J in X)if(!$[J])s7(Q,`unknown keyword: "${J}"`)}e7.checkUnknownRules=o7;function r7(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}e7.schemaHasRules=r7;function Nq(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}e7.schemaHasRulesButRef=Nq;function wq({topSchemaRef:Q,schemaPath:X},Y,W,$){if(!$){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return e._`${Y}`}return e._`${Q}${X}${(0,e.getProperty)(W)}`}e7.schemaRefOrVal=wq;function Mq(Q){return t7(decodeURIComponent(Q))}e7.unescapeFragment=Mq;function jq(Q){return encodeURIComponent(MY(Q))}e7.escapeFragment=jq;function MY(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}e7.escapeJsonPointer=MY;function t7(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}e7.unescapeJsonPointer=t7;function bq(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}e7.eachItem=bq;function n7({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return($,J,G,H)=>{let B=G===void 0?J:G instanceof e.Name?(J instanceof e.Name?Q($,J,G):X($,J,G),G):J instanceof e.Name?(X($,G,J),J):Y(J,G);return H===e.Name&&!(B instanceof e.Name)?W($,B):B}}e7.mergeEvaluated={props:n7({mergeNames:(Q,X,Y)=>Q.if(e._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(e._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,e._`${Y} || {}`).code(e._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(e._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,e._`${Y} || {}`),jY(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:a7}),items:n7({mergeNames:(Q,X,Y)=>Q.if(e._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,e._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(e._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:e._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function a7(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",e._`{}`);if(X!==void 0)jY(Q,Y,X);return Y}e7.evaluatedPropsToName=a7;function jY(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(e._`${X}${(0,e.getProperty)(W)}`,!0))}e7.setEvaluated=jY;var d7={};function Eq(Q,X){return Q.scopeValue("func",{ref:X,code:d7[X.code]||(d7[X.code]=new Vq._Code(X.code))})}e7.useFunc=Eq;var wY;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(wY||(e7.Type=wY={}));function Sq(Q,X,Y){if(Q instanceof e.Name){let W=X===wY.Num;return Y?W?e._`"[" + ${Q} + "]"`:e._`"['" + ${Q} + "']"`:W?e._`"/" + ${Q}`:e._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,e.getProperty)(Q).toString():"/"+MY(Q)}e7.getErrorPath=Sq;function s7(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}e7.checkStrictMode=s7});var L1=P((XG)=>{Object.defineProperty(XG,"__esModule",{value:!0});var M0=l(),cq={data:new M0.Name("data"),valCxt:new M0.Name("valCxt"),instancePath:new M0.Name("instancePath"),parentData:new M0.Name("parentData"),parentDataProperty:new M0.Name("parentDataProperty"),rootData:new M0.Name("rootData"),dynamicAnchors:new M0.Name("dynamicAnchors"),vErrors:new M0.Name("vErrors"),errors:new M0.Name("errors"),this:new M0.Name("this"),self:new M0.Name("self"),scope:new M0.Name("scope"),json:new M0.Name("json"),jsonPos:new M0.Name("jsonPos"),jsonLen:new M0.Name("jsonLen"),jsonPart:new M0.Name("jsonPart")};XG.default=cq});var j4=P((JG)=>{Object.defineProperty(JG,"__esModule",{value:!0});JG.extendErrors=JG.resetErrorsCount=JG.reportExtraError=JG.reportError=JG.keyword$DataError=JG.keywordError=void 0;var r=l(),s9=o(),S0=L1();JG.keywordError={message:({keyword:Q})=>r.str`must pass "${Q}" keyword validation`};JG.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?r.str`"${Q}" keyword must be ${X} ($data)`:r.str`"${Q}" keyword is invalid ($data)`};function iq(Q,X=JG.keywordError,Y,W){let{it:$}=Q,{gen:J,compositeRule:G,allErrors:H}=$,B=$G(Q,X,Y);if(W!==null&&W!==void 0?W:G||H)YG(J,B);else WG($,r._`[${B}]`)}JG.reportError=iq;function nq(Q,X=JG.keywordError,Y){let{it:W}=Q,{gen:$,compositeRule:J,allErrors:G}=W,H=$G(Q,X,Y);if(YG($,H),!(J||G))WG(W,S0.default.vErrors)}JG.reportExtraError=nq;function dq(Q,X){Q.assign(S0.default.errors,X),Q.if(r._`${S0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(r._`${S0.default.vErrors}.length`,X),()=>Q.assign(S0.default.vErrors,null)))}JG.resetErrorsCount=dq;function oq({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:$,it:J}){if($===void 0)throw Error("ajv implementation error");let G=Q.name("err");Q.forRange("i",$,S0.default.errors,(H)=>{if(Q.const(G,r._`${S0.default.vErrors}[${H}]`),Q.if(r._`${G}.instancePath === undefined`,()=>Q.assign(r._`${G}.instancePath`,(0,r.strConcat)(S0.default.instancePath,J.errorPath))),Q.assign(r._`${G}.schemaPath`,r.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(r._`${G}.schema`,Y),Q.assign(r._`${G}.data`,W)})}JG.extendErrors=oq;function YG(Q,X){let Y=Q.const("err",X);Q.if(r._`${S0.default.vErrors} === null`,()=>Q.assign(S0.default.vErrors,r._`[${Y}]`),r._`${S0.default.vErrors}.push(${Y})`),Q.code(r._`${S0.default.errors}++`)}function WG(Q,X){let{gen:Y,validateName:W,schemaEnv:$}=Q;if($.$async)Y.throw(r._`new ${Q.ValidationError}(${X})`);else Y.assign(r._`${W}.errors`,X),Y.return(!1)}var r1={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function $G(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return r._`{}`;return rq(Q,X,Y)}function rq(Q,X,Y={}){let{gen:W,it:$}=Q,J=[tq($,Y),aq(Q,Y)];return sq(Q,X,J),W.object(...J)}function tq({errorPath:Q},{instancePath:X}){let Y=X?r.str`${Q}${(0,s9.getErrorPath)(X,s9.Type.Str)}`:Q;return[S0.default.instancePath,(0,r.strConcat)(S0.default.instancePath,Y)]}function aq({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let $=W?X:r.str`${X}/${Q}`;if(Y)$=r.str`${$}${(0,s9.getErrorPath)(Y,s9.Type.Str)}`;return[r1.schemaPath,$]}function sq(Q,{params:X,message:Y},W){let{keyword:$,data:J,schemaValue:G,it:H}=Q,{opts:B,propertyName:z,topSchemaRef:A,schemaPath:D}=H;if(W.push([r1.keyword,$],[r1.params,typeof X=="function"?X(Q):X||r._`{}`]),B.messages)W.push([r1.message,typeof Y=="function"?Y(Q):Y]);if(B.verbose)W.push([r1.schema,G],[r1.parentSchema,r._`${A}${D}`],[S0.default.data,J]);if(z)W.push([r1.propertyName,z])}});var AG=P((BG)=>{Object.defineProperty(BG,"__esModule",{value:!0});BG.boolOrEmptySchema=BG.topBoolOrEmptySchema=void 0;var WF=j4(),$F=l(),JF=L1(),GF={message:"boolean schema is false"};function HF(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)HG(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(JF.default.data);else X.assign($F._`${W}.errors`,null),X.return(!0)}BG.topBoolOrEmptySchema=HF;function BF(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),HG(Q);else Y.var(X,!0)}BG.boolOrEmptySchema=BF;function HG(Q,X){let{gen:Y,data:W}=Q,$={gen:Y,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,WF.reportError)($,GF,void 0,X)}});var EY=P((KG)=>{Object.defineProperty(KG,"__esModule",{value:!0});KG.getRules=KG.isJSONType=void 0;var AF=["string","number","integer","boolean","null","object","array"],KF=new Set(AF);function DF(Q){return typeof Q=="string"&&KF.has(Q)}KG.isJSONType=DF;function LF(){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:{}}}KG.getRules=LF});var SY=P((FG)=>{Object.defineProperty(FG,"__esModule",{value:!0});FG.shouldUseRule=FG.shouldUseGroup=FG.schemaHasRulesForType=void 0;function FF({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&LG(Q,W)}FG.schemaHasRulesForType=FF;function LG(Q,X){return X.rules.some((Y)=>qG(Q,Y))}FG.shouldUseGroup=LG;function qG(Q,X){var Y;return Q[X.keyword]!==void 0||((Y=X.definition.implements)===null||Y===void 0?void 0:Y.some((W)=>Q[W]!==void 0))}FG.shouldUseRule=qG});var b4=P((wG)=>{Object.defineProperty(wG,"__esModule",{value:!0});wG.reportTypeError=wG.checkDataTypes=wG.checkDataType=wG.coerceAndCheckDataType=wG.getJSONTypes=wG.getSchemaTypes=wG.DataType=void 0;var OF=EY(),NF=SY(),wF=j4(),u=l(),UG=o(),C6;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(C6||(wG.DataType=C6={}));function MF(Q){let X=OG(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}wG.getSchemaTypes=MF;function OG(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(OF.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}wG.getJSONTypes=OG;function jF(Q,X){let{gen:Y,data:W,opts:$}=Q,J=bF(X,$.coerceTypes),G=X.length>0&&!(J.length===0&&X.length===1&&(0,NF.schemaHasRulesForType)(Q,X[0]));if(G){let H=IY(X,W,$.strictNumbers,C6.Wrong);Y.if(H,()=>{if(J.length)EF(Q,X,J);else RY(Q)})}return G}wG.coerceAndCheckDataType=jF;var NG=new Set(["string","number","integer","boolean","null"]);function bF(Q,X){return X?Q.filter((Y)=>NG.has(Y)||X==="array"&&Y==="array"):[]}function EF(Q,X,Y){let{gen:W,data:$,opts:J}=Q,G=W.let("dataType",u._`typeof ${$}`),H=W.let("coerced",u._`undefined`);if(J.coerceTypes==="array")W.if(u._`${G} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>W.assign($,u._`${$}[0]`).assign(G,u._`typeof ${$}`).if(IY(X,$,J.strictNumbers),()=>W.assign(H,$)));W.if(u._`${H} !== undefined`);for(let z of Y)if(NG.has(z)||z==="array"&&J.coerceTypes==="array")B(z);W.else(),RY(Q),W.endIf(),W.if(u._`${H} !== undefined`,()=>{W.assign($,H),SF(Q,H)});function B(z){switch(z){case"string":W.elseIf(u._`${G} == "number" || ${G} == "boolean"`).assign(H,u._`"" + ${$}`).elseIf(u._`${$} === null`).assign(H,u._`""`);return;case"number":W.elseIf(u._`${G} == "boolean" || ${$} === null
4
- || (${G} == "string" && ${$} && ${$} == +${$})`).assign(H,u._`+${$}`);return;case"integer":W.elseIf(u._`${G} === "boolean" || ${$} === null
5
- || (${G} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(H,u._`+${$}`);return;case"boolean":W.elseIf(u._`${$} === "false" || ${$} === 0 || ${$} === null`).assign(H,!1).elseIf(u._`${$} === "true" || ${$} === 1`).assign(H,!0);return;case"null":W.elseIf(u._`${$} === "" || ${$} === 0 || ${$} === false`),W.assign(H,null);return;case"array":W.elseIf(u._`${G} === "string" || ${G} === "number"
6
- || ${G} === "boolean" || ${$} === null`).assign(H,u._`[${$}]`)}}}function SF({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(u._`${X} !== undefined`,()=>Q.assign(u._`${X}[${Y}]`,W))}function PY(Q,X,Y,W=C6.Correct){let $=W===C6.Correct?u.operators.EQ:u.operators.NEQ,J;switch(Q){case"null":return u._`${X} ${$} null`;case"array":J=u._`Array.isArray(${X})`;break;case"object":J=u._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=G(u._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=G();break;default:return u._`typeof ${X} ${$} ${Q}`}return W===C6.Correct?J:(0,u.not)(J);function G(H=u.nil){return(0,u.and)(u._`typeof ${X} == "number"`,H,Y?u._`isFinite(${X})`:u.nil)}}wG.checkDataType=PY;function IY(Q,X,Y,W){if(Q.length===1)return PY(Q[0],X,Y,W);let $,J=(0,UG.toHash)(Q);if(J.array&&J.object){let G=u._`typeof ${X} != "object"`;$=J.null?G:u._`!${X} || ${G}`,delete J.null,delete J.array,delete J.object}else $=u.nil;if(J.number)delete J.integer;for(let G in J)$=(0,u.and)($,PY(G,X,Y,W));return $}wG.checkDataTypes=IY;var PF={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?u._`{type: ${Q}}`:u._`{type: ${X}}`};function RY(Q){let X=IF(Q);(0,wF.reportError)(X,PF)}wG.reportTypeError=RY;function IF(Q){let{gen:X,data:Y,schema:W}=Q,$=(0,UG.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:$,schemaValue:$,parentSchema:W,params:{},it:Q}}});var SG=P((bG)=>{Object.defineProperty(bG,"__esModule",{value:!0});bG.assignDefaults=void 0;var T6=l(),_F=o();function xF(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let $ in Y)jG(Q,$,Y[$].default);else if(X==="array"&&Array.isArray(W))W.forEach(($,J)=>jG(Q,J,$.default))}bG.assignDefaults=xF;function jG(Q,X,Y){let{gen:W,compositeRule:$,data:J,opts:G}=Q;if(Y===void 0)return;let H=T6._`${J}${(0,T6.getProperty)(X)}`;if($){(0,_F.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=T6._`${H} === undefined`;if(G.useDefaults==="empty")B=T6._`${B} || ${H} === null || ${H} === ""`;W.if(B,T6._`${H} = ${(0,T6.stringify)(Y)}`)}});var l0=P((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.validateUnion=RG.validateArray=RG.usePattern=RG.callValidateCode=RG.schemaProperties=RG.allSchemaProperties=RG.noPropertyInData=RG.propertyInData=RG.isOwnProperty=RG.hasPropFunc=RG.reportMissingProp=RG.checkMissingProp=RG.checkReportMissingProp=void 0;var $0=l(),CY=o(),Z1=L1(),gF=o();function yF(Q,X){let{gen:Y,data:W,it:$}=Q;Y.if(ZY(Y,W,X,$.opts.ownProperties),()=>{Q.setParams({missingProperty:$0._`${X}`},!0),Q.error()})}RG.checkReportMissingProp=yF;function hF({gen:Q,data:X,it:{opts:Y}},W,$){return(0,$0.or)(...W.map((J)=>(0,$0.and)(ZY(Q,X,J,Y.ownProperties),$0._`${$} = ${J}`)))}RG.checkMissingProp=hF;function fF(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}RG.reportMissingProp=fF;function PG(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:$0._`Object.prototype.hasOwnProperty`})}RG.hasPropFunc=PG;function TY(Q,X,Y){return $0._`${PG(Q)}.call(${X}, ${Y})`}RG.isOwnProperty=TY;function uF(Q,X,Y,W){let $=$0._`${X}${(0,$0.getProperty)(Y)} !== undefined`;return W?$0._`${$} && ${TY(Q,X,Y)}`:$}RG.propertyInData=uF;function ZY(Q,X,Y,W){let $=$0._`${X}${(0,$0.getProperty)(Y)} === undefined`;return W?(0,$0.or)($,(0,$0.not)(TY(Q,X,Y))):$}RG.noPropertyInData=ZY;function IG(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}RG.allSchemaProperties=IG;function lF(Q,X){return IG(X).filter((Y)=>!(0,CY.alwaysValidSchema)(Q,X[Y]))}RG.schemaProperties=lF;function mF({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:$,errorPath:J},it:G},H,B,z){let A=z?$0._`${Q}, ${X}, ${W}${$}`:X,D=[[Z1.default.instancePath,(0,$0.strConcat)(Z1.default.instancePath,J)],[Z1.default.parentData,G.parentData],[Z1.default.parentDataProperty,G.parentDataProperty],[Z1.default.rootData,Z1.default.rootData]];if(G.opts.dynamicRef)D.push([Z1.default.dynamicAnchors,Z1.default.dynamicAnchors]);let L=$0._`${A}, ${Y.object(...D)}`;return B!==$0.nil?$0._`${H}.call(${B}, ${L})`:$0._`${H}(${L})`}RG.callValidateCode=mF;var cF=$0._`new RegExp`;function pF({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:$}=X.code,J=$(Y,W);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:$0._`${$.code==="new RegExp"?cF:(0,gF.useFunc)(Q,$)}(${Y}, ${W})`})}RG.usePattern=pF;function iF(Q){let{gen:X,data:Y,keyword:W,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",$0._`${Y}.length`);X.forRange("i",0,B,(z)=>{Q.subschema({keyword:W,dataProp:z,dataPropType:CY.Type.Num},J),X.if((0,$0.not)(J),H)})}}RG.validateArray=iF;function nF(Q){let{gen:X,schema:Y,keyword:W,it:$}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,CY.alwaysValidSchema)($,B))&&!$.opts.unevaluated)return;let G=X.let("valid",!1),H=X.name("_valid");X.block(()=>Y.forEach((B,z)=>{let A=Q.subschema({keyword:W,schemaProp:z,compositeRule:!0},H);if(X.assign(G,$0._`${G} || ${H}`),!Q.mergeValidEvaluated(A,H))X.if((0,$0.not)(G))})),Q.result(G,()=>Q.reset(),()=>Q.error(!0))}RG.validateUnion=nF});var _G=P((vG)=>{Object.defineProperty(vG,"__esModule",{value:!0});vG.validateKeywordUsage=vG.validSchemaType=vG.funcKeywordCode=vG.macroKeywordCode=void 0;var P0=l(),t1=L1(),JV=l0(),GV=j4();function HV(Q,X){let{gen:Y,keyword:W,schema:$,parentSchema:J,it:G}=Q,H=X.macro.call(G.self,$,J,G),B=ZG(Y,W,H);if(G.opts.validateSchema!==!1)G.self.validateSchema(H,!0);let z=Y.name("valid");Q.subschema({schema:H,schemaPath:P0.nil,errSchemaPath:`${G.errSchemaPath}/${W}`,topSchemaRef:B,compositeRule:!0},z),Q.pass(z,()=>Q.error(!0))}vG.macroKeywordCode=HV;function BV(Q,X){var Y;let{gen:W,keyword:$,schema:J,parentSchema:G,$data:H,it:B}=Q;AV(B,X);let z=!H&&X.compile?X.compile.call(B.self,J,G,B):X.validate,A=ZG(W,$,z),D=W.let("valid");Q.block$data(D,L),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:D);function L(){if(X.errors===!1){if(F(),X.modifying)TG(Q);N(()=>Q.error())}else{let O=X.async?K():q();if(X.modifying)TG(Q);N(()=>zV(Q,O))}}function K(){let O=W.let("ruleErrs",null);return W.try(()=>F(P0._`await `),(b)=>W.assign(D,!1).if(P0._`${b} instanceof ${B.ValidationError}`,()=>W.assign(O,P0._`${b}.errors`),()=>W.throw(b))),O}function q(){let O=P0._`${A}.errors`;return W.assign(O,null),F(P0.nil),O}function F(O=X.async?P0._`await `:P0.nil){let b=B.opts.passContext?t1.default.this:t1.default.self,E=!(("compile"in X)&&!H||X.schema===!1);W.assign(D,P0._`${O}${(0,JV.callValidateCode)(Q,A,b,E)}`,X.modifying)}function N(O){var b;W.if((0,P0.not)((b=X.valid)!==null&&b!==void 0?b:D),O)}}vG.funcKeywordCode=BV;function TG(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,P0._`${W.parentData}[${W.parentDataProperty}]`))}function zV(Q,X){let{gen:Y}=Q;Y.if(P0._`Array.isArray(${X})`,()=>{Y.assign(t1.default.vErrors,P0._`${t1.default.vErrors} === null ? ${X} : ${t1.default.vErrors}.concat(${X})`).assign(t1.default.errors,P0._`${t1.default.vErrors}.length`),(0,GV.extendErrors)(Q)},()=>Q.error())}function AV({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function ZG(Q,X,Y){if(Y===void 0)throw Error(`keyword "${X}" failed to compile`);return Q.scopeValue("keyword",typeof Y=="function"?{ref:Y}:{ref:Y,code:(0,P0.stringify)(Y)})}function KV(Q,X,Y=!1){return!X.length||X.some((W)=>W==="array"?Array.isArray(Q):W==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==W||Y&&typeof Q>"u")}vG.validSchemaType=KV;function DV({schema:Q,opts:X,self:Y,errSchemaPath:W},$,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 "${W}": `+Y.errorsText($.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}vG.validateKeywordUsage=DV});var hG=P((gG)=>{Object.defineProperty(gG,"__esModule",{value:!0});gG.extendSubschemaMode=gG.extendSubschemaData=gG.getSubschema=void 0;var H1=l(),xG=o();function VV(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:$,errSchemaPath:J,topSchemaRef:G}){if(X!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let H=Q.schema[X];return Y===void 0?{schema:H,schemaPath:H1._`${Q.schemaPath}${(0,H1.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[Y],schemaPath:H1._`${Q.schemaPath}${(0,H1.getProperty)(X)}${(0,H1.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,xG.escapeFragment)(Y)}`}}if(W!==void 0){if($===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:$,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}gG.getSubschema=VV;function UV(Q,X,{dataProp:Y,dataPropType:W,data:$,dataTypes:J,propertyName:G}){if($!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:H}=X;if(Y!==void 0){let{errorPath:z,dataPathArr:A,opts:D}=X,L=H.let("data",H1._`${X.data}${(0,H1.getProperty)(Y)}`,!0);B(L),Q.errorPath=H1.str`${z}${(0,xG.getErrorPath)(Y,W,D.jsPropertySyntax)}`,Q.parentDataProperty=H1._`${Y}`,Q.dataPathArr=[...A,Q.parentDataProperty]}if($!==void 0){let z=$ instanceof H1.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]}}gG.extendSubschemaData=UV;function OV(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:$,allErrors:J}){if(W!==void 0)Q.compositeRule=W;if($!==void 0)Q.createErrors=$;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}gG.extendSubschemaMode=OV});var vY=P((dI,fG)=>{fG.exports=function Q(X,Y){if(X===Y)return!0;if(X&&Y&&typeof X=="object"&&typeof Y=="object"){if(X.constructor!==Y.constructor)return!1;var W,$,J;if(Array.isArray(X)){if(W=X.length,W!=Y.length)return!1;for($=W;$--!==0;)if(!Q(X[$],Y[$]))return!1;return!0}if(X.constructor===RegExp)return X.source===Y.source&&X.flags===Y.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===Y.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===Y.toString();if(J=Object.keys(X),W=J.length,W!==Object.keys(Y).length)return!1;for($=W;$--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[$]))return!1;for($=W;$--!==0;){var G=J[$];if(!Q(X[G],Y[G]))return!1}return!0}return X!==X&&Y!==Y}});var lG=P((oI,uG)=>{var v1=uG.exports=function(Q,X,Y){if(typeof X=="function")Y=X,X={};Y=X.cb||Y;var W=typeof Y=="function"?Y:Y.pre||function(){},$=Y.post||function(){};e9(X,W,$,Q,"",Q)};v1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};v1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};v1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};v1.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 e9(Q,X,Y,W,$,J,G,H,B,z){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,$,J,G,H,B,z);for(var A in W){var D=W[A];if(Array.isArray(D)){if(A in v1.arrayKeywords)for(var L=0;L<D.length;L++)e9(Q,X,Y,D[L],$+"/"+A+"/"+L,J,$,A,W,L)}else if(A in v1.propsKeywords){if(D&&typeof D=="object")for(var K in D)e9(Q,X,Y,D[K],$+"/"+A+"/"+MV(K),J,$,A,W,K)}else if(A in v1.keywords||Q.allKeys&&!(A in v1.skipKeywords))e9(Q,X,Y,D,$+"/"+A,J,$,A,W)}Y(W,$,J,G,H,B,z)}}function MV(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var E4=P((iG)=>{Object.defineProperty(iG,"__esModule",{value:!0});iG.getSchemaRefs=iG.resolveUrl=iG.normalizeId=iG._getFullPath=iG.getFullPath=iG.inlineRef=void 0;var jV=o(),bV=vY(),EV=lG(),SV=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function PV(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!kY(Q);if(!X)return!1;return mG(Q)<=X}iG.inlineRef=PV;var IV=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function kY(Q){for(let X in Q){if(IV.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(kY))return!0;if(typeof Y=="object"&&kY(Y))return!0}return!1}function mG(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,SV.has(Y))continue;if(typeof Q[Y]=="object")(0,jV.eachItem)(Q[Y],(W)=>X+=mG(W));if(X===1/0)return 1/0}return X}function cG(Q,X="",Y){if(Y!==!1)X=Z6(X);let W=Q.parse(X);return pG(Q,W)}iG.getFullPath=cG;function pG(Q,X){return Q.serialize(X).split("#")[0]+"#"}iG._getFullPath=pG;var RV=/#\/?$/;function Z6(Q){return Q?Q.replace(RV,""):""}iG.normalizeId=Z6;function CV(Q,X,Y){return Y=Z6(Y),Q.resolve(X,Y)}iG.resolveUrl=CV;var TV=/^[a-z_][-a-z0-9._]*$/i;function ZV(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,$=Z6(Q[Y]||X),J={"":$},G=cG(W,$,!1),H={},B=new Set;return EV(Q,{allKeys:!0},(D,L,K,q)=>{if(q===void 0)return;let F=G+L,N=J[q];if(typeof D[Y]=="string")N=O.call(this,D[Y]);b.call(this,D.$anchor),b.call(this,D.$dynamicAnchor),J[L]=N;function O(E){let y=this.opts.uriResolver.resolve;if(E=Z6(N?y(N,E):E),B.has(E))throw A(E);B.add(E);let x=this.refs[E];if(typeof x=="string")x=this.refs[x];if(typeof x=="object")z(D,x.schema,E);else if(E!==Z6(F))if(E[0]==="#")z(D,H[E],E),H[E]=D;else this.refs[E]=F;return E}function b(E){if(typeof E=="string"){if(!TV.test(E))throw Error(`invalid anchor "${E}"`);O.call(this,`#${E}`)}}}),H;function z(D,L,K){if(L!==void 0&&!bV(D,L))throw A(K)}function A(D){return Error(`reference "${D}" resolves to more than one schema`)}}iG.getSchemaRefs=ZV});var I4=P((H5)=>{Object.defineProperty(H5,"__esModule",{value:!0});H5.getData=H5.KeywordCxt=H5.validateFunctionCode=void 0;var aG=AG(),dG=b4(),xY=SY(),Q8=b4(),yV=SG(),P4=_G(),_Y=hG(),Z=l(),h=L1(),hV=E4(),q1=o(),S4=j4();function fV(Q){if(Q5(Q)){if(X5(Q),eG(Q)){mV(Q);return}}sG(Q,()=>(0,aG.topBoolOrEmptySchema)(Q))}H5.validateFunctionCode=fV;function sG({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:$},J){if($.code.es5)Q.func(X,Z._`${h.default.data}, ${h.default.valCxt}`,W.$async,()=>{Q.code(Z._`"use strict"; ${oG(Y,$)}`),lV(Q,$),Q.code(J)});else Q.func(X,Z._`${h.default.data}, ${uV($)}`,W.$async,()=>Q.code(oG(Y,$)).code(J))}function uV(Q){return Z._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${Q.dynamicRef?Z._`, ${h.default.dynamicAnchors}={}`:Z.nil}}={}`}function lV(Q,X){Q.if(h.default.valCxt,()=>{if(Q.var(h.default.instancePath,Z._`${h.default.valCxt}.${h.default.instancePath}`),Q.var(h.default.parentData,Z._`${h.default.valCxt}.${h.default.parentData}`),Q.var(h.default.parentDataProperty,Z._`${h.default.valCxt}.${h.default.parentDataProperty}`),Q.var(h.default.rootData,Z._`${h.default.valCxt}.${h.default.rootData}`),X.dynamicRef)Q.var(h.default.dynamicAnchors,Z._`${h.default.valCxt}.${h.default.dynamicAnchors}`)},()=>{if(Q.var(h.default.instancePath,Z._`""`),Q.var(h.default.parentData,Z._`undefined`),Q.var(h.default.parentDataProperty,Z._`undefined`),Q.var(h.default.rootData,h.default.data),X.dynamicRef)Q.var(h.default.dynamicAnchors,Z._`{}`)})}function mV(Q){let{schema:X,opts:Y,gen:W}=Q;sG(Q,()=>{if(Y.$comment&&X.$comment)W5(Q);if(dV(Q),W.let(h.default.vErrors,null),W.let(h.default.errors,0),Y.unevaluated)cV(Q);Y5(Q),tV(Q)});return}function cV(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",Z._`${Y}.evaluated`),X.if(Z._`${Q.evaluated}.dynamicProps`,()=>X.assign(Z._`${Q.evaluated}.props`,Z._`undefined`)),X.if(Z._`${Q.evaluated}.dynamicItems`,()=>X.assign(Z._`${Q.evaluated}.items`,Z._`undefined`))}function oG(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?Z._`/*# sourceURL=${Y} */`:Z.nil}function pV(Q,X){if(Q5(Q)){if(X5(Q),eG(Q)){iV(Q,X);return}}(0,aG.boolOrEmptySchema)(Q,X)}function eG({schema:Q,self:X}){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X.RULES.all[Y])return!0;return!1}function Q5(Q){return typeof Q.schema!="boolean"}function iV(Q,X){let{schema:Y,gen:W,opts:$}=Q;if($.$comment&&Y.$comment)W5(Q);oV(Q),rV(Q);let J=W.const("_errs",h.default.errors);Y5(Q,J),W.var(X,Z._`${J} === ${h.default.errors}`)}function X5(Q){(0,q1.checkUnknownRules)(Q),nV(Q)}function Y5(Q,X){if(Q.opts.jtd)return rG(Q,[],!1,X);let Y=(0,dG.getSchemaTypes)(Q.schema),W=(0,dG.coerceAndCheckDataType)(Q,Y);rG(Q,Y,!W,X)}function nV(Q){let{schema:X,errSchemaPath:Y,opts:W,self:$}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,q1.schemaHasRulesButRef)(X,$.RULES))$.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function dV(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,q1.checkStrictMode)(Q,"default is ignored in the schema root")}function oV(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,hV.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function rV(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function W5({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:$}){let J=Y.$comment;if($.$comment===!0)Q.code(Z._`${h.default.self}.logger.log(${J})`);else if(typeof $.$comment=="function"){let G=Z.str`${W}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(Z._`${h.default.self}.opts.$comment(${J}, ${G}, ${H}.schema)`)}}function tV(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:$,opts:J}=Q;if(Y.$async)X.if(Z._`${h.default.errors} === 0`,()=>X.return(h.default.data),()=>X.throw(Z._`new ${$}(${h.default.vErrors})`));else{if(X.assign(Z._`${W}.errors`,h.default.vErrors),J.unevaluated)aV(Q);X.return(Z._`${h.default.errors} === 0`)}}function aV({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof Z.Name)Q.assign(Z._`${X}.props`,Y);if(W instanceof Z.Name)Q.assign(Z._`${X}.items`,W)}function rG(Q,X,Y,W){let{gen:$,schema:J,data:G,allErrors:H,opts:B,self:z}=Q,{RULES:A}=z;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,q1.schemaHasRulesButRef)(J,A))){$.block(()=>J5(Q,"$ref",A.all.$ref.definition));return}if(!B.jtd)sV(Q,X);$.block(()=>{for(let L of A.rules)D(L);D(A.post)});function D(L){if(!(0,xY.shouldUseGroup)(J,L))return;if(L.type){if($.if((0,Q8.checkDataType)(L.type,G,B.strictNumbers)),tG(Q,L),X.length===1&&X[0]===L.type&&Y)$.else(),(0,Q8.reportTypeError)(Q);$.endIf()}else tG(Q,L);if(!H)$.if(Z._`${h.default.errors} === ${W||0}`)}}function tG(Q,X){let{gen:Y,schema:W,opts:{useDefaults:$}}=Q;if($)(0,yV.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,xY.shouldUseRule)(W,J))J5(Q,J.keyword,J.definition,X.type)})}function sV(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(eV(Q,X),!Q.opts.allowUnionTypes)QU(Q,X);XU(Q,Q.dataTypes)}function eV(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!$5(Q.dataTypes,Y))gY(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),WU(Q,X)}function QU(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))gY(Q,"use allowUnionTypes to allow union type keyword")}function XU(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let $=Y[W];if(typeof $=="object"&&(0,xY.shouldUseRule)(Q.schema,$)){let{type:J}=$.definition;if(J.length&&!J.some((G)=>YU(X,G)))gY(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function YU(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function $5(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function WU(Q,X){let Y=[];for(let W of Q.dataTypes)if($5(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function gY(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,q1.checkStrictMode)(Q,X,Q.opts.strictTypes)}class yY{constructor(Q,X,Y){if((0,P4.validateKeywordUsage)(Q,X,Y),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=Y,this.data=Q.data,this.schema=Q.schema[Y],this.$data=X.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,q1.schemaRefOrVal)(Q,this.schema,Y,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",G5(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,P4.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${Y} value must be ${JSON.stringify(X.schemaType)}`);if("code"in X?X.trackErrors:X.errors!==!1)this.errsCount=Q.gen.const("_errs",h.default.errors)}result(Q,X,Y){this.failResult((0,Z.not)(Q),X,Y)}failResult(Q,X,Y){if(this.gen.if(Q),Y)Y();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,Z.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(Z._`${X} !== undefined && (${(0,Z.or)(this.invalid$data(),Q)})`)}error(Q,X,Y){if(X){this.setParams(X),this._error(Q,Y),this.setParams({});return}this._error(Q,Y)}_error(Q,X){(Q?S4.reportExtraError:S4.reportError)(this,this.def.error,X)}$dataError(){(0,S4.reportError)(this,this.def.$dataError||S4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,S4.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,Y=Z.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=Z.nil,X=Z.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:$,def:J}=this;if(Y.if((0,Z.or)(Z._`${W} === undefined`,X)),Q!==Z.nil)Y.assign(Q,!0);if($.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==Z.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:$}=this;return(0,Z.or)(J(),G());function J(){if(Y.length){if(!(X instanceof Z.Name))throw Error("ajv implementation error");let H=Array.isArray(Y)?Y:[Y];return Z._`${(0,Q8.checkDataTypes)(H,X,$.opts.strictNumbers,Q8.DataType.Wrong)}`}return Z.nil}function G(){if(W.validateSchema){let H=Q.scopeValue("validate$data",{ref:W.validateSchema});return Z._`!${H}(${X})`}return Z.nil}}subschema(Q,X){let Y=(0,_Y.getSubschema)(this.it,Q);(0,_Y.extendSubschemaData)(Y,this.it,Q),(0,_Y.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return pV(W,X),W}mergeEvaluated(Q,X){let{it:Y,gen:W}=this;if(!Y.opts.unevaluated)return;if(Y.props!==!0&&Q.props!==void 0)Y.props=q1.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=q1.mergeEvaluated.items(W,Q.items,Y.items,X)}mergeValidEvaluated(Q,X){let{it:Y,gen:W}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return W.if(X,()=>this.mergeEvaluated(Q,Z.Name)),!0}}H5.KeywordCxt=yY;function J5(Q,X,Y,W){let $=new yY(Q,Y,X);if("code"in Y)Y.code($,W);else if($.$data&&Y.validate)(0,P4.funcKeywordCode)($,Y);else if("macro"in Y)(0,P4.macroKeywordCode)($,Y);else if(Y.compile||Y.validate)(0,P4.funcKeywordCode)($,Y)}var $U=/^\/(?:[^~]|~0|~1)*$/,JU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function G5(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let $,J;if(Q==="")return h.default.rootData;if(Q[0]==="/"){if(!$U.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);$=Q,J=h.default.rootData}else{let z=JU.exec(Q);if(!z)throw Error(`Invalid JSON-pointer: ${Q}`);let A=+z[1];if($=z[2],$==="#"){if(A>=X)throw Error(B("property/index",A));return W[X-A]}if(A>X)throw Error(B("data",A));if(J=Y[X-A],!$)return J}let G=J,H=$.split("/");for(let z of H)if(z)J=Z._`${J}${(0,Z.getProperty)((0,q1.unescapeJsonPointer)(z))}`,G=Z._`${G} && ${J}`;return G;function B(z,A){return`Cannot access ${z} ${A} levels up, current level is ${X}`}}H5.getData=G5});var X8=P((A5)=>{Object.defineProperty(A5,"__esModule",{value:!0});class z5 extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}A5.default=z5});var R4=P((D5)=>{Object.defineProperty(D5,"__esModule",{value:!0});var hY=E4();class K5 extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,hY.resolveUrl)(Q,X,Y),this.missingSchema=(0,hY.normalizeId)((0,hY.getFullPath)(Q,this.missingRef))}}D5.default=K5});var W8=P((F5)=>{Object.defineProperty(F5,"__esModule",{value:!0});F5.resolveSchema=F5.getCompilingSchema=F5.resolveRef=F5.compileSchema=F5.SchemaEnv=void 0;var e0=l(),AU=X8(),a1=L1(),Q1=E4(),L5=o(),KU=I4();class C4{constructor(Q){var X;this.refs={},this.dynamicAnchors={};let Y;if(typeof Q.schema=="object")Y=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,Q1.normalizeId)(Y===null||Y===void 0?void 0:Y[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=Y===null||Y===void 0?void 0:Y.$async,this.refs={}}}F5.SchemaEnv=C4;function uY(Q){let X=q5.call(this,Q);if(X)return X;let Y=(0,Q1.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:$}=this.opts.code,{ownProperties:J}=this.opts,G=new e0.CodeGen(this.scope,{es5:W,lines:$,ownProperties:J}),H;if(Q.$async)H=G.scopeValue("Error",{ref:AU.default,code:e0._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");Q.validateName=B;let z={gen:G,allErrors:this.opts.allErrors,data:a1.default.data,parentData:a1.default.parentData,parentDataProperty:a1.default.parentDataProperty,dataNames:[a1.default.data],dataPathArr:[e0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,e0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:e0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:e0._`""`,opts:this.opts,self:this},A;try{this._compilations.add(Q),(0,KU.validateFunctionCode)(z),G.optimize(this.opts.code.optimize);let D=G.toString();if(A=`${G.scopeRefs(a1.default.scope)}return ${D}`,this.opts.code.process)A=this.opts.code.process(A,Q);let K=Function(`${a1.default.self}`,`${a1.default.scope}`,A)(this,this.scope.get());if(this.scope.value(B,{ref:K}),K.errors=null,K.schema=Q.schema,K.schemaEnv=Q,Q.$async)K.$async=!0;if(this.opts.code.source===!0)K.source={validateName:B,validateCode:D,scopeValues:G._values};if(this.opts.unevaluated){let{props:q,items:F}=z;if(K.evaluated={props:q instanceof e0.Name?void 0:q,items:F instanceof e0.Name?void 0:F,dynamicProps:q instanceof e0.Name,dynamicItems:F instanceof e0.Name},K.source)K.source.evaluated=(0,e0.stringify)(K.evaluated)}return Q.validate=K,Q}catch(D){if(delete Q.validate,delete Q.validateName,A)this.logger.error("Error compiling schema, function code:",A);throw D}finally{this._compilations.delete(Q)}}F5.compileSchema=uY;function DU(Q,X,Y){var W;Y=(0,Q1.resolveUrl)(this.opts.uriResolver,X,Y);let $=Q.refs[Y];if($)return $;let J=FU.call(this,Q,Y);if(J===void 0){let G=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:H}=this.opts;if(G)J=new C4({schema:G,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=LU.call(this,J)}F5.resolveRef=DU;function LU(Q){if((0,Q1.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:uY.call(this,Q)}function q5(Q){for(let X of this._compilations)if(qU(X,Q))return X}F5.getCompilingSchema=q5;function qU(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function FU(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||Y8.call(this,Q,X)}function Y8(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,Q1._getFullPath)(this.opts.uriResolver,Y),$=(0,Q1.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===$)return fY.call(this,Y,Q);let J=(0,Q1.normalizeId)(W),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let H=Y8.call(this,Q,G);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return fY.call(this,Y,H)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)uY.call(this,G);if(J===(0,Q1.normalizeId)(X)){let{schema:H}=G,{schemaId:B}=this.opts,z=H[B];if(z)$=(0,Q1.resolveUrl)(this.opts.uriResolver,$,z);return new C4({schema:H,schemaId:B,root:Q,baseId:$})}return fY.call(this,Y,G)}F5.resolveSchema=Y8;var VU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fY(Q,{baseId:X,schema:Y,root:W}){var $;if((($=Q.fragment)===null||$===void 0?void 0:$[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,L5.unescapeFragment)(H)];if(B===void 0)return;Y=B;let z=typeof Y==="object"&&Y[this.opts.schemaId];if(!VU.has(H)&&z)X=(0,Q1.resolveUrl)(this.opts.uriResolver,X,z)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,L5.schemaHasRulesButRef)(Y,this.RULES)){let H=(0,Q1.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=Y8.call(this,W,H)}let{schemaId:G}=this.opts;if(J=J||new C4({schema:Y,schemaId:G,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var U5=P((QR,MU)=>{MU.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 cY=P((XR,b5)=>{var jU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),N5=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),lY=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),w5=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),bU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function mY(Q){let X="",Y=0,W=0;for(W=0;W<Q.length;W++){if(Y=Q[W].charCodeAt(0),Y===48)continue;if(!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";X+=Q[W];break}for(W+=1;W<Q.length;W++){if(Y=Q[W].charCodeAt(0),!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";X+=Q[W]}return X}var EU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function O5(Q){return Q.length=0,!0}function SU(Q,X,Y){if(Q.length){let W=mY(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function PU(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],$=[],J=!1,G=!1,H=SU;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($,W,Y))break;if(++X>7){Y.error=!0;break}if(B>0&&Q[B-1]===":")J=!0;W.push(":");continue}else if(z==="%"){if(!H($,W,Y))break;H=O5}else{$.push(z);continue}}if($.length)if(H===O5)Y.zone=$.join("");else if(G)W.push($.join(""));else W.push(mY($));return Y.address=W.join(""),Y}function M5(Q){if(IU(Q,":")<2)return{host:Q,isIPV6:!1};let X=PU(Q);if(!X.error){let{address:Y,address:W}=X;if(X.zone)Y+="%"+X.zone,W+="%25"+X.zone;return{host:Y,isIPV6:!0,escapedHost:W}}else return{host:Q,isIPV6:!1}}function IU(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function RU(Q){let X=Q,Y=[],W=-1,$=0;while($=X.length){if($===1)if(X===".")break;else if(X==="/"){Y.push("/");break}else{Y.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]==="/"){Y.push("/");break}}}else if($===3){if(X==="/.."){if(Y.length!==0)Y.pop();Y.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),Y.length!==0)Y.pop();continue}}}}if((W=X.indexOf("/",1))===-1){Y.push(X);break}else Y.push(X.slice(0,W)),X=X.slice(W)}return Y.join("")}var CU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},TU=/[@/?#:]/g,ZU=/[@/?#]/g;function j5(Q,X){let Y=X?ZU:TU;return Y.lastIndex=0,Q.replace(Y,(W)=>CU[W])}function vU(Q,X=!1){if(Q.indexOf("%")===-1)return Q;let Y="";for(let W=0;W<Q.length;W++){if(Q[W]==="%"&&W+2<Q.length){let $=Q.slice(W+1,W+3);if(lY($)){let J=$.toUpperCase(),G=String.fromCharCode(parseInt(J,16));if(X&&w5(G))Y+=G;else Y+="%"+J;W+=2;continue}}Y+=Q[W]}return Y}function kU(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(lY(W)){let $=W.toUpperCase(),J=String.fromCharCode(parseInt($,16));if(J!=="."&&w5(J))X+=J;else X+="%"+$;Y+=2;continue}}if(bU(Q[Y]))X+=Q[Y];else X+=escape(Q[Y])}return X}function _U(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(lY(W)){X+="%"+W.toUpperCase(),Y+=2;continue}}X+=escape(Q[Y])}return X}function xU(Q){let X=[];if(Q.userinfo!==void 0)X.push(Q.userinfo),X.push("@");if(Q.host!==void 0){let Y=unescape(Q.host);if(!N5(Y)){let W=M5(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=j5(Y,!1)}X.push(Y)}if(typeof Q.port==="number"||typeof Q.port==="string")X.push(":"),X.push(String(Q.port));return X.length?X.join(""):void 0}b5.exports={nonSimpleDomain:EU,recomposeAuthority:xU,reescapeHostDelimiters:j5,normalizePercentEncoding:vU,normalizePathEncoding:kU,escapePreservingEscapes:_U,removeDotSegments:RU,isIPv4:N5,isUUID:jU,normalizeIPv6:M5,stringArrayToHexStripped:mY}});var R5=P((YR,I5)=>{var{isUUID:gU}=cY(),yU=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hU=["http","https","ws","wss","urn","urn:uuid"];function fU(Q){return hU.indexOf(Q)!==-1}function pY(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 E5(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function S5(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 uU(Q){return Q.secure=pY(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function lU(Q){if(Q.port===(pY(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,Y]=Q.resourceName.split("?");Q.path=X&&X!=="/"?X:void 0,Q.query=Y,Q.resourceName=void 0}return Q.fragment=void 0,Q}function mU(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(yU);if(Y){let W=X.scheme||Q.scheme||"urn";Q.nid=Y[1].toLowerCase(),Q.nss=Y[2];let $=`${W}:${X.nid||Q.nid}`,J=iY($);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function cU(Q,X){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=X.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),$=`${Y}:${X.nid||W}`,J=iY($);if(J)Q=J.serialize(Q,X);let G=Q,H=Q.nss;return G.path=`${W||X.nid}:${H}`,X.skipEscape=!0,G}function pU(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!gU(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function iU(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var P5={scheme:"http",domainHost:!0,parse:E5,serialize:S5},nU={scheme:"https",domainHost:P5.domainHost,parse:E5,serialize:S5},$8={scheme:"ws",domainHost:!0,parse:uU,serialize:lU},dU={scheme:"wss",domainHost:$8.domainHost,parse:$8.parse,serialize:$8.serialize},oU={scheme:"urn",parse:mU,serialize:cU,skipNormalize:!0},rU={scheme:"urn:uuid",parse:pU,serialize:iU,skipNormalize:!0},J8={http:P5,https:nU,ws:$8,wss:dU,urn:oU,"urn:uuid":rU};Object.setPrototypeOf(J8,null);function iY(Q){return Q&&(J8[Q]||J8[Q.toLowerCase()])||void 0}I5.exports={wsIsSecure:pY,SCHEMES:J8,isValidSchemeName:fU,getSchemeHandler:iY}});var _5=P((WR,G8)=>{var{normalizeIPv6:tU,removeDotSegments:T4,recomposeAuthority:aU,normalizePercentEncoding:sU,normalizePathEncoding:eU,escapePreservingEscapes:QO,reescapeHostDelimiters:XO,isIPv4:YO,nonSimpleDomain:WO}=cY(),{SCHEMES:$O,getSchemeHandler:T5}=R5();function JO(Q,X){if(typeof Q==="string")Q=AO(Q,X);else if(typeof Q==="object")Q=v6(s1(Q,X),X);return Q}function GO(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},$=Z5(v6(Q,W),v6(X,W),W,!0);return W.skipEscape=!0,s1($,W)}function Z5(Q,X,Y,W){let $={};if(!W)Q=v6(s1(Q,Y),Y),X=v6(s1(X,Y),Y);if(Y=Y||{},!Y.tolerant&&X.scheme)$.scheme=X.scheme,$.userinfo=X.userinfo,$.host=X.host,$.port=X.port,$.path=T4(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=T4(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=T4(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=T4($.path)}$.query=X.query}$.userinfo=Q.userinfo,$.host=Q.host,$.port=Q.port}$.scheme=Q.scheme}return $.fragment=X.fragment,$}function HO(Q,X,Y){let W=C5(Q,Y),$=C5(X,Y);return W!==void 0&&$!==void 0&&W.toLowerCase()===$.toLowerCase()}function s1(Q,X){let Y={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:""},W=Object.assign({},X),$=[],J=T5(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=QO(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=sU(Y.path);if(W.reference!=="suffix"&&Y.scheme)$.push(Y.scheme,":");let G=aU(Y);if(G!==void 0){if(W.reference!=="suffix")$.push("//");if($.push(G),Y.path&&Y.path[0]!=="/")$.push("/")}if(Y.path!==void 0){let H=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))H=T4(H);if(G===void 0&&H[0]==="/"&&H[1]==="/")H="/%2F"+H.slice(2);$.push(H)}if(Y.query!==void 0)$.push("?",Y.query);if(Y.fragment!==void 0)$.push("#",Y.fragment);return $.join("")}var BO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function zO(Q,X){if(X[2]!==void 0&&Q.path&&Q.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof Q.port==="number"&&(Q.port<0||Q.port>65535))return"URI port is malformed.";return}function v5(Q,X){let Y=Object.assign({},X),W={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},$=!1,J=!1;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let G=Q.match(BO);if(G){if(W.scheme=G[1],W.userinfo=G[3],W.host=G[4],W.port=parseInt(G[5],10),W.path=G[6]||"",W.query=G[7],W.fragment=G[8],isNaN(W.port))W.port=G[5];let H=zO(W,G);if(H!==void 0)W.error=W.error||H,$=!0;if(W.host)if(YO(W.host)===!1){let A=tU(W.host);W.host=A.host.toLowerCase(),J=A.isIPV6}else J=!0;if(W.scheme===void 0&&W.userinfo===void 0&&W.host===void 0&&W.port===void 0&&W.query===void 0&&!W.path)W.reference="same-document";else if(W.scheme===void 0)W.reference="relative";else if(W.fragment===void 0)W.reference="absolute";else W.reference="uri";if(Y.reference&&Y.reference!=="suffix"&&Y.reference!==W.reference)W.error=W.error||"URI is not a "+Y.reference+" reference.";let B=T5(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!B||!B.unicodeSupport)){if(W.host&&(Y.domainHost||B&&B.domainHost)&&J===!1&&WO(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(z){W.error=W.error||"Host's domain name can not be converted to ASCII: "+z}}if(!B||B&&!B.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=XO(unescape(W.host),J)}if(W.path)W.path=eU(W.path);if(W.fragment)try{W.fragment=encodeURI(decodeURIComponent(W.fragment))}catch{W.error=W.error||"URI malformed"}}if(B&&B.parse)B.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return{parsed:W,malformedAuthorityOrPort:$}}function v6(Q,X){return v5(Q,X).parsed}function AO(Q,X){return k5(Q,X).normalized}function k5(Q,X){let{parsed:Y,malformedAuthorityOrPort:W}=v5(Q,X);return{normalized:W?Q:s1(Y,X),malformedAuthorityOrPort:W}}function C5(Q,X){if(typeof Q==="string"){let{normalized:Y,malformedAuthorityOrPort:W}=k5(Q,X);return W?void 0:Y}if(typeof Q==="object")return s1(Q,X)}var nY={SCHEMES:$O,normalize:JO,resolve:GO,resolveComponent:Z5,equal:HO,serialize:s1,parse:v6};G8.exports=nY;G8.exports.default=nY;G8.exports.fastUri=nY});var y5=P((g5)=>{Object.defineProperty(g5,"__esModule",{value:!0});var x5=_5();x5.code='require("ajv/dist/runtime/uri").default';g5.default=x5});var i5=P((F1)=>{Object.defineProperty(F1,"__esModule",{value:!0});F1.CodeGen=F1.Name=F1.nil=F1.stringify=F1.str=F1._=F1.KeywordCxt=void 0;var DO=I4();Object.defineProperty(F1,"KeywordCxt",{enumerable:!0,get:function(){return DO.KeywordCxt}});var k6=l();Object.defineProperty(F1,"_",{enumerable:!0,get:function(){return k6._}});Object.defineProperty(F1,"str",{enumerable:!0,get:function(){return k6.str}});Object.defineProperty(F1,"stringify",{enumerable:!0,get:function(){return k6.stringify}});Object.defineProperty(F1,"nil",{enumerable:!0,get:function(){return k6.nil}});Object.defineProperty(F1,"Name",{enumerable:!0,get:function(){return k6.Name}});Object.defineProperty(F1,"CodeGen",{enumerable:!0,get:function(){return k6.CodeGen}});var LO=X8(),m5=R4(),qO=EY(),Z4=W8(),FO=l(),v4=E4(),H8=b4(),oY=o(),h5=U5(),VO=y5(),c5=(Q,X)=>new RegExp(Q,X);c5.code="new RegExp";var UO=["removeAdditional","useDefaults","coerceTypes"],OO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),NO={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."},wO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},f5=200;function MO(Q){var X,Y,W,$,J,G,H,B,z,A,D,L,K,q,F,N,O,b,E,y,x,j0,y0,X6,b8;let l6=Q.strict,E8=(X=Q.code)===null||X===void 0?void 0:X.optimize,bW=E8===!0||E8===void 0?1:E8||0,EW=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:c5,CB=($=Q.uriResolver)!==null&&$!==void 0?$:VO.default;return{strictSchema:(G=(J=Q.strictSchema)!==null&&J!==void 0?J:l6)!==null&&G!==void 0?G:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:l6)!==null&&B!==void 0?B:!0,strictTypes:(A=(z=Q.strictTypes)!==null&&z!==void 0?z:l6)!==null&&A!==void 0?A:"log",strictTuples:(L=(D=Q.strictTuples)!==null&&D!==void 0?D:l6)!==null&&L!==void 0?L:"log",strictRequired:(q=(K=Q.strictRequired)!==null&&K!==void 0?K:l6)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:bW,regExp:EW}:{optimize:bW,regExp:EW},loopRequired:(F=Q.loopRequired)!==null&&F!==void 0?F:f5,loopEnum:(N=Q.loopEnum)!==null&&N!==void 0?N:f5,meta:(O=Q.meta)!==null&&O!==void 0?O:!0,messages:(b=Q.messages)!==null&&b!==void 0?b:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(y=Q.schemaId)!==null&&y!==void 0?y:"$id",addUsedSchema:(x=Q.addUsedSchema)!==null&&x!==void 0?x:!0,validateSchema:(j0=Q.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(y0=Q.validateFormats)!==null&&y0!==void 0?y0:!0,unicodeRegExp:(X6=Q.unicodeRegExp)!==null&&X6!==void 0?X6:!0,int32range:(b8=Q.int32range)!==null&&b8!==void 0?b8:!0,uriResolver:CB}}class B8{constructor(Q={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...MO(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new FO.ValueScope({scope:{},prefixes:OO,es5:X,lines:Y}),this.logger=IO(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,qO.getRules)(),u5.call(this,NO,Q,"NOT SUPPORTED"),u5.call(this,wO,Q,"DEPRECATED","warn"),this._metaOpts=SO.call(this),Q.formats)bO.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)EO.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);jO.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=h5;if(Y==="id")W={...h5},W.id=W.$id,delete W.$id;if(X&&Q)this.addMetaSchema(W,W[Y],!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 Y;if(typeof Q=="string"){if(Y=this.getSchema(Q),!Y)throw Error(`no schema with key or ref "${Q}"`)}else Y=this.compile(Q);let W=Y(X);if(!("$async"in Y))this.errors=Y.errors;return W}compile(Q,X){let Y=this._addSchema(Q,X);return Y.validate||this._compileSchemaEnv(Y)}compileAsync(Q,X){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:Y}=this.opts;return W.call(this,Q,X);async function W(z,A){await $.call(this,z.$schema);let D=this._addSchema(z,A);return D.validate||J.call(this,D)}async function $(z){if(z&&!this.getSchema(z))await W.call(this,{$ref:z},!0)}async function J(z){try{return this._compileSchemaEnv(z)}catch(A){if(!(A instanceof m5.default))throw A;return G.call(this,A),await H.call(this,A.missingSchema),J.call(this,z)}}function G({missingSchema:z,missingRef:A}){if(this.refs[z])throw Error(`AnySchema ${z} is loaded but ${A} cannot be resolved`)}async function H(z){let A=await B.call(this,z);if(!this.refs[z])await $.call(this,A.$schema);if(!this.refs[z])this.addSchema(A,z,X)}async function B(z){let A=this._loading[z];if(A)return A;try{return await(this._loading[z]=Y(z))}finally{delete this._loading[z]}}}addSchema(Q,X,Y,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let J of Q)this.addSchema(J,void 0,Y,W);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,v4.normalizeId)(X||$),this._checkUnique(X),this.schemas[X]=this._addSchema(Q,Y,X,W,!0),this}addMetaSchema(Q,X,Y=this.opts.validateSchema){return this.addSchema(Q,X,!0,Y),this}validateSchema(Q,X){if(typeof Q=="boolean")return!0;let Y;if(Y=Q.$schema,Y!==void 0&&typeof Y!="string")throw Error("$schema must be a string");if(Y=Y||this.opts.defaultMeta||this.defaultMeta(),!Y)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let W=this.validate(Y,Q);if(!W&&X){let $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw Error($)}return W}getSchema(Q){let X;while(typeof(X=l5.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new Z4.SchemaEnv({schema:{},schemaId:Y});if(X=Z4.resolveSchema.call(this,W,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=l5.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 Y=Q[this.opts.schemaId];if(Y)Y=(0,v4.normalizeId)(Y),delete this.schemas[Y],delete this.refs[Y];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 Y;if(typeof Q=="string"){if(Y=Q,typeof X=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),X.keyword=Y}else if(typeof Q=="object"&&X===void 0){if(X=Q,Y=X.keyword,Array.isArray(Y)&&!Y.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(CO.call(this,Y,X),!X)return(0,oY.eachItem)(Y,($)=>dY.call(this,$)),this;ZO.call(this,X);let W={...X,type:(0,H8.getJSONTypes)(X.type),schemaType:(0,H8.getJSONTypes)(X.schemaType)};return(0,oY.eachItem)(Y,W.type.length===0?($)=>dY.call(this,$,W):($)=>W.type.forEach((J)=>dY.call(this,$,W,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 Y of X.rules){let W=Y.rules.findIndex(($)=>$.keyword===Q);if(W>=0)Y.rules.splice(W,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:Y="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${Y}${W.instancePath} ${W.message}`).reduce((W,$)=>W+X+$)}$dataMetaSchema(Q,X){let Y=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of X){let $=W.split("/").slice(1),J=Q;for(let G of $)J=J[G];for(let G in Y){let H=Y[G];if(typeof H!="object")continue;let{$data:B}=H.definition,z=J[G];if(B&&z)J[G]=p5(z)}}return Q}_removeAllSchemas(Q,X){for(let Y in Q){let W=Q[Y];if(!X||X.test(Y)){if(typeof W=="string")delete Q[Y];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[Y]}}}_addSchema(Q,X,Y,W=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;Y=(0,v4.normalizeId)(J||Y);let B=v4.getSchemaRefs.call(this,Q,Y);if(H=new Z4.SchemaEnv({schema:Q,schemaId:G,meta:X,baseId:Y,localRefs:B}),this._cache.set(H.schema,H),$&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=H}if(W)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 Z4.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{Z4.compileSchema.call(this,Q)}finally{this.opts=X}}}B8.ValidationError=LO.default;B8.MissingRefError=m5.default;F1.default=B8;function u5(Q,X,Y,W="error"){for(let $ in Q){let J=$;if(J in X)this.logger[W](`${Y}: option ${$}. ${Q[J]}`)}}function l5(Q){return Q=(0,v4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function jO(){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 bO(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function EO(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 Y=Q[X];if(!Y.keyword)Y.keyword=X;this.addKeyword(Y)}}function SO(){let Q={...this.opts};for(let X of UO)delete Q[X];return Q}var PO={log(){},warn(){},error(){}};function IO(Q){if(Q===!1)return PO;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 RO=/^[a-z_$][a-z0-9_$:-]*$/i;function CO(Q,X){let{RULES:Y}=this;if((0,oY.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!RO.test(W))throw Error(`Keyword ${W} 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 dY(Q,X,Y){var W;let $=X===null||X===void 0?void 0:X.post;if(Y&&$)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=$?J.post:J.rules.find(({type:B})=>B===Y);if(!G)G={type:Y,rules:[]},J.rules.push(G);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,H8.getJSONTypes)(X.type),schemaType:(0,H8.getJSONTypes)(X.schemaType)}};if(X.before)TO.call(this,G,H,X.before);else G.rules.push(H);J.all[Q]=H,(W=X.implements)===null||W===void 0||W.forEach((B)=>this.addKeyword(B))}function TO(Q,X,Y){let W=Q.rules.findIndex(($)=>$.keyword===Y);if(W>=0)Q.rules.splice(W,0,X);else Q.rules.push(X),this.logger.warn(`rule ${Y} is not defined`)}function ZO(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=p5(X);Q.validateSchema=this.compile(X,!0)}var vO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function p5(Q){return{anyOf:[Q,vO]}}});var d5=P((n5)=>{Object.defineProperty(n5,"__esModule",{value:!0});var xO={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};n5.default=xO});var e5=P((a5)=>{Object.defineProperty(a5,"__esModule",{value:!0});a5.callRef=a5.getValidate=void 0;var yO=R4(),o5=l0(),Z0=l(),_6=L1(),r5=W8(),z8=o(),hO={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:$,schemaEnv:J,validateName:G,opts:H,self:B}=W,{root:z}=J;if((Y==="#"||Y==="#/")&&$===z.baseId)return D();let A=r5.resolveRef.call(B,z,$,Y);if(A===void 0)throw new yO.default(W.opts.uriResolver,$,Y);if(A instanceof r5.SchemaEnv)return L(A);return K(A);function D(){if(J===z)return A8(Q,G,J,J.$async);let q=X.scopeValue("root",{ref:z});return A8(Q,Z0._`${q}.validate`,z,z.$async)}function L(q){let F=t5(Q,q);A8(Q,F,q,q.$async)}function K(q){let F=X.scopeValue("schema",H.code.source===!0?{ref:q,code:(0,Z0.stringify)(q)}:{ref:q}),N=X.name("valid"),O=Q.subschema({schema:q,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:F,errSchemaPath:Y},N);Q.mergeEvaluated(O),Q.ok(N)}}};function t5(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):Z0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}a5.getValidate=t5;function A8(Q,X,Y,W){let{gen:$,it:J}=Q,{allErrors:G,schemaEnv:H,opts:B}=J,z=B.passContext?_6.default.this:Z0.nil;if(W)A();else D();function A(){if(!H.$async)throw Error("async schema referenced by sync schema");let q=$.let("valid");$.try(()=>{if($.code(Z0._`await ${(0,o5.callValidateCode)(Q,X,z)}`),K(X),!G)$.assign(q,!0)},(F)=>{if($.if(Z0._`!(${F} instanceof ${J.ValidationError})`,()=>$.throw(F)),L(F),!G)$.assign(q,!1)}),Q.ok(q)}function D(){Q.result((0,o5.callValidateCode)(Q,X,z),()=>K(X),()=>L(X))}function L(q){let F=Z0._`${q}.errors`;$.assign(_6.default.vErrors,Z0._`${_6.default.vErrors} === null ? ${F} : ${_6.default.vErrors}.concat(${F})`),$.assign(_6.default.errors,Z0._`${_6.default.vErrors}.length`)}function K(q){var F;if(!J.opts.unevaluated)return;let N=(F=Y===null||Y===void 0?void 0:Y.validate)===null||F===void 0?void 0:F.evaluated;if(J.props!==!0)if(N&&!N.dynamicProps){if(N.props!==void 0)J.props=z8.mergeEvaluated.props($,N.props,J.props)}else{let O=$.var("props",Z0._`${q}.evaluated.props`);J.props=z8.mergeEvaluated.props($,O,J.props,Z0.Name)}if(J.items!==!0)if(N&&!N.dynamicItems){if(N.items!==void 0)J.items=z8.mergeEvaluated.items($,N.items,J.items)}else{let O=$.var("items",Z0._`${q}.evaluated.items`);J.items=z8.mergeEvaluated.items($,O,J.items,Z0.Name)}}}a5.callRef=A8;a5.default=hO});var XH=P((QH)=>{Object.defineProperty(QH,"__esModule",{value:!0});var lO=d5(),mO=e5(),cO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",lO.default,mO.default];QH.default=cO});var WH=P((YH)=>{Object.defineProperty(YH,"__esModule",{value:!0});var K8=l(),k1=K8.operators,D8={maximum:{okStr:"<=",ok:k1.LTE,fail:k1.GT},minimum:{okStr:">=",ok:k1.GTE,fail:k1.LT},exclusiveMaximum:{okStr:"<",ok:k1.LT,fail:k1.GTE},exclusiveMinimum:{okStr:">",ok:k1.GT,fail:k1.LTE}},iO={message:({keyword:Q,schemaCode:X})=>K8.str`must be ${D8[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>K8._`{comparison: ${D8[Q].okStr}, limit: ${X}}`},nO={keyword:Object.keys(D8),type:"number",schemaType:"number",$data:!0,error:iO,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(K8._`${Y} ${D8[X].fail} ${W} || isNaN(${Y})`)}};YH.default=nO});var JH=P(($H)=>{Object.defineProperty($H,"__esModule",{value:!0});var k4=l(),oO={message:({schemaCode:Q})=>k4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>k4._`{multipleOf: ${Q}}`},rO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oO,code(Q){let{gen:X,data:Y,schemaCode:W,it:$}=Q,J=$.opts.multipleOfPrecision,G=X.let("res"),H=J?k4._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:k4._`${G} !== parseInt(${G})`;Q.fail$data(k4._`(${W} === 0 || (${G} = ${Y}/${W}, ${H}))`)}};$H.default=rO});var BH=P((HH)=>{Object.defineProperty(HH,"__esModule",{value:!0});function GH(Q){let X=Q.length,Y=0,W=0,$;while(W<X)if(Y++,$=Q.charCodeAt(W++),$>=55296&&$<=56319&&W<X){if($=Q.charCodeAt(W),($&64512)===56320)W++}return Y}HH.default=GH;GH.code='require("ajv/dist/runtime/ucs2length").default'});var AH=P((zH)=>{Object.defineProperty(zH,"__esModule",{value:!0});var e1=l(),sO=o(),eO=BH(),QN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return e1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>e1._`{limit: ${Q}}`},XN={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QN,code(Q){let{keyword:X,data:Y,schemaCode:W,it:$}=Q,J=X==="maxLength"?e1.operators.GT:e1.operators.LT,G=$.opts.unicode===!1?e1._`${Y}.length`:e1._`${(0,sO.useFunc)(Q.gen,eO.default)}(${Y})`;Q.fail$data(e1._`${G} ${J} ${W}`)}};zH.default=XN});var DH=P((KH)=>{Object.defineProperty(KH,"__esModule",{value:!0});var WN=l0(),$N=o(),x6=l(),JN={message:({schemaCode:Q})=>x6.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>x6._`{pattern: ${Q}}`},GN={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:JN,code(Q){let{gen:X,data:Y,$data:W,schema:$,schemaCode:J,it:G}=Q,H=G.opts.unicodeRegExp?"u":"";if(W){let{regExp:B}=G.opts.code,z=B.code==="new RegExp"?x6._`new RegExp`:(0,$N.useFunc)(X,B),A=X.let("valid");X.try(()=>X.assign(A,x6._`${z}(${J}, ${H}).test(${Y})`),()=>X.assign(A,!1)),Q.fail$data(x6._`!${A}`)}else{let B=(0,WN.usePattern)(Q,$);Q.fail$data(x6._`!${B}.test(${Y})`)}}};KH.default=GN});var qH=P((LH)=>{Object.defineProperty(LH,"__esModule",{value:!0});var _4=l(),BN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return _4.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>_4._`{limit: ${Q}}`},zN={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:BN,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,$=X==="maxProperties"?_4.operators.GT:_4.operators.LT;Q.fail$data(_4._`Object.keys(${Y}).length ${$} ${W}`)}};LH.default=zN});var VH=P((FH)=>{Object.defineProperty(FH,"__esModule",{value:!0});var x4=l0(),g4=l(),KN=o(),DN={message:({params:{missingProperty:Q}})=>g4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>g4._`{missingProperty: ${Q}}`},LN={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DN,code(Q){let{gen:X,schema:Y,schemaCode:W,data:$,$data:J,it:G}=Q,{opts:H}=G;if(!J&&Y.length===0)return;let B=Y.length>=H.loopRequired;if(G.allErrors)z();else A();if(H.strictRequired){let K=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let F of Y)if((K===null||K===void 0?void 0:K[F])===void 0&&!q.has(F)){let N=G.schemaEnv.baseId+G.errSchemaPath,O=`required property "${F}" is not defined at "${N}" (strictRequired)`;(0,KN.checkStrictMode)(G,O,G.opts.strictRequired)}}function z(){if(B||J)Q.block$data(g4.nil,D);else for(let K of Y)(0,x4.checkReportMissingProp)(Q,K)}function A(){let K=X.let("missing");if(B||J){let q=X.let("valid",!0);Q.block$data(q,()=>L(K,q)),Q.ok(q)}else X.if((0,x4.checkMissingProp)(Q,Y,K)),(0,x4.reportMissingProp)(Q,K),X.else()}function D(){X.forOf("prop",W,(K)=>{Q.setParams({missingProperty:K}),X.if((0,x4.noPropertyInData)(X,$,K,H.ownProperties),()=>Q.error())})}function L(K,q){Q.setParams({missingProperty:K}),X.forOf(K,W,()=>{X.assign(q,(0,x4.propertyInData)(X,$,K,H.ownProperties)),X.if((0,g4.not)(q),()=>{Q.error(),X.break()})},g4.nil)}}};FH.default=LN});var OH=P((UH)=>{Object.defineProperty(UH,"__esModule",{value:!0});var y4=l(),FN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return y4.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>y4._`{limit: ${Q}}`},VN={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:FN,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,$=X==="maxItems"?y4.operators.GT:y4.operators.LT;Q.fail$data(y4._`${Y}.length ${$} ${W}`)}};UH.default=VN});var L8=P((wH)=>{Object.defineProperty(wH,"__esModule",{value:!0});var NH=vY();NH.code='require("ajv/dist/runtime/equal").default';wH.default=NH});var jH=P((MH)=>{Object.defineProperty(MH,"__esModule",{value:!0});var rY=b4(),N0=l(),NN=o(),wN=L8(),MN={message:({params:{i:Q,j:X}})=>N0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>N0._`{i: ${Q}, j: ${X}}`},jN={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:MN,code(Q){let{gen:X,data:Y,$data:W,schema:$,parentSchema:J,schemaCode:G,it:H}=Q;if(!W&&!$)return;let B=X.let("valid"),z=J.items?(0,rY.getSchemaTypes)(J.items):[];Q.block$data(B,A,N0._`${G} === false`),Q.ok(B);function A(){let q=X.let("i",N0._`${Y}.length`),F=X.let("j");Q.setParams({i:q,j:F}),X.assign(B,!0),X.if(N0._`${q} > 1`,()=>(D()?L:K)(q,F))}function D(){return z.length>0&&!z.some((q)=>q==="object"||q==="array")}function L(q,F){let N=X.name("item"),O=(0,rY.checkDataTypes)(z,N,H.opts.strictNumbers,rY.DataType.Wrong),b=X.const("indices",N0._`{}`);X.for(N0._`;${q}--;`,()=>{if(X.let(N,N0._`${Y}[${q}]`),X.if(O,N0._`continue`),z.length>1)X.if(N0._`typeof ${N} == "string"`,N0._`${N} += "_"`);X.if(N0._`typeof ${b}[${N}] == "number"`,()=>{X.assign(F,N0._`${b}[${N}]`),Q.error(),X.assign(B,!1).break()}).code(N0._`${b}[${N}] = ${q}`)})}function K(q,F){let N=(0,NN.useFunc)(X,wN.default),O=X.name("outer");X.label(O).for(N0._`;${q}--;`,()=>X.for(N0._`${F} = ${q}; ${F}--;`,()=>X.if(N0._`${N}(${Y}[${q}], ${Y}[${F}])`,()=>{Q.error(),X.assign(B,!1).break(O)})))}}};MH.default=jN});var EH=P((bH)=>{Object.defineProperty(bH,"__esModule",{value:!0});var tY=l(),EN=o(),SN=L8(),PN={message:"must be equal to constant",params:({schemaCode:Q})=>tY._`{allowedValue: ${Q}}`},IN={keyword:"const",$data:!0,error:PN,code(Q){let{gen:X,data:Y,$data:W,schemaCode:$,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(tY._`!${(0,EN.useFunc)(X,SN.default)}(${Y}, ${$})`);else Q.fail(tY._`${J} !== ${Y}`)}};bH.default=IN});var PH=P((SH)=>{Object.defineProperty(SH,"__esModule",{value:!0});var h4=l(),CN=o(),TN=L8(),ZN={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>h4._`{allowedValues: ${Q}}`},vN={keyword:"enum",schemaType:"array",$data:!0,error:ZN,code(Q){let{gen:X,data:Y,$data:W,schema:$,schemaCode:J,it:G}=Q;if(!W&&$.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,CN.useFunc)(X,TN.default),A;if(H||W)A=X.let("valid"),Q.block$data(A,D);else{if(!Array.isArray($))throw Error("ajv implementation error");let K=X.const("vSchema",J);A=(0,h4.or)(...$.map((q,F)=>L(K,F)))}Q.pass(A);function D(){X.assign(A,!1),X.forOf("v",J,(K)=>X.if(h4._`${z()}(${Y}, ${K})`,()=>X.assign(A,!0).break()))}function L(K,q){let F=$[q];return typeof F==="object"&&F!==null?h4._`${z()}(${Y}, ${K}[${q}])`:h4._`${Y} === ${F}`}}};SH.default=vN});var RH=P((IH)=>{Object.defineProperty(IH,"__esModule",{value:!0});var _N=WH(),xN=JH(),gN=AH(),yN=DH(),hN=qH(),fN=VH(),uN=OH(),lN=jH(),mN=EH(),cN=PH(),pN=[_N.default,xN.default,gN.default,yN.default,hN.default,fN.default,uN.default,lN.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},mN.default,cN.default];IH.default=pN});var sY=P((TH)=>{Object.defineProperty(TH,"__esModule",{value:!0});TH.validateAdditionalItems=void 0;var Q6=l(),aY=o(),nN={message:({params:{len:Q}})=>Q6.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Q6._`{limit: ${Q}}`},dN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:nN,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,aY.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}CH(Q,W)}};function CH(Q,X){let{gen:Y,schema:W,data:$,keyword:J,it:G}=Q;G.items=!0;let H=Y.const("len",Q6._`${$}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(Q6._`${H} <= ${X.length}`);else if(typeof W=="object"&&!(0,aY.alwaysValidSchema)(G,W)){let z=Y.var("valid",Q6._`${H} <= ${X.length}`);Y.if((0,Q6.not)(z),()=>B(z)),Q.ok(z)}function B(z){Y.forRange("i",X.length,H,(A)=>{if(Q.subschema({keyword:J,dataProp:A,dataPropType:aY.Type.Num},z),!G.allErrors)Y.if((0,Q6.not)(z),()=>Y.break())})}}TH.validateAdditionalItems=CH;TH.default=dN});var eY=P((_H)=>{Object.defineProperty(_H,"__esModule",{value:!0});_H.validateTuple=void 0;var vH=l(),q8=o(),rN=l0(),tN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return kH(Q,"additionalItems",X);if(Y.items=!0,(0,q8.alwaysValidSchema)(Y,X))return;Q.ok((0,rN.validateArray)(Q))}};function kH(Q,X,Y=Q.schema){let{gen:W,parentSchema:$,data:J,keyword:G,it:H}=Q;if(A($),H.opts.unevaluated&&Y.length&&H.items!==!0)H.items=q8.mergeEvaluated.items(W,Y.length,H.items);let B=W.name("valid"),z=W.const("len",vH._`${J}.length`);Y.forEach((D,L)=>{if((0,q8.alwaysValidSchema)(H,D))return;W.if(vH._`${z} > ${L}`,()=>Q.subschema({keyword:G,schemaProp:L,dataProp:L},B)),Q.ok(B)});function A(D){let{opts:L,errSchemaPath:K}=H,q=Y.length,F=q===D.minItems&&(q===D.maxItems||D[X]===!1);if(L.strictTuples&&!F){let N=`"${G}" is ${q}-tuple, but minItems or maxItems/${X} are not specified or different at path "${K}"`;(0,q8.checkStrictMode)(H,N,L.strictTuples)}}}_H.validateTuple=kH;_H.default=tN});var yH=P((gH)=>{Object.defineProperty(gH,"__esModule",{value:!0});var sN=eY(),eN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,sN.validateTuple)(Q,"items")};gH.default=eN});var uH=P((fH)=>{Object.defineProperty(fH,"__esModule",{value:!0});var hH=l(),Xw=o(),Yw=l0(),Ww=sY(),$w={message:({params:{len:Q}})=>hH.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>hH._`{limit: ${Q}}`},Jw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$w,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:$}=Y;if(W.items=!0,(0,Xw.alwaysValidSchema)(W,X))return;if($)(0,Ww.validateAdditionalItems)(Q,$);else Q.ok((0,Yw.validateArray)(Q))}};fH.default=Jw});var mH=P((lH)=>{Object.defineProperty(lH,"__esModule",{value:!0});var m0=l(),F8=o(),Hw={message:({params:{min:Q,max:X}})=>X===void 0?m0.str`must contain at least ${Q} valid item(s)`:m0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?m0._`{minContains: ${Q}}`:m0._`{minContains: ${Q}, maxContains: ${X}}`},Bw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Hw,code(Q){let{gen:X,schema:Y,parentSchema:W,data:$,it:J}=Q,G,H,{minContains:B,maxContains:z}=W;if(J.opts.next)G=B===void 0?1:B,H=z;else G=1;let A=X.const("len",m0._`${$}.length`);if(Q.setParams({min:G,max:H}),H===void 0&&G===0){(0,F8.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&G>H){(0,F8.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,F8.alwaysValidSchema)(J,Y)){let F=m0._`${A} >= ${G}`;if(H!==void 0)F=m0._`${F} && ${A} <= ${H}`;Q.pass(F);return}J.items=!0;let D=X.name("valid");if(H===void 0&&G===1)K(D,()=>X.if(D,()=>X.break()));else if(G===0){if(X.let(D,!0),H!==void 0)X.if(m0._`${$}.length > 0`,L)}else X.let(D,!1),L();Q.result(D,()=>Q.reset());function L(){let F=X.name("_valid"),N=X.let("count",0);K(F,()=>X.if(F,()=>q(N)))}function K(F,N){X.forRange("i",0,A,(O)=>{Q.subschema({keyword:"contains",dataProp:O,dataPropType:F8.Type.Num,compositeRule:!0},F),N()})}function q(F){if(X.code(m0._`${F}++`),H===void 0)X.if(m0._`${F} >= ${G}`,()=>X.assign(D,!0).break());else if(X.if(m0._`${F} > ${H}`,()=>X.assign(D,!1).break()),G===1)X.assign(D,!0);else X.if(m0._`${F} >= ${G}`,()=>X.assign(D,!0))}}};lH.default=Bw});var oH=P((iH)=>{Object.defineProperty(iH,"__esModule",{value:!0});iH.validateSchemaDeps=iH.validatePropertyDeps=iH.error=void 0;var QW=l(),Aw=o(),f4=l0();iH.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return QW.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>QW._`{property: ${Q},
7
- missingProperty: ${W},
8
- depsCount: ${X},
9
- deps: ${Y}}`};var Kw={keyword:"dependencies",type:"object",schemaType:"object",error:iH.error,code(Q){let[X,Y]=Dw(Q);cH(Q,X),pH(Q,Y)}};function Dw({schema:Q}){let X={},Y={};for(let W in Q){if(W==="__proto__")continue;let $=Array.isArray(Q[W])?X:Y;$[W]=Q[W]}return[X,Y]}function cH(Q,X=Q.schema){let{gen:Y,data:W,it:$}=Q;if(Object.keys(X).length===0)return;let J=Y.let("missing");for(let G in X){let H=X[G];if(H.length===0)continue;let B=(0,f4.propertyInData)(Y,W,G,$.opts.ownProperties);if(Q.setParams({property:G,depsCount:H.length,deps:H.join(", ")}),$.allErrors)Y.if(B,()=>{for(let z of H)(0,f4.checkReportMissingProp)(Q,z)});else Y.if(QW._`${B} && (${(0,f4.checkMissingProp)(Q,H,J)})`),(0,f4.reportMissingProp)(Q,J),Y.else()}}iH.validatePropertyDeps=cH;function pH(Q,X=Q.schema){let{gen:Y,data:W,keyword:$,it:J}=Q,G=Y.name("valid");for(let H in X){if((0,Aw.alwaysValidSchema)(J,X[H]))continue;Y.if((0,f4.propertyInData)(Y,W,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:$,schemaProp:H},G);Q.mergeValidEvaluated(B,G)},()=>Y.var(G,!0)),Q.ok(G)}}iH.validateSchemaDeps=pH;iH.default=Kw});var aH=P((tH)=>{Object.defineProperty(tH,"__esModule",{value:!0});var rH=l(),Fw=o(),Vw={message:"property name must be valid",params:({params:Q})=>rH._`{propertyName: ${Q.propertyName}}`},Uw={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vw,code(Q){let{gen:X,schema:Y,data:W,it:$}=Q;if((0,Fw.alwaysValidSchema)($,Y))return;let J=X.name("valid");X.forIn("key",W,(G)=>{Q.setParams({propertyName:G}),Q.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),X.if((0,rH.not)(J),()=>{if(Q.error(!0),!$.allErrors)X.break()})}),Q.ok(J)}};tH.default=Uw});var XW=P((sH)=>{Object.defineProperty(sH,"__esModule",{value:!0});var V8=l0(),X1=l(),Nw=L1(),U8=o(),ww={message:"must NOT have additional properties",params:({params:Q})=>X1._`{additionalProperty: ${Q.additionalProperty}}`},Mw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ww,code(Q){let{gen:X,schema:Y,parentSchema:W,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,U8.alwaysValidSchema)(G,Y))return;let z=(0,V8.allSchemaProperties)(W.properties),A=(0,V8.allSchemaProperties)(W.patternProperties);D(),Q.ok(X1._`${J} === ${Nw.default.errors}`);function D(){X.forIn("key",$,(N)=>{if(!z.length&&!A.length)q(N);else X.if(L(N),()=>q(N))})}function L(N){let O;if(z.length>8){let b=(0,U8.schemaRefOrVal)(G,W.properties,"properties");O=(0,V8.isOwnProperty)(X,b,N)}else if(z.length)O=(0,X1.or)(...z.map((b)=>X1._`${N} === ${b}`));else O=X1.nil;if(A.length)O=(0,X1.or)(O,...A.map((b)=>X1._`${(0,V8.usePattern)(Q,b)}.test(${N})`));return(0,X1.not)(O)}function K(N){X.code(X1._`delete ${$}[${N}]`)}function q(N){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){K(N);return}if(Y===!1){if(Q.setParams({additionalProperty:N}),Q.error(),!H)X.break();return}if(typeof Y=="object"&&!(0,U8.alwaysValidSchema)(G,Y)){let O=X.name("valid");if(B.removeAdditional==="failing")F(N,O,!1),X.if((0,X1.not)(O),()=>{Q.reset(),K(N)});else if(F(N,O),!H)X.if((0,X1.not)(O),()=>X.break())}}function F(N,O,b){let E={keyword:"additionalProperties",dataProp:N,dataPropType:U8.Type.Str};if(b===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,O)}}};sH.default=Mw});var Y3=P((X3)=>{Object.defineProperty(X3,"__esModule",{value:!0});var bw=I4(),eH=l0(),YW=o(),Q3=XW(),Ew={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:$,it:J}=Q;if(J.opts.removeAdditional==="all"&&W.additionalProperties===void 0)Q3.default.code(new bw.KeywordCxt(J,Q3.default,"additionalProperties"));let G=(0,eH.allSchemaProperties)(Y);for(let D of G)J.definedProperties.add(D);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=YW.mergeEvaluated.props(X,(0,YW.toHash)(G),J.props);let H=G.filter((D)=>!(0,YW.alwaysValidSchema)(J,Y[D]));if(H.length===0)return;let B=X.name("valid");for(let D of H){if(z(D))A(D);else{if(X.if((0,eH.propertyInData)(X,$,D,J.opts.ownProperties)),A(D),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(D),Q.ok(B)}function z(D){return J.opts.useDefaults&&!J.compositeRule&&Y[D].default!==void 0}function A(D){Q.subschema({keyword:"properties",schemaProp:D,dataProp:D},B)}}};X3.default=Ew});var H3=P((G3)=>{Object.defineProperty(G3,"__esModule",{value:!0});var W3=l0(),O8=l(),$3=o(),J3=o(),Pw={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:$,it:J}=Q,{opts:G}=J,H=(0,W3.allSchemaProperties)(Y),B=H.filter((F)=>(0,$3.alwaysValidSchema)(J,Y[F]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let z=G.strictSchema&&!G.allowMatchingProperties&&$.properties,A=X.name("valid");if(J.props!==!0&&!(J.props instanceof O8.Name))J.props=(0,J3.evaluatedPropsToName)(X,J.props);let{props:D}=J;L();function L(){for(let F of H){if(z)K(F);if(J.allErrors)q(F);else X.var(A,!0),q(F),X.if(A)}}function K(F){for(let N in z)if(new RegExp(F).test(N))(0,$3.checkStrictMode)(J,`property ${N} matches pattern ${F} (use allowMatchingProperties)`)}function q(F){X.forIn("key",W,(N)=>{X.if(O8._`${(0,W3.usePattern)(Q,F)}.test(${N})`,()=>{let O=B.includes(F);if(!O)Q.subschema({keyword:"patternProperties",schemaProp:F,dataProp:N,dataPropType:J3.Type.Str},A);if(J.opts.unevaluated&&D!==!0)X.assign(O8._`${D}[${N}]`,!0);else if(!O&&!J.allErrors)X.if((0,O8.not)(A),()=>X.break())})})}}};G3.default=Pw});var z3=P((B3)=>{Object.defineProperty(B3,"__esModule",{value:!0});var Rw=o(),Cw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,Rw.alwaysValidSchema)(W,Y)){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"}};B3.default=Cw});var K3=P((A3)=>{Object.defineProperty(A3,"__esModule",{value:!0});var Zw=l0(),vw={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zw.validateUnion,error:{message:"must match a schema in anyOf"}};A3.default=vw});var L3=P((D3)=>{Object.defineProperty(D3,"__esModule",{value:!0});var N8=l(),_w=o(),xw={message:"must match exactly one schema in oneOf",params:({params:Q})=>N8._`{passingSchemas: ${Q.passing}}`},gw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:xw,code(Q){let{gen:X,schema:Y,parentSchema:W,it:$}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if($.opts.discriminator&&W.discriminator)return;let J=Y,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((A,D)=>{let L;if((0,_w.alwaysValidSchema)($,A))X.var(B,!0);else L=Q.subschema({keyword:"oneOf",schemaProp:D,compositeRule:!0},B);if(D>0)X.if(N8._`${B} && ${G}`).assign(G,!1).assign(H,N8._`[${H}, ${D}]`).else();X.if(B,()=>{if(X.assign(G,!0),X.assign(H,D),L)Q.mergeEvaluated(L,N8.Name)})})}}};D3.default=gw});var F3=P((q3)=>{Object.defineProperty(q3,"__esModule",{value:!0});var hw=o(),fw={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:Y,it:W}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");let $=X.name("valid");Y.forEach((J,G)=>{if((0,hw.alwaysValidSchema)(W,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:G},$);Q.ok($),Q.mergeEvaluated(H)})}};q3.default=fw});var N3=P((O3)=>{Object.defineProperty(O3,"__esModule",{value:!0});var w8=l(),U3=o(),lw={message:({params:Q})=>w8.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>w8._`{failingKeyword: ${Q.ifClause}}`},mw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lw,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,U3.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let $=V3(W,"then"),J=V3(W,"else");if(!$&&!J)return;let G=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),$&&J){let A=X.let("ifClause");Q.setParams({ifClause:A}),X.if(H,z("then",A),z("else",A))}else if($)X.if(H,z("then"));else X.if((0,w8.not)(H),z("else"));Q.pass(G,()=>Q.error(!0));function B(){let A=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(A)}function z(A,D){return()=>{let L=Q.subschema({keyword:A},H);if(X.assign(G,H),Q.mergeValidEvaluated(L,G),D)X.assign(D,w8._`${A}`);else Q.setParams({ifClause:A})}}}};function V3(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,U3.alwaysValidSchema)(Q,Y)}O3.default=mw});var M3=P((w3)=>{Object.defineProperty(w3,"__esModule",{value:!0});var pw=o(),iw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,pw.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};w3.default=iw});var b3=P((j3)=>{Object.defineProperty(j3,"__esModule",{value:!0});var dw=sY(),ow=yH(),rw=eY(),tw=uH(),aw=mH(),sw=oH(),ew=aH(),QM=XW(),XM=Y3(),YM=H3(),WM=z3(),$M=K3(),JM=L3(),GM=F3(),HM=N3(),BM=M3();function zM(Q=!1){let X=[WM.default,$M.default,JM.default,GM.default,HM.default,BM.default,ew.default,QM.default,sw.default,XM.default,YM.default];if(Q)X.push(ow.default,tw.default);else X.push(dw.default,rw.default);return X.push(aw.default),X}j3.default=zM});var S3=P((E3)=>{Object.defineProperty(E3,"__esModule",{value:!0});var K0=l(),KM={message:({schemaCode:Q})=>K0.str`must match format "${Q}"`,params:({schemaCode:Q})=>K0._`{format: ${Q}}`},DM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:KM,code(Q,X){let{gen:Y,data:W,$data:$,schema:J,schemaCode:G,it:H}=Q,{opts:B,errSchemaPath:z,schemaEnv:A,self:D}=H;if(!B.validateFormats)return;if($)L();else K();function L(){let q=Y.scopeValue("formats",{ref:D.formats,code:B.code.formats}),F=Y.const("fDef",K0._`${q}[${G}]`),N=Y.let("fType"),O=Y.let("format");Y.if(K0._`typeof ${F} == "object" && !(${F} instanceof RegExp)`,()=>Y.assign(N,K0._`${F}.type || "string"`).assign(O,K0._`${F}.validate`),()=>Y.assign(N,K0._`"string"`).assign(O,F)),Q.fail$data((0,K0.or)(b(),E()));function b(){if(B.strictSchema===!1)return K0.nil;return K0._`${G} && !${O}`}function E(){let y=A.$async?K0._`(${F}.async ? await ${O}(${W}) : ${O}(${W}))`:K0._`${O}(${W})`,x=K0._`(typeof ${O} == "function" ? ${y} : ${O}.test(${W}))`;return K0._`${O} && ${O} !== true && ${N} === ${X} && !${x}`}}function K(){let q=D.formats[J];if(!q){b();return}if(q===!0)return;let[F,N,O]=E(q);if(F===X)Q.pass(y());function b(){if(B.strictSchema===!1){D.logger.warn(x());return}throw Error(x());function x(){return`unknown format "${J}" ignored in schema at path "${z}"`}}function E(x){let j0=x instanceof RegExp?(0,K0.regexpCode)(x):B.code.formats?K0._`${B.code.formats}${(0,K0.getProperty)(J)}`:void 0,y0=Y.scopeValue("formats",{key:J,ref:x,code:j0});if(typeof x=="object"&&!(x instanceof RegExp))return[x.type||"string",x.validate,K0._`${y0}.validate`];return["string",x,y0]}function y(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!A.$async)throw Error("async format in sync schema");return K0._`await ${O}(${W})`}return typeof N=="function"?K0._`${O}(${W})`:K0._`${O}.test(${W})`}}}};E3.default=DM});var I3=P((P3)=>{Object.defineProperty(P3,"__esModule",{value:!0});var qM=S3(),FM=[qM.default];P3.default=FM});var T3=P((R3)=>{Object.defineProperty(R3,"__esModule",{value:!0});R3.contentVocabulary=R3.metadataVocabulary=void 0;R3.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];R3.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var k3=P((v3)=>{Object.defineProperty(v3,"__esModule",{value:!0});var OM=XH(),NM=RH(),wM=b3(),MM=I3(),Z3=T3(),jM=[OM.default,NM.default,(0,wM.default)(),MM.default,Z3.metadataVocabulary,Z3.contentVocabulary];v3.default=jM});var y3=P((x3)=>{Object.defineProperty(x3,"__esModule",{value:!0});x3.DiscrError=void 0;var _3;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(_3||(x3.DiscrError=_3={}))});var u3=P((f3)=>{Object.defineProperty(f3,"__esModule",{value:!0});var g6=l(),WW=y3(),h3=W8(),EM=R4(),SM=o(),PM={message:({params:{discrError:Q,tagName:X}})=>Q===WW.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>g6._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},IM={keyword:"discriminator",type:"object",schemaType:"object",error:PM,code(Q){let{gen:X,data:Y,schema:W,parentSchema:$,it:J}=Q,{oneOf:G}=$;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let H=W.propertyName;if(typeof H!="string")throw Error("discriminator: requires propertyName");if(W.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",g6._`${Y}${(0,g6.getProperty)(H)}`);X.if(g6._`typeof ${z} == "string"`,()=>A(),()=>Q.error(!1,{discrError:WW.DiscrError.Tag,tag:z,tagName:H})),Q.ok(B);function A(){let K=L();X.if(!1);for(let q in K)X.elseIf(g6._`${z} === ${q}`),X.assign(B,D(K[q]));X.else(),Q.error(!1,{discrError:WW.DiscrError.Mapping,tag:z,tagName:H}),X.endIf()}function D(K){let q=X.name("valid"),F=Q.subschema({keyword:"oneOf",schemaProp:K},q);return Q.mergeEvaluated(F,g6.Name),q}function L(){var K;let q={},F=O($),N=!0;for(let y=0;y<G.length;y++){let x=G[y];if((x===null||x===void 0?void 0:x.$ref)&&!(0,SM.schemaHasRulesButRef)(x,J.self.RULES)){let y0=x.$ref;if(x=h3.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,y0),x instanceof h3.SchemaEnv)x=x.schema;if(x===void 0)throw new EM.default(J.opts.uriResolver,J.baseId,y0)}let j0=(K=x===null||x===void 0?void 0:x.properties)===null||K===void 0?void 0:K[H];if(typeof j0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);N=N&&(F||O(x)),b(j0,y)}if(!N)throw Error(`discriminator: "${H}" must be required`);return q;function O({required:y}){return Array.isArray(y)&&y.includes(H)}function b(y,x){if(y.const)E(y.const,x);else if(y.enum)for(let j0 of y.enum)E(j0,x);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function E(y,x){if(typeof y!="string"||y in q)throw Error(`discriminator: "${H}" values must be unique strings`);q[y]=x}}}};f3.default=IM});var l3=P((aR,CM)=>{CM.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 JW=P((v0,$W)=>{Object.defineProperty(v0,"__esModule",{value:!0});v0.MissingRefError=v0.ValidationError=v0.CodeGen=v0.Name=v0.nil=v0.stringify=v0.str=v0._=v0.KeywordCxt=v0.Ajv=void 0;var TM=i5(),ZM=k3(),vM=u3(),m3=l3(),kM=["/properties"],M8="http://json-schema.org/draft-07/schema";class u4 extends TM.default{_addVocabularies(){if(super._addVocabularies(),ZM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(vM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(m3,kM):m3;this.addMetaSchema(Q,M8,!1),this.refs["http://json-schema.org/schema"]=M8}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(M8)?M8:void 0)}}v0.Ajv=u4;$W.exports=v0=u4;$W.exports.Ajv=u4;Object.defineProperty(v0,"__esModule",{value:!0});v0.default=u4;var _M=I4();Object.defineProperty(v0,"KeywordCxt",{enumerable:!0,get:function(){return _M.KeywordCxt}});var y6=l();Object.defineProperty(v0,"_",{enumerable:!0,get:function(){return y6._}});Object.defineProperty(v0,"str",{enumerable:!0,get:function(){return y6.str}});Object.defineProperty(v0,"stringify",{enumerable:!0,get:function(){return y6.stringify}});Object.defineProperty(v0,"nil",{enumerable:!0,get:function(){return y6.nil}});Object.defineProperty(v0,"Name",{enumerable:!0,get:function(){return y6.Name}});Object.defineProperty(v0,"CodeGen",{enumerable:!0,get:function(){return y6.CodeGen}});var xM=X8();Object.defineProperty(v0,"ValidationError",{enumerable:!0,get:function(){return xM.default}});var gM=R4();Object.defineProperty(v0,"MissingRefError",{enumerable:!0,get:function(){return gM.default}})});var s3=P((t3)=>{Object.defineProperty(t3,"__esModule",{value:!0});t3.formatNames=t3.fastFormats=t3.fullFormats=void 0;function B1(Q,X){return{validate:Q,compare:X}}t3.fullFormats={date:B1(n3,zW),time:B1(HW(!0),AW),"date-time":B1(c3(!0),o3),"iso-time":B1(HW(),d3),"iso-date-time":B1(c3(),r3),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:pM,"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:aM,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:iM,int32:{type:"number",validate:oM},int64:{type:"number",validate:rM},float:{type:"number",validate:i3},double:{type:"number",validate:i3},password:!0,binary:!0};t3.fastFormats={...t3.fullFormats,date:B1(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,zW),time:B1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,AW),"date-time":B1(/^\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,o3),"iso-time":B1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d3),"iso-date-time":B1(/^\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,r3),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};t3.formatNames=Object.keys(t3.fullFormats);function fM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var uM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,lM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n3(Q){let X=uM.exec(Q);if(!X)return!1;let Y=+X[1],W=+X[2],$=+X[3];return W>=1&&W<=12&&$>=1&&$<=(W===2&&fM(Y)?29:lM[W])}function zW(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var GW=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function HW(Q){return function(Y){let W=GW.exec(Y);if(!W)return!1;let $=+W[1],J=+W[2],G=+W[3],H=W[4],B=W[5]==="-"?-1:1,z=+(W[6]||0),A=+(W[7]||0);if(z>23||A>59||Q&&!H)return!1;if($<=23&&J<=59&&G<60)return!0;let D=J-A*B,L=$-z*B-(D<0?1:0);return(L===23||L===-1)&&(D===59||D===-1)&&G<61}}function AW(Q,X){if(!(Q&&X))return;let Y=new Date("2020-01-01T"+Q).valueOf(),W=new Date("2020-01-01T"+X).valueOf();if(!(Y&&W))return;return Y-W}function d3(Q,X){if(!(Q&&X))return;let Y=GW.exec(Q),W=GW.exec(X);if(!(Y&&W))return;if(Q=Y[1]+Y[2]+Y[3],X=W[1]+W[2]+W[3],Q>X)return 1;if(Q<X)return-1;return 0}var BW=/t|\s/i;function c3(Q){let X=HW(Q);return function(W){let $=W.split(BW);return $.length===2&&n3($[0])&&X($[1])}}function o3(Q,X){if(!(Q&&X))return;let Y=new Date(Q).valueOf(),W=new Date(X).valueOf();if(!(Y&&W))return;return Y-W}function r3(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(BW),[$,J]=X.split(BW),G=zW(Y,$);if(G===void 0)return;return G||AW(W,J)}var mM=/\/|:/,cM=/^(?:[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 pM(Q){return mM.test(Q)&&cM.test(Q)}var p3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function iM(Q){return p3.lastIndex=0,p3.test(Q)}var nM=-2147483648,dM=2147483647;function oM(Q){return Number.isInteger(Q)&&Q<=dM&&Q>=nM}function rM(Q){return Number.isInteger(Q)}function i3(){return!0}var tM=/[^\\]\\Z/;function aM(Q){if(tM.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var QB=P((e3)=>{Object.defineProperty(e3,"__esModule",{value:!0});e3.formatLimitDefinition=void 0;var eM=JW(),Y1=l(),_1=Y1.operators,j8={formatMaximum:{okStr:"<=",ok:_1.LTE,fail:_1.GT},formatMinimum:{okStr:">=",ok:_1.GTE,fail:_1.LT},formatExclusiveMaximum:{okStr:"<",ok:_1.LT,fail:_1.GTE},formatExclusiveMinimum:{okStr:">",ok:_1.GT,fail:_1.LTE}},Qj={message:({keyword:Q,schemaCode:X})=>Y1.str`should be ${j8[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>Y1._`{comparison: ${j8[Q].okStr}, limit: ${X}}`};e3.formatLimitDefinition={keyword:Object.keys(j8),type:"string",schemaType:"string",$data:!0,error:Qj,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:$,it:J}=Q,{opts:G,self:H}=J;if(!G.validateFormats)return;let B=new eM.KeywordCxt(J,H.RULES.all.format.definition,"format");if(B.$data)z();else A();function z(){let L=X.scopeValue("formats",{ref:H.formats,code:G.code.formats}),K=X.const("fmt",Y1._`${L}[${B.schemaCode}]`);Q.fail$data((0,Y1.or)(Y1._`typeof ${K} != "object"`,Y1._`${K} instanceof RegExp`,Y1._`typeof ${K}.compare != "function"`,D(K)))}function A(){let L=B.schema,K=H.formats[L];if(!K||K===!0)return;if(typeof K!="object"||K instanceof RegExp||typeof K.compare!="function")throw Error(`"${$}": format "${L}" does not define "compare" function`);let q=X.scopeValue("formats",{key:L,ref:K,code:G.code.formats?Y1._`${G.code.formats}${(0,Y1.getProperty)(L)}`:void 0});Q.fail$data(D(q))}function D(L){return Y1._`${L}.compare(${Y}, ${W}) ${j8[$].fail} 0`}},dependencies:["format"]};var Xj=(Q)=>{return Q.addKeyword(e3.formatLimitDefinition),Q};e3.default=Xj});var $B=P((l4,WB)=>{Object.defineProperty(l4,"__esModule",{value:!0});var h6=s3(),Wj=QB(),LW=l(),XB=new LW.Name("fullFormats"),$j=new LW.Name("fastFormats"),qW=(Q,X={keywords:!0})=>{if(Array.isArray(X))return YB(Q,X,h6.fullFormats,XB),Q;let[Y,W]=X.mode==="fast"?[h6.fastFormats,$j]:[h6.fullFormats,XB],$=X.formats||h6.formatNames;if(YB(Q,$,Y,W),X.keywords)(0,Wj.default)(Q);return Q};qW.get=(Q,X="full")=>{let W=(X==="fast"?h6.fastFormats:h6.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function YB(Q,X,Y,W){var $,J;($=(J=Q.opts.code).formats)!==null&&$!==void 0||(J.formats=LW._`require("ajv-formats/dist/formats").${W}`);for(let G of X)Q.addFormat(G,Y[G])}WB.exports=l4=qW;Object.defineProperty(l4,"__esModule",{value:!0});l4.default=qW});import TJ from"node:process";var fB=Object.freeze({status:"aborted"});function U(Q,X,Y){function W(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 A in G.prototype)if(!(A in H))Object.defineProperty(H,A,{value:G.prototype[A].bind(H)});H._zod.constr=G,H._zod.def=B}let $=Y?.Parent??Object;class J extends ${}Object.defineProperty(J,"name",{value:Q});function G(H){var B;let z=Y?.Parent?new J:this;W(z,H),(B=z._zod).deferred??(B.deferred=[]);for(let A of z._zod.deferred)A();return z}return Object.defineProperty(G,"init",{value:W}),Object.defineProperty(G,Symbol.hasInstance,{value:(H)=>{if(Y?.Parent&&H instanceof Y.Parent)return!0;return H?._zod?.traits?.has(Q)}}),Object.defineProperty(G,"name",{value:Q}),G}var uB=Symbol("zod_brand");class V1 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var p4={};function k0(Q){if(Q)Object.assign(p4,Q);return p4}var p={};P8(p,{unwrapMessage:()=>m6,stringifyPrimitive:()=>d4,required:()=>Wz,randomString:()=>oB,propertyKeyTypes:()=>v8,promiseAllObject:()=>dB,primitiveTypes:()=>PW,prefixIssues:()=>W1,pick:()=>sB,partial:()=>Yz,optionalKeys:()=>k8,omit:()=>eB,numKeys:()=>rB,nullish:()=>i6,normalizeParams:()=>k,merge:()=>Xz,jsonStringifyReplacer:()=>R8,joinValues:()=>i4,issue:()=>x8,isPlainObject:()=>W6,isObject:()=>Y6,getSizableOrigin:()=>RW,getParsedType:()=>tB,getLengthableOrigin:()=>d6,getEnumValues:()=>c6,getElementAtPath:()=>nB,floatSafeRemainder:()=>C8,finalizeIssue:()=>p0,extend:()=>Qz,escapeRegex:()=>U1,esc:()=>g1,defineLazy:()=>Q0,createTransparentProxy:()=>aB,clone:()=>_0,cleanRegex:()=>n6,cleanEnum:()=>$z,captureStackTrace:()=>n4,cached:()=>p6,assignProp:()=>T8,assertNotEqual:()=>mB,assertNever:()=>pB,assertIs:()=>cB,assertEqual:()=>lB,assert:()=>iB,allowsEval:()=>Z8,aborted:()=>y1,NUMBER_FORMAT_RANGES:()=>_8,Class:()=>CW,BIGINT_FORMAT_RANGES:()=>IW});function lB(Q){return Q}function mB(Q){return Q}function cB(Q){}function pB(Q){throw Error()}function iB(Q){}function c6(Q){let X=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,$])=>X.indexOf(+W)===-1).map(([W,$])=>$)}function i4(Q,X="|"){return Q.map((Y)=>d4(Y)).join(X)}function R8(Q,X){if(typeof X==="bigint")return X.toString();return X}function p6(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function i6(Q){return Q===null||Q===void 0}function n6(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function C8(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,$=Y>W?Y:W,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}function Q0(Q,X,Y){Object.defineProperty(Q,X,{get(){{let $=Y();return Q[X]=$,$}throw Error("cached value already set")},set($){Object.defineProperty(Q,X,{value:$})},configurable:!0})}function T8(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function nB(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function dB(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let $={};for(let J=0;J<X.length;J++)$[X[J]]=W[J];return $})}function oB(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function g1(Q){return JSON.stringify(Q)}var n4=Error.captureStackTrace?Error.captureStackTrace:(...Q)=>{};function Y6(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var Z8=p6(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function W6(Q){if(Y6(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(Y6(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function rB(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var tB=(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}`)}},v8=new Set(["string","number","symbol"]),PW=new Set(["string","number","bigint","boolean","symbol","undefined"]);function U1(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function k(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 aB(Q){let X;return new Proxy({},{get(Y,W,$){return X??(X=Q()),Reflect.get(X,W,$)},set(Y,W,$,J){return X??(X=Q()),Reflect.set(X,W,$,J)},has(Y,W){return X??(X=Q()),Reflect.has(X,W)},deleteProperty(Y,W){return X??(X=Q()),Reflect.deleteProperty(X,W)},ownKeys(Y){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,W){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(Y,W,$){return X??(X=Q()),Reflect.defineProperty(X,W,$)}})}function d4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function k8(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var _8={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]},IW={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sB(Q,X){let Y={},W=Q._zod.def;for(let $ in X){if(!($ in W.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;Y[$]=W.shape[$]}return _0(Q,{...Q._zod.def,shape:Y,checks:[]})}function eB(Q,X){let Y={...Q._zod.def.shape},W=Q._zod.def;for(let $ in X){if(!($ in W.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;delete Y[$]}return _0(Q,{...Q._zod.def,shape:Y,checks:[]})}function Qz(Q,X){if(!W6(X))throw Error("Invalid input to extend: expected a plain object");let Y={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X};return T8(this,"shape",W),W},checks:[]};return _0(Q,Y)}function Xz(Q,X){return _0(Q,{...Q._zod.def,get shape(){let Y={...Q._zod.def.shape,...X._zod.def.shape};return T8(this,"shape",Y),Y},catchall:X._zod.def.catchall,checks:[]})}function Yz(Q,X,Y){let W=X._zod.def.shape,$={...W};if(Y)for(let J in Y){if(!(J in W))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=Q?new Q({type:"optional",innerType:W[J]}):W[J]}else for(let J in W)$[J]=Q?new Q({type:"optional",innerType:W[J]}):W[J];return _0(X,{...X._zod.def,shape:$,checks:[]})}function Wz(Q,X,Y){let W=X._zod.def.shape,$={...W};if(Y)for(let J in Y){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=new Q({type:"nonoptional",innerType:W[J]})}else for(let J in W)$[J]=new Q({type:"nonoptional",innerType:W[J]});return _0(X,{...X._zod.def,shape:$,checks:[]})}function y1(Q,X=0){for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue!==!0)return!0;return!1}function W1(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function m6(Q){return typeof Q==="string"?Q:Q?.message}function p0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let $=m6(Q.inst?._zod.def?.error?.(Q))??m6(X?.error?.(Q))??m6(Y.customError?.(Q))??m6(Y.localeError?.(Q))??"Invalid input";W.message=$}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function RW(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function d6(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function x8(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function $z(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class CW{constructor(...Q){}}var TW=(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,R8,2)},enumerable:!0}),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},o4=U("$ZodError",TW),o6=U("$ZodError",TW,{Parent:Error});function g8(Q,X=(Y)=>Y.message){let Y={},W=[];for(let $ of Q.issues)if($.path.length>0)Y[$.path[0]]=Y[$.path[0]]||[],Y[$.path[0]].push(X($));else W.push(X($));return{formErrors:W,fieldErrors:Y}}function y8(Q,X){let Y=X||function(J){return J.message},W={_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)W._errors.push(Y(G));else{let H=W,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(Y(G));H=H[z],B++}}};return $(Q),W}var h8=(Q)=>(X,Y,W,$)=>{let J=W?Object.assign(W,{async:!1}):{async:!1},G=X._zod.run({value:Y,issues:[]},J);if(G instanceof Promise)throw new V1;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>p0(B,J,k0())));throw n4(H,$?.callee),H}return G.value},f8=h8(o6),u8=(Q)=>async(X,Y,W,$)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},G=X._zod.run({value:Y,issues:[]},J);if(G instanceof Promise)G=await G;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>p0(B,J,k0())));throw n4(H,$?.callee),H}return G.value},l8=u8(o6),m8=(Q)=>(X,Y,W)=>{let $=W?{...W,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)throw new V1;return J.issues.length?{success:!1,error:new(Q??o4)(J.issues.map((G)=>p0(G,$,k0())))}:{success:!0,data:J.value}},h1=m8(o6),c8=(Q)=>async(X,Y,W)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map((G)=>p0(G,$,k0())))}:{success:!0,data:J.value}},f1=c8(o6);var ZW=/^[cC][^\s-]{8,}$/,vW=/^[0-9a-z]+$/,kW=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_W=/^[0-9a-vA-V]{20}$/,xW=/^[A-Za-z0-9]{27}$/,gW=/^[a-zA-Z0-9_-]{21}$/,yW=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var hW=/^([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})$/,p8=(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 fW=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function uW(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var lW=/^(?:(?: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])$/,mW=/^(([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})$/,cW=/^((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])$/,pW=/^(([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])$/,iW=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,i8=/^[A-Za-z0-9_-]*$/,nW=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var dW=/^\+(?:[0-9]){6,14}[0-9]$/,oW="(?:(?:\\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])))",rW=new RegExp(`^${oW}$`);function tW(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 aW(Q){return new RegExp(`^${tW(Q)}$`)}function sW(Q){let X=tW({precision:Q.precision}),Y=["Z"];if(Q.local)Y.push("");if(Q.offset)Y.push("([+-]\\d{2}:\\d{2})");let W=`${X}(?:${Y.join("|")})`;return new RegExp(`^${oW}T(?:${W})$`)}var eW=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var Q$=/^\d+$/,X$=/^-?\d+(?:\.\d+)?/i,Y$=/true|false/i,W$=/null/i;var $$=/^[^A-Z]*$/,J$=/^[^a-z]*$/;var F0=U("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),G$={number:"number",bigint:"bigint",object:"date"},n8=U("$ZodCheckLessThan",(Q,X)=>{F0.init(Q,X);let Y=G$[typeof X.value];Q._zod.onattach.push((W)=>{let $=W._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=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:Y,code:"too_big",maximum:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),d8=U("$ZodCheckGreaterThan",(Q,X)=>{F0.init(Q,X);let Y=G$[typeof X.value];Q._zod.onattach.push((W)=>{let $=W._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=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:Y,code:"too_small",minimum:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),H$=U("$ZodCheckMultipleOf",(Q,X)=>{F0.init(Q,X),Q._zod.onattach.push((Y)=>{var W;(W=Y._zod.bag).multipleOf??(W.multipleOf=X.value)}),Q._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):C8(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:Q,continue:!X.abort})}}),B$=U("$ZodCheckNumberFormat",(Q,X)=>{F0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[$,J]=_8[X.format];Q._zod.onattach.push((G)=>{let H=G._zod.bag;if(H.format=X.format,H.minimum=$,H.maximum=J,Y)H.pattern=Q$}),Q._zod.check=(G)=>{let H=G.value;if(Y){if(!Number.isInteger(H)){G.issues.push({expected:W,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:W,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:W,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 z$=U("$ZodCheckMaxLength",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<$)W._zod.bag.maximum=X.maximum}),Q._zod.check=(W)=>{let $=W.value;if($.length<=X.maximum)return;let G=d6($);W.issues.push({origin:G,code:"too_big",maximum:X.maximum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),A$=U("$ZodCheckMinLength",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>$)W._zod.bag.minimum=X.minimum}),Q._zod.check=(W)=>{let $=W.value;if($.length>=X.minimum)return;let G=d6($);W.issues.push({origin:G,code:"too_small",minimum:X.minimum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),K$=U("$ZodCheckLengthEquals",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.minimum=X.length,$.maximum=X.length,$.length=X.length}),Q._zod.check=(W)=>{let $=W.value,J=$.length;if(J===X.length)return;let G=d6($),H=J>X.length;W.issues.push({origin:G,...H?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),r6=U("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(F0.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)(Y=Q._zod).check??(Y.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(W=Q._zod).check??(W.check=()=>{})}),D$=U("$ZodCheckRegex",(Q,X)=>{r6.init(Q,X),Q._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:Q,continue:!X.abort})}}),L$=U("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=$$),r6.init(Q,X)}),q$=U("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=J$),r6.init(Q,X)}),F$=U("$ZodCheckIncludes",(Q,X)=>{F0.init(Q,X);let Y=U1(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push(($)=>{let J=$._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),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})}}),V$=U("$ZodCheckStartsWith",(Q,X)=>{F0.init(Q,X);let Y=new RegExp(`^${U1(X.prefix)}.*`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(Y)}),Q._zod.check=(W)=>{if(W.value.startsWith(X.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:W.value,inst:Q,continue:!X.abort})}}),U$=U("$ZodCheckEndsWith",(Q,X)=>{F0.init(Q,X);let Y=new RegExp(`.*${U1(X.suffix)}$`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(Y)}),Q._zod.check=(W)=>{if(W.value.endsWith(X.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:W.value,inst:Q,continue:!X.abort})}});var O$=U("$ZodCheckOverwrite",(Q,X)=>{F0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class o8{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 Y=Q.split(`
10
- `).filter((J)=>J),W=Math.min(...Y.map((J)=>J.length-J.trimStart().length)),$=Y.map((J)=>J.slice(W)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of $)this.content.push(J)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map(($)=>` ${$}`)];return new Q(...X,W.join(`
11
- `))}}var w$={major:4,minor:0,patch:0};var a=U("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=w$;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let $ of W)for(let J of $._zod.onattach)J(Q);if(W.length===0)(Y=Q._zod).deferred??(Y.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let $=(J,G,H)=>{let B=y1(J),z;for(let A of G){if(A._zod.def.when){if(!A._zod.def.when(J))continue}else if(B)continue;let D=J.issues.length,L=A._zod.check(J);if(L instanceof Promise&&H?.async===!1)throw new V1;if(z||L instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await L,J.issues.length===D)return;if(!B)B=y1(J,D)});else{if(J.issues.length===D)continue;if(!B)B=y1(J,D)}}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 V1;return H.then((B)=>$(B,W,G))}return $(H,W,G)}}Q["~standard"]={validate:($)=>{try{let J=h1(Q,$);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return f1(Q,$).then((G)=>G.success?{value:G.data}:{issues:G.error?.issues})}},vendor:"zod",version:1}}),t6=U("$ZodString",(Q,X)=>{a.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??eW(Q._zod.bag),Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch($){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:Q}),Y}}),X0=U("$ZodStringFormat",(Q,X)=>{r6.init(Q,X),t6.init(Q,X)}),t8=U("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=hW),X0.init(Q,X)}),a8=U("$ZodUUID",(Q,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=p8(W))}else X.pattern??(X.pattern=p8());X0.init(Q,X)}),s8=U("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=fW),X0.init(Q,X)}),e8=U("$ZodURL",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value,$=new URL(W),J=$.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test($.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:nW.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test($.protocol.endsWith(":")?$.protocol.slice(0,-1):$.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:Q,continue:!X.abort})}if(!W.endsWith("/")&&J.endsWith("/"))Y.value=J.slice(0,-1);else Y.value=J;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:Q,continue:!X.abort})}}}),QQ=U("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=uW()),X0.init(Q,X)}),XQ=U("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=gW),X0.init(Q,X)}),YQ=U("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=ZW),X0.init(Q,X)}),WQ=U("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=vW),X0.init(Q,X)}),$Q=U("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=kW),X0.init(Q,X)}),JQ=U("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=_W),X0.init(Q,X)}),GQ=U("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=xW),X0.init(Q,X)}),T$=U("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=sW(X)),X0.init(Q,X)}),Z$=U("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=rW),X0.init(Q,X)}),v$=U("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=aW(X)),X0.init(Q,X)}),k$=U("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=yW),X0.init(Q,X)}),HQ=U("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=lW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),BQ=U("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=mW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv6"}),Q._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:Q,continue:!X.abort})}}}),zQ=U("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=cW),X0.init(Q,X)}),AQ=U("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=pW),X0.init(Q,X),Q._zod.check=(Y)=>{let[W,$]=Y.value.split("/");try{if(!$)throw Error();let J=Number($);if(`${J}`!==$)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${W}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:Q,continue:!X.abort})}}});function _$(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var KQ=U("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=iW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(_$(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function Gz(Q){if(!i8.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return _$(Y)}var DQ=U("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=i8),X0.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(Gz(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),LQ=U("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=dW),X0.init(Q,X)});function Hz(Q,X=null){try{let Y=Q.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let $=JSON.parse(atob(W));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 qQ=U("$ZodJWT",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{if(Hz(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var a4=U("$ZodNumber",(Q,X)=>{a.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??X$,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(G){}let $=Y.value;if(typeof $==="number"&&!Number.isNaN($)&&Number.isFinite($))return Y;let J=typeof $==="number"?Number.isNaN($)?"NaN":!Number.isFinite($)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:$,inst:Q,...J?{received:J}:{}}),Y}}),FQ=U("$ZodNumber",(Q,X)=>{B$.init(Q,X),a4.init(Q,X)}),VQ=U("$ZodBoolean",(Q,X)=>{a.init(Q,X),Q._zod.pattern=Y$,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(J){}let $=Y.value;if(typeof $==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:$,inst:Q}),Y}});var UQ=U("$ZodNull",(Q,X)=>{a.init(Q,X),Q._zod.pattern=W$,Q._zod.values=new Set([null]),Q._zod.parse=(Y,W)=>{let $=Y.value;if($===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:$,inst:Q}),Y}});var OQ=U("$ZodUnknown",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y)=>Y}),NQ=U("$ZodNever",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function M$(Q,X,Y){if(Q.issues.length)X.issues.push(...W1(Y,Q.issues));X.value[Y]=Q.value}var wQ=U("$ZodArray",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value;if(!Array.isArray($))return Y.issues.push({expected:"array",code:"invalid_type",input:$,inst:Q}),Y;Y.value=Array($.length);let J=[];for(let G=0;G<$.length;G++){let H=$[G],B=X.element._zod.run({value:H,issues:[]},W);if(B instanceof Promise)J.push(B.then((z)=>M$(z,Y,G)));else M$(B,Y,G)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function t4(Q,X,Y){if(Q.issues.length)X.issues.push(...W1(Y,Q.issues));X.value[Y]=Q.value}function j$(Q,X,Y,W){if(Q.issues.length)if(W[Y]===void 0)if(Y in W)X.value[Y]=void 0;else X.value[Y]=Q.value;else X.issues.push(...W1(Y,Q.issues));else if(Q.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=Q.value}var s4=U("$ZodObject",(Q,X)=>{a.init(Q,X);let Y=p6(()=>{let D=Object.keys(X.shape);for(let K of D)if(!(X.shape[K]instanceof a))throw Error(`Invalid element at key "${K}": expected a Zod schema`);let L=k8(X.shape);return{shape:X.shape,keys:D,keySet:new Set(D),numKeys:D.length,optionalKeys:new Set(L)}});Q0(Q._zod,"propValues",()=>{let D=X.shape,L={};for(let K in D){let q=D[K]._zod;if(q.values){L[K]??(L[K]=new Set);for(let F of q.values)L[K].add(F)}}return L});let W=(D)=>{let L=new o8(["shape","payload","ctx"]),K=Y.value,q=(b)=>{let E=g1(b);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};L.write("const input = payload.value;");let F=Object.create(null),N=0;for(let b of K.keys)F[b]=`key_${N++}`;L.write("const newResult = {}");for(let b of K.keys)if(K.optionalKeys.has(b)){let E=F[b];L.write(`const ${E} = ${q(b)};`);let y=g1(b);L.write(`
12
- if (${E}.issues.length) {
13
- if (input[${y}] === undefined) {
14
- if (${y} in input) {
15
- newResult[${y}] = undefined;
2
+ var Cg=Object.create;var{getPrototypeOf:Og,defineProperty:za,getOwnPropertyNames:jg}=Object;var Sa=Object.prototype.hasOwnProperty;function Ng(e){return this[e]}var Ag,Zg,ka=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?Ag??=new WeakMap:Zg??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?Cg(Og(e)):{};let i=t||!e||!e.__esModule||!Sa.call(e,"default")?za(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of jg(e))if(!Sa.call(i,a))za(i,a,{get:Ng.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eo=T(function(cd){Object.defineProperty(cd,"__esModule",{value:!0});cd.regexpCode=cd.getEsmExportName=cd.getProperty=cd.safeStringify=cd.stringify=cd.strConcat=cd.addCodeArg=cd.str=cd._=cd.nil=cd._Code=cd.Name=cd.IDENTIFIER=cd._CodeOrName=void 0;class Yo{}cd._CodeOrName=Yo;cd.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ir extends Yo{constructor(e){super();if(!cd.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}cd.Name=ir;class Le extends Yo{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof ir)t[r.str]=(t[r.str]||0)+1;return t},{})}}cd._Code=Le;cd.nil=new Le("");function id(e,...t){let r=[e[0]],o=0;while(o<t.length)fi(r,t[o]),r.push(e[++o]);return new Le(r)}cd._=id;var pi=new Le("+");function ad(e,...t){let r=[Xr(e[0])],o=0;while(o<t.length)r.push(pi),fi(r,t[o]),r.push(pi,Xr(e[++o]));return Sv(r),new Le(r)}cd.str=ad;function fi(e,t){if(t instanceof Le)e.push(...t._items);else if(t instanceof ir)e.push(t);else e.push(Ev(t))}cd.addCodeArg=fi;function Sv(e){let t=1;while(t<e.length-1){if(e[t]===pi){let r=kv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function kv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ir||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof ir))return`"${e}${t.slice(1)}`;return}function Pv(e,t){return t.emptyStr()?e:e.emptyStr()?t:ad`${e}${t}`}cd.strConcat=Pv;function Ev(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Xr(Array.isArray(e)?e.join(","):e)}function Tv(e){return new Le(Xr(e))}cd.stringify=Tv;function Xr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cd.safeStringify=Xr;function Rv(e){return typeof e=="string"&&cd.IDENTIFIER.test(e)?new Le(`.${e}`):id`[${e}]`}cd.getProperty=Rv;function Iv(e){if(typeof e=="string"&&cd.IDENTIFIER.test(e))return new Le(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}cd.getEsmExportName=Iv;function Cv(e){return new Le(e.toString())}cd.regexpCode=Cv});var _i=T(function(pd){Object.defineProperty(pd,"__esModule",{value:!0});pd.ValueScope=pd.ValueScopeName=pd.Scope=pd.varKinds=pd.UsedValueState=void 0;var W=eo();class ld extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Xo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Xo||(pd.UsedValueState=Xo={}));pd.varKinds={const:new W.Name("const"),let:new W.Name("let"),var:new W.Name("var")};class hi{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof W.Name?e:this.name(e)}name(e){return new W.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}pd.Scope=hi;class gi extends W.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=W._`.${new W.Name(t)}[${r}]`}}pd.ValueScopeName=gi;var Hv=W._`\n`;class dd extends hi{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Hv:W.nil}}get(){return this._scope}name(e){return new gi(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[n];if(i){let c=i.get(s);if(c)return c}else i=this._values[n]=new Map;i.set(s,o);let a=this._scope[n]||(this._scope[n]=[]),u=a.length;return a[u]=t.ref,o.setValue(t,{property:n,itemIndex:u}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return W._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=W.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Xo.Started);let c=t(u);if(c){let l=this.opts.es5?pd.varKinds.var:pd.varKinds.const;n=W._`${n}${l} ${u} = ${c};${this.opts._n}`}else if(c=o===null||o===void 0?void 0:o(u))n=W._`${n}${c}${this.opts._n}`;else throw new ld(u);a.set(u,Xo.Completed)})}return n}}pd.ValueScope=dd});var U=T(function(Ee){Object.defineProperty(Ee,"__esModule",{value:!0});Ee.or=Ee.and=Ee.not=Ee.CodeGen=Ee.operators=Ee.varKinds=Ee.ValueScopeName=Ee.ValueScope=Ee.Scope=Ee.Name=Ee.regexpCode=Ee.stringify=Ee.getProperty=Ee.nil=Ee.strConcat=Ee.str=Ee._=void 0;var R=eo(),ce=_i(),yt=eo();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return yt._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return yt.str}});Object.defineProperty(Ee,"strConcat",{enumerable:!0,get:function(){return yt.strConcat}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return yt.nil}});Object.defineProperty(Ee,"getProperty",{enumerable:!0,get:function(){return yt.getProperty}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return yt.stringify}});Object.defineProperty(Ee,"regexpCode",{enumerable:!0,get:function(){return yt.regexpCode}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return yt.Name}});var sn=_i();Object.defineProperty(Ee,"Scope",{enumerable:!0,get:function(){return sn.Scope}});Object.defineProperty(Ee,"ValueScope",{enumerable:!0,get:function(){return sn.ValueScope}});Object.defineProperty(Ee,"ValueScopeName",{enumerable:!0,get:function(){return sn.ValueScopeName}});Object.defineProperty(Ee,"varKinds",{enumerable:!0,get:function(){return sn.varKinds}});Ee.operators={GT:new R._Code(">"),GTE:new R._Code(">="),LT:new R._Code("<"),LTE:new R._Code("<="),EQ:new R._Code("==="),NEQ:new R._Code("!=="),NOT:new R._Code("!"),OR:new R._Code("||"),AND:new R._Code("&&"),ADD:new R._Code("+")};class vt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class md extends vt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ce.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=cr(this.rhs,e,t);return this}get names(){return this.rhs instanceof R._CodeOrName?this.rhs.names:{}}}class $i extends vt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof R.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=cr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof R.Name?{}:{...this.lhs.names};return nn(e,this.rhs)}}class hd extends $i{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class gd extends vt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class _d extends vt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class yd extends vt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class vd extends vt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=cr(this.code,e,t),this}get names(){return this.code instanceof R._CodeOrName?this.code.names:{}}}class an extends vt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;Jv(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Vt(e,t.names),{})}}class $t extends an{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $d extends an{}class to extends $t{}to.kind="else";class it extends $t{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new to(r):r}if(t){if(e===!1)return t instanceof it?t:t.nodes;if(this.nodes.length)return this;return new it(Sd(e),t instanceof it?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=cr(this.condition,e,t),this}get names(){let e=super.names;if(nn(e,this.condition),this.else)Vt(e,this.else.names);return e}}it.kind="if";class ar extends $t{}ar.kind="for";class wd extends ar{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=cr(this.iteration,e,t),this}get names(){return Vt(super.names,this.iteration.names)}}class xd extends ar{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?ce.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=nn(super.names,this.from);return nn(e,this.to)}}class yi extends ar{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=cr(this.iterable,e,t),this}get names(){return Vt(super.names,this.iterable.names)}}class en extends $t{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}en.kind="func";class tn extends an{render(e){return"return "+super.render(e)}}tn.kind="return";class bd extends $t{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Vt(e,this.catch.names);if(this.finally)Vt(e,this.finally.names);return e}}class rn extends $t{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}rn.kind="catch";class on extends $t{render(e){return"finally"+super.render(e)}}on.kind="finally";class zd{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
+ `:""},this._extScope=e,this._scope=new ce.Scope({parent:e}),this._nodes=[new $d]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new md(e,n,r)),n}const(e,t,r){return this._def(ce.varKinds.const,e,t,r)}let(e,t,r){return this._def(ce.varKinds.let,e,t,r)}var(e,t,r){return this._def(ce.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new $i(e,t,r))}add(e,t){return this._leafNode(new hd(e,Ee.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==R.nil)this._leafNode(new vd(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),R.addCodeArg(t,o)}return t.push("}"),new R._Code(t)}if(e,t,r){if(this._blockNode(new it(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new it(e))}else(){return this._elseNode(new to)}endIf(){return this._endBlockNode(it,to)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new wd(e),t)}forRange(e,t,r,o,n=this.opts.es5?ce.varKinds.var:ce.varKinds.let){let s=this._scope.toName(e);return this._for(new xd(n,s,t,r),()=>o(s))}forOf(e,t,r,o=ce.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof R.Name?t:this.var("_arr",t);return this.forRange("_i",0,R._`${s}.length`,(i)=>{this.var(n,R._`${s}[${i}]`),r(n)})}return this._for(new yi("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?ce.varKinds.var:ce.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,R._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new yi("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(ar)}label(e){return this._leafNode(new gd(e))}break(e){return this._leafNode(new _d(e))}return(e){let t=new tn;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(tn)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new bd;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new rn(n),t(n)}if(r)this._currNode=o.finally=new on,this.code(r);return this._endBlockNode(rn,on)}throw(e){return this._leafNode(new yd(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=R.nil,r,o){if(this._blockNode(new en(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(en)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof it))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}Ee.CodeGen=zd;function Vt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function nn(e,t){return t instanceof R._CodeOrName?Vt(e,t.names):e}function cr(e,t,r){if(e instanceof R.Name)return o(e);if(!n(e))return e;return new R._Code(e._items.reduce((s,i)=>{if(i instanceof R.Name)i=o(i);if(i instanceof R._Code)s.push(...i._items);else s.push(i);return s},[]));function o(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function n(s){return s instanceof R._Code&&s._items.some((i)=>i instanceof R.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Jv(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Sd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:R._`!${vi(e)}`}Ee.not=Sd;var Gv=kd(Ee.operators.AND);function Yv(...e){return e.reduce(Gv)}Ee.and=Yv;var Qv=kd(Ee.operators.OR);function Xv(...e){return e.reduce(Qv)}Ee.or=Xv;function kd(e){return(t,r)=>t===R.nil?r:r===R.nil?t:R._`${vi(t)} ${e} ${vi(r)}`}function vi(e){return e instanceof R.Name?e:R._`(${e})`}});var V=T(function(Ad){Object.defineProperty(Ad,"__esModule",{value:!0});Ad.checkStrictMode=Ad.getErrorPath=Ad.Type=Ad.useFunc=Ad.setEvaluated=Ad.evaluatedPropsToName=Ad.mergeEvaluated=Ad.eachItem=Ad.unescapeJsonPointer=Ad.escapeJsonPointer=Ad.escapeFragment=Ad.unescapeFragment=Ad.schemaRefOrVal=Ad.schemaHasRulesButRef=Ad.schemaHasRules=Ad.checkUnknownRules=Ad.alwaysValidSchema=Ad.toHash=void 0;var A=U(),Rd=eo();function o$(e){let t={};for(let r of e)t[r]=!0;return t}Ad.toHash=o$;function n$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Id(e,t),!Cd(t,e.self.RULES.all)}Ad.alwaysValidSchema=n$;function Id(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let s in t)if(!n[s])Nd(e,`unknown keyword: "${s}"`)}Ad.checkUnknownRules=Id;function Cd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Ad.schemaHasRules=Cd;function s$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Ad.schemaHasRulesButRef=s$;function i$({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return A._`${r}`}return A._`${e}${t}${A.getProperty(o)}`}Ad.schemaRefOrVal=i$;function a$(e){return Od(decodeURIComponent(e))}Ad.unescapeFragment=a$;function c$(e){return encodeURIComponent(xi(e))}Ad.escapeFragment=c$;function xi(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Ad.escapeJsonPointer=xi;function Od(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Ad.unescapeJsonPointer=Od;function u$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Ad.eachItem=u$;function Ed({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let u=i===void 0?s:i instanceof A.Name?(s instanceof A.Name?e(n,s,i):t(n,s,i),i):s instanceof A.Name?(t(n,i,s),s):r(s,i);return a===A.Name&&!(u instanceof A.Name)?o(n,u):u}}Ad.mergeEvaluated={props:Ed({mergeNames:(e,t,r)=>e.if(A._`${r} !== true && ${t} !== undefined`,()=>{e.if(A._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,A._`${r} || {}`).code(A._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(A._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,A._`${r} || {}`),bi(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:jd}),items:Ed({mergeNames:(e,t,r)=>e.if(A._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,A._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(A._`${r} !== true`,()=>e.assign(r,t===!0?!0:A._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function jd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",A._`{}`);if(t!==void 0)bi(e,r,t);return r}Ad.evaluatedPropsToName=jd;function bi(e,t,r){Object.keys(r).forEach((o)=>e.assign(A._`${t}${A.getProperty(o)}`,!0))}Ad.setEvaluated=bi;var Td={};function l$(e,t){return e.scopeValue("func",{ref:t,code:Td[t.code]||(Td[t.code]=new Rd._Code(t.code))})}Ad.useFunc=l$;var wi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(wi||(Ad.Type=wi={}));function d$(e,t,r){if(e instanceof A.Name){let o=t===wi.Num;return r?o?A._`"[" + ${e} + "]"`:A._`"['" + ${e} + "']"`:o?A._`"/" + ${e}`:A._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?A.getProperty(e).toString():"/"+xi(e)}Ad.getErrorPath=d$;function Nd(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Ad.checkStrictMode=Nd});var at=T(function(qd){Object.defineProperty(qd,"__esModule",{value:!0});var K=U(),T$={data:new K.Name("data"),valCxt:new K.Name("valCxt"),instancePath:new K.Name("instancePath"),parentData:new K.Name("parentData"),parentDataProperty:new K.Name("parentDataProperty"),rootData:new K.Name("rootData"),dynamicAnchors:new K.Name("dynamicAnchors"),vErrors:new K.Name("vErrors"),errors:new K.Name("errors"),this:new K.Name("this"),self:new K.Name("self"),scope:new K.Name("scope"),json:new K.Name("json"),jsonPos:new K.Name("jsonPos"),jsonLen:new K.Name("jsonLen"),jsonPart:new K.Name("jsonPart")};qd.default=T$});var ro=T(function(Ud){Object.defineProperty(Ud,"__esModule",{value:!0});Ud.extendErrors=Ud.resetErrorsCount=Ud.reportExtraError=Ud.reportError=Ud.keyword$DataError=Ud.keywordError=void 0;var I=U(),wt=V(),Se=at();Ud.keywordError={message:({keyword:e})=>I.str`must pass "${e}" keyword validation`};Ud.keyword$DataError={message:({keyword:e,schemaType:t})=>t?I.str`"${e}" keyword must be ${t} ($data)`:I.str`"${e}" keyword is invalid ($data)`};function I$(e,t=Ud.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,u=Ld(e,t,r);if(o!==null&&o!==void 0?o:i||a)Md(s,u);else Dd(n,I._`[${u}]`)}Ud.reportError=I$;function C$(e,t=Ud.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Ld(e,t,r);if(Md(n,a),!(s||i))Dd(o,Se.default.vErrors)}Ud.reportExtraError=C$;function O$(e,t){e.assign(Se.default.errors,t),e.if(I._`${Se.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(I._`${Se.default.vErrors}.length`,t),()=>e.assign(Se.default.vErrors,null)))}Ud.resetErrorsCount=O$;function j$({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,Se.default.errors,(a)=>{if(e.const(i,I._`${Se.default.vErrors}[${a}]`),e.if(I._`${i}.instancePath === undefined`,()=>e.assign(I._`${i}.instancePath`,I.strConcat(Se.default.instancePath,s.errorPath))),e.assign(I._`${i}.schemaPath`,I.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(I._`${i}.schema`,r),e.assign(I._`${i}.data`,o)})}Ud.extendErrors=j$;function Md(e,t){let r=e.const("err",t);e.if(I._`${Se.default.vErrors} === null`,()=>e.assign(Se.default.vErrors,I._`[${r}]`),I._`${Se.default.vErrors}.push(${r})`),e.code(I._`${Se.default.errors}++`)}function Dd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(I._`new ${e.ValidationError}(${t})`);else r.assign(I._`${o}.errors`,t),r.return(!1)}var Ft={keyword:new I.Name("keyword"),schemaPath:new I.Name("schemaPath"),params:new I.Name("params"),propertyName:new I.Name("propertyName"),message:new I.Name("message"),schema:new I.Name("schema"),parentSchema:new I.Name("parentSchema")};function Ld(e,t,r){let{createErrors:o}=e.it;if(o===!1)return I._`{}`;return N$(e,t,r)}function N$(e,t,r={}){let{gen:o,it:n}=e,s=[A$(n,r),Z$(e,r)];return q$(e,t,s),o.object(...s)}function A$({errorPath:e},{instancePath:t}){let r=t?I.str`${e}${wt.getErrorPath(t,wt.Type.Str)}`:e;return[Se.default.instancePath,I.strConcat(Se.default.instancePath,r)]}function Z$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:I.str`${t}/${e}`;if(r)n=I.str`${n}${wt.getErrorPath(r,wt.Type.Str)}`;return[Ft.schemaPath,n]}function q$(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(o.push([Ft.keyword,n],[Ft.params,typeof t=="function"?t(e):t||I._`{}`]),u.messages)o.push([Ft.message,typeof r=="function"?r(e):r]);if(u.verbose)o.push([Ft.schema,i],[Ft.parentSchema,I._`${l}${d}`],[Se.default.data,s]);if(c)o.push([Ft.propertyName,c])}});var Jd=T(function(Bd){Object.defineProperty(Bd,"__esModule",{value:!0});Bd.boolOrEmptySchema=Bd.topBoolOrEmptySchema=void 0;var Fd=ro(),Hd=U(),V$=at(),F$={message:"boolean schema is false"};function H$(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)Kd(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(V$.default.data);else t.assign(Hd._`${o}.errors`,null),t.return(!0)}Bd.topBoolOrEmptySchema=H$;function K$(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),Kd(e);else r.var(t,!0)}Bd.boolOrEmptySchema=K$;function Kd(e,t){let{gen:r,data:o}=e;Fd.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},F$,void 0,t)}});var Si=T(function(Gd){Object.defineProperty(Gd,"__esModule",{value:!0});Gd.getRules=Gd.isJSONType=void 0;var W$=["string","number","integer","boolean","null","object","array"],J$=new Set(W$);function G$(e){return typeof e=="string"&&J$.has(e)}Gd.isJSONType=G$;function Y$(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Gd.getRules=Y$});var ki=T(function(ep){Object.defineProperty(ep,"__esModule",{value:!0});ep.shouldUseRule=ep.shouldUseGroup=ep.schemaHasRulesForType=void 0;function X$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&Qd(e,o)}ep.schemaHasRulesForType=X$;function Qd(e,t){return t.rules.some((r)=>Xd(e,r))}ep.shouldUseGroup=Qd;function Xd(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}ep.shouldUseRule=Xd});var oo=T(function(ap){Object.defineProperty(ap,"__esModule",{value:!0});ap.reportTypeError=ap.checkDataTypes=ap.checkDataType=ap.coerceAndCheckDataType=ap.getJSONTypes=ap.getSchemaTypes=ap.DataType=void 0;var rp=Si(),op=ki(),np=ro(),z=U(),un=V(),ur;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ur||(ap.DataType=ur={}));function rw(e){let t=sp(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}ap.getSchemaTypes=rw;function sp(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(rp.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}ap.getJSONTypes=sp;function ow(e,t){let{gen:r,data:o,opts:n}=e,s=nw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&op.schemaHasRulesForType(e,t[0]));if(i){let a=Ei(t,o,n.strictNumbers,ur.Wrong);r.if(a,()=>{if(s.length)sw(e,t,s);else Ti(e)})}return i}ap.coerceAndCheckDataType=ow;var ip=new Set(["string","number","integer","boolean","null"]);function nw(e,t){return t?e.filter((r)=>ip.has(r)||t==="array"&&r==="array"):[]}function sw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",z._`typeof ${n}`),a=o.let("coerced",z._`undefined`);if(s.coerceTypes==="array")o.if(z._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,z._`${n}[0]`).assign(i,z._`typeof ${n}`).if(Ei(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(z._`${a} !== undefined`);for(let c of r)if(ip.has(c)||c==="array"&&s.coerceTypes==="array")u(c);o.else(),Ti(e),o.endIf(),o.if(z._`${a} !== undefined`,()=>{o.assign(n,a),iw(e,a)});function u(c){switch(c){case"string":o.elseIf(z._`${i} == "number" || ${i} == "boolean"`).assign(a,z._`"" + ${n}`).elseIf(z._`${n} === null`).assign(a,z._`""`);return;case"number":o.elseIf(z._`${i} == "boolean" || ${n} === null
4
+ || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,z._`+${n}`);return;case"integer":o.elseIf(z._`${i} === "boolean" || ${n} === null
5
+ || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,z._`+${n}`);return;case"boolean":o.elseIf(z._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(z._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(z._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(z._`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${n} === null`).assign(a,z._`[${n}]`)}}}function iw({gen:e,parentData:t,parentDataProperty:r},o){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,o))}function Pi(e,t,r,o=ur.Correct){let n=o===ur.Correct?z.operators.EQ:z.operators.NEQ,s;switch(e){case"null":return z._`${t} ${n} null`;case"array":s=z._`Array.isArray(${t})`;break;case"object":s=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return z._`typeof ${t} ${n} ${e}`}return o===ur.Correct?s:z.not(s);function i(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}ap.checkDataType=Pi;function Ei(e,t,r,o){if(e.length===1)return Pi(e[0],t,r,o);let n,s=un.toHash(e);if(s.array&&s.object){let i=z._`typeof ${t} != "object"`;n=s.null?i:z._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=z.nil;if(s.number)delete s.integer;for(let i in s)n=z.and(n,Pi(i,t,r,o));return n}ap.checkDataTypes=Ei;var aw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function Ti(e){let t=cw(e);np.reportError(t,aw)}ap.reportTypeError=Ti;function cw(e){let{gen:t,data:r,schema:o}=e,n=un.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var fp=T(function(dp){Object.defineProperty(dp,"__esModule",{value:!0});dp.assignDefaults=void 0;var Ae=U(),lp=V();function hw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)up(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>up(e,s,n.default))}dp.assignDefaults=hw;function up(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=Ae._`${s}${Ae.getProperty(t)}`;if(n){lp.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Ae._`${a} === undefined`;if(i.useDefaults==="empty")u=Ae._`${u} || ${a} === null || ${a} === ""`;o.if(u,Ae._`${a} = ${Ae.stringify(r)}`)}});var Ze=T(function(_p){Object.defineProperty(_p,"__esModule",{value:!0});_p.validateUnion=_p.validateArray=_p.usePattern=_p.callValidateCode=_p.schemaProperties=_p.allSchemaProperties=_p.noPropertyInData=_p.propertyInData=_p.isOwnProperty=_p.hasPropFunc=_p.reportMissingProp=_p.checkMissingProp=_p.checkReportMissingProp=void 0;var q=U(),lr=V(),xt=at(),mp=V();function gw(e,t){let{gen:r,data:o,it:n}=e;r.if(Ii(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:q._`${t}`},!0),e.error()})}_p.checkReportMissingProp=gw;function _w({gen:e,data:t,it:{opts:r}},o,n){return q.or(...o.map((s)=>q.and(Ii(e,t,s,r.ownProperties),q._`${n} = ${s}`)))}_p.checkMissingProp=_w;function yw(e,t){e.setParams({missingProperty:t},!0),e.error()}_p.reportMissingProp=yw;function hp(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:q._`Object.prototype.hasOwnProperty`})}_p.hasPropFunc=hp;function Ri(e,t,r){return q._`${hp(e)}.call(${t}, ${r})`}_p.isOwnProperty=Ri;function vw(e,t,r,o){let n=q._`${t}${q.getProperty(r)} !== undefined`;return o?q._`${n} && ${Ri(e,t,r)}`:n}_p.propertyInData=vw;function Ii(e,t,r,o){let n=q._`${t}${q.getProperty(r)} === undefined`;return o?q.or(n,q.not(Ri(e,t,r))):n}_p.noPropertyInData=Ii;function gp(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}_p.allSchemaProperties=gp;function $w(e,t){return gp(t).filter((r)=>!lr.alwaysValidSchema(e,t[r]))}_p.schemaProperties=$w;function ww({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,u,c){let l=c?q._`${e}, ${t}, ${o}${n}`:t,d=[[xt.default.instancePath,q.strConcat(xt.default.instancePath,s)],[xt.default.parentData,i.parentData],[xt.default.parentDataProperty,i.parentDataProperty],[xt.default.rootData,xt.default.rootData]];if(i.opts.dynamicRef)d.push([xt.default.dynamicAnchors,xt.default.dynamicAnchors]);let f=q._`${l}, ${r.object(...d)}`;return u!==q.nil?q._`${a}.call(${u}, ${f})`:q._`${a}(${f})`}_p.callValidateCode=ww;var xw=q._`new RegExp`;function bw({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:q._`${n.code==="new RegExp"?xw:mp.useFunc(e,n)}(${r}, ${o})`})}_p.usePattern=bw;function zw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let u=t.const("len",q._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:o,dataProp:c,dataPropType:lr.Type.Num},s),t.if(q.not(s),a)})}}_p.validateArray=zw;function Sw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>lr.alwaysValidSchema(n,u))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:o,schemaProp:c,compositeRule:!0},a);if(t.assign(i,q._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(q.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}_p.validateUnion=Sw});var Sp=T(function(bp){Object.defineProperty(bp,"__esModule",{value:!0});bp.validateKeywordUsage=bp.validSchemaType=bp.funcKeywordCode=bp.macroKeywordCode=void 0;var B=U(),Ht=at(),$p=Ze(),wp=ro();function qw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),u=xp(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:B.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}bp.macroKeywordCode=qw;function Mw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:u}=e;Lw(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=xp(o,n,c),d=o.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1){if(g(),t.modifying)vp(e);x(()=>e.error())}else{let w=t.async?m():h();if(t.modifying)vp(e);x(()=>Dw(e,w))}}function m(){let w=o.let("ruleErrs",null);return o.try(()=>g(B._`await `),(E)=>o.assign(d,!1).if(B._`${E} instanceof ${u.ValidationError}`,()=>o.assign(w,B._`${E}.errors`),()=>o.throw(E))),w}function h(){let w=B._`${l}.errors`;return o.assign(w,null),g(B.nil),w}function g(w=t.async?B._`await `:B.nil){let E=u.opts.passContext?Ht.default.this:Ht.default.self,S=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,B._`${w}${$p.callValidateCode(e,l,E,S)}`,t.modifying)}function x(w){var E;o.if(B.not((E=t.valid)!==null&&E!==void 0?E:d),w)}}bp.funcKeywordCode=Mw;function vp(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,B._`${o.parentData}[${o.parentDataProperty}]`))}function Dw(e,t){let{gen:r}=e;r.if(B._`Array.isArray(${t})`,()=>{r.assign(Ht.default.vErrors,B._`${Ht.default.vErrors} === null ? ${t} : ${Ht.default.vErrors}.concat(${t})`).assign(Ht.default.errors,B._`${Ht.default.vErrors}.length`),wp.extendErrors(e)},()=>e.error())}function Lw({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function xp(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:B.stringify(r)})}function Uw(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}bp.validSchemaType=Uw;function Vw({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw Error("ajv implementation error");let i=n.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}bp.validateKeywordUsage=Vw});var Ep=T(function(kp){Object.defineProperty(kp,"__esModule",{value:!0});kp.extendSubschemaMode=kp.extendSubschemaData=kp.getSubschema=void 0;var me=U(),ln=V();function Bw(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:me._`${e.schemaPath}${me.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:me._`${e.schemaPath}${me.getProperty(t)}${me.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${ln.escapeFragment(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}kp.getSubschema=Bw;function Ww(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,f=a.let("data",me._`${t.data}${me.getProperty(r)}`,!0);u(f),e.errorPath=me.str`${c}${ln.getErrorPath(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=me._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let c=n instanceof me.Name?n:a.let("data",n,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}kp.extendSubschemaData=Ww;function Jw(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}kp.extendSubschemaMode=Jw});var Ci=T(function(e1,Tp){Tp.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Ip=T(function(t1,Rp){var bt=Rp.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};dn(t,o,n,e,"",e)};bt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};bt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};bt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};bt.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 dn(e,t,r,o,n,s,i,a,u,c){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,u,c);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in bt.arrayKeywords)for(var f=0;f<d.length;f++)dn(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in bt.propsKeywords){if(d&&typeof d=="object")for(var m in d)dn(e,t,r,d[m],n+"/"+l+"/"+Qw(m),s,n,l,o,m)}else if(l in bt.keywords||e.allKeys&&!(l in bt.skipKeywords))dn(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,u,c)}}function Qw(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var no=T(function(Ap){Object.defineProperty(Ap,"__esModule",{value:!0});Ap.getSchemaRefs=Ap.resolveUrl=Ap.normalizeId=Ap._getFullPath=Ap.getFullPath=Ap.inlineRef=void 0;var Cp=V(),Xw=Ci(),ex=Ip(),tx=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rx(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Oi(e);if(!t)return!1;return Op(e)<=t}Ap.inlineRef=rx;var ox=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Oi(e){for(let t in e){if(ox.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Oi))return!0;if(typeof r=="object"&&Oi(r))return!0}return!1}function Op(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,tx.has(r))continue;if(typeof e[r]=="object")Cp.eachItem(e[r],(o)=>t+=Op(o));if(t===1/0)return 1/0}return t}function jp(e,t="",r){if(r!==!1)t=dr(t);let o=e.parse(t);return Np(e,o)}Ap.getFullPath=jp;function Np(e,t){return e.serialize(t).split("#")[0]+"#"}Ap._getFullPath=Np;var nx=/#\/?$/;function dr(e){return e?e.replace(nx,""):""}Ap.normalizeId=dr;function sx(e,t,r){return r=dr(r),e.resolve(t,r)}Ap.resolveUrl=sx;var ix=/^[a-z_][-a-z0-9._]*$/i;function ax(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=dr(e[r]||t),s={"":n},i=jp(o,n,!1),a={},u=new Set;return ex(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let g=i+f,x=s[h];if(typeof d[r]=="string")x=w.call(this,d[r]);E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),s[f]=x;function w(S){let N=this.opts.uriResolver.resolve;if(S=dr(x?N(x,S):S),u.has(S))throw l(S);u.add(S);let v=this.refs[S];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")c(d,v.schema,S);else if(S!==dr(g))if(S[0]==="#")c(d,a[S],S),a[S]=d;else this.refs[S]=g;return S}function E(S){if(typeof S=="string"){if(!ix.test(S))throw Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function c(d,f,m){if(f!==void 0&&!Xw(d,f))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Ap.getSchemaRefs=ax});var so=T(function(Qp){Object.defineProperty(Qp,"__esModule",{value:!0});Qp.getData=Qp.KeywordCxt=Qp.validateFunctionCode=void 0;var fn=Jd(),pn=oo(),fr=ki(),zt=oo(),Lp=fp(),He=Sp(),pr=Ep(),y=U(),D=at(),Up=no(),ye=V(),Fe=ro();function fx(e){if(Hp(e)){if(Kp(e),Fp(e)){gx(e);return}}Vp(e,()=>fn.topBoolOrEmptySchema(e))}Qp.validateFunctionCode=fx;function Vp({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,y._`${D.default.data}, ${D.default.valCxt}`,o.$async,()=>{e.code(y._`"use strict"; ${qp(r,n)}`),hx(e,n),e.code(s)});else e.func(t,y._`${D.default.data}, ${mx(n)}`,o.$async,()=>e.code(qp(r,n)).code(s))}function mx(e){return y._`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${e.dynamicRef?y._`, ${D.default.dynamicAnchors}={}`:y.nil}}={}`}function hx(e,t){e.if(D.default.valCxt,()=>{if(e.var(D.default.instancePath,y._`${D.default.valCxt}.${D.default.instancePath}`),e.var(D.default.parentData,y._`${D.default.valCxt}.${D.default.parentData}`),e.var(D.default.parentDataProperty,y._`${D.default.valCxt}.${D.default.parentDataProperty}`),e.var(D.default.rootData,y._`${D.default.valCxt}.${D.default.rootData}`),t.dynamicRef)e.var(D.default.dynamicAnchors,y._`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{if(e.var(D.default.instancePath,y._`""`),e.var(D.default.parentData,y._`undefined`),e.var(D.default.parentDataProperty,y._`undefined`),e.var(D.default.rootData,D.default.data),t.dynamicRef)e.var(D.default.dynamicAnchors,y._`{}`)})}function gx(e){let{schema:t,opts:r,gen:o}=e;Vp(e,()=>{if(r.$comment&&t.$comment)Wp(e);if(wx(e),o.let(D.default.vErrors,null),o.let(D.default.errors,0),r.unevaluated)_x(e);Bp(e),zx(e)});return}function _x(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",y._`${r}.evaluated`),t.if(y._`${e.evaluated}.dynamicProps`,()=>t.assign(y._`${e.evaluated}.props`,y._`undefined`)),t.if(y._`${e.evaluated}.dynamicItems`,()=>t.assign(y._`${e.evaluated}.items`,y._`undefined`))}function qp(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?y._`/*# sourceURL=${r} */`:y.nil}function yx(e,t){if(Hp(e)){if(Kp(e),Fp(e)){vx(e,t);return}}fn.boolOrEmptySchema(e,t)}function Fp({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Hp(e){return typeof e.schema!="boolean"}function vx(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)Wp(e);xx(e),bx(e);let s=o.const("_errs",D.default.errors);Bp(e,s),o.var(t,y._`${s} === ${D.default.errors}`)}function Kp(e){ye.checkUnknownRules(e),$x(e)}function Bp(e,t){if(e.opts.jtd)return Mp(e,[],!1,t);let r=pn.getSchemaTypes(e.schema),o=pn.coerceAndCheckDataType(e,r);Mp(e,r,!o,t)}function $x(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&ye.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function wx(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)ye.checkStrictMode(e,"default is ignored in the schema root")}function xx(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Up.resolveUrl(e.opts.uriResolver,e.baseId,t)}function bx(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Wp({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(y._`${D.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=y.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(y._`${D.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function zx(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(y._`${D.default.errors} === 0`,()=>t.return(D.default.data),()=>t.throw(y._`new ${n}(${D.default.vErrors})`));else{if(t.assign(y._`${o}.errors`,D.default.vErrors),s.unevaluated)Sx(e);t.return(y._`${D.default.errors} === 0`)}}function Sx({gen:e,evaluated:t,props:r,items:o}){if(r instanceof y.Name)e.assign(y._`${t}.props`,r);if(o instanceof y.Name)e.assign(y._`${t}.items`,o)}function Mp(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!ye.schemaHasRulesButRef(s,l))){n.block(()=>Gp(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)kx(e,t);n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!fr.shouldUseGroup(s,f))return;if(f.type){if(n.if(zt.checkDataType(f.type,i,u.strictNumbers)),Dp(e,f),t.length===1&&t[0]===f.type&&r)n.else(),zt.reportTypeError(e);n.endIf()}else Dp(e,f);if(!a)n.if(y._`${D.default.errors} === ${o||0}`)}}function Dp(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Lp.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(fr.shouldUseRule(o,s))Gp(e,s.keyword,s.definition,t.type)})}function kx(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Px(e,t),!e.opts.allowUnionTypes)Ex(e,t);Tx(e,e.dataTypes)}function Px(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Jp(e.dataTypes,r))ji(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Ix(e,t)}function Ex(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))ji(e,"use allowUnionTypes to allow union type keyword")}function Tx(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&fr.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>Rx(t,i)))ji(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rx(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jp(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Ix(e,t){let r=[];for(let o of e.dataTypes)if(Jp(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function ji(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,ye.checkStrictMode(e,t,e.opts.strictTypes)}class Ni{constructor(e,t,r){if(He.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=ye.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",Yp(this.$data,e));else if(this.schemaCode=this.schemaValue,!He.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",D.default.errors)}result(e,t,r){this.failResult(y.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(y.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(y._`${t} !== undefined && (${y.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Fe.reportExtraError:Fe.reportError)(this,this.def.error,t)}$dataError(){Fe.reportError(this,this.def.$dataError||Fe.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Fe.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=y.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=y.nil,t=y.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(y.or(y._`${o} === undefined`,t)),e!==y.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==y.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return y.or(s(),i());function s(){if(r.length){if(!(t instanceof y.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return y._`${zt.checkDataTypes(a,t,n.opts.strictNumbers,zt.DataType.Wrong)}`}return y.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return y._`!${a}(${t})`}return y.nil}}subschema(e,t){let r=pr.getSubschema(this.it,e);pr.extendSubschemaData(r,this.it,e),pr.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return yx(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=ye.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=ye.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,y.Name)),!0}}Qp.KeywordCxt=Ni;function Gp(e,t,r,o){let n=new Ni(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)He.funcKeywordCode(n,r);else if("macro"in r)He.macroKeywordCode(n,r);else if(r.compile||r.validate)He.funcKeywordCode(n,r)}var Cx=/^\/(?:[^~]|~0|~1)*$/,Ox=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yp(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return D.default.rootData;if(e[0]==="/"){if(!Cx.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=D.default.rootData}else{let c=Ox.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(n=c[2],n==="#"){if(l>=t)throw Error(u("property/index",l));return o[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let c of a)if(c)s=y._`${s}${y.getProperty(ye.unescapeJsonPointer(c))}`,i=y._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Qp.getData=Yp});var mn=T(function(tf){Object.defineProperty(tf,"__esModule",{value:!0});class ef extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}tf.default=ef});var io=T(function(of){Object.defineProperty(of,"__esModule",{value:!0});var mr=no();class rf extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=mr.resolveUrl(e,t,r),this.missingSchema=mr.normalizeId(mr.getFullPath(e,this.missingRef))}}of.default=rf});var _n=T(function(af){Object.defineProperty(af,"__esModule",{value:!0});af.resolveSchema=af.getCompilingSchema=af.resolveRef=af.compileSchema=af.SchemaEnv=void 0;var ue=U(),qx=mn(),Kt=at(),le=no(),hn=V(),nf=so();class ao{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:le.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}af.SchemaEnv=ao;function Zi(e){let t=sf.call(this,e);if(t)return t;let r=le.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new ue.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:qx.default,code:ue._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:Kt.default.data,parentData:Kt.default.parentData,parentDataProperty:Kt.default.parentDataProperty,dataNames:[Kt.default.data],dataPathArr:[ue.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ue.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ue.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ue._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),nf.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Kt.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${Kt.default.self}`,`${Kt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=c;if(m.evaluated={props:h instanceof ue.Name?void 0:h,items:g instanceof ue.Name?void 0:g,dynamicProps:h instanceof ue.Name,dynamicItems:g instanceof ue.Name},m.source)m.source.evaluated=ue.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}af.compileSchema=Zi;function Mx(e,t,r){var o;r=le.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Ux.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(i)s=new ao({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=Dx.call(this,s)}af.resolveRef=Mx;function Dx(e){if(le.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Zi.call(this,e)}function sf(e){for(let t of this._compilations)if(Lx(t,e))return t}af.getCompilingSchema=sf;function Lx(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Ux(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||gn.call(this,e,t)}function gn(e,t){let r=this.opts.uriResolver.parse(t),o=le._getFullPath(this.opts.uriResolver,r),n=le.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Ai.call(this,r,e);let s=le.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=gn.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Ai.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Zi.call(this,i);if(s===le.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)n=le.resolveUrl(this.opts.uriResolver,n,c);return new ao({schema:a,schemaId:u,root:e,baseId:n})}return Ai.call(this,r,i)}af.resolveSchema=gn;var Vx=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ai(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let u=r[hn.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!Vx.has(a)&&c)t=le.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!hn.schemaHasRulesButRef(r,this.RULES)){let a=le.resolveUrl(this.opts.uriResolver,t,r.$ref);s=gn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new ao({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var uf=T(function(a1,Wx){Wx.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 Di=T(function(c1,hf){var Jx=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),df=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),qi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),pf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Gx=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Mi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Yx=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function lf(e){return e.length=0,!0}function Qx(e,t,r){if(e.length){let o=Mi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Xx(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Qx;for(let u=0;u<e.length;u++){let c=e[u];if(c==="["||c==="]")continue;if(c===":"){if(s===!0)i=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(u>0&&e[u-1]===":")s=!0;o.push(":");continue}else if(c==="%"){if(!a(n,o,r))break;a=lf}else{n.push(c);continue}}if(n.length)if(a===lf)r.zone=n.join("");else if(i)o.push(n.join(""));else o.push(Mi(n));return r.address=o.join(""),r}function ff(e){if(eb(e,":")<2)return{host:e,isIPV6:!1};let t=Xx(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function eb(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function tb(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var rb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ob=/[@/?#:]/g,nb=/[@/?#]/g;function mf(e,t){let r=t?nb:ob;return r.lastIndex=0,e.replace(r,(o)=>rb[o])}function sb(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(qi(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&pf(i))r+=i;else r+="%"+s;o+=2;continue}}r+=e[o]}return r}function ib(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(qi(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));if(s!=="."&&pf(s))t+=s;else t+="%"+n;r+=2;continue}}if(Gx(e[r]))t+=e[r];else t+=escape(e[r])}return t}function ab(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(qi(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function cb(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!df(r)){let o=ff(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=mf(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}hf.exports={nonSimpleDomain:Yx,recomposeAuthority:cb,reescapeHostDelimiters:mf,normalizePercentEncoding:sb,normalizePathEncoding:ib,escapePreservingEscapes:ab,removeDotSegments:tb,isIPv4:df,isUUID:Jx,normalizeIPv6:ff,stringArrayToHexStripped:Mi}});var $f=T(function(u1,vf){var{isUUID:ub}=Di(),lb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,db=["http","https","ws","wss","urn","urn:uuid"];function pb(e){return db.indexOf(e)!==-1}function Li(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function gf(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function _f(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function fb(e){return e.secure=Li(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function mb(e){if(e.port===(Li(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function hb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(lb);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=Ui(n);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function gb(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=Ui(n);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function _b(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!ub(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function yb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var yf={scheme:"http",domainHost:!0,parse:gf,serialize:_f},vb={scheme:"https",domainHost:yf.domainHost,parse:gf,serialize:_f},yn={scheme:"ws",domainHost:!0,parse:fb,serialize:mb},$b={scheme:"wss",domainHost:yn.domainHost,parse:yn.parse,serialize:yn.serialize},wb={scheme:"urn",parse:hb,serialize:gb,skipNormalize:!0},xb={scheme:"urn:uuid",parse:_b,serialize:yb,skipNormalize:!0},vn={http:yf,https:vb,ws:yn,wss:$b,urn:wb,"urn:uuid":xb};Object.setPrototypeOf(vn,null);function Ui(e){return e&&(vn[e]||vn[e.toLowerCase()])||void 0}vf.exports={wsIsSecure:Li,SCHEMES:vn,isValidSchemeName:pb,getSchemeHandler:Ui}});var kf=T(function(l1,$n){var{normalizeIPv6:bb,removeDotSegments:co,recomposeAuthority:zb,normalizePercentEncoding:Sb,normalizePathEncoding:kb,escapePreservingEscapes:Pb,reescapeHostDelimiters:Eb,isIPv4:Tb,nonSimpleDomain:Rb}=Di(),{SCHEMES:Ib,getSchemeHandler:xf}=$f();function Cb(e,t){if(typeof e==="string")e=Zb(e,t);else if(typeof e==="object")e=hr(Bt(e,t),t);return e}function Ob(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=bf(hr(e,o),hr(t,o),o,!0);return o.skipEscape=!0,Bt(n,o)}function bf(e,t,r,o){let n={};if(!o)e=hr(Bt(e,r),r),t=hr(Bt(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=co(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=co(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=co(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=co(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function jb(e,t,r){let o=wf(e,r),n=wf(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Bt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=xf(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=Pb(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=Sb(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let i=zb(r);if(i!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(i),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!s||!s.absolutePath))a=co(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var Nb=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ab(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function zf(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let i=e.match(Nb);if(i){if(o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port))o.port=i[5];let a=Ab(o,i);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(Tb(o.host)===!1){let l=bb(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let u=xf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)){if(o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&Rb(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(c){o.error=o.error||"Host's domain name can not be converted to ASCII: "+c}}if(!u||u&&!u.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=Eb(unescape(o.host),s)}if(o.path)o.path=kb(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(u&&u.parse)u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function hr(e,t){return zf(e,t).parsed}function Zb(e,t){return Sf(e,t).normalized}function Sf(e,t){let{parsed:r,malformedAuthorityOrPort:o}=zf(e,t);return{normalized:o?e:Bt(r,t),malformedAuthorityOrPort:o}}function wf(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=Sf(e,t);return o?void 0:r}if(typeof e==="object")return Bt(e,t)}var Vi={SCHEMES:Ib,normalize:Cb,resolve:Ob,resolveComponent:bf,equal:jb,serialize:Bt,parse:hr};$n.exports=Vi;$n.exports.default=Vi;$n.exports.fastUri=Vi});var Tf=T(function(Ef){Object.defineProperty(Ef,"__esModule",{value:!0});var Pf=kf();Pf.code='require("ajv/dist/runtime/uri").default';Ef.default=Pf});var Mf=T(function(ct){Object.defineProperty(ct,"__esModule",{value:!0});ct.CodeGen=ct.Name=ct.nil=ct.stringify=ct.str=ct._=ct.KeywordCxt=void 0;var Mb=so();Object.defineProperty(ct,"KeywordCxt",{enumerable:!0,get:function(){return Mb.KeywordCxt}});var _r=U();Object.defineProperty(ct,"_",{enumerable:!0,get:function(){return _r._}});Object.defineProperty(ct,"str",{enumerable:!0,get:function(){return _r.str}});Object.defineProperty(ct,"stringify",{enumerable:!0,get:function(){return _r.stringify}});Object.defineProperty(ct,"nil",{enumerable:!0,get:function(){return _r.nil}});Object.defineProperty(ct,"Name",{enumerable:!0,get:function(){return _r.Name}});Object.defineProperty(ct,"CodeGen",{enumerable:!0,get:function(){return _r.CodeGen}});var Db=mn(),jf=io(),Nf=Si(),Ke=_n(),Af=U(),Be=no(),St=oo(),gr=V(),Rf=uf(),Lb=Tf(),Zf=(e,t)=>new RegExp(e,t);Zf.code="new RegExp";var Ub=["removeAdditional","useDefaults","coerceTypes"],Vb=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Fb={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."},Hb={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},If=200;function Kb(e){var t,r,o,n,s,i,a,u,c,l,d,f,m,h,g,x,w,E,S,N,v,b,M,re,fe;let ke=e.strict,Ir=(t=e.code)===null||t===void 0?void 0:t.optimize,mo=Ir===!0||Ir===void 0?1:Ir||0,ho=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Zf,ut=(n=e.uriResolver)!==null&&n!==void 0?n:Lb.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ke)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:ke)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:ke)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:ke)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:ke)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:mo,regExp:ho}:{optimize:mo,regExp:ho},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:If,loopEnum:(x=e.loopEnum)!==null&&x!==void 0?x:If,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(N=e.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(b=e.validateSchema)!==null&&b!==void 0?b:!0,validateFormats:(M=e.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(re=e.unicodeRegExp)!==null&&re!==void 0?re:!0,int32range:(fe=e.int32range)!==null&&fe!==void 0?fe:!0,uriResolver:ut}}class wn{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Kb(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Af.ValueScope({scope:{},prefixes:Vb,es5:t,lines:r}),this.logger=Qb(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=Nf.getRules(),Cf.call(this,Fb,e,"NOT SUPPORTED"),Cf.call(this,Hb,e,"DEPRECATED","warn"),this._metaOpts=Gb.call(this),e.formats)Wb.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Jb.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Bb.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=Rf;if(r==="id")o={...Rf},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(c,l){await n.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function n(c){if(c&&!this.getSchema(c))await o.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof jf.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await n.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:s}=this.opts;if(n=e[s],n!==void 0&&typeof n!="string")throw Error(`schema ${s} must be string`)}return t=Be.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=Of.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Ke.SchemaEnv({schema:{},schemaId:r});if(t=Ke.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=Of.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Be.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(e0.call(this,r,t),!t)return gr.eachItem(r,(n)=>Fi.call(this,n)),this;r0.call(this,t);let o={...t,type:St.getJSONTypes(t.type),schemaType:St.getJSONTypes(t.schemaType)};return gr.eachItem(r,o.type.length===0?(n)=>Fi.call(this,n,o):(n)=>o.type.forEach((s)=>Fi.call(this,n,o,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),s=e;for(let i of n)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:u}=a.definition,c=s[i];if(u&&c)s[i]=qf(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Be.normalizeId(s||r);let u=Be.getSchemaRefs.call(this,e,r);if(a=new Ke.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ke.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ke.compileSchema.call(this,e)}finally{this.opts=t}}}wn.ValidationError=Db.default;wn.MissingRefError=jf.default;ct.default=wn;function Cf(e,t,r,o="error"){for(let n in e){let s=n;if(s in t)this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function Of(e){return e=Be.normalizeId(e),this.schemas[e]||this.refs[e]}function Bb(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Wb(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Jb(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function Gb(){let e={...this.opts};for(let t of Ub)delete e[t];return e}var Yb={log(){},warn(){},error(){}};function Qb(e){if(e===!1)return Yb;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var Xb=/^[a-z_$][a-z0-9_$:-]*$/i;function e0(e,t){let{RULES:r}=this;if(gr.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!Xb.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Fi(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:u})=>u===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:St.getJSONTypes(t.type),schemaType:St.getJSONTypes(t.schemaType)}};if(t.before)t0.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((u)=>this.addKeyword(u))}function t0(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function r0(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=qf(t);e.validateSchema=this.compile(t,!0)}var o0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qf(e){return{anyOf:[e,o0]}}});var Lf=T(function(Df){Object.defineProperty(Df,"__esModule",{value:!0});var i0={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Df.default=i0});var Hf=T(function(Vf){Object.defineProperty(Vf,"__esModule",{value:!0});Vf.callRef=Vf.getValidate=void 0;var c0=io(),bn=Ze(),J=U(),yr=at(),zn=_n(),kt=V(),u0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:u}=o,{root:c}=s;if((r==="#"||r==="#/")&&n===c.baseId)return d();let l=zn.resolveRef.call(u,c,n,r);if(l===void 0)throw new c0.default(o.opts.uriResolver,n,r);if(l instanceof zn.SchemaEnv)return f(l);return m(l);function d(){if(s===c)return xn(e,i,s,s.$async);let h=t.scopeValue("root",{ref:c});return xn(e,J._`${h}.validate`,c,c.$async)}function f(h){let g=Uf(e,h);xn(e,g,h,h.$async)}function m(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:J.stringify(h)}:{ref:h}),x=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:J.nil,topSchemaRef:g,errSchemaPath:r},x);e.mergeEvaluated(w),e.ok(x)}}};function Uf(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):J._`${r.scopeValue("wrapper",{ref:t})}.validate`}Vf.getValidate=Uf;function xn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?yr.default.this:J.nil;if(o)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{if(n.code(J._`await ${bn.callValidateCode(e,t,c)}`),m(t),!i)n.assign(h,!0)},(g)=>{if(n.if(J._`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),f(g),!i)n.assign(h,!1)}),e.ok(h)}function d(){e.result(bn.callValidateCode(e,t,c),()=>m(t),()=>f(t))}function f(h){let g=J._`${h}.errors`;n.assign(yr.default.vErrors,J._`${yr.default.vErrors} === null ? ${g} : ${yr.default.vErrors}.concat(${g})`),n.assign(yr.default.errors,J._`${yr.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let x=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(x&&!x.dynamicProps){if(x.props!==void 0)s.props=kt.mergeEvaluated.props(n,x.props,s.props)}else{let w=n.var("props",J._`${h}.evaluated.props`);s.props=kt.mergeEvaluated.props(n,w,s.props,J.Name)}if(s.items!==!0)if(x&&!x.dynamicItems){if(x.items!==void 0)s.items=kt.mergeEvaluated.items(n,x.items,s.items)}else{let w=n.var("items",J._`${h}.evaluated.items`);s.items=kt.mergeEvaluated.items(n,w,s.items,J.Name)}}}Vf.callRef=xn;Vf.default=u0});var Bf=T(function(Kf){Object.defineProperty(Kf,"__esModule",{value:!0});var p0=Lf(),f0=Hf(),m0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",p0.default,f0.default];Kf.default=m0});var Jf=T(function(Wf){Object.defineProperty(Wf,"__esModule",{value:!0});var Et=U(),Pt=Et.operators,Sn={maximum:{okStr:"<=",ok:Pt.LTE,fail:Pt.GT},minimum:{okStr:">=",ok:Pt.GTE,fail:Pt.LT},exclusiveMaximum:{okStr:"<",ok:Pt.LT,fail:Pt.GTE},exclusiveMinimum:{okStr:">",ok:Pt.GT,fail:Pt.LTE}},g0={message:({keyword:e,schemaCode:t})=>Et.str`must be ${Sn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Et._`{comparison: ${Sn[e].okStr}, limit: ${t}}`},_0={keyword:Object.keys(Sn),type:"number",schemaType:"number",$data:!0,error:g0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Et._`${r} ${Sn[t].fail} ${o} || isNaN(${r})`)}};Wf.default=_0});var Yf=T(function(Gf){Object.defineProperty(Gf,"__esModule",{value:!0});var We=U(),v0={message:({schemaCode:e})=>We.str`must be multiple of ${e}`,params:({schemaCode:e})=>We._`{multipleOf: ${e}}`},$0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:v0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?We._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:We._`${i} !== parseInt(${i})`;e.fail$data(We._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Gf.default=$0});var em=T(function(Xf){Object.defineProperty(Xf,"__esModule",{value:!0});function Qf(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}Xf.default=Qf;Qf.code='require("ajv/dist/runtime/ucs2length").default'});var om=T(function(rm){Object.defineProperty(rm,"__esModule",{value:!0});var Te=U(),tm=V(),b0=em(),z0={message({keyword:e,schemaCode:t}){return Te.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Te._`{limit: ${e}}`},S0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:z0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Te.operators.GT:Te.operators.LT,i=n.opts.unicode===!1?Te._`${r}.length`:Te._`${tm.useFunc(e.gen,b0.default)}(${r})`;e.fail$data(Te._`${i} ${s} ${o}`)}};rm.default=S0});var am=T(function(im){Object.defineProperty(im,"__esModule",{value:!0});var nm=Ze(),sm=V(),qe=U(),P0={message:({schemaCode:e})=>qe.str`must match pattern "${e}"`,params:({schemaCode:e})=>qe._`{pattern: ${e}}`},E0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:P0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:u}=i.opts.code,c=u.code==="new RegExp"?qe._`new RegExp`:sm.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,qe._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(qe._`!${l}`)}else{let u=nm.usePattern(e,n);e.fail$data(qe._`!${u}.test(${r})`)}}};im.default=E0});var um=T(function(cm){Object.defineProperty(cm,"__esModule",{value:!0});var Je=U(),R0={message({keyword:e,schemaCode:t}){return Je.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Je._`{limit: ${e}}`},I0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:R0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Je.operators.GT:Je.operators.LT;e.fail$data(Je._`Object.keys(${r}).length ${n} ${o}`)}};cm.default=I0});var pm=T(function(dm){Object.defineProperty(dm,"__esModule",{value:!0});var Ge=Ze(),Ye=U(),lm=V(),O0={message:({params:{missingProperty:e}})=>Ye.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Ye._`{missingProperty: ${e}}`},j0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:O0,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!h.has(g)){let x=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${g}" is not defined at "${x}" (strictRequired)`;lm.checkStrictMode(i,w,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(Ye.nil,d);else for(let m of r)Ge.checkReportMissingProp(e,m)}function l(){let m=t.let("missing");if(u||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if(Ge.checkMissingProp(e,r,m)),Ge.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if(Ge.noPropertyInData(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,Ge.propertyInData(t,n,m,a.ownProperties)),t.if(Ye.not(h),()=>{e.error(),t.break()})},Ye.nil)}}};dm.default=j0});var mm=T(function(fm){Object.defineProperty(fm,"__esModule",{value:!0});var Qe=U(),A0={message({keyword:e,schemaCode:t}){return Qe.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Qe._`{limit: ${e}}`},Z0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:A0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Qe.operators.GT:Qe.operators.LT;e.fail$data(Qe._`${r}.length ${n} ${o}`)}};fm.default=Z0});var kn=T(function(gm){Object.defineProperty(gm,"__esModule",{value:!0});var hm=Ci();hm.code='require("ajv/dist/runtime/equal").default';gm.default=hm});var vm=T(function(ym){Object.defineProperty(ym,"__esModule",{value:!0});var vr=oo(),F=U(),_m=V(),D0=kn(),L0={message:({params:{i:e,j:t}})=>F.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>F._`{i: ${e}, j: ${t}}`},U0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:L0,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let u=t.let("valid"),c=s.items?vr.getSchemaTypes(s.items):[];e.block$data(u,l,F._`${i} === false`),e.ok(u);function l(){let h=t.let("i",F._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(u,!0),t.if(F._`${h} > 1`,()=>(d()?f:m)(h,g))}function d(){return c.length>0&&!c.some((h)=>h==="object"||h==="array")}function f(h,g){let x=t.name("item"),w=vr.checkDataTypes(c,x,a.opts.strictNumbers,vr.DataType.Wrong),E=t.const("indices",F._`{}`);t.for(F._`;${h}--;`,()=>{if(t.let(x,F._`${r}[${h}]`),t.if(w,F._`continue`),c.length>1)t.if(F._`typeof ${x} == "string"`,F._`${x} += "_"`);t.if(F._`typeof ${E}[${x}] == "number"`,()=>{t.assign(g,F._`${E}[${x}]`),e.error(),t.assign(u,!1).break()}).code(F._`${E}[${x}] = ${h}`)})}function m(h,g){let x=_m.useFunc(t,D0.default),w=t.name("outer");t.label(w).for(F._`;${h}--;`,()=>t.for(F._`${g} = ${h}; ${g}--;`,()=>t.if(F._`${x}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(w)})))}}};ym.default=U0});var xm=T(function(wm){Object.defineProperty(wm,"__esModule",{value:!0});var $r=U(),$m=V(),F0=kn(),H0={message:"must be equal to constant",params:({schemaCode:e})=>$r._`{allowedValue: ${e}}`},K0={keyword:"const",$data:!0,error:H0,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data($r._`!${$m.useFunc(t,F0.default)}(${r}, ${n})`);else e.fail($r._`${s} !== ${r}`)}};wm.default=K0});var Sm=T(function(zm){Object.defineProperty(zm,"__esModule",{value:!0});var Xe=U(),bm=V(),W0=kn(),J0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Xe._`{allowedValues: ${e}}`},G0={keyword:"enum",schemaType:"array",$data:!0,error:J0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,u,c=()=>u!==null&&u!==void 0?u:u=bm.useFunc(t,W0.default),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw Error("ajv implementation error");let m=t.const("vSchema",s);l=Xe.or(...n.map((h,g)=>f(m,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(m)=>t.if(Xe._`${c()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let g=n[h];return typeof g==="object"&&g!==null?Xe._`${c()}(${r}, ${m}[${h}])`:Xe._`${r} === ${g}`}}};zm.default=G0});var Pm=T(function(km){Object.defineProperty(km,"__esModule",{value:!0});var Q0=Jf(),X0=Yf(),ez=om(),tz=am(),rz=um(),oz=pm(),nz=mm(),sz=vm(),iz=xm(),az=Sm(),cz=[Q0.default,X0.default,ez.default,tz.default,rz.default,oz.default,nz.default,sz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},iz.default,az.default];km.default=cz});var Hi=T(function(Tm){Object.defineProperty(Tm,"__esModule",{value:!0});Tm.validateAdditionalItems=void 0;var Re=U(),wr=V(),lz={message:({params:{len:e}})=>Re.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Re._`{limit: ${e}}`},dz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lz,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){wr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Em(e,o)}};function Em(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Re._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Re._`${a} <= ${t.length}`);else if(typeof o=="object"&&!wr.alwaysValidSchema(i,o)){let c=r.var("valid",Re._`${a} <= ${t.length}`);r.if(Re.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:wr.Type.Num},c),!i.allErrors)r.if(Re.not(c),()=>r.break())})}}Tm.validateAdditionalItems=Em;Tm.default=dz});var Ki=T(function(Om){Object.defineProperty(Om,"__esModule",{value:!0});Om.validateTuple=void 0;var Pn=U(),Tt=V(),Im=Ze(),fz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Cm(e,"additionalItems",t);if(r.items=!0,Tt.alwaysValidSchema(r,t))return;e.ok(Im.validateArray(e))}};function Cm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=Tt.mergeEvaluated.items(o,r.length,a.items);let u=o.name("valid"),c=o.const("len",Pn._`${s}.length`);r.forEach((d,f)=>{if(Tt.alwaysValidSchema(a,d))return;o.if(Pn._`${c} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},u)),e.ok(u)});function l(d){let{opts:f,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let x=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Tt.checkStrictMode(a,x,f.strictTuples)}}}Om.validateTuple=Cm;Om.default=fz});var Zm=T(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});var Nm=Ki(),hz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>Nm.validateTuple(e,"items")};Am.default=hz});var Um=T(function(Lm){Object.defineProperty(Lm,"__esModule",{value:!0});var En=U(),qm=V(),Mm=Ze(),Dm=Hi(),_z={message:({params:{len:e}})=>En.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>En._`{limit: ${e}}`},yz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_z,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,qm.alwaysValidSchema(o,t))return;if(n)Dm.validateAdditionalItems(e,n);else e.ok(Mm.validateArray(e))}};Lm.default=yz});var Fm=T(function(Vm){Object.defineProperty(Vm,"__esModule",{value:!0});var ae=U(),Rt=V(),$z={message:({params:{min:e,max:t}})=>t===void 0?ae.str`must contain at least ${e} valid item(s)`:ae.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ae._`{minContains: ${e}}`:ae._`{minContains: ${e}, maxContains: ${t}}`},wz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$z,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:u,maxContains:c}=o;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ae._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Rt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Rt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Rt.alwaysValidSchema(s,r)){let g=ae._`${l} >= ${i}`;if(a!==void 0)g=ae._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ae._`${n}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),x=t.let("count",0);m(g,()=>t.if(g,()=>h(x)))}function m(g,x){t.forRange("i",0,l,(w)=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Rt.Type.Num,compositeRule:!0},g),x()})}function h(g){if(t.code(ae._`${g}++`),a===void 0)t.if(ae._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ae._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ae._`${g} >= ${i}`,()=>t.assign(d,!0))}}};Vm.default=wz});var Ym=T(function(Wm){Object.defineProperty(Wm,"__esModule",{value:!0});Wm.validateSchemaDeps=Wm.validatePropertyDeps=Wm.error=void 0;var xr=U(),Hm=V(),et=Ze();Wm.error={message:({params:{property:e,depsCount:t,deps:r}})=>xr.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>xr._`{property: ${e},
7
+ missingProperty: ${o},
8
+ depsCount: ${t},
9
+ deps: ${r}}`};var bz={keyword:"dependencies",type:"object",schemaType:"object",error:Wm.error,code(e){let[t,r]=zz(e);Km(e,t),Bm(e,r)}};function zz({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Km(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let u=et.propertyInData(r,o,i,n.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(u,()=>{for(let c of a)et.checkReportMissingProp(e,c)});else r.if(xr._`${u} && (${et.checkMissingProp(e,a,s)})`),et.reportMissingProp(e,s),r.else()}}Wm.validatePropertyDeps=Km;function Bm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(Hm.alwaysValidSchema(s,t[a]))continue;r.if(et.propertyInData(r,o,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}Wm.validateSchemaDeps=Bm;Wm.default=bz});var eh=T(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});var Tn=U(),Qm=V(),Pz={message:"property name must be valid",params:({params:e})=>Tn._`{propertyName: ${e.propertyName}}`},Ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Pz,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(Qm.alwaysValidSchema(n,r))return;let s=t.name("valid");t.forIn("key",o,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(Tn.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};Xm.default=Ez});var Bi=T(function(th){Object.defineProperty(th,"__esModule",{value:!0});var It=Ze(),de=U(),Rz=at(),Ct=V(),Iz={message:"must NOT have additional properties",params:({params:e})=>de._`{additionalProperty: ${e.additionalProperty}}`},Cz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Iz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&Ct.alwaysValidSchema(i,r))return;let c=It.allSchemaProperties(o.properties),l=It.allSchemaProperties(o.patternProperties);d(),e.ok(de._`${s} === ${Rz.default.errors}`);function d(){t.forIn("key",n,(x)=>{if(!c.length&&!l.length)h(x);else t.if(f(x),()=>h(x))})}function f(x){let w;if(c.length>8){let E=Ct.schemaRefOrVal(i,o.properties,"properties");w=It.isOwnProperty(t,E,x)}else if(c.length)w=de.or(...c.map((E)=>de._`${x} === ${E}`));else w=de.nil;if(l.length)w=de.or(w,...l.map((E)=>de._`${It.usePattern(e,E)}.test(${x})`));return de.not(w)}function m(x){t.code(de._`delete ${n}[${x}]`)}function h(x){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){m(x);return}if(r===!1){if(e.setParams({additionalProperty:x}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Ct.alwaysValidSchema(i,r)){let w=t.name("valid");if(u.removeAdditional==="failing")g(x,w,!1),t.if(de.not(w),()=>{e.reset(),m(x)});else if(g(x,w),!a)t.if(de.not(w),()=>t.break())}}function g(x,w,E){let S={keyword:"additionalProperties",dataProp:x,dataPropType:Ct.Type.Str};if(E===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,w)}}};th.default=Cz});var sh=T(function(nh){Object.defineProperty(nh,"__esModule",{value:!0});var oh=so(),Rn=Ze(),br=V(),rh=Bi(),jz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;if(s.opts.removeAdditional==="all"&&o.additionalProperties===void 0)rh.default.code(new oh.KeywordCxt(s,rh.default,"additionalProperties"));let i=Rn.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=br.mergeEvaluated.props(t,br.toHash(i),s.props);let a=i.filter((d)=>!br.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if(Rn.propertyInData(t,n,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};nh.default=jz});var ah=T(function(ih){Object.defineProperty(ih,"__esModule",{value:!0});var In=Ze(),Ot=U(),Cn=V(),On=V(),Az={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=In.allSchemaProperties(r),u=a.filter((g)=>Cn.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Ot.Name))s.props=On.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let g of a){if(c)m(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function m(g){for(let x in c)if(new RegExp(g).test(x))Cn.checkStrictMode(s,`property ${x} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",o,(x)=>{t.if(Ot._`${In.usePattern(e,g)}.test(${x})`,()=>{let w=u.includes(g);if(!w)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:x,dataPropType:On.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Ot._`${d}[${x}]`,!0);else if(!w&&!s.allErrors)t.if(Ot.not(l),()=>t.break())})})}}};ih.default=Az});var lh=T(function(uh){Object.defineProperty(uh,"__esModule",{value:!0});var ch=V(),qz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(ch.alwaysValidSchema(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};uh.default=qz});var fh=T(function(ph){Object.defineProperty(ph,"__esModule",{value:!0});var dh=Ze(),Dz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:dh.validateUnion,error:{message:"must match a schema in anyOf"}};ph.default=Dz});var gh=T(function(hh){Object.defineProperty(hh,"__esModule",{value:!0});var jt=U(),mh=V(),Uz={message:"must match exactly one schema in oneOf",params:({params:e})=>jt._`{passingSchemas: ${e.passing}}`},Vz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Uz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let f;if(mh.alwaysValidSchema(n,l))t.var(u,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(jt._`${u} && ${i}`).assign(i,!1).assign(a,jt._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,jt.Name)})})}}};hh.default=Vz});var vh=T(function(yh){Object.defineProperty(yh,"__esModule",{value:!0});var _h=V(),Hz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if(_h.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};yh.default=Hz});var xh=T(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});var Nt=U(),jn=V(),Bz={message:({params:e})=>Nt.str`must match "${e.ifClause}" schema`,params:({params:e})=>Nt._`{failingKeyword: ${e.ifClause}}`},Wz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Bz,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)jn.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=$h(o,"then"),s=$h(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(n)t.if(a,c("then"));else t.if(Nt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let f=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),d)t.assign(d,Nt._`${l}`);else e.setParams({ifClause:l})}}}};function $h(e,t){let r=e.schema[t];return r!==void 0&&!jn.alwaysValidSchema(e,r)}wh.default=Wz});var Sh=T(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});var bh=V(),Gz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)bh.checkStrictMode(r,`"${e}" without "if" is ignored`)}};zh.default=Gz});var Ph=T(function(kh){Object.defineProperty(kh,"__esModule",{value:!0});var Qz=Hi(),Xz=Zm(),eS=Ki(),tS=Um(),rS=Fm(),oS=Ym(),nS=eh(),sS=Bi(),iS=sh(),aS=ah(),cS=lh(),uS=fh(),lS=gh(),dS=vh(),pS=xh(),fS=Sh();function mS(e=!1){let t=[cS.default,uS.default,lS.default,dS.default,pS.default,fS.default,nS.default,sS.default,oS.default,iS.default,aS.default];if(e)t.push(Xz.default,tS.default);else t.push(Qz.default,eS.default);return t.push(rS.default),t}kh.default=mS});var Th=T(function(Eh){Object.defineProperty(Eh,"__esModule",{value:!0});var L=U(),gS={message:({schemaCode:e})=>L.str`must match format "${e}"`,params:({schemaCode:e})=>L._`{format: ${e}}`},_S={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:gS,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(n)f();else m();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",L._`${h}[${i}]`),x=r.let("fType"),w=r.let("format");r.if(L._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(x,L._`${g}.type || "string"`).assign(w,L._`${g}.validate`),()=>r.assign(x,L._`"string"`).assign(w,g)),e.fail$data(L.or(E(),S()));function E(){if(u.strictSchema===!1)return L.nil;return L._`${i} && !${w}`}function S(){let N=l.$async?L._`(${g}.async ? await ${w}(${o}) : ${w}(${o}))`:L._`${w}(${o})`,v=L._`(typeof ${w} == "function" ? ${N} : ${w}.test(${o}))`;return L._`${w} && ${w} !== true && ${x} === ${t} && !${v}`}}function m(){let h=d.formats[s];if(!h){E();return}if(h===!0)return;let[g,x,w]=S(h);if(g===t)e.pass(N());function E(){if(u.strictSchema===!1){d.logger.warn(v());return}throw Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function S(v){let b=v instanceof RegExp?L.regexpCode(v):u.code.formats?L._`${u.code.formats}${L.getProperty(s)}`:void 0,M=r.scopeValue("formats",{key:s,ref:v,code:b});if(typeof v=="object"&&!(v instanceof RegExp))return[v.type||"string",v.validate,L._`${M}.validate`];return["string",v,M]}function N(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return L._`await ${w}(${o})`}return typeof x=="function"?L._`${w}(${o})`:L._`${w}.test(${o})`}}}};Eh.default=_S});var Ih=T(function(Rh){Object.defineProperty(Rh,"__esModule",{value:!0});var vS=Th(),$S=[vS.default];Rh.default=$S});var jh=T(function(Ch){Object.defineProperty(Ch,"__esModule",{value:!0});Ch.contentVocabulary=Ch.metadataVocabulary=void 0;Ch.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ch.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ah=T(function(Nh){Object.defineProperty(Nh,"__esModule",{value:!0});var bS=Bf(),zS=Pm(),SS=Ph(),kS=Ih(),Nn=jh(),PS=[bS.default,zS.default,(0,SS.default)(),kS.default,Nn.metadataVocabulary,Nn.contentVocabulary];Nh.default=PS});var Dh=T(function(qh){Object.defineProperty(qh,"__esModule",{value:!0});qh.DiscrError=void 0;var Zh;(function(e){e.Tag="tag",e.Mapping="mapping"})(Zh||(qh.DiscrError=Zh={}))});var Vh=T(function(Uh){Object.defineProperty(Uh,"__esModule",{value:!0});var Me=U(),zr=Dh(),An=_n(),TS=io(),Lh=V(),RS={message:({params:{discrError:e,tagName:t}})=>e===zr.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Me._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},IS={keyword:"discriminator",type:"object",schemaType:"object",error:RS,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",Me._`${r}${Me.getProperty(a)}`);t.if(Me._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:zr.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf(Me._`${c} === ${h}`),t.assign(u,d(m[h]));t.else(),e.error(!1,{discrError:zr.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(g,Me.Name),h}function f(){var m;let h={},g=w(n),x=!0;for(let N=0;N<i.length;N++){let v=i[N];if((v===null||v===void 0?void 0:v.$ref)&&!Lh.schemaHasRulesButRef(v,s.self.RULES)){let M=v.$ref;if(v=An.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,M),v instanceof An.SchemaEnv)v=v.schema;if(v===void 0)throw new TS.default(s.opts.uriResolver,s.baseId,M)}let b=(m=v===null||v===void 0?void 0:v.properties)===null||m===void 0?void 0:m[a];if(typeof b!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);x=x&&(g||w(v)),E(b,N)}if(!x)throw Error(`discriminator: "${a}" must be required`);return h;function w({required:N}){return Array.isArray(N)&&N.includes(a)}function E(N,v){if(N.const)S(N.const,v);else if(N.enum)for(let b of N.enum)S(b,v);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(N,v){if(typeof N!="string"||N in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[N]=v}}}};Uh.default=IS});var Fh=T(function(nO,OS){OS.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 Ji=T(function(Ie,Wi){Object.defineProperty(Ie,"__esModule",{value:!0});Ie.MissingRefError=Ie.ValidationError=Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=Ie.Ajv=void 0;var jS=Mf(),NS=Ah(),AS=Vh(),Hh=Fh(),ZS=["/properties"],Zn="http://json-schema.org/draft-07/schema";class uo extends jS.default{_addVocabularies(){if(super._addVocabularies(),NS.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(AS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Hh,ZS):Hh;this.addMetaSchema(e,Zn,!1),this.refs["http://json-schema.org/schema"]=Zn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Zn)?Zn:void 0)}}Ie.Ajv=uo;Wi.exports=Ie=uo;Wi.exports.Ajv=uo;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.default=uo;var qS=so();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return qS.KeywordCxt}});var Sr=U();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return Sr._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return Sr.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return Sr.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return Sr.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return Sr.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return Sr.CodeGen}});var MS=mn();Object.defineProperty(Ie,"ValidationError",{enumerable:!0,get:function(){return MS.default}});var DS=io();Object.defineProperty(Ie,"MissingRefError",{enumerable:!0,get:function(){return DS.default}})});var tg=T(function(Xh){Object.defineProperty(Xh,"__esModule",{value:!0});Xh.formatNames=Xh.fastFormats=Xh.fullFormats=void 0;function tt(e,t){return{validate:e,compare:t}}Xh.fullFormats={date:tt(Jh,Xi),time:tt(Yi(!0),ea),"date-time":tt(Kh(!0),Yh),"iso-time":tt(Yi(),Gh),"iso-date-time":tt(Kh(),Qh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:WS,"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:tk,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:JS,int32:{type:"number",validate:QS},int64:{type:"number",validate:XS},float:{type:"number",validate:Wh},double:{type:"number",validate:Wh},password:!0,binary:!0};Xh.fastFormats={...Xh.fullFormats,date:tt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Xi),time:tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ea),"date-time":tt(/^\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,Yh),"iso-time":tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gh),"iso-date-time":tt(/^\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,Qh),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};Xh.formatNames=Object.keys(Xh.fullFormats);function VS(e){return e%4===0&&(e%100!==0||e%400===0)}var FS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,HS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jh(e){let t=FS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&VS(r)?29:HS[o])}function Xi(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Gi=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yi(e){return function(r){let o=Gi.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],u=o[5]==="-"?-1:1,c=+(o[6]||0),l=+(o[7]||0);if(c>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*u,f=n-c*u-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function ea(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function Gh(e,t){if(!(e&&t))return;let r=Gi.exec(e),o=Gi.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Qi=/t|\s/i;function Kh(e){let t=Yi(e);return function(o){let n=o.split(Qi);return n.length===2&&Jh(n[0])&&t(n[1])}}function Yh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function Qh(e,t){if(!(e&&t))return;let[r,o]=e.split(Qi),[n,s]=t.split(Qi),i=Xi(r,n);if(i===void 0)return;return i||ea(o,s)}var KS=/\/|:/,BS=/^(?:[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 WS(e){return KS.test(e)&&BS.test(e)}var Bh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function JS(e){return Bh.lastIndex=0,Bh.test(e)}var GS=-2147483648,YS=2147483647;function QS(e){return Number.isInteger(e)&&e<=YS&&e>=GS}function XS(e){return Number.isInteger(e)}function Wh(){return!0}var ek=/[^\\]\\Z/;function tk(e){if(ek.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var ng=T(function(og){Object.defineProperty(og,"__esModule",{value:!0});og.formatLimitDefinition=void 0;var rg=Ji(),pe=U(),At=pe.operators,qn={formatMaximum:{okStr:"<=",ok:At.LTE,fail:At.GT},formatMinimum:{okStr:">=",ok:At.GTE,fail:At.LT},formatExclusiveMaximum:{okStr:"<",ok:At.LT,fail:At.GTE},formatExclusiveMinimum:{okStr:">",ok:At.GT,fail:At.LTE}},ok={message:({keyword:e,schemaCode:t})=>pe.str`should be ${qn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>pe._`{comparison: ${qn[e].okStr}, limit: ${t}}`};og.formatLimitDefinition={keyword:Object.keys(qn),type:"string",schemaType:"string",$data:!0,error:ok,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new rg.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",pe._`${f}[${u.schemaCode}]`);e.fail$data(pe.or(pe._`typeof ${m} != "object"`,pe._`${m} instanceof RegExp`,pe._`typeof ${m}.compare != "function"`,d(m)))}function l(){let f=u.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${n}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?pe._`${i.code.formats}${pe.getProperty(f)}`:void 0});e.fail$data(d(h))}function d(f){return pe._`${f}.compare(${r}, ${o}) ${qn[n].fail} 0`}},dependencies:["format"]};var nk=(e)=>(e.addKeyword(og.formatLimitDefinition),e);og.default=nk});var cg=T(function(lo,ag){Object.defineProperty(lo,"__esModule",{value:!0});var De=tg(),ik=ng(),kr=U(),sg=new kr.Name("fullFormats"),ak=new kr.Name("fastFormats"),oa=(e,t={keywords:!0})=>{if(Array.isArray(t))return ig(e,t,De.fullFormats,sg),e;let[r,o]=t.mode==="fast"?[De.fastFormats,ak]:[De.fullFormats,sg],n=t.formats||De.formatNames;if(ig(e,n,r,o),t.keywords)(0,ik.default)(e);return e};oa.get=(e,t="full")=>{let o=(t==="fast"?De.fastFormats:De.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function ig(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=kr._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}ag.exports=lo=oa;Object.defineProperty(lo,"__esModule",{value:!0});lo.default=oa});var rs=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,u){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,u);for(let l in i.prototype)if(!(l in a))Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=u}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var u;let c=r?.Parent?new s:this;o(c,a),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var qg=Symbol("zod_brand");class lt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var go={};function Ce(e){if(e)Object.assign(go,e);return go}function Pa(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function ns(e,t="|"){return e.map((r)=>is(r)).join(t)}function Ea(e,t){if(typeof t==="bigint")return t.toString();return t}function yo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function vo(e){return e===null||e===void 0}function $o(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ta(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}function Q(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function wo(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Gt(e){return JSON.stringify(e)}var ss=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ra=yo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Or(e){if(Cr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Cr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}var Ia=new Set(["string","number","symbol"]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function C(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function is(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ca(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Oa={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]};function Mg(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return Ue(e,{...e._zod.def,shape:r,checks:[]})}function Dg(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ue(e,{...e._zod.def,shape:r,checks:[]})}function Lg(e,t){if(!Or(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return wo(this,"shape",o),o},checks:[]};return Ue(e,r)}function Ug(e,t){return Ue(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return wo(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function Vg(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=e?new e({type:"optional",innerType:o[s]}):o[s]}else for(let s in o)n[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Ue(t,{...t._zod.def,shape:n,checks:[]})}function Fg(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=new e({type:"nonoptional",innerType:o[s]})}else for(let s in o)n[s]=new e({type:"nonoptional",innerType:o[s]});return Ue(t,{...t._zod.def,shape:n,checks:[]})}function Yt(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function rt(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function _o(e){return typeof e==="string"?e:e?.message}function Ve(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=_o(e.inst?._zod.def?.error?.(e))??_o(t?.error?.(e))??_o(r.customError?.(e))??_o(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function xo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Qt(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var ja=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Ea,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bo=_("$ZodError",ja),as=_("$ZodError",ja,{Parent:Error});function cs(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function us(e,t){let r=t||function(s){return s.message},o={_errors:[]},n=(s)=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,u=0;while(u<i.path.length){let c=i.path[u];if(u!==i.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i));a=a[c],u++}}};return n(e),o}var Na=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new lt;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ve(u,s,Ce())));throw ss(a,n?.callee),a}return i.value};var Aa=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ve(u,s,Ce())));throw ss(a,n?.callee),a}return i.value};var ls=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new lt;return s.issues.length?{success:!1,error:new(e??bo)(s.issues.map((i)=>Ve(i,n,Ce())))}:{success:!0,data:s.value}},jr=ls(as),ds=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Ve(i,n,Ce())))}:{success:!0,data:s.value}},zo=ds(as);var Za=/^[cC][^\s-]{8,}$/,qa=/^[0-9a-z]+$/,Ma=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Da=/^[0-9a-vA-V]{20}$/,La=/^[A-Za-z0-9]{27}$/,Ua=/^[a-zA-Z0-9_-]{21}$/,Va=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Fa=/^([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})$/,ps=(e)=>{if(!e)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}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Ha=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ka(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Ba=/^(?:(?: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])$/,Wa=/^(([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})$/,Ja=/^((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])$/,Ga=/^(([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])$/,Ya=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fs=/^[A-Za-z0-9_-]*$/,Qa=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Xa=/^\+(?:[0-9]){6,14}[0-9]$/,ec="(?:(?:\\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])))",tc=new RegExp(`^${ec}$`);function rc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.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{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function oc(e){return new RegExp(`^${rc(e)}$`)}function nc(e){let t=rc({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${ec}T(?:${o})$`)}var sc=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var ic=/^\d+$/,ac=/^-?\d+(?:\.\d+)?/i,cc=/true|false/i,uc=/null/i;var lc=/^[^A-Z]*$/,dc=/^[^a-z]*$/;var be=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pc={number:"number",bigint:"bigint",object:"date"},ms=_("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let r=pc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hs=_("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let r=pc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fc=_("$ZodCheckMultipleOf",(e,t)=>{be.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Ta(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),mc=_("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Oa[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=ic}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var hc=_("$ZodCheckMaxLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=xo(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),gc=_("$ZodCheckMinLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=xo(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),_c=_("$ZodCheckLengthEquals",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=xo(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Nr=_("$ZodCheckStringFormat",(e,t)=>{var r,o;if(be.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),yc=_("$ZodCheckRegex",(e,t)=>{Nr.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vc=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lc),Nr.init(e,t)}),$c=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dc),Nr.init(e,t)}),wc=_("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let r=Mt(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xc=_("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`^${Mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),bc=_("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`.*${Mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var zc=_("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class gs{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
10
+ `).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
11
+ `))}}var kc={major:4,minor:0,patch:0};var G=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kc;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,i,a)=>{let u=Yt(s),c;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(u)continue;let d=s.issues.length,f=l._zod.check(s);if(f instanceof Promise&&a?.async===!1)throw new lt;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{if(await f,s.issues.length===d)return;if(!u)u=Yt(s,d)});else{if(s.issues.length===d)continue;if(!u)u=Yt(s,d)}}if(c)return c.then(()=>s);return s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new lt;return a.then((u)=>n(u,o,i))}return n(a,o,i)}}e["~standard"]={validate:(n)=>{try{let s=jr(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return zo(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Po=_("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??sc(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ee=_("$ZodStringFormat",(e,t)=>{Nr.init(e,t),Po.init(e,t)}),Ac=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fa),ee.init(e,t)}),Zc=_("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ps(o))}else t.pattern??(t.pattern=ps());ee.init(e,t)}),qc=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ha),ee.init(e,t)}),Mc=_("$ZodURL",(e,t)=>{ee.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),s=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Qa.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&s.endsWith("/"))r.value=s.slice(0,-1);else r.value=s;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Dc=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ka()),ee.init(e,t)}),Lc=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ua),ee.init(e,t)}),Uc=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Za),ee.init(e,t)}),Vc=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qa),ee.init(e,t)}),Fc=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ma),ee.init(e,t)}),Hc=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Da),ee.init(e,t)}),Kc=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=La),ee.init(e,t)}),Bc=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nc(t)),ee.init(e,t)}),Wc=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tc),ee.init(e,t)}),Jc=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=oc(t)),ee.init(e,t)}),Gc=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Va),ee.init(e,t)}),Yc=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ba),ee.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),Qc=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wa),ee.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Xc=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ja),ee.init(e,t)}),eu=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ga),ee.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let s=Number(n);if(`${s}`!==n)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function tu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ru=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ya),ee.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(tu(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Kg(e){if(!fs.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return tu(r)}var ou=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=fs),ee.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(Kg(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),nu=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xa),ee.init(e,t)});function Bg(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var su=_("$ZodJWT",(e,t)=>{ee.init(e,t),e._zod.check=(r)=>{if(Bg(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var ys=_("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??ac,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),iu=_("$ZodNumber",(e,t)=>{mc.init(e,t),ys.init(e,t)}),au=_("$ZodBoolean",(e,t)=>{G.init(e,t),e._zod.pattern=cc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var cu=_("$ZodNull",(e,t)=>{G.init(e,t),e._zod.pattern=uc,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),uu=_("$ZodAny",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),lu=_("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),du=_("$ZodNever",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Pc(e,t,r){if(e.issues.length)t.issues.push(...rt(r,e.issues));t.value[r]=e.value}var pu=_("$ZodArray",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],u=t.element._zod.run({value:a,issues:[]},o);if(u instanceof Promise)s.push(u.then((c)=>Pc(c,r,i)));else Pc(u,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ko(e,t,r){if(e.issues.length)t.issues.push(...rt(r,e.issues));t.value[r]=e.value}function Ec(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...rt(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var fu=_("$ZodObject",(e,t)=>{G.init(e,t);let r=yo(()=>{let d=Object.keys(t.shape);for(let m of d)if(!(t.shape[m]instanceof G))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let f=Ca(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});Q(e._zod,"propValues",()=>{let d=t.shape,f={};for(let m in d){let h=d[m]._zod;if(h.values){f[m]??(f[m]=new Set);for(let g of h.values)f[m].add(g)}}return f});let o=(d)=>{let f=new gs(["shape","payload","ctx"]),m=r.value,h=(E)=>{let S=Gt(E);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let g=Object.create(null),x=0;for(let E of m.keys)g[E]=`key_${x++}`;f.write("const newResult = {}");for(let E of m.keys)if(m.optionalKeys.has(E)){let S=g[E];f.write(`const ${S} = ${h(E)};`);let N=Gt(E);f.write(`
12
+ if (${S}.issues.length) {
13
+ if (input[${N}] === undefined) {
14
+ if (${N} in input) {
15
+ newResult[${N}] = undefined;
16
16
  }
17
17
  } else {
18
18
  payload.issues = payload.issues.concat(
19
- ${E}.issues.map((iss) => ({
19
+ ${S}.issues.map((iss) => ({
20
20
  ...iss,
21
- path: iss.path ? [${y}, ...iss.path] : [${y}],
21
+ path: iss.path ? [${N}, ...iss.path] : [${N}],
22
22
  }))
23
23
  );
24
24
  }
25
- } else if (${E}.value === undefined) {
26
- if (${y} in input) newResult[${y}] = undefined;
25
+ } else if (${S}.value === undefined) {
26
+ if (${N} in input) newResult[${N}] = undefined;
27
27
  } else {
28
- newResult[${y}] = ${E}.value;
28
+ newResult[${N}] = ${S}.value;
29
29
  }
30
- `)}else{let E=F[b];L.write(`const ${E} = ${q(b)};`),L.write(`
31
- if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
30
+ `)}else{let S=g[E];f.write(`const ${S} = ${h(E)};`),f.write(`
31
+ if (${S}.issues.length) payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${g1(b)}, ...iss.path] : [${g1(b)}]
34
- })));`),L.write(`newResult[${g1(b)}] = ${E}.value`)}L.write("payload.value = newResult;"),L.write("return payload;");let O=L.compile();return(b,E)=>O(D,b,E)},$,J=Y6,G=!p4.jitless,B=G&&Z8.value,z=X.catchall,A;Q._zod.parse=(D,L)=>{A??(A=Y.value);let K=D.value;if(!J(K))return D.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),D;let q=[];if(G&&B&&L?.async===!1&&L.jitless!==!0){if(!$)$=W(X.shape);D=$(D,L)}else{D.value={};let E=A.shape;for(let y of A.keys){let x=E[y],j0=x._zod.run({value:K[y],issues:[]},L),y0=x._zod.optin==="optional"&&x._zod.optout==="optional";if(j0 instanceof Promise)q.push(j0.then((X6)=>y0?j$(X6,D,y,K):t4(X6,D,y)));else if(y0)j$(j0,D,y,K);else t4(j0,D,y)}}if(!z)return q.length?Promise.all(q).then(()=>D):D;let F=[],N=A.keySet,O=z._zod,b=O.def.type;for(let E of Object.keys(K)){if(N.has(E))continue;if(b==="never"){F.push(E);continue}let y=O.run({value:K[E],issues:[]},L);if(y instanceof Promise)q.push(y.then((x)=>t4(x,D,E)));else t4(y,D,E)}if(F.length)D.issues.push({code:"unrecognized_keys",keys:F,input:K,inst:Q});if(!q.length)return D;return Promise.all(q).then(()=>{return D})}});function b$(Q,X,Y,W){for(let $ of Q)if($.issues.length===0)return X.value=$.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map(($)=>$.issues.map((J)=>p0(J,W,k0())))}),X}var e4=U("$ZodUnion",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),Q0(Q._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),Q0(Q._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),Q0(Q._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((W)=>W._zod.pattern);return new RegExp(`^(${Y.map((W)=>n6(W.source)).join("|")})$`)}return}),Q._zod.parse=(Y,W)=>{let $=!1,J=[];for(let G of X.options){let H=G._zod.run({value:Y.value,issues:[]},W);if(H instanceof Promise)J.push(H),$=!0;else{if(H.issues.length===0)return H;J.push(H)}}if(!$)return b$(J,Y,Q,W);return Promise.all(J).then((G)=>{return b$(G,Y,Q,W)})}}),MQ=U("$ZodDiscriminatedUnion",(Q,X)=>{e4.init(Q,X);let Y=Q._zod.parse;Q0(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 W=p6(()=>{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(!Y6(G))return $.issues.push({code:"invalid_type",expected:"object",input:G,inst:Q}),$;let H=W.value.get(G?.[X.discriminator]);if(H)return H._zod.run($,J);if(X.unionFallback)return Y($,J);return $.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:G,path:[X.discriminator],inst:Q}),$}}),jQ=U("$ZodIntersection",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value,J=X.left._zod.run({value:$,issues:[]},W),G=X.right._zod.run({value:$,issues:[]},W);if(J instanceof Promise||G instanceof Promise)return Promise.all([J,G]).then(([B,z])=>{return E$(Y,B,z)});return E$(Y,J,G)}});function r8(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(W6(Q)&&W6(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),$={...Q,...X};for(let J of W){let G=r8(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 Y=[];for(let W=0;W<Q.length;W++){let $=Q[W],J=X[W],G=r8($,J);if(!G.valid)return{valid:!1,mergeErrorPath:[W,...G.mergeErrorPath]};Y.push(G.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function E$(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(y1(Q))return Q;let W=r8(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var bQ=U("$ZodRecord",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value;if(!W6($))return Y.issues.push({expected:"record",code:"invalid_type",input:$,inst:Q}),Y;let J=[];if(X.keyType._zod.values){let G=X.keyType._zod.values;Y.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:[]},W);if(z instanceof Promise)J.push(z.then((A)=>{if(A.issues.length)Y.issues.push(...W1(B,A.issues));Y.value[B]=A.value}));else{if(z.issues.length)Y.issues.push(...W1(B,z.issues));Y.value[B]=z.value}}let H;for(let B in $)if(!G.has(B))H=H??[],H.push(B);if(H&&H.length>0)Y.issues.push({code:"unrecognized_keys",input:$,inst:Q,keys:H})}else{Y.value={};for(let G of Reflect.ownKeys($)){if(G==="__proto__")continue;let H=X.keyType._zod.run({value:G,issues:[]},W);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){Y.issues.push({origin:"record",code:"invalid_key",issues:H.issues.map((z)=>p0(z,W,k0())),input:G,path:[G],inst:Q}),Y.value[H.value]=H.value;continue}let B=X.valueType._zod.run({value:$[G],issues:[]},W);if(B instanceof Promise)J.push(B.then((z)=>{if(z.issues.length)Y.issues.push(...W1(G,z.issues));Y.value[H.value]=z.value}));else{if(B.issues.length)Y.issues.push(...W1(G,B.issues));Y.value[H.value]=B.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var EQ=U("$ZodEnum",(Q,X)=>{a.init(Q,X);let Y=c6(X.entries);Q._zod.values=new Set(Y),Q._zod.pattern=new RegExp(`^(${Y.filter((W)=>v8.has(typeof W)).map((W)=>typeof W==="string"?U1(W):W.toString()).join("|")})$`),Q._zod.parse=(W,$)=>{let J=W.value;if(Q._zod.values.has(J))return W;return W.issues.push({code:"invalid_value",values:Y,input:J,inst:Q}),W}}),SQ=U("$ZodLiteral",(Q,X)=>{a.init(Q,X),Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?U1(Y):Y?Y.toString():String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let $=Y.value;if(Q._zod.values.has($))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:$,inst:Q}),Y}});var PQ=U("$ZodTransform",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=X.transform(Y.value,Y);if(W.async)return($ instanceof Promise?$:Promise.resolve($)).then((G)=>{return Y.value=G,Y});if($ instanceof Promise)throw new V1;return Y.value=$,Y}}),IQ=U("$ZodOptional",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",Q0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),Q0(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n6(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),RQ=U("$ZodNullable",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"optin",()=>X.innerType._zod.optin),Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q0(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n6(Y.source)}|null)$`):void 0}),Q0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(Y,W)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,W)}}),CQ=U("$ZodDefault",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(Y.value===void 0)return Y.value=X.defaultValue,Y;let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>S$(J,X));return S$($,X)}});function S$(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var TQ=U("$ZodPrefault",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),ZQ=U("$ZodNonOptional",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>P$(J,Q));return P$($,Q)}});function P$(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 vQ=U("$ZodCatch",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map((G)=>p0(G,W,k0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=$.value,$.issues.length)Y.value=X.catchValue({...Y,error:{issues:$.issues.map((J)=>p0(J,W,k0()))},input:Y.value}),Y.issues=[];return Y}});var kQ=U("$ZodPipe",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"values",()=>X.in._zod.values),Q0(Q._zod,"optin",()=>X.in._zod.optin),Q0(Q._zod,"optout",()=>X.out._zod.optout),Q._zod.parse=(Y,W)=>{let $=X.in._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>I$(J,X,W));return I$($,X,W)}});function I$(Q,X,Y){if(y1(Q))return Q;return X.out._zod.run({value:Q.value,issues:Q.issues},Y)}var _Q=U("$ZodReadonly",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"propValues",()=>X.innerType._zod.propValues),Q0(Q._zod,"values",()=>X.innerType._zod.values),Q0(Q._zod,"optin",()=>X.innerType._zod.optin),Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then(R$);return R$($)}});function R$(Q){return Q.value=Object.freeze(Q.value),Q}var xQ=U("$ZodCustom",(Q,X)=>{F0.init(Q,X),a.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,$=X.fn(W);if($ instanceof Promise)return $.then((J)=>C$(J,Y,W,Q));C$($,Y,W,Q);return}});function C$(Q,X,Y,W){if(!Q){let $={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)$.params=W._zod.def.params;X.issues.push(x8($))}}var Bz=(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},zz=()=>{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(W){return Q[W]??null}let Y={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(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${Bz(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${d4(W.values[0])}`;return`Invalid option: expected one of ${i4(W.values,"|")}`;case"too_big":{let $=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${$}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${$}${W.maximum.toString()}`}case"too_small":{let $=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${$}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${$}${W.minimum.toString()}`}case"invalid_format":{let $=W;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 ${Y[$.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${i4(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function gQ(){return{localeError:zz()}}var Az=Symbol("ZodOutput"),Kz=Symbol("ZodInput");class Q9{constructor(){this._map=new Map,this._idmap=new Map}add(Q,...X){let Y=X[0];if(this._map.set(Q,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.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 Y={...this.get(X)??{}};return delete Y.id,{...Y,...this._map.get(Q)}}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function x$(){return new Q9}var O1=x$();function yQ(Q,X){return new Q({type:"string",...k(X)})}function hQ(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...k(X)})}function X9(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...k(X)})}function fQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...k(X)})}function uQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(X)})}function lQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(X)})}function mQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(X)})}function cQ(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...k(X)})}function pQ(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...k(X)})}function iQ(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(X)})}function nQ(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...k(X)})}function dQ(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(X)})}function oQ(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...k(X)})}function rQ(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...k(X)})}function tQ(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(X)})}function aQ(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(X)})}function sQ(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(X)})}function eQ(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(X)})}function QX(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(X)})}function XX(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...k(X)})}function YX(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...k(X)})}function WX(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...k(X)})}function $X(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...k(X)})}function g$(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(X)})}function y$(Q,X){return new Q({type:"string",format:"date",check:"string_format",...k(X)})}function h$(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...k(X)})}function f$(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...k(X)})}function JX(Q,X){return new Q({type:"number",checks:[],...k(X)})}function GX(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...k(X)})}function HX(Q,X){return new Q({type:"boolean",...k(X)})}function BX(Q,X){return new Q({type:"null",...k(X)})}function zX(Q){return new Q({type:"unknown"})}function AX(Q,X){return new Q({type:"never",...k(X)})}function Y9(Q,X){return new n8({check:"less_than",...k(X),value:Q,inclusive:!1})}function a6(Q,X){return new n8({check:"less_than",...k(X),value:Q,inclusive:!0})}function W9(Q,X){return new d8({check:"greater_than",...k(X),value:Q,inclusive:!1})}function s6(Q,X){return new d8({check:"greater_than",...k(X),value:Q,inclusive:!0})}function $9(Q,X){return new H$({check:"multiple_of",...k(X),value:Q})}function J9(Q,X){return new z$({check:"max_length",...k(X),maximum:Q})}function $6(Q,X){return new A$({check:"min_length",...k(X),minimum:Q})}function G9(Q,X){return new K$({check:"length_equals",...k(X),length:Q})}function KX(Q,X){return new D$({check:"string_format",format:"regex",...k(X),pattern:Q})}function DX(Q){return new L$({check:"string_format",format:"lowercase",...k(Q)})}function LX(Q){return new q$({check:"string_format",format:"uppercase",...k(Q)})}function qX(Q,X){return new F$({check:"string_format",format:"includes",...k(X),includes:Q})}function FX(Q,X){return new V$({check:"string_format",format:"starts_with",...k(X),prefix:Q})}function VX(Q,X){return new U$({check:"string_format",format:"ends_with",...k(X),suffix:Q})}function u1(Q){return new O$({check:"overwrite",tx:Q})}function UX(Q){return u1((X)=>X.normalize(Q))}function OX(){return u1((Q)=>Q.trim())}function NX(){return u1((Q)=>Q.toLowerCase())}function wX(){return u1((Q)=>Q.toUpperCase())}function u$(Q,X,Y){return new Q({type:"array",element:X,...k(Y)})}function MX(Q,X,Y){let W=k(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function jX(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...k(Y)})}class bX{constructor(Q){this.counter=0,this.metadataRegistry=Q?.metadata??O1,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 Y;let W=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 A={...X,schemaPath:[...X.schemaPath,Q],path:X.path},D=Q._zod.parent;if(D)G.ref=D,this.process(D,A),this.seen.get(D).isParent=!0;else{let L=G.schema;switch(W.type){case"string":{let K=L;K.type="string";let{minimum:q,maximum:F,format:N,patterns:O,contentEncoding:b}=Q._zod.bag;if(typeof q==="number")K.minLength=q;if(typeof F==="number")K.maxLength=F;if(N){if(K.format=$[N]??N,K.format==="")delete K.format}if(b)K.contentEncoding=b;if(O&&O.size>0){let E=[...O];if(E.length===1)K.pattern=E[0].source;else if(E.length>1)G.schema.allOf=[...E.map((y)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:y.source}))]}break}case"number":{let K=L,{minimum:q,maximum:F,format:N,multipleOf:O,exclusiveMaximum:b,exclusiveMinimum:E}=Q._zod.bag;if(typeof N==="string"&&N.includes("int"))K.type="integer";else K.type="number";if(typeof E==="number")K.exclusiveMinimum=E;if(typeof q==="number"){if(K.minimum=q,typeof E==="number")if(E>=q)delete K.minimum;else delete K.exclusiveMinimum}if(typeof b==="number")K.exclusiveMaximum=b;if(typeof F==="number"){if(K.maximum=F,typeof b==="number")if(b<=F)delete K.maximum;else delete K.exclusiveMaximum}if(typeof O==="number")K.multipleOf=O;break}case"boolean":{let K=L;K.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":{L.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":{L.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let K=L,{minimum:q,maximum:F}=Q._zod.bag;if(typeof q==="number")K.minItems=q;if(typeof F==="number")K.maxItems=F;K.type="array",K.items=this.process(W.element,{...A,path:[...A.path,"items"]});break}case"object":{let K=L;K.type="object",K.properties={};let q=W.shape;for(let O in q)K.properties[O]=this.process(q[O],{...A,path:[...A.path,"properties",O]});let F=new Set(Object.keys(q)),N=new Set([...F].filter((O)=>{let b=W.shape[O]._zod;if(this.io==="input")return b.optin===void 0;else return b.optout===void 0}));if(N.size>0)K.required=Array.from(N);if(W.catchall?._zod.def.type==="never")K.additionalProperties=!1;else if(!W.catchall){if(this.io==="output")K.additionalProperties=!1}else if(W.catchall)K.additionalProperties=this.process(W.catchall,{...A,path:[...A.path,"additionalProperties"]});break}case"union":{let K=L;K.anyOf=W.options.map((q,F)=>this.process(q,{...A,path:[...A.path,"anyOf",F]}));break}case"intersection":{let K=L,q=this.process(W.left,{...A,path:[...A.path,"allOf",0]}),F=this.process(W.right,{...A,path:[...A.path,"allOf",1]}),N=(b)=>("allOf"in b)&&Object.keys(b).length===1,O=[...N(q)?q.allOf:[q],...N(F)?F.allOf:[F]];K.allOf=O;break}case"tuple":{let K=L;K.type="array";let q=W.items.map((O,b)=>this.process(O,{...A,path:[...A.path,"prefixItems",b]}));if(this.target==="draft-2020-12")K.prefixItems=q;else K.items=q;if(W.rest){let O=this.process(W.rest,{...A,path:[...A.path,"items"]});if(this.target==="draft-2020-12")K.items=O;else K.additionalItems=O}if(W.rest)K.items=this.process(W.rest,{...A,path:[...A.path,"items"]});let{minimum:F,maximum:N}=Q._zod.bag;if(typeof F==="number")K.minItems=F;if(typeof N==="number")K.maxItems=N;break}case"record":{let K=L;K.type="object",K.propertyNames=this.process(W.keyType,{...A,path:[...A.path,"propertyNames"]}),K.additionalProperties=this.process(W.valueType,{...A,path:[...A.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 K=L,q=c6(W.entries);if(q.every((F)=>typeof F==="number"))K.type="number";if(q.every((F)=>typeof F==="string"))K.type="string";K.enum=q;break}case"literal":{let K=L,q=[];for(let F of W.values)if(F===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else q.push(Number(F));else q.push(F);if(q.length===0);else if(q.length===1){let F=q[0];K.type=F===null?"null":typeof F,K.const=F}else{if(q.every((F)=>typeof F==="number"))K.type="number";if(q.every((F)=>typeof F==="string"))K.type="string";if(q.every((F)=>typeof F==="boolean"))K.type="string";if(q.every((F)=>F===null))K.type="null";K.enum=q}break}case"file":{let K=L,q={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:N,mime:O}=Q._zod.bag;if(F!==void 0)q.minLength=F;if(N!==void 0)q.maxLength=N;if(O)if(O.length===1)q.contentMediaType=O[0],Object.assign(K,q);else K.anyOf=O.map((b)=>{return{...q,contentMediaType:b}});else Object.assign(K,q);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let K=this.process(W.innerType,A);L.anyOf=[K,{type:"null"}];break}case"nonoptional":{this.process(W.innerType,A),G.ref=W.innerType;break}case"success":{let K=L;K.type="boolean";break}case"default":{this.process(W.innerType,A),G.ref=W.innerType,L.default=JSON.parse(JSON.stringify(W.defaultValue));break}case"prefault":{if(this.process(W.innerType,A),G.ref=W.innerType,this.io==="input")L._prefault=JSON.parse(JSON.stringify(W.defaultValue));break}case"catch":{this.process(W.innerType,A),G.ref=W.innerType;let K;try{K=W.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}L.default=K;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let K=L,q=Q._zod.pattern;if(!q)throw Error("Pattern not found in template literal");K.type="string",K.pattern=q.source;break}case"pipe":{let K=this.io==="input"?W.in._zod.def.type==="transform"?W.out:W.in:W.out;this.process(K,A),G.ref=K;break}case"readonly":{this.process(W.innerType,A),G.ref=W.innerType,L.readOnly=!0;break}case"promise":{this.process(W.innerType,A),G.ref=W.innerType;break}case"optional":{this.process(W.innerType,A),G.ref=W.innerType;break}case"lazy":{let K=Q._zod.innerType;this.process(K,A),G.ref=K;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"&&D0(Q))delete G.schema.examples,delete G.schema.default;if(this.io==="input"&&G.schema._prefault)(Y=G.schema).default??(Y.default=G.schema._prefault);return delete G.schema._prefault,this.seen.get(Q).schema}emit(Q,X){let Y={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},W=this.seen.get(Q);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let $=(z)=>{let A=this.target==="draft-2020-12"?"$defs":"definitions";if(Y.external){let q=Y.external.registry.get(z[0])?.id,F=Y.external.uri??((O)=>O);if(q)return{ref:F(q)};let N=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=N,{defId:N,ref:`${F("__shared")}#/${A}/${N}`}}if(z[1]===W)return{ref:"#"};let L=`${"#"}/${A}/`,K=z[1].schema.id??`__schema${this.counter++}`;return{defId:K,ref:L+K}},J=(z)=>{if(z[1].schema.$ref)return;let A=z[1],{ref:D,defId:L}=$(z);if(A.def={...A.schema},L)A.defId=L;let K=A.schema;for(let q in K)delete K[q];K.$ref=D};if(Y.cycles==="throw")for(let z of this.seen.entries()){let A=z[1];if(A.cycle)throw Error(`Cycle detected: #/${A.cycle?.join("/")}/<root>
35
-
36
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of this.seen.entries()){let A=z[1];if(Q===z[0]){J(z);continue}if(Y.external){let L=Y.external.registry.get(z[0])?.id;if(Q!==z[0]&&L){J(z);continue}}if(this.metadataRegistry.get(z[0])?.id){J(z);continue}if(A.cycle){J(z);continue}if(A.count>1){if(Y.reused==="ref"){J(z);continue}}}let G=(z,A)=>{let D=this.seen.get(z),L=D.def??D.schema,K={...L};if(D.ref===null)return;let q=D.ref;if(D.ref=null,q){G(q,A);let F=this.seen.get(q).schema;if(F.$ref&&A.target==="draft-7")L.allOf=L.allOf??[],L.allOf.push(F);else Object.assign(L,F),Object.assign(L,K)}if(!D.isParent)this.override({zodSchema:z,jsonSchema:L,path:D.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(Y.external?.uri){let z=Y.external.registry.get(Q)?.id;if(!z)throw Error("Schema is missing an `id` property");H.$id=Y.external.uri(z)}Object.assign(H,W.def);let B=Y.external?.defs??{};for(let z of this.seen.entries()){let A=z[1];if(A.def&&A.defId)B[A.defId]=A.def}if(Y.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 EX(Q,X){if(Q instanceof Q9){let W=new bX(X),$={};for(let H of Q._idmap.entries()){let[B,z]=H;W.process(z)}let J={},G={registry:Q,uri:X?.uri,defs:$};for(let H of Q._idmap.entries()){let[B,z]=H;J[B]=W.emit(z,{...X,external:G})}if(Object.keys($).length>0){let H=W.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[H]:$}}return{schemas:J}}let Y=new bX(X);return Y.process(Q),Y.emit(Q,X)}function D0(Q,X){let Y=X??{seen:new Set};if(Y.seen.has(Q))return!1;Y.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 D0($.element,Y);case"object":{for(let J in $.shape)if(D0($.shape[J],Y))return!0;return!1}case"union":{for(let J of $.options)if(D0(J,Y))return!0;return!1}case"intersection":return D0($.left,Y)||D0($.right,Y);case"tuple":{for(let J of $.items)if(D0(J,Y))return!0;if($.rest&&D0($.rest,Y))return!0;return!1}case"record":return D0($.keyType,Y)||D0($.valueType,Y);case"map":return D0($.keyType,Y)||D0($.valueType,Y);case"set":return D0($.valueType,Y);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return D0($.innerType,Y);case"lazy":return D0($.getter(),Y);case"default":return D0($.innerType,Y);case"prefault":return D0($.innerType,Y);case"custom":return!1;case"transform":return!0;case"pipe":return D0($.in,Y)||D0($.out,Y);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${$.type}`)}var e6={};P8(e6,{time:()=>IX,duration:()=>RX,datetime:()=>SX,date:()=>PX,ZodISOTime:()=>p$,ZodISODuration:()=>i$,ZodISODateTime:()=>m$,ZodISODate:()=>c$});var m$=U("ZodISODateTime",(Q,X)=>{T$.init(Q,X),J0.init(Q,X)});function SX(Q){return g$(m$,Q)}var c$=U("ZodISODate",(Q,X)=>{Z$.init(Q,X),J0.init(Q,X)});function PX(Q){return y$(c$,Q)}var p$=U("ZodISOTime",(Q,X)=>{v$.init(Q,X),J0.init(Q,X)});function IX(Q){return h$(p$,Q)}var i$=U("ZodISODuration",(Q,X)=>{k$.init(Q,X),J0.init(Q,X)});function RX(Q){return f$(i$,Q)}var n$=(Q,X)=>{o4.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>y8(Q,Y)},flatten:{value:(Y)=>g8(Q,Y)},addIssue:{value:(Y)=>Q.issues.push(Y)},addIssues:{value:(Y)=>Q.issues.push(...Y)},isEmpty:{get(){return Q.issues.length===0}}})},$b=U("ZodError",n$),Q4=U("ZodError",n$,{Parent:Error});var d$=h8(Q4),o$=u8(Q4),r$=m8(Q4),t$=c8(Q4);var z0=U("ZodType",(Q,X)=>{return a.init(Q,X),Q.def=X,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone({...X,checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]})},Q.clone=(Y,W)=>_0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>d$(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>r$(Q,Y,W),Q.parseAsync=async(Y,W)=>o$(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>t$(Q,Y,W),Q.spa=Q.safeParseAsync,Q.refine=(Y,W)=>Q.check(uA(Y,W)),Q.superRefine=(Y)=>Q.check(lA(Y)),Q.overwrite=(Y)=>Q.check(u1(Y)),Q.optional=()=>H0(Q),Q.nullable=()=>e$(Q),Q.nullish=()=>H0(e$(Q)),Q.nonoptional=(Y)=>kA(Q,Y),Q.array=()=>i(Q),Q.or=(Y)=>W0([Q,Y]),Q.and=(Y)=>B9(Q,Y),Q.transform=(Y)=>TX(Q,JJ(Y)),Q.default=(Y)=>TA(Q,Y),Q.prefault=(Y)=>vA(Q,Y),Q.catch=(Y)=>xA(Q,Y),Q.pipe=(Y)=>TX(Q,Y),Q.readonly=()=>hA(Q),Q.describe=(Y)=>{let W=Q.clone();return O1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return O1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return O1.get(Q);let W=Q.clone();return O1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),QJ=U("_ZodString",(Q,X)=>{t6.init(Q,X),z0.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(KX(...W)),Q.includes=(...W)=>Q.check(qX(...W)),Q.startsWith=(...W)=>Q.check(FX(...W)),Q.endsWith=(...W)=>Q.check(VX(...W)),Q.min=(...W)=>Q.check($6(...W)),Q.max=(...W)=>Q.check(J9(...W)),Q.length=(...W)=>Q.check(G9(...W)),Q.nonempty=(...W)=>Q.check($6(1,...W)),Q.lowercase=(W)=>Q.check(DX(W)),Q.uppercase=(W)=>Q.check(LX(W)),Q.trim=()=>Q.check(OX()),Q.normalize=(...W)=>Q.check(UX(...W)),Q.toLowerCase=()=>Q.check(NX()),Q.toUpperCase=()=>Q.check(wX())}),sz=U("ZodString",(Q,X)=>{t6.init(Q,X),QJ.init(Q,X),Q.email=(Y)=>Q.check(hQ(ez,Y)),Q.url=(Y)=>Q.check(cQ(QA,Y)),Q.jwt=(Y)=>Q.check($X(FA,Y)),Q.emoji=(Y)=>Q.check(pQ(XA,Y)),Q.guid=(Y)=>Q.check(X9(a$,Y)),Q.uuid=(Y)=>Q.check(fQ(H9,Y)),Q.uuidv4=(Y)=>Q.check(uQ(H9,Y)),Q.uuidv6=(Y)=>Q.check(lQ(H9,Y)),Q.uuidv7=(Y)=>Q.check(mQ(H9,Y)),Q.nanoid=(Y)=>Q.check(iQ(YA,Y)),Q.guid=(Y)=>Q.check(X9(a$,Y)),Q.cuid=(Y)=>Q.check(nQ(WA,Y)),Q.cuid2=(Y)=>Q.check(dQ($A,Y)),Q.ulid=(Y)=>Q.check(oQ(JA,Y)),Q.base64=(Y)=>Q.check(XX(DA,Y)),Q.base64url=(Y)=>Q.check(YX(LA,Y)),Q.xid=(Y)=>Q.check(rQ(GA,Y)),Q.ksuid=(Y)=>Q.check(tQ(HA,Y)),Q.ipv4=(Y)=>Q.check(aQ(BA,Y)),Q.ipv6=(Y)=>Q.check(sQ(zA,Y)),Q.cidrv4=(Y)=>Q.check(eQ(AA,Y)),Q.cidrv6=(Y)=>Q.check(QX(KA,Y)),Q.e164=(Y)=>Q.check(WX(qA,Y)),Q.datetime=(Y)=>Q.check(SX(Y)),Q.date=(Y)=>Q.check(PX(Y)),Q.time=(Y)=>Q.check(IX(Y)),Q.duration=(Y)=>Q.check(RX(Y))});function V(Q){return yQ(sz,Q)}var J0=U("ZodStringFormat",(Q,X)=>{X0.init(Q,X),QJ.init(Q,X)}),ez=U("ZodEmail",(Q,X)=>{s8.init(Q,X),J0.init(Q,X)});var a$=U("ZodGUID",(Q,X)=>{t8.init(Q,X),J0.init(Q,X)});var H9=U("ZodUUID",(Q,X)=>{a8.init(Q,X),J0.init(Q,X)});var QA=U("ZodURL",(Q,X)=>{e8.init(Q,X),J0.init(Q,X)});var XA=U("ZodEmoji",(Q,X)=>{QQ.init(Q,X),J0.init(Q,X)});var YA=U("ZodNanoID",(Q,X)=>{XQ.init(Q,X),J0.init(Q,X)});var WA=U("ZodCUID",(Q,X)=>{YQ.init(Q,X),J0.init(Q,X)});var $A=U("ZodCUID2",(Q,X)=>{WQ.init(Q,X),J0.init(Q,X)});var JA=U("ZodULID",(Q,X)=>{$Q.init(Q,X),J0.init(Q,X)});var GA=U("ZodXID",(Q,X)=>{JQ.init(Q,X),J0.init(Q,X)});var HA=U("ZodKSUID",(Q,X)=>{GQ.init(Q,X),J0.init(Q,X)});var BA=U("ZodIPv4",(Q,X)=>{HQ.init(Q,X),J0.init(Q,X)});var zA=U("ZodIPv6",(Q,X)=>{BQ.init(Q,X),J0.init(Q,X)});var AA=U("ZodCIDRv4",(Q,X)=>{zQ.init(Q,X),J0.init(Q,X)});var KA=U("ZodCIDRv6",(Q,X)=>{AQ.init(Q,X),J0.init(Q,X)});var DA=U("ZodBase64",(Q,X)=>{KQ.init(Q,X),J0.init(Q,X)});var LA=U("ZodBase64URL",(Q,X)=>{DQ.init(Q,X),J0.init(Q,X)});var qA=U("ZodE164",(Q,X)=>{LQ.init(Q,X),J0.init(Q,X)});var FA=U("ZodJWT",(Q,X)=>{qQ.init(Q,X),J0.init(Q,X)});var XJ=U("ZodNumber",(Q,X)=>{a4.init(Q,X),z0.init(Q,X),Q.gt=(W,$)=>Q.check(W9(W,$)),Q.gte=(W,$)=>Q.check(s6(W,$)),Q.min=(W,$)=>Q.check(s6(W,$)),Q.lt=(W,$)=>Q.check(Y9(W,$)),Q.lte=(W,$)=>Q.check(a6(W,$)),Q.max=(W,$)=>Q.check(a6(W,$)),Q.int=(W)=>Q.check(s$(W)),Q.safe=(W)=>Q.check(s$(W)),Q.positive=(W)=>Q.check(W9(0,W)),Q.nonnegative=(W)=>Q.check(s6(0,W)),Q.negative=(W)=>Q.check(Y9(0,W)),Q.nonpositive=(W)=>Q.check(a6(0,W)),Q.multipleOf=(W,$)=>Q.check($9(W,$)),Q.step=(W,$)=>Q.check($9(W,$)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function t(Q){return JX(XJ,Q)}var VA=U("ZodNumberFormat",(Q,X)=>{FQ.init(Q,X),XJ.init(Q,X)});function s$(Q){return GX(VA,Q)}var UA=U("ZodBoolean",(Q,X)=>{VQ.init(Q,X),z0.init(Q,X)});function q0(Q){return HX(UA,Q)}var OA=U("ZodNull",(Q,X)=>{UQ.init(Q,X),z0.init(Q,X)});function YJ(Q){return BX(OA,Q)}var NA=U("ZodUnknown",(Q,X)=>{OQ.init(Q,X),z0.init(Q,X)});function G0(){return zX(NA)}var wA=U("ZodNever",(Q,X)=>{NQ.init(Q,X),z0.init(Q,X)});function MA(Q){return AX(wA,Q)}var jA=U("ZodArray",(Q,X)=>{wQ.init(Q,X),z0.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check($6(Y,W)),Q.nonempty=(Y)=>Q.check($6(1,Y)),Q.max=(Y,W)=>Q.check(J9(Y,W)),Q.length=(Y,W)=>Q.check(G9(Y,W)),Q.unwrap=()=>Q.element});function i(Q,X){return u$(jA,Q,X)}var WJ=U("ZodObject",(Q,X)=>{s4.init(Q,X),z0.init(Q,X),p.defineLazy(Q,"shape",()=>X.shape),Q.keyof=()=>I0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:G0()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:G0()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:MA()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return p.extend(Q,Y)},Q.merge=(Y)=>p.merge(Q,Y),Q.pick=(Y)=>p.pick(Q,Y),Q.omit=(Y)=>p.omit(Q,Y),Q.partial=(...Y)=>p.partial(GJ,Q,Y[0]),Q.required=(...Y)=>p.required(HJ,Q,Y[0])});function I(Q,X){let Y={type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},...p.normalizeParams(X)};return new WJ(Y)}function b0(Q,X){return new WJ({type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},catchall:G0(),...p.normalizeParams(X)})}var $J=U("ZodUnion",(Q,X)=>{e4.init(Q,X),z0.init(Q,X),Q.options=X.options});function W0(Q,X){return new $J({type:"union",options:Q,...p.normalizeParams(X)})}var bA=U("ZodDiscriminatedUnion",(Q,X)=>{$J.init(Q,X),MQ.init(Q,X)});function ZX(Q,X,Y){return new bA({type:"union",options:X,discriminator:Q,...p.normalizeParams(Y)})}var EA=U("ZodIntersection",(Q,X)=>{jQ.init(Q,X),z0.init(Q,X)});function B9(Q,X){return new EA({type:"intersection",left:Q,right:X})}var SA=U("ZodRecord",(Q,X)=>{bQ.init(Q,X),z0.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function Y0(Q,X,Y){return new SA({type:"record",keyType:Q,valueType:X,...p.normalizeParams(Y)})}var CX=U("ZodEnum",(Q,X)=>{EQ.init(Q,X),z0.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,$)=>{let J={};for(let G of W)if(Y.has(G))J[G]=X.entries[G];else throw Error(`Key ${G} not found in enum`);return new CX({...X,checks:[],...p.normalizeParams($),entries:J})},Q.exclude=(W,$)=>{let J={...X.entries};for(let G of W)if(Y.has(G))delete J[G];else throw Error(`Key ${G} not found in enum`);return new CX({...X,checks:[],...p.normalizeParams($),entries:J})}});function I0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new CX({type:"enum",entries:Y,...p.normalizeParams(X)})}var PA=U("ZodLiteral",(Q,X)=>{SQ.init(Q,X),z0.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 T(Q,X){return new PA({type:"literal",values:Array.isArray(Q)?Q:[Q],...p.normalizeParams(X)})}var IA=U("ZodTransform",(Q,X)=>{PQ.init(Q,X),z0.init(Q,X),Q._zod.parse=(Y,W)=>{Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(p.issue(J,Y.value,X));else{let G=J;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=Q),G.continue??(G.continue=!0),Y.issues.push(p.issue(G))}};let $=X.transform(Y.value,Y);if($ instanceof Promise)return $.then((J)=>{return Y.value=J,Y});return Y.value=$,Y}});function JJ(Q){return new IA({type:"transform",transform:Q})}var GJ=U("ZodOptional",(Q,X)=>{IQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function H0(Q){return new GJ({type:"optional",innerType:Q})}var RA=U("ZodNullable",(Q,X)=>{RQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function e$(Q){return new RA({type:"nullable",innerType:Q})}var CA=U("ZodDefault",(Q,X)=>{CQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function TA(Q,X){return new CA({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var ZA=U("ZodPrefault",(Q,X)=>{TQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function vA(Q,X){return new ZA({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var HJ=U("ZodNonOptional",(Q,X)=>{ZQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function kA(Q,X){return new HJ({type:"nonoptional",innerType:Q,...p.normalizeParams(X)})}var _A=U("ZodCatch",(Q,X)=>{vQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function xA(Q,X){return new _A({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var gA=U("ZodPipe",(Q,X)=>{kQ.init(Q,X),z0.init(Q,X),Q.in=X.in,Q.out=X.out});function TX(Q,X){return new gA({type:"pipe",in:Q,out:X})}var yA=U("ZodReadonly",(Q,X)=>{_Q.init(Q,X),z0.init(Q,X)});function hA(Q){return new yA({type:"readonly",innerType:Q})}var BJ=U("ZodCustom",(Q,X)=>{xQ.init(Q,X),z0.init(Q,X)});function fA(Q){let X=new F0({check:"custom"});return X._zod.check=Q,X}function zJ(Q,X){return MX(BJ,Q??(()=>!0),X)}function uA(Q,X={}){return jX(BJ,Q,X)}function lA(Q){let X=fA((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(p.issue(W,Y.value,X._zod.def));else{let $=W;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=X),$.continue??($.continue=!X._zod.def.abort),Y.issues.push(p.issue($))}},Q(Y.value,Y)});return X}function vX(Q,X){return TX(JJ(Q),X)}k0(gQ());var kX="2025-11-25";var AJ=[kX,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],N1="io.modelcontextprotocol/related-task",A9="2.0",L0=zJ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),KJ=W0([V(),t().int()]),DJ=V(),Ob=b0({ttl:t().optional(),pollInterval:t().optional()}),mA=I({ttl:t().optional()}),cA=I({taskId:V()}),_X=b0({progressToken:KJ.optional(),[N1]:cA.optional()}),x0=I({_meta:_X.optional()}),X4=x0.extend({task:mA.optional()}),LJ=(Q)=>X4.safeParse(Q).success,V0=I({method:V(),params:x0.loose().optional()}),h0=I({_meta:_X.optional()}),f0=I({method:V(),params:h0.loose().optional()}),U0=b0({_meta:_X.optional()}),K9=W0([V(),t().int()]),qJ=I({jsonrpc:T(A9),id:K9,...V0.shape}).strict(),xX=(Q)=>qJ.safeParse(Q).success,FJ=I({jsonrpc:T(A9),...f0.shape}).strict(),VJ=(Q)=>FJ.safeParse(Q).success,gX=I({jsonrpc:T(A9),id:K9,result:U0}).strict(),Y4=(Q)=>gX.safeParse(Q).success;var v;(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"})(v||(v={}));var yX=I({jsonrpc:T(A9),id:K9.optional(),error:I({code:t().int(),message:V(),data:G0().optional()})}).strict();var UJ=(Q)=>yX.safeParse(Q).success;var OJ=W0([qJ,FJ,gX,yX]),Nb=W0([gX,yX]),D9=U0.strict(),pA=h0.extend({requestId:K9.optional(),reason:V().optional()}),L9=f0.extend({method:T("notifications/cancelled"),params:pA}),iA=I({src:V(),mimeType:V().optional(),sizes:i(V()).optional(),theme:I0(["light","dark"]).optional()}),W4=I({icons:i(iA).optional()}),J6=I({name:V(),title:V().optional()}),NJ=J6.extend({...J6.shape,...W4.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),nA=B9(I({applyDefaults:q0().optional()}),Y0(V(),G0())),dA=vX((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},B9(I({form:nA.optional(),url:L0.optional()}),Y0(V(),G0()).optional())),oA=b0({list:L0.optional(),cancel:L0.optional(),requests:b0({sampling:b0({createMessage:L0.optional()}).optional(),elicitation:b0({create:L0.optional()}).optional()}).optional()}),rA=b0({list:L0.optional(),cancel:L0.optional(),requests:b0({tools:b0({call:L0.optional()}).optional()}).optional()}),tA=I({experimental:Y0(V(),L0).optional(),sampling:I({context:L0.optional(),tools:L0.optional()}).optional(),elicitation:dA.optional(),roots:I({listChanged:q0().optional()}).optional(),tasks:oA.optional(),extensions:Y0(V(),L0).optional()}),aA=x0.extend({protocolVersion:V(),capabilities:tA,clientInfo:NJ}),hX=V0.extend({method:T("initialize"),params:aA});var sA=I({experimental:Y0(V(),L0).optional(),logging:L0.optional(),completions:L0.optional(),prompts:I({listChanged:q0().optional()}).optional(),resources:I({subscribe:q0().optional(),listChanged:q0().optional()}).optional(),tools:I({listChanged:q0().optional()}).optional(),tasks:rA.optional(),extensions:Y0(V(),L0).optional()}),eA=U0.extend({protocolVersion:V(),capabilities:sA,serverInfo:NJ,instructions:V().optional()}),fX=f0.extend({method:T("notifications/initialized"),params:h0.optional()});var q9=V0.extend({method:T("ping"),params:x0.optional()}),QK=I({progress:t(),total:H0(t()),message:H0(V())}),XK=I({...h0.shape,...QK.shape,progressToken:KJ}),F9=f0.extend({method:T("notifications/progress"),params:XK}),YK=x0.extend({cursor:DJ.optional()}),$4=V0.extend({params:YK.optional()}),J4=U0.extend({nextCursor:DJ.optional()}),WK=I0(["working","input_required","completed","failed","cancelled"]),G4=I({taskId:V(),status:WK,ttl:W0([t(),YJ()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:H0(t()),statusMessage:H0(V())}),G6=U0.extend({task:G4}),$K=h0.merge(G4),H4=f0.extend({method:T("notifications/tasks/status"),params:$K}),V9=V0.extend({method:T("tasks/get"),params:x0.extend({taskId:V()})}),U9=U0.merge(G4),O9=V0.extend({method:T("tasks/result"),params:x0.extend({taskId:V()})}),wb=U0.loose(),N9=$4.extend({method:T("tasks/list")}),w9=J4.extend({tasks:i(G4)}),M9=V0.extend({method:T("tasks/cancel"),params:x0.extend({taskId:V()})}),wJ=U0.merge(G4),MJ=I({uri:V(),mimeType:H0(V()),_meta:Y0(V(),G0()).optional()}),jJ=MJ.extend({text:V()}),uX=V().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),bJ=MJ.extend({blob:uX}),B4=I0(["user","assistant"]),H6=I({audience:i(B4).optional(),priority:t().min(0).max(1).optional(),lastModified:e6.datetime({offset:!0}).optional()}),EJ=I({...J6.shape,...W4.shape,uri:V(),description:H0(V()),mimeType:H0(V()),size:H0(t()),annotations:H6.optional(),_meta:H0(b0({}))}),JK=I({...J6.shape,...W4.shape,uriTemplate:V(),description:H0(V()),mimeType:H0(V()),annotations:H6.optional(),_meta:H0(b0({}))}),j9=$4.extend({method:T("resources/list")}),GK=J4.extend({resources:i(EJ)}),b9=$4.extend({method:T("resources/templates/list")}),HK=J4.extend({resourceTemplates:i(JK)}),lX=x0.extend({uri:V()}),BK=lX,E9=V0.extend({method:T("resources/read"),params:BK}),zK=U0.extend({contents:i(W0([jJ,bJ]))}),AK=f0.extend({method:T("notifications/resources/list_changed"),params:h0.optional()}),KK=lX,DK=V0.extend({method:T("resources/subscribe"),params:KK}),LK=lX,qK=V0.extend({method:T("resources/unsubscribe"),params:LK}),FK=h0.extend({uri:V()}),VK=f0.extend({method:T("notifications/resources/updated"),params:FK}),UK=I({name:V(),description:H0(V()),required:H0(q0())}),OK=I({...J6.shape,...W4.shape,description:H0(V()),arguments:H0(i(UK)),_meta:H0(b0({}))}),S9=$4.extend({method:T("prompts/list")}),NK=J4.extend({prompts:i(OK)}),wK=x0.extend({name:V(),arguments:Y0(V(),V()).optional()}),P9=V0.extend({method:T("prompts/get"),params:wK}),mX=I({type:T("text"),text:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),cX=I({type:T("image"),data:uX,mimeType:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),pX=I({type:T("audio"),data:uX,mimeType:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),MK=I({type:T("tool_use"),name:V(),id:V(),input:Y0(V(),G0()),_meta:Y0(V(),G0()).optional()}),jK=I({type:T("resource"),resource:W0([jJ,bJ]),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),bK=EJ.extend({type:T("resource_link")}),iX=W0([mX,cX,pX,bK,jK]),EK=I({role:B4,content:iX}),SK=U0.extend({description:V().optional(),messages:i(EK)}),PK=f0.extend({method:T("notifications/prompts/list_changed"),params:h0.optional()}),IK=I({title:V().optional(),readOnlyHint:q0().optional(),destructiveHint:q0().optional(),idempotentHint:q0().optional(),openWorldHint:q0().optional()}),RK=I({taskSupport:I0(["required","optional","forbidden"]).optional()}),SJ=I({...J6.shape,...W4.shape,description:V().optional(),inputSchema:I({type:T("object"),properties:Y0(V(),L0).optional(),required:i(V()).optional()}).catchall(G0()),outputSchema:I({type:T("object"),properties:Y0(V(),L0).optional(),required:i(V()).optional()}).catchall(G0()).optional(),annotations:IK.optional(),execution:RK.optional(),_meta:Y0(V(),G0()).optional()}),I9=$4.extend({method:T("tools/list")}),CK=J4.extend({tools:i(SJ)}),R9=U0.extend({content:i(iX).default([]),structuredContent:Y0(V(),G0()).optional(),isError:q0().optional()}),Mb=R9.or(U0.extend({toolResult:G0()})),TK=X4.extend({name:V(),arguments:Y0(V(),G0()).optional()}),B6=V0.extend({method:T("tools/call"),params:TK}),ZK=f0.extend({method:T("notifications/tools/list_changed"),params:h0.optional()}),jb=I({autoRefresh:q0().default(!0),debounceMs:t().int().nonnegative().default(300)}),z4=I0(["debug","info","notice","warning","error","critical","alert","emergency"]),vK=x0.extend({level:z4}),nX=V0.extend({method:T("logging/setLevel"),params:vK}),kK=h0.extend({level:z4,logger:V().optional(),data:G0()}),_K=f0.extend({method:T("notifications/message"),params:kK}),xK=I({name:V().optional()}),gK=I({hints:i(xK).optional(),costPriority:t().min(0).max(1).optional(),speedPriority:t().min(0).max(1).optional(),intelligencePriority:t().min(0).max(1).optional()}),yK=I({mode:I0(["auto","required","none"]).optional()}),hK=I({type:T("tool_result"),toolUseId:V().describe("The unique identifier for the corresponding tool call."),content:i(iX).default([]),structuredContent:I({}).loose().optional(),isError:q0().optional(),_meta:Y0(V(),G0()).optional()}),fK=ZX("type",[mX,cX,pX]),z9=ZX("type",[mX,cX,pX,MK,hK]),uK=I({role:B4,content:W0([z9,i(z9)]),_meta:Y0(V(),G0()).optional()}),lK=X4.extend({messages:i(uK),modelPreferences:gK.optional(),systemPrompt:V().optional(),includeContext:I0(["none","thisServer","allServers"]).optional(),temperature:t().optional(),maxTokens:t().int(),stopSequences:i(V()).optional(),metadata:L0.optional(),tools:i(SJ).optional(),toolChoice:yK.optional()}),mK=V0.extend({method:T("sampling/createMessage"),params:lK}),A4=U0.extend({model:V(),stopReason:H0(I0(["endTurn","stopSequence","maxTokens"]).or(V())),role:B4,content:fK}),dX=U0.extend({model:V(),stopReason:H0(I0(["endTurn","stopSequence","maxTokens","toolUse"]).or(V())),role:B4,content:W0([z9,i(z9)])}),cK=I({type:T("boolean"),title:V().optional(),description:V().optional(),default:q0().optional()}),pK=I({type:T("string"),title:V().optional(),description:V().optional(),minLength:t().optional(),maxLength:t().optional(),format:I0(["email","uri","date","date-time"]).optional(),default:V().optional()}),iK=I({type:I0(["number","integer"]),title:V().optional(),description:V().optional(),minimum:t().optional(),maximum:t().optional(),default:t().optional()}),nK=I({type:T("string"),title:V().optional(),description:V().optional(),enum:i(V()),default:V().optional()}),dK=I({type:T("string"),title:V().optional(),description:V().optional(),oneOf:i(I({const:V(),title:V()})),default:V().optional()}),oK=I({type:T("string"),title:V().optional(),description:V().optional(),enum:i(V()),enumNames:i(V()).optional(),default:V().optional()}),rK=W0([nK,dK]),tK=I({type:T("array"),title:V().optional(),description:V().optional(),minItems:t().optional(),maxItems:t().optional(),items:I({type:T("string"),enum:i(V())}),default:i(V()).optional()}),aK=I({type:T("array"),title:V().optional(),description:V().optional(),minItems:t().optional(),maxItems:t().optional(),items:I({anyOf:i(I({const:V(),title:V()}))}),default:i(V()).optional()}),sK=W0([tK,aK]),eK=W0([oK,rK,sK]),QD=W0([eK,cK,pK,iK]),XD=X4.extend({mode:T("form").optional(),message:V(),requestedSchema:I({type:T("object"),properties:Y0(V(),QD),required:i(V()).optional()})}),YD=X4.extend({mode:T("url"),message:V(),elicitationId:V(),url:V().url()}),WD=W0([XD,YD]),$D=V0.extend({method:T("elicitation/create"),params:WD}),JD=h0.extend({elicitationId:V()}),GD=f0.extend({method:T("notifications/elicitation/complete"),params:JD}),z6=U0.extend({action:I0(["accept","decline","cancel"]),content:vX((Q)=>Q===null?void 0:Q,Y0(V(),W0([V(),t(),q0(),i(V())])).optional())}),HD=I({type:T("ref/resource"),uri:V()});var BD=I({type:T("ref/prompt"),name:V()}),zD=x0.extend({ref:W0([BD,HD]),argument:I({name:V(),value:V()}),context:I({arguments:Y0(V(),V()).optional()}).optional()}),C9=V0.extend({method:T("completion/complete"),params:zD});function PJ(Q){if(Q.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${Q.params.ref.type}`)}function IJ(Q){if(Q.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${Q.params.ref.type}`)}var AD=U0.extend({completion:b0({values:i(V()).max(100),total:H0(t().int()),hasMore:H0(q0())})}),KD=I({uri:V().startsWith("file://"),name:V().optional(),_meta:Y0(V(),G0()).optional()}),DD=V0.extend({method:T("roots/list"),params:x0.optional()}),oX=U0.extend({roots:i(KD)}),LD=f0.extend({method:T("notifications/roots/list_changed"),params:h0.optional()}),bb=W0([q9,hX,C9,nX,P9,S9,j9,b9,E9,DK,qK,B6,I9,V9,O9,N9,M9]),Eb=W0([L9,F9,fX,LD,H4]),Sb=W0([D9,A4,dX,z6,oX,U9,w9,G6]),Pb=W0([q9,mK,$D,DD,V9,O9,N9,M9]),Ib=W0([L9,F9,_K,VK,AK,ZK,PK,H4,GD]),Rb=W0([D9,eA,AD,SK,NK,GK,HK,zK,R9,CK,U9,w9,G6]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===v.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new RJ(W.elicitations,X)}return new C(Q,X,Y)}}class RJ extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(v.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}class rX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
37
- `);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),qD(X)}clear(){this._buffer=void 0}}function qD(Q){return OJ.parse(JSON.parse(Q))}function CJ(Q){return JSON.stringify(Q)+`
38
- `}class tX{constructor(Q=TJ.stdin,X=TJ.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new rX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=CJ(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var s={};P8(s,{void:()=>sD,util:()=>c,unknown:()=>tD,union:()=>XL,undefined:()=>dD,tuple:()=>$L,transformer:()=>qL,symbol:()=>nD,string:()=>fJ,strictObject:()=>QL,setErrorMap:()=>UD,set:()=>HL,record:()=>JL,quotelessJson:()=>FD,promise:()=>LL,preprocess:()=>UL,pipeline:()=>OL,ostring:()=>NL,optional:()=>FL,onumber:()=>wL,oboolean:()=>ML,objectUtil:()=>aX,object:()=>QY,number:()=>uJ,nullable:()=>VL,null:()=>oD,never:()=>aD,nativeEnum:()=>DL,nan:()=>cD,map:()=>GL,makeIssue:()=>K4,literal:()=>AL,lazy:()=>zL,late:()=>lD,isValid:()=>w1,isDirty:()=>Z9,isAsync:()=>K6,isAborted:()=>T9,intersection:()=>WL,instanceof:()=>mD,getParsedType:()=>$1,getErrorMap:()=>A6,function:()=>BL,enum:()=>KL,effect:()=>qL,discriminatedUnion:()=>YL,defaultErrorMap:()=>z1,datetimeRegex:()=>gJ,date:()=>iD,custom:()=>hJ,coerce:()=>jL,boolean:()=>lJ,bigint:()=>pD,array:()=>eD,any:()=>rD,addIssueToContext:()=>S,ZodVoid:()=>L4,ZodUnknown:()=>M1,ZodUnion:()=>U6,ZodUndefined:()=>F6,ZodType:()=>m,ZodTuple:()=>G1,ZodTransformer:()=>o0,ZodSymbol:()=>D4,ZodString:()=>i0,ZodSet:()=>i1,ZodSchema:()=>m,ZodRecord:()=>q4,ZodReadonly:()=>E6,ZodPromise:()=>n1,ZodPipeline:()=>U4,ZodParsedType:()=>j,ZodOptional:()=>g0,ZodObject:()=>A0,ZodNumber:()=>j1,ZodNullable:()=>K1,ZodNull:()=>V6,ZodNever:()=>J1,ZodNativeEnum:()=>M6,ZodNaN:()=>V4,ZodMap:()=>F4,ZodLiteral:()=>w6,ZodLazy:()=>N6,ZodIssueCode:()=>w,ZodIntersection:()=>O6,ZodFunction:()=>L6,ZodFirstPartyTypeKind:()=>M,ZodError:()=>R0,ZodEnum:()=>E1,ZodEffects:()=>o0,ZodDiscriminatedUnion:()=>v9,ZodDefault:()=>j6,ZodDate:()=>c1,ZodCatch:()=>b6,ZodBranded:()=>k9,ZodBoolean:()=>q6,ZodBigInt:()=>b1,ZodArray:()=>n0,ZodAny:()=>p1,Schema:()=>m,ParseStatus:()=>O0,OK:()=>w0,NEVER:()=>bL,INVALID:()=>_,EMPTY_PATH:()=>OD,DIRTY:()=>m1,BRAND:()=>uD});var c;(function(Q){Q.assertEqual=($)=>{};function X($){}Q.assertIs=X;function Y($){throw Error()}Q.assertNever=Y,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 W($,J=" | "){return $.map((G)=>typeof G==="string"?`'${G}'`:G).join(J)}Q.joinValues=W,Q.jsonStringifyReplacer=($,J)=>{if(typeof J==="bigint")return J.toString();return J}})(c||(c={}));var aX;(function(Q){Q.mergeShapes=(X,Y)=>{return{...X,...Y}}})(aX||(aX={}));var j=c.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 j.undefined;case"string":return j.string;case"number":return Number.isNaN(Q)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":if(Array.isArray(Q))return j.array;if(Q===null)return j.null;if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return j.promise;if(typeof Map<"u"&&Q instanceof Map)return j.map;if(typeof Set<"u"&&Q instanceof Set)return j.set;if(typeof Date<"u"&&Q instanceof Date)return j.date;return j.object;default:return j.unknown}};var w=c.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"]),FD=(Q)=>{return JSON.stringify(Q,null,2).replace(/"([^"]+)":/g,"$1:")};class R0 extends Error{get errors(){return this.issues}constructor(Q){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};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},Y={_errors:[]},W=($)=>{for(let J of $.issues)if(J.code==="invalid_union")J.unionErrors.map(W);else if(J.code==="invalid_return_type")W(J.returnTypeError);else if(J.code==="invalid_arguments")W(J.argumentsError);else if(J.path.length===0)Y._errors.push(X(J));else{let G=Y,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 W(this),Y}static assert(Q){if(!(Q instanceof R0))throw Error(`Not a ZodError: ${Q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(Q=(X)=>X.message){let X={},Y=[];for(let W of this.issues)if(W.path.length>0){let $=W.path[0];X[$]=X[$]||[],X[$].push(Q(W))}else Y.push(Q(W));return{formErrors:Y,fieldErrors:X}}get formErrors(){return this.flatten()}}R0.create=(Q)=>{return new R0(Q)};var VD=(Q,X)=>{let Y;switch(Q.code){case w.invalid_type:if(Q.received===j.undefined)Y="Required";else Y=`Expected ${Q.expected}, received ${Q.received}`;break;case w.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(Q.expected,c.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:Y=`Unrecognized key(s) in object: ${c.joinValues(Q.keys,", ")}`;break;case w.invalid_union:Y="Invalid input";break;case w.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${c.joinValues(Q.options)}`;break;case w.invalid_enum_value:Y=`Invalid enum value. Expected ${c.joinValues(Q.options)}, received '${Q.received}'`;break;case w.invalid_arguments:Y="Invalid function arguments";break;case w.invalid_return_type:Y="Invalid function return type";break;case w.invalid_date:Y="Invalid date";break;case w.invalid_string:if(typeof Q.validation==="object")if("includes"in Q.validation){if(Y=`Invalid input: must include "${Q.validation.includes}"`,typeof Q.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${Q.validation.position}`}else if("startsWith"in Q.validation)Y=`Invalid input: must start with "${Q.validation.startsWith}"`;else if("endsWith"in Q.validation)Y=`Invalid input: must end with "${Q.validation.endsWith}"`;else c.assertNever(Q.validation);else if(Q.validation!=="regex")Y=`Invalid ${Q.validation}`;else Y="Invalid";break;case w.too_small:if(Q.type==="array")Y=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at least":"more than"} ${Q.minimum} element(s)`;else if(Q.type==="string")Y=`String must contain ${Q.exact?"exactly":Q.inclusive?"at least":"over"} ${Q.minimum} character(s)`;else if(Q.type==="number")Y=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="bigint")Y=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="date")Y=`Date must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(Q.minimum))}`;else Y="Invalid input";break;case w.too_big:if(Q.type==="array")Y=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at most":"less than"} ${Q.maximum} element(s)`;else if(Q.type==="string")Y=`String must contain ${Q.exact?"exactly":Q.inclusive?"at most":"under"} ${Q.maximum} character(s)`;else if(Q.type==="number")Y=`Number must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="bigint")Y=`BigInt must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="date")Y=`Date must be ${Q.exact?"exactly":Q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(Q.maximum))}`;else Y="Invalid input";break;case w.custom:Y="Invalid input";break;case w.invalid_intersection_types:Y="Intersection results could not be merged";break;case w.not_multiple_of:Y=`Number must be a multiple of ${Q.multipleOf}`;break;case w.not_finite:Y="Number must be finite";break;default:Y=X.defaultError,c.assertNever(Q)}return{message:Y}},z1=VD;var ZJ=z1;function UD(Q){ZJ=Q}function A6(){return ZJ}var K4=(Q)=>{let{data:X,path:Y,errorMaps:W,issueData:$}=Q,J=[...Y,...$.path||[]],G={...$,path:J};if($.message!==void 0)return{...$,path:J,message:$.message};let H="",B=W.filter((z)=>!!z).slice().reverse();for(let z of B)H=z(G,{data:X,defaultError:H}).message;return{...$,path:J,message:H}},OD=[];function S(Q,X){let Y=A6(),W=K4({issueData:X,data:Q.data,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,Y,Y===z1?void 0:z1].filter(($)=>!!$)});Q.common.issues.push(W)}class O0{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 Y=[];for(let W of X){if(W.status==="aborted")return _;if(W.status==="dirty")Q.dirty();Y.push(W.value)}return{status:Q.value,value:Y}}static async mergeObjectAsync(Q,X){let Y=[];for(let W of X){let $=await W.key,J=await W.value;Y.push({key:$,value:J})}return O0.mergeObjectSync(Q,Y)}static mergeObjectSync(Q,X){let Y={};for(let W of X){let{key:$,value:J}=W;if($.status==="aborted")return _;if(J.status==="aborted")return _;if($.status==="dirty")Q.dirty();if(J.status==="dirty")Q.dirty();if($.value!=="__proto__"&&(typeof J.value<"u"||W.alwaysSet))Y[$.value]=J.value}return{status:Q.value,value:Y}}}var _=Object.freeze({status:"aborted"}),m1=(Q)=>({status:"dirty",value:Q}),w0=(Q)=>({status:"valid",value:Q}),T9=(Q)=>Q.status==="aborted",Z9=(Q)=>Q.status==="dirty",w1=(Q)=>Q.status==="valid",K6=(Q)=>typeof Promise<"u"&&Q instanceof Promise;var R;(function(Q){Q.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},Q.toString=(X)=>typeof X==="string"?X:X?.message})(R||(R={}));class d0{constructor(Q,X,Y,W){this._cachedPath=[],this.parent=Q,this.data=X,this._path=Y,this._key=W}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 vJ=(Q,X)=>{if(w1(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 Y=new R0(Q.common.issues);return this._error=Y,this._error}}}};function f(Q){if(!Q)return{};let{errorMap:X,invalid_type_error:Y,required_error:W,description:$}=Q;if(X&&(Y||W))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??W??H.defaultError};if(G.code!=="invalid_type")return{message:H.defaultError};return{message:B??Y??H.defaultError}},description:$}}class m{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 O0,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(K6(X))throw Error("Synchronous parse encountered promise.");return X}_parseAsync(Q){let X=this._parse(Q);return Promise.resolve(X)}parse(Q,X){let Y=this.safeParse(Q,X);if(Y.success)return Y.data;throw Y.error}safeParse(Q,X){let Y={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:$1(Q)},W=this._parseSync({data:Q,path:Y.path,parent:Y});return vJ(Y,W)}"~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 Y=this._parseSync({data:Q,path:[],parent:X});return w1(Y)?{value:Y.value}:{issues:X.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:Q,path:[],parent:X}).then((Y)=>w1(Y)?{value:Y.value}:{issues:X.common.issues})}async parseAsync(Q,X){let Y=await this.safeParseAsync(Q,X);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(Q,X){let Y={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:$1(Q)},W=this._parse({data:Q,path:Y.path,parent:Y}),$=await(K6(W)?W:Promise.resolve(W));return vJ(Y,$)}refine(Q,X){let Y=(W)=>{if(typeof X==="string"||typeof X>"u")return{message:X};else if(typeof X==="function")return X(W);else return X};return this._refinement((W,$)=>{let J=Q(W),G=()=>$.addIssue({code:w.custom,...Y(W)});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((Y,W)=>{if(!Q(Y))return W.addIssue(typeof X==="function"?X(Y,W):X),!1;else return!0})}_refinement(Q){return new o0({schema:this,typeName:M.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 g0.create(this,this._def)}nullable(){return K1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return n0.create(this)}promise(){return n1.create(this,this._def)}or(Q){return U6.create([this,Q],this._def)}and(Q){return O6.create(this,Q,this._def)}transform(Q){return new o0({...f(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:Q}})}default(Q){let X=typeof Q==="function"?Q:()=>Q;return new j6({...f(this._def),innerType:this,defaultValue:X,typeName:M.ZodDefault})}brand(){return new k9({typeName:M.ZodBranded,type:this,...f(this._def)})}catch(Q){let X=typeof Q==="function"?Q:()=>Q;return new b6({...f(this._def),innerType:this,catchValue:X,typeName:M.ZodCatch})}describe(Q){return new this.constructor({...this._def,description:Q})}pipe(Q){return U4.create(this,Q)}readonly(){return E6.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var ND=/^c[^\s-]{8,}$/i,wD=/^[0-9a-z]+$/,MD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jD=/^[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,bD=/^[a-z0-9_-]{21}$/i,ED=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SD=/^[-+]?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)?)??$/,PD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ID="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",sX,RD=/^(?:(?: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])$/,CD=/^(?:(?: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])$/,TD=/^(([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]))$/,ZD=/^(([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])$/,vD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_J="((\\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])))",_D=new RegExp(`^${_J}$`);function xJ(Q){let X="[0-5]\\d";if(Q.precision)X=`${X}\\.\\d{${Q.precision}}`;else if(Q.precision==null)X=`${X}(\\.\\d+)?`;let Y=Q.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${Y}`}function xD(Q){return new RegExp(`^${xJ(Q)}$`)}function gJ(Q){let X=`${_J}T${xJ(Q)}`,Y=[];if(Y.push(Q.local?"Z?":"Z"),Q.offset)Y.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Y.join("|")})`,new RegExp(`^${X}$`)}function gD(Q,X){if((X==="v4"||!X)&&RD.test(Q))return!0;if((X==="v6"||!X)&&TD.test(Q))return!0;return!1}function yD(Q,X){if(!ED.test(Q))return!1;try{let[Y]=Q.split(".");if(!Y)return!1;let W=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),$=JSON.parse(atob(W));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 hD(Q,X){if((X==="v4"||!X)&&CD.test(Q))return!0;if((X==="v6"||!X)&&ZD.test(Q))return!0;return!1}class i0 extends m{_parse(Q){if(this._def.coerce)Q.data=String(Q.data);if(this._getType(Q)!==j.string){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.string,received:$.parsedType}),_}let Y=new O0,W=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.length<$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="max"){if(Q.data.length>$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="length"){let J=Q.data.length>$.value,G=Q.data.length<$.value;if(J||G){if(W=this._getOrReturnCtx(Q,W),J)S(W,{code:w.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(G)S(W,{code:w.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});Y.dirty()}}else if($.kind==="email"){if(!PD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"email",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="emoji"){if(!sX)sX=new RegExp(ID,"u");if(!sX.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"emoji",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="uuid"){if(!jD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"uuid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="nanoid"){if(!bD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"nanoid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cuid"){if(!ND.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cuid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cuid2"){if(!wD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cuid2",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="ulid"){if(!MD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"ulid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="url")try{new URL(Q.data)}catch{W=this._getOrReturnCtx(Q,W),S(W,{validation:"url",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"regex",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="trim")Q.data=Q.data.trim();else if($.kind==="includes"){if(!Q.data.includes($.value,$.position))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),Y.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))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{startsWith:$.value},message:$.message}),Y.dirty()}else if($.kind==="endsWith"){if(!Q.data.endsWith($.value))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{endsWith:$.value},message:$.message}),Y.dirty()}else if($.kind==="datetime"){if(!gJ($).test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"datetime",message:$.message}),Y.dirty()}else if($.kind==="date"){if(!_D.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"date",message:$.message}),Y.dirty()}else if($.kind==="time"){if(!xD($).test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"time",message:$.message}),Y.dirty()}else if($.kind==="duration"){if(!SD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"duration",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="ip"){if(!gD(Q.data,$.version))W=this._getOrReturnCtx(Q,W),S(W,{validation:"ip",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="jwt"){if(!yD(Q.data,$.alg))W=this._getOrReturnCtx(Q,W),S(W,{validation:"jwt",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cidr"){if(!hD(Q.data,$.version))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cidr",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="base64"){if(!vD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"base64",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="base64url"){if(!kD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"base64url",code:w.invalid_string,message:$.message}),Y.dirty()}else c.assertNever($);return{status:Y.value,value:Q.data}}_regex(Q,X,Y){return this.refinement((W)=>Q.test(W),{validation:X,code:w.invalid_string,...R.errToObj(Y)})}_addCheck(Q){return new i0({...this._def,checks:[...this._def.checks,Q]})}email(Q){return this._addCheck({kind:"email",...R.errToObj(Q)})}url(Q){return this._addCheck({kind:"url",...R.errToObj(Q)})}emoji(Q){return this._addCheck({kind:"emoji",...R.errToObj(Q)})}uuid(Q){return this._addCheck({kind:"uuid",...R.errToObj(Q)})}nanoid(Q){return this._addCheck({kind:"nanoid",...R.errToObj(Q)})}cuid(Q){return this._addCheck({kind:"cuid",...R.errToObj(Q)})}cuid2(Q){return this._addCheck({kind:"cuid2",...R.errToObj(Q)})}ulid(Q){return this._addCheck({kind:"ulid",...R.errToObj(Q)})}base64(Q){return this._addCheck({kind:"base64",...R.errToObj(Q)})}base64url(Q){return this._addCheck({kind:"base64url",...R.errToObj(Q)})}jwt(Q){return this._addCheck({kind:"jwt",...R.errToObj(Q)})}ip(Q){return this._addCheck({kind:"ip",...R.errToObj(Q)})}cidr(Q){return this._addCheck({kind:"cidr",...R.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,...R.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,...R.errToObj(Q?.message)})}duration(Q){return this._addCheck({kind:"duration",...R.errToObj(Q)})}regex(Q,X){return this._addCheck({kind:"regex",regex:Q,...R.errToObj(X)})}includes(Q,X){return this._addCheck({kind:"includes",value:Q,position:X?.position,...R.errToObj(X?.message)})}startsWith(Q,X){return this._addCheck({kind:"startsWith",value:Q,...R.errToObj(X)})}endsWith(Q,X){return this._addCheck({kind:"endsWith",value:Q,...R.errToObj(X)})}min(Q,X){return this._addCheck({kind:"min",value:Q,...R.errToObj(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q,...R.errToObj(X)})}length(Q,X){return this._addCheck({kind:"length",value:Q,...R.errToObj(X)})}nonempty(Q){return this.min(1,R.errToObj(Q))}trim(){return new i0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i0({...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}}i0.create=(Q)=>{return new i0({checks:[],typeName:M.ZodString,coerce:Q?.coerce??!1,...f(Q)})};function fD(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,$=Y>W?Y:W,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}class j1 extends m{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)!==j.number){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.number,received:$.parsedType}),_}let Y=void 0,W=new O0;for(let $ of this._def.checks)if($.kind==="int"){if(!c.isInteger(Q.data))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.invalid_type,expected:"integer",received:"float",message:$.message}),W.dirty()}else if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),W.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),W.dirty()}else if($.kind==="multipleOf"){if(fD(Q.data,$.value)!==0)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_multiple_of,multipleOf:$.value,message:$.message}),W.dirty()}else if($.kind==="finite"){if(!Number.isFinite(Q.data))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_finite,message:$.message}),W.dirty()}else c.assertNever($);return{status:W.value,value:Q.data}}gte(Q,X){return this.setLimit("min",Q,!0,R.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,R.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,R.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,R.toString(X))}setLimit(Q,X,Y,W){return new j1({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:Y,message:R.toString(W)}]})}_addCheck(Q){return new j1({...this._def,checks:[...this._def.checks,Q]})}int(Q){return this._addCheck({kind:"int",message:R.toString(Q)})}positive(Q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:R.toString(X)})}finite(Q){return this._addCheck({kind:"finite",message:R.toString(Q)})}safe(Q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(Q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.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"&&c.isInteger(Q.value))}get isFinite(){let Q=null,X=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}else if(Y.kind==="max"){if(Q===null||Y.value<Q)Q=Y.value}return Number.isFinite(X)&&Number.isFinite(Q)}}j1.create=(Q)=>{return new j1({checks:[],typeName:M.ZodNumber,coerce:Q?.coerce||!1,...f(Q)})};class b1 extends m{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)!==j.bigint)return this._getInvalidInput(Q);let Y=void 0,W=new O0;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),W.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),W.dirty()}else if($.kind==="multipleOf"){if(Q.data%$.value!==BigInt(0))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_multiple_of,multipleOf:$.value,message:$.message}),W.dirty()}else c.assertNever($);return{status:W.value,value:Q.data}}_getInvalidInput(Q){let X=this._getOrReturnCtx(Q);return S(X,{code:w.invalid_type,expected:j.bigint,received:X.parsedType}),_}gte(Q,X){return this.setLimit("min",Q,!0,R.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,R.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,R.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,R.toString(X))}setLimit(Q,X,Y,W){return new b1({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:Y,message:R.toString(W)}]})}_addCheck(Q){return new b1({...this._def,checks:[...this._def.checks,Q]})}positive(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:R.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}}b1.create=(Q)=>{return new b1({checks:[],typeName:M.ZodBigInt,coerce:Q?.coerce??!1,...f(Q)})};class q6 extends m{_parse(Q){if(this._def.coerce)Q.data=Boolean(Q.data);if(this._getType(Q)!==j.boolean){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.boolean,received:Y.parsedType}),_}return w0(Q.data)}}q6.create=(Q)=>{return new q6({typeName:M.ZodBoolean,coerce:Q?.coerce||!1,...f(Q)})};class c1 extends m{_parse(Q){if(this._def.coerce)Q.data=new Date(Q.data);if(this._getType(Q)!==j.date){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.date,received:$.parsedType}),_}if(Number.isNaN(Q.data.getTime())){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_date}),_}let Y=new O0,W=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.getTime()<$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),Y.dirty()}else if($.kind==="max"){if(Q.data.getTime()>$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),Y.dirty()}else c.assertNever($);return{status:Y.value,value:new Date(Q.data.getTime())}}_addCheck(Q){return new c1({...this._def,checks:[...this._def.checks,Q]})}min(Q,X){return this._addCheck({kind:"min",value:Q.getTime(),message:R.toString(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q.getTime(),message:R.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}}c1.create=(Q)=>{return new c1({checks:[],coerce:Q?.coerce||!1,typeName:M.ZodDate,...f(Q)})};class D4 extends m{_parse(Q){if(this._getType(Q)!==j.symbol){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.symbol,received:Y.parsedType}),_}return w0(Q.data)}}D4.create=(Q)=>{return new D4({typeName:M.ZodSymbol,...f(Q)})};class F6 extends m{_parse(Q){if(this._getType(Q)!==j.undefined){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.undefined,received:Y.parsedType}),_}return w0(Q.data)}}F6.create=(Q)=>{return new F6({typeName:M.ZodUndefined,...f(Q)})};class V6 extends m{_parse(Q){if(this._getType(Q)!==j.null){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.null,received:Y.parsedType}),_}return w0(Q.data)}}V6.create=(Q)=>{return new V6({typeName:M.ZodNull,...f(Q)})};class p1 extends m{constructor(){super(...arguments);this._any=!0}_parse(Q){return w0(Q.data)}}p1.create=(Q)=>{return new p1({typeName:M.ZodAny,...f(Q)})};class M1 extends m{constructor(){super(...arguments);this._unknown=!0}_parse(Q){return w0(Q.data)}}M1.create=(Q)=>{return new M1({typeName:M.ZodUnknown,...f(Q)})};class J1 extends m{_parse(Q){let X=this._getOrReturnCtx(Q);return S(X,{code:w.invalid_type,expected:j.never,received:X.parsedType}),_}}J1.create=(Q)=>{return new J1({typeName:M.ZodNever,...f(Q)})};class L4 extends m{_parse(Q){if(this._getType(Q)!==j.undefined){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.void,received:Y.parsedType}),_}return w0(Q.data)}}L4.create=(Q)=>{return new L4({typeName:M.ZodVoid,...f(Q)})};class n0 extends m{_parse(Q){let{ctx:X,status:Y}=this._processInputParams(Q),W=this._def;if(X.parsedType!==j.array)return S(X,{code:w.invalid_type,expected:j.array,received:X.parsedType}),_;if(W.exactLength!==null){let J=X.data.length>W.exactLength.value,G=X.data.length<W.exactLength.value;if(J||G)S(X,{code:J?w.too_big:w.too_small,minimum:G?W.exactLength.value:void 0,maximum:J?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Y.dirty()}if(W.minLength!==null){if(X.data.length<W.minLength.value)S(X,{code:w.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Y.dirty()}if(W.maxLength!==null){if(X.data.length>W.maxLength.value)S(X,{code:w.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Y.dirty()}if(X.common.async)return Promise.all([...X.data].map((J,G)=>{return W.type._parseAsync(new d0(X,J,X.path,G))})).then((J)=>{return O0.mergeArray(Y,J)});let $=[...X.data].map((J,G)=>{return W.type._parseSync(new d0(X,J,X.path,G))});return O0.mergeArray(Y,$)}get element(){return this._def.type}min(Q,X){return new n0({...this._def,minLength:{value:Q,message:R.toString(X)}})}max(Q,X){return new n0({...this._def,maxLength:{value:Q,message:R.toString(X)}})}length(Q,X){return new n0({...this._def,exactLength:{value:Q,message:R.toString(X)}})}nonempty(Q){return this.min(1,Q)}}n0.create=(Q,X)=>{return new n0({type:Q,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...f(X)})};function D6(Q){if(Q instanceof A0){let X={};for(let Y in Q.shape){let W=Q.shape[Y];X[Y]=g0.create(D6(W))}return new A0({...Q._def,shape:()=>X})}else if(Q instanceof n0)return new n0({...Q._def,type:D6(Q.element)});else if(Q instanceof g0)return g0.create(D6(Q.unwrap()));else if(Q instanceof K1)return K1.create(D6(Q.unwrap()));else if(Q instanceof G1)return G1.create(Q.items.map((X)=>D6(X)));else return Q}class A0 extends m{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=c.objectKeys(Q);return this._cached={shape:Q,keys:X},this._cached}_parse(Q){if(this._getType(Q)!==j.object){let B=this._getOrReturnCtx(Q);return S(B,{code:w.invalid_type,expected:j.object,received:B.parsedType}),_}let{status:Y,ctx:W}=this._processInputParams(Q),{shape:$,keys:J}=this._getCached(),G=[];if(!(this._def.catchall instanceof J1&&this._def.unknownKeys==="strip")){for(let B in W.data)if(!J.includes(B))G.push(B)}let H=[];for(let B of J){let z=$[B],A=W.data[B];H.push({key:{status:"valid",value:B},value:z._parse(new d0(W,A,W.path,B)),alwaysSet:B in W.data})}if(this._def.catchall instanceof J1){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of G)H.push({key:{status:"valid",value:z},value:{status:"valid",value:W.data[z]}});else if(B==="strict"){if(G.length>0)S(W,{code:w.unrecognized_keys,keys:G}),Y.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 A=W.data[z];H.push({key:{status:"valid",value:z},value:B._parse(new d0(W,A,W.path,z)),alwaysSet:z in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of H){let A=await z.key,D=await z.value;B.push({key:A,value:D,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return O0.mergeObjectSync(Y,B)});else return O0.mergeObjectSync(Y,H)}get shape(){return this._def.shape()}strict(Q){return R.errToObj,new A0({...this._def,unknownKeys:"strict",...Q!==void 0?{errorMap:(X,Y)=>{let W=this._def.errorMap?.(X,Y).message??Y.defaultError;if(X.code==="unrecognized_keys")return{message:R.errToObj(Q).message??W};return{message:W}}}:{}})}strip(){return new A0({...this._def,unknownKeys:"strip"})}passthrough(){return new A0({...this._def,unknownKeys:"passthrough"})}extend(Q){return new A0({...this._def,shape:()=>({...this._def.shape(),...Q})})}merge(Q){return new A0({unknownKeys:Q._def.unknownKeys,catchall:Q._def.catchall,shape:()=>({...this._def.shape(),...Q._def.shape()}),typeName:M.ZodObject})}setKey(Q,X){return this.augment({[Q]:X})}catchall(Q){return new A0({...this._def,catchall:Q})}pick(Q){let X={};for(let Y of c.objectKeys(Q))if(Q[Y]&&this.shape[Y])X[Y]=this.shape[Y];return new A0({...this._def,shape:()=>X})}omit(Q){let X={};for(let Y of c.objectKeys(this.shape))if(!Q[Y])X[Y]=this.shape[Y];return new A0({...this._def,shape:()=>X})}deepPartial(){return D6(this)}partial(Q){let X={};for(let Y of c.objectKeys(this.shape)){let W=this.shape[Y];if(Q&&!Q[Y])X[Y]=W;else X[Y]=W.optional()}return new A0({...this._def,shape:()=>X})}required(Q){let X={};for(let Y of c.objectKeys(this.shape))if(Q&&!Q[Y])X[Y]=this.shape[Y];else{let $=this.shape[Y];while($ instanceof g0)$=$._def.innerType;X[Y]=$}return new A0({...this._def,shape:()=>X})}keyof(){return yJ(c.objectKeys(this.shape))}}A0.create=(Q,X)=>{return new A0({shape:()=>Q,unknownKeys:"strip",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};A0.strictCreate=(Q,X)=>{return new A0({shape:()=>Q,unknownKeys:"strict",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};A0.lazycreate=(Q,X)=>{return new A0({shape:Q,unknownKeys:"strip",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};class U6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=this._def.options;function W($){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 R0(G.ctx.common.issues));return S(X,{code:w.invalid_union,unionErrors:J}),_}if(X.common.async)return Promise.all(Y.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(W);else{let $=void 0,J=[];for(let H of Y){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 R0(H));return S(X,{code:w.invalid_union,unionErrors:G}),_}}get options(){return this._def.options}}U6.create=(Q,X)=>{return new U6({options:Q,typeName:M.ZodUnion,...f(X)})};var A1=(Q)=>{if(Q instanceof N6)return A1(Q.schema);else if(Q instanceof o0)return A1(Q.innerType());else if(Q instanceof w6)return[Q.value];else if(Q instanceof E1)return Q.options;else if(Q instanceof M6)return c.objectValues(Q.enum);else if(Q instanceof j6)return A1(Q._def.innerType);else if(Q instanceof F6)return[void 0];else if(Q instanceof V6)return[null];else if(Q instanceof g0)return[void 0,...A1(Q.unwrap())];else if(Q instanceof K1)return[null,...A1(Q.unwrap())];else if(Q instanceof k9)return A1(Q.unwrap());else if(Q instanceof E6)return A1(Q.unwrap());else if(Q instanceof b6)return A1(Q._def.innerType);else return[]};class v9 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.object)return S(X,{code:w.invalid_type,expected:j.object,received:X.parsedType}),_;let Y=this.discriminator,W=X.data[Y],$=this.optionsMap.get(W);if(!$)return S(X,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),_;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,Y){let W=new Map;for(let $ of X){let J=A1($.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(W.has(G))throw Error(`Discriminator property ${String(Q)} has duplicate value ${String(G)}`);W.set(G,$)}}return new v9({typeName:M.ZodDiscriminatedUnion,discriminator:Q,options:X,optionsMap:W,...f(Y)})}}function eX(Q,X){let Y=$1(Q),W=$1(X);if(Q===X)return{valid:!0,data:Q};else if(Y===j.object&&W===j.object){let $=c.objectKeys(X),J=c.objectKeys(Q).filter((H)=>$.indexOf(H)!==-1),G={...Q,...X};for(let H of J){let B=eX(Q[H],X[H]);if(!B.valid)return{valid:!1};G[H]=B.data}return{valid:!0,data:G}}else if(Y===j.array&&W===j.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=eX(G,H);if(!B.valid)return{valid:!1};$.push(B.data)}return{valid:!0,data:$}}else if(Y===j.date&&W===j.date&&+Q===+X)return{valid:!0,data:Q};else return{valid:!1}}class O6 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q),W=($,J)=>{if(T9($)||T9(J))return _;let G=eX($.value,J.value);if(!G.valid)return S(Y,{code:w.invalid_intersection_types}),_;if(Z9($)||Z9(J))X.dirty();return{status:X.value,value:G.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([$,J])=>W($,J));else return W(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}}O6.create=(Q,X,Y)=>{return new O6({left:Q,right:X,typeName:M.ZodIntersection,...f(Y)})};class G1 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.array)return S(Y,{code:w.invalid_type,expected:j.array,received:Y.parsedType}),_;if(Y.data.length<this._def.items.length)return S(Y,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;if(!this._def.rest&&Y.data.length>this._def.items.length)S(Y,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let $=[...Y.data].map((J,G)=>{let H=this._def.items[G]||this._def.rest;if(!H)return null;return H._parse(new d0(Y,J,Y.path,G))}).filter((J)=>!!J);if(Y.common.async)return Promise.all($).then((J)=>{return O0.mergeArray(X,J)});else return O0.mergeArray(X,$)}get items(){return this._def.items}rest(Q){return new G1({...this._def,rest:Q})}}G1.create=(Q,X)=>{if(!Array.isArray(Q))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new G1({items:Q,typeName:M.ZodTuple,rest:null,...f(X)})};class q4 extends m{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.object)return S(Y,{code:w.invalid_type,expected:j.object,received:Y.parsedType}),_;let W=[],$=this._def.keyType,J=this._def.valueType;for(let G in Y.data)W.push({key:$._parse(new d0(Y,G,Y.path,G)),value:J._parse(new d0(Y,Y.data[G],Y.path,G)),alwaysSet:G in Y.data});if(Y.common.async)return O0.mergeObjectAsync(X,W);else return O0.mergeObjectSync(X,W)}get element(){return this._def.valueType}static create(Q,X,Y){if(X instanceof m)return new q4({keyType:Q,valueType:X,typeName:M.ZodRecord,...f(Y)});return new q4({keyType:i0.create(),valueType:Q,typeName:M.ZodRecord,...f(X)})}}class F4 extends m{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.map)return S(Y,{code:w.invalid_type,expected:j.map,received:Y.parsedType}),_;let W=this._def.keyType,$=this._def.valueType,J=[...Y.data.entries()].map(([G,H],B)=>{return{key:W._parse(new d0(Y,G,Y.path,[B,"key"])),value:$._parse(new d0(Y,H,Y.path,[B,"value"]))}});if(Y.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 _;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 _;if(B.status==="dirty"||z.status==="dirty")X.dirty();G.set(B.value,z.value)}return{status:X.value,value:G}}}}F4.create=(Q,X,Y)=>{return new F4({valueType:X,keyType:Q,typeName:M.ZodMap,...f(Y)})};class i1 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.set)return S(Y,{code:w.invalid_type,expected:j.set,received:Y.parsedType}),_;let W=this._def;if(W.minSize!==null){if(Y.data.size<W.minSize.value)S(Y,{code:w.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),X.dirty()}if(W.maxSize!==null){if(Y.data.size>W.maxSize.value)S(Y,{code:w.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.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 _;if(z.status==="dirty")X.dirty();B.add(z.value)}return{status:X.value,value:B}}let G=[...Y.data.values()].map((H,B)=>$._parse(new d0(Y,H,Y.path,B)));if(Y.common.async)return Promise.all(G).then((H)=>J(H));else return J(G)}min(Q,X){return new i1({...this._def,minSize:{value:Q,message:R.toString(X)}})}max(Q,X){return new i1({...this._def,maxSize:{value:Q,message:R.toString(X)}})}size(Q,X){return this.min(Q,X).max(Q,X)}nonempty(Q){return this.min(1,Q)}}i1.create=(Q,X)=>{return new i1({valueType:Q,minSize:null,maxSize:null,typeName:M.ZodSet,...f(X)})};class L6 extends m{constructor(){super(...arguments);this.validate=this.implement}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.function)return S(X,{code:w.invalid_type,expected:j.function,received:X.parsedType}),_;function Y(G,H){return K4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,A6(),z1].filter((B)=>!!B),issueData:{code:w.invalid_arguments,argumentsError:H}})}function W(G,H){return K4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,A6(),z1].filter((B)=>!!B),issueData:{code:w.invalid_return_type,returnTypeError:H}})}let $={errorMap:X.common.contextualErrorMap},J=X.data;if(this._def.returns instanceof n1){let G=this;return w0(async function(...H){let B=new R0([]),z=await G._def.args.parseAsync(H,$).catch((L)=>{throw B.addIssue(Y(H,L)),B}),A=await Reflect.apply(J,this,z);return await G._def.returns._def.type.parseAsync(A,$).catch((L)=>{throw B.addIssue(W(A,L)),B})})}else{let G=this;return w0(function(...H){let B=G._def.args.safeParse(H,$);if(!B.success)throw new R0([Y(H,B.error)]);let z=Reflect.apply(J,this,B.data),A=G._def.returns.safeParse(z,$);if(!A.success)throw new R0([W(z,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...Q){return new L6({...this._def,args:G1.create(Q).rest(M1.create())})}returns(Q){return new L6({...this._def,returns:Q})}implement(Q){return this.parse(Q)}strictImplement(Q){return this.parse(Q)}static create(Q,X,Y){return new L6({args:Q?Q:G1.create([]).rest(M1.create()),returns:X||M1.create(),typeName:M.ZodFunction,...f(Y)})}}class N6 extends m{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})}}N6.create=(Q,X)=>{return new N6({getter:Q,typeName:M.ZodLazy,...f(X)})};class w6 extends m{_parse(Q){if(Q.data!==this._def.value){let X=this._getOrReturnCtx(Q);return S(X,{received:X.data,code:w.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:Q.data}}get value(){return this._def.value}}w6.create=(Q,X)=>{return new w6({value:Q,typeName:M.ZodLiteral,...f(X)})};function yJ(Q,X){return new E1({values:Q,typeName:M.ZodEnum,...f(X)})}class E1 extends m{_parse(Q){if(typeof Q.data!=="string"){let X=this._getOrReturnCtx(Q),Y=this._def.values;return S(X,{expected:c.joinValues(Y),received:X.parsedType,code:w.invalid_type}),_}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(Q.data)){let X=this._getOrReturnCtx(Q),Y=this._def.values;return S(X,{received:X.data,code:w.invalid_enum_value,options:Y}),_}return w0(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 E1.create(Q,{...this._def,...X})}exclude(Q,X=this._def){return E1.create(this.options.filter((Y)=>!Q.includes(Y)),{...this._def,...X})}}E1.create=yJ;class M6 extends m{_parse(Q){let X=c.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(Q);if(Y.parsedType!==j.string&&Y.parsedType!==j.number){let W=c.objectValues(X);return S(Y,{expected:c.joinValues(W),received:Y.parsedType,code:w.invalid_type}),_}if(!this._cache)this._cache=new Set(c.getValidEnumValues(this._def.values));if(!this._cache.has(Q.data)){let W=c.objectValues(X);return S(Y,{received:Y.data,code:w.invalid_enum_value,options:W}),_}return w0(Q.data)}get enum(){return this._def.values}}M6.create=(Q,X)=>{return new M6({values:Q,typeName:M.ZodNativeEnum,...f(X)})};class n1 extends m{unwrap(){return this._def.type}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.promise&&X.common.async===!1)return S(X,{code:w.invalid_type,expected:j.promise,received:X.parsedType}),_;let Y=X.parsedType===j.promise?X.data:Promise.resolve(X.data);return w0(Y.then((W)=>{return this._def.type.parseAsync(W,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}n1.create=(Q,X)=>{return new n1({type:Q,typeName:M.ZodPromise,...f(X)})};class o0 extends m{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q),W=this._def.effect||null,$={addIssue:(J)=>{if(S(Y,J),J.fatal)X.abort();else X.dirty()},get path(){return Y.path}};if($.addIssue=$.addIssue.bind($),W.type==="preprocess"){let J=W.transform(Y.data,$);if(Y.common.async)return Promise.resolve(J).then(async(G)=>{if(X.value==="aborted")return _;let H=await this._def.schema._parseAsync({data:G,path:Y.path,parent:Y});if(H.status==="aborted")return _;if(H.status==="dirty")return m1(H.value);if(X.value==="dirty")return m1(H.value);return H});else{if(X.value==="aborted")return _;let G=this._def.schema._parseSync({data:J,path:Y.path,parent:Y});if(G.status==="aborted")return _;if(G.status==="dirty")return m1(G.value);if(X.value==="dirty")return m1(G.value);return G}}if(W.type==="refinement"){let J=(G)=>{let H=W.refinement(G,$);if(Y.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(Y.common.async===!1){let G=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return _;if(G.status==="dirty")X.dirty();return J(G.value),{status:X.value,value:G.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((G)=>{if(G.status==="aborted")return _;if(G.status==="dirty")X.dirty();return J(G.value).then(()=>{return{status:X.value,value:G.value}})})}if(W.type==="transform")if(Y.common.async===!1){let J=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!w1(J))return _;let G=W.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:Y.data,path:Y.path,parent:Y}).then((J)=>{if(!w1(J))return _;return Promise.resolve(W.transform(J.value,$)).then((G)=>({status:X.value,value:G}))});c.assertNever(W)}}o0.create=(Q,X,Y)=>{return new o0({schema:Q,typeName:M.ZodEffects,effect:X,...f(Y)})};o0.createWithPreprocess=(Q,X,Y)=>{return new o0({schema:X,effect:{type:"preprocess",transform:Q},typeName:M.ZodEffects,...f(Y)})};class g0 extends m{_parse(Q){if(this._getType(Q)===j.undefined)return w0(void 0);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}g0.create=(Q,X)=>{return new g0({innerType:Q,typeName:M.ZodOptional,...f(X)})};class K1 extends m{_parse(Q){if(this._getType(Q)===j.null)return w0(null);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}K1.create=(Q,X)=>{return new K1({innerType:Q,typeName:M.ZodNullable,...f(X)})};class j6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=X.data;if(X.parsedType===j.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}j6.create=(Q,X)=>{return new j6({innerType:Q,typeName:M.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...f(X)})};class b6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y={...X,common:{...X.common,issues:[]}},W=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(K6(W))return W.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new R0(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new R0(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}}b6.create=(Q,X)=>{return new b6({innerType:Q,typeName:M.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...f(X)})};class V4 extends m{_parse(Q){if(this._getType(Q)!==j.nan){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.nan,received:Y.parsedType}),_}return{status:"valid",value:Q.data}}}V4.create=(Q)=>{return new V4({typeName:M.ZodNaN,...f(Q)})};var uD=Symbol("zod_brand");class k9 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=X.data;return this._def.type._parse({data:Y,path:X.path,parent:X})}unwrap(){return this._def.type}}class U4 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if($.status==="aborted")return _;if($.status==="dirty")return X.dirty(),m1($.value);else return this._def.out._parseAsync({data:$.value,path:Y.path,parent:Y})})();else{let W=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(W.status==="aborted")return _;if(W.status==="dirty")return X.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Y.path,parent:Y})}}static create(Q,X){return new U4({in:Q,out:X,typeName:M.ZodPipeline})}}class E6 extends m{_parse(Q){let X=this._def.innerType._parse(Q),Y=(W)=>{if(w1(W))W.value=Object.freeze(W.value);return W};return K6(X)?X.then((W)=>Y(W)):Y(X)}unwrap(){return this._def.innerType}}E6.create=(Q,X)=>{return new E6({innerType:Q,typeName:M.ZodReadonly,...f(X)})};function kJ(Q,X){let Y=typeof Q==="function"?Q(X):typeof Q==="string"?{message:Q}:Q;return typeof Y==="string"?{message:Y}:Y}function hJ(Q,X={},Y){if(Q)return p1.create().superRefine((W,$)=>{let J=Q(W);if(J instanceof Promise)return J.then((G)=>{if(!G){let H=kJ(X,W),B=H.fatal??Y??!0;$.addIssue({code:"custom",...H,fatal:B})}});if(!J){let G=kJ(X,W),H=G.fatal??Y??!0;$.addIssue({code:"custom",...G,fatal:H})}return});return p1.create()}var lD={object:A0.lazycreate},M;(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"})(M||(M={}));var mD=(Q,X={message:`Input not instance of ${Q.name}`})=>hJ((Y)=>Y instanceof Q,X),fJ=i0.create,uJ=j1.create,cD=V4.create,pD=b1.create,lJ=q6.create,iD=c1.create,nD=D4.create,dD=F6.create,oD=V6.create,rD=p1.create,tD=M1.create,aD=J1.create,sD=L4.create,eD=n0.create,QY=A0.create,QL=A0.strictCreate,XL=U6.create,YL=v9.create,WL=O6.create,$L=G1.create,JL=q4.create,GL=F4.create,HL=i1.create,BL=L6.create,zL=N6.create,AL=w6.create,KL=E1.create,DL=M6.create,LL=n1.create,qL=o0.create,FL=g0.create,VL=K1.create,UL=o0.createWithPreprocess,OL=U4.create,NL=()=>fJ().optional(),wL=()=>uJ().optional(),ML=()=>lJ().optional(),jL={string:(Q)=>i0.create({...Q,coerce:!0}),number:(Q)=>j1.create({...Q,coerce:!0}),boolean:(Q)=>q6.create({...Q,coerce:!0}),bigint:(Q)=>b1.create({...Q,coerce:!0}),date:(Q)=>c1.create({...Q,coerce:!0})};var bL=_;var SL=U("ZodMiniType",(Q,X)=>{if(!Q._zod)throw Error("Uninitialized schema in ZodMiniType.");a.init(Q,X),Q.def=X,Q.parse=(Y,W)=>f8(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>h1(Q,Y,W),Q.parseAsync=async(Y,W)=>l8(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>f1(Q,Y,W),Q.check=(...Y)=>{return Q.clone({...X,checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]})},Q.clone=(Y,W)=>_0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q}});var PL=U("ZodMiniObject",(Q,X)=>{s4.init(Q,X),SL.init(Q,X),p.defineLazy(Q,"shape",()=>X.shape)});function XY(Q,X){let Y={type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},...p.normalizeParams(X)};return new PL(Y)}function u0(Q){return!!Q._zod}function d1(Q){let X=Object.values(Q);if(X.length===0)return XY({});let Y=X.every(u0),W=X.every(($)=>!u0($));if(Y)return XY(Q);if(W)return QY(Q);throw Error("Mixed Zod versions detected in object shape.")}function S1(Q,X){if(u0(Q))return h1(Q,X);return Q.safeParse(X)}async function _9(Q,X){if(u0(Q))return await f1(Q,X);return await Q.safeParseAsync(X)}function P1(Q){if(!Q)return;let X;if(u0(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 S6(Q){if(!Q)return;if(typeof Q==="object"){let X=Q,Y=Q;if(!X._def&&!Y._zod){let W=Object.values(Q);if(W.length>0&&W.every(($)=>typeof $==="object"&&$!==null&&($._def!==void 0||$._zod!==void 0||typeof $.parse==="function")))return d1(Q)}}if(u0(Q)){let Y=Q._zod?.def;if(Y&&(Y.type==="object"||Y.shape!==void 0))return Q}else if(Q.shape!==void 0)return Q;return}function x9(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 mJ(Q){return Q.description}function cJ(Q){if(u0(Q))return Q._zod?.def?.type==="optional";let X=Q;if(typeof Q.isOptional==="function")return Q.isOptional();return X._def?.typeName==="ZodOptional"}function g9(Q){if(u0(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 Y=Q._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let W=Q.value;if(W!==void 0)return W;return}function I1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var iJ=Symbol("Let zodToJsonSchema decide on which parser to use");var pJ={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"},nJ=(Q)=>typeof Q==="string"?{...pJ,name:Q}:{...pJ,...Q};var dJ=(Q)=>{let X=nJ(Q),Y=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Y,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([W,$])=>[$._def,{def:$._def,path:[...X.basePath,X.definitionPath,W],jsonSchema:void 0}]))}};function YY(Q,X,Y,W){if(!W?.errorMessages)return;if(Y)Q.errorMessage={...Q.errorMessage,[X]:Y}}function n(Q,X,Y,W,$){Q[X]=Y,YY(Q,X,W,$)}var y9=(Q,X)=>{let Y=0;for(;Y<Q.length&&Y<X.length;Y++)if(Q[Y]!==X[Y])break;return[(Q.length-Y).toString(),...X.slice(Y)].join("/")};function B0(Q){if(Q.target!=="openAi")return{};let X=[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName];return Q.flags.hasReferencedOpenAiAnyType=!0,{$ref:Q.$refStrategy==="relative"?y9(X,Q.currentPath):X.join("/")}}function oJ(Q,X){let Y={type:"array"};if(Q.type?._def&&Q.type?._def?.typeName!==M.ZodAny)Y.items=g(Q.type._def,{...X,currentPath:[...X.currentPath,"items"]});if(Q.minLength)n(Y,"minItems",Q.minLength.value,Q.minLength.message,X);if(Q.maxLength)n(Y,"maxItems",Q.maxLength.value,Q.maxLength.message,X);if(Q.exactLength)n(Y,"minItems",Q.exactLength.value,Q.exactLength.message,X),n(Y,"maxItems",Q.exactLength.value,Q.exactLength.message,X);return Y}function rJ(Q,X){let Y={type:"integer",format:"int64"};if(!Q.checks)return Y;for(let W of Q.checks)switch(W.kind){case"min":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"minimum",W.value,W.message,X);else n(Y,"exclusiveMinimum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMinimum=!0;n(Y,"minimum",W.value,W.message,X)}break;case"max":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"maximum",W.value,W.message,X);else n(Y,"exclusiveMaximum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMaximum=!0;n(Y,"maximum",W.value,W.message,X)}break;case"multipleOf":n(Y,"multipleOf",W.value,W.message,X);break}return Y}function tJ(){return{type:"boolean"}}function h9(Q,X){return g(Q.type._def,X)}var aJ=(Q,X)=>{return g(Q.innerType._def,X)};function WY(Q,X,Y){let W=Y??X.dateStrategy;if(Array.isArray(W))return{anyOf:W.map(($,J)=>WY(Q,X,$))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return RL(Q,X)}}var RL=(Q,X)=>{let Y={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Y;for(let W of Q.checks)switch(W.kind){case"min":n(Y,"minimum",W.value,W.message,X);break;case"max":n(Y,"maximum",W.value,W.message,X);break}return Y};function sJ(Q,X){return{...g(Q.innerType._def,X),default:Q.defaultValue()}}function eJ(Q,X){return X.effectStrategy==="input"?g(Q.schema._def,X):B0(X)}function Q7(Q){return{type:"string",enum:Array.from(Q.values)}}var CL=(Q)=>{if("type"in Q&&Q.type==="string")return!1;return"allOf"in Q};function X7(Q,X){let Y=[g(Q.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),g(Q.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((J)=>!!J),W=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,$=[];return Y.forEach((J)=>{if(CL(J)){if($.push(...J.allOf),J.unevaluatedProperties===void 0)W=void 0}else{let G=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:H,...B}=J;G=B}else W=void 0;$.push(G)}}),$.length?{allOf:$,...W}:void 0}function Y7(Q,X){let Y=typeof Q.value;if(Y!=="bigint"&&Y!=="number"&&Y!=="boolean"&&Y!=="string")return{type:Array.isArray(Q.value)?"array":"object"};if(X.target==="openApi3")return{type:Y==="bigint"?"integer":Y,enum:[Q.value]};return{type:Y==="bigint"?"integer":Y,const:Q.value}}var $Y=void 0,r0={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($Y===void 0)$Y=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return $Y},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 f9(Q,X){let Y={type:"string"};if(Q.checks)for(let W of Q.checks)switch(W.kind){case"min":n(Y,"minLength",typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value,W.message,X);break;case"max":n(Y,"maxLength",typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value,W.message,X);break;case"email":switch(X.emailStrategy){case"format:email":t0(Y,"email",W.message,X);break;case"format:idn-email":t0(Y,"idn-email",W.message,X);break;case"pattern:zod":E0(Y,r0.email,W.message,X);break}break;case"url":t0(Y,"uri",W.message,X);break;case"uuid":t0(Y,"uuid",W.message,X);break;case"regex":E0(Y,W.regex,W.message,X);break;case"cuid":E0(Y,r0.cuid,W.message,X);break;case"cuid2":E0(Y,r0.cuid2,W.message,X);break;case"startsWith":E0(Y,RegExp(`^${JY(W.value,X)}`),W.message,X);break;case"endsWith":E0(Y,RegExp(`${JY(W.value,X)}$`),W.message,X);break;case"datetime":t0(Y,"date-time",W.message,X);break;case"date":t0(Y,"date",W.message,X);break;case"time":t0(Y,"time",W.message,X);break;case"duration":t0(Y,"duration",W.message,X);break;case"length":n(Y,"minLength",typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value,W.message,X),n(Y,"maxLength",typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value,W.message,X);break;case"includes":{E0(Y,RegExp(JY(W.value,X)),W.message,X);break}case"ip":{if(W.version!=="v6")t0(Y,"ipv4",W.message,X);if(W.version!=="v4")t0(Y,"ipv6",W.message,X);break}case"base64url":E0(Y,r0.base64url,W.message,X);break;case"jwt":E0(Y,r0.jwt,W.message,X);break;case"cidr":{if(W.version!=="v6")E0(Y,r0.ipv4Cidr,W.message,X);if(W.version!=="v4")E0(Y,r0.ipv6Cidr,W.message,X);break}case"emoji":E0(Y,r0.emoji(),W.message,X);break;case"ulid":{E0(Y,r0.ulid,W.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{t0(Y,"binary",W.message,X);break}case"contentEncoding:base64":{n(Y,"contentEncoding","base64",W.message,X);break}case"pattern:zod":{E0(Y,r0.base64,W.message,X);break}}break}case"nanoid":E0(Y,r0.nanoid,W.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:(($)=>{})(W)}return Y}function JY(Q,X){return X.patternStrategy==="escape"?ZL(Q):Q}var TL=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ZL(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(!TL.has(Q[Y]))X+="\\";X+=Q[Y]}return X}function t0(Q,X,Y,W){if(Q.format||Q.anyOf?.some(($)=>$.format)){if(!Q.anyOf)Q.anyOf=[];if(Q.format){if(Q.anyOf.push({format:Q.format,...Q.errorMessage&&W.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,...Y&&W.errorMessages&&{errorMessage:{format:Y}}})}else n(Q,"format",X,Y,W)}function E0(Q,X,Y,W){if(Q.pattern||Q.allOf?.some(($)=>$.pattern)){if(!Q.allOf)Q.allOf=[];if(Q.pattern){if(Q.allOf.push({pattern:Q.pattern,...Q.errorMessage&&W.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:W7(X,W),...Y&&W.errorMessages&&{errorMessage:{pattern:Y}}})}else n(Q,"pattern",W7(X,W),Y,W)}function W7(Q,X){if(!X.applyRegexFlags||!Q.flags)return Q.source;let Y={i:Q.flags.includes("i"),m:Q.flags.includes("m"),s:Q.flags.includes("s")},W=Y.i?Q.source.toLowerCase():Q.source,$="",J=!1,G=!1,H=!1;for(let B=0;B<W.length;B++){if(J){$+=W[B],J=!1;continue}if(Y.i){if(G){if(W[B].match(/[a-z]/)){if(H)$+=W[B],$+=`${W[B-2]}-${W[B]}`.toUpperCase(),H=!1;else if(W[B+1]==="-"&&W[B+2]?.match(/[a-z]/))$+=W[B],H=!0;else $+=`${W[B]}${W[B].toUpperCase()}`;continue}}else if(W[B].match(/[a-z]/)){$+=`[${W[B]}${W[B].toUpperCase()}]`;continue}}if(Y.m){if(W[B]==="^"){$+=`(^|(?<=[\r
39
- ]))`;continue}else if(W[B]==="$"){$+=`($|(?=[\r
40
- ]))`;continue}}if(Y.s&&W[B]==="."){$+=G?`${W[B]}\r
41
- `:`[${W[B]}\r
42
- ]`;continue}if($+=W[B],W[B]==="\\")J=!0;else if(G&&W[B]==="]")G=!1;else if(!G&&W[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 u9(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===M.ZodEnum)return{type:"object",required:Q.keyType._def.values,properties:Q.keyType._def.values.reduce((W,$)=>({...W,[$]:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"properties",$]})??B0(X)}),{}),additionalProperties:X.rejectedAdditionalProperties};let Y={type:"object",additionalProperties:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Y;if(Q.keyType?._def.typeName===M.ZodString&&Q.keyType._def.checks?.length){let{type:W,...$}=f9(Q.keyType._def,X);return{...Y,propertyNames:$}}else if(Q.keyType?._def.typeName===M.ZodEnum)return{...Y,propertyNames:{enum:Q.keyType._def.values}};else if(Q.keyType?._def.typeName===M.ZodBranded&&Q.keyType._def.type._def.typeName===M.ZodString&&Q.keyType._def.type._def.checks?.length){let{type:W,...$}=h9(Q.keyType._def,X);return{...Y,propertyNames:$}}return Y}function $7(Q,X){if(X.mapStrategy==="record")return u9(Q,X);let Y=g(Q.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||B0(X),W=g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||B0(X);return{type:"array",maxItems:125,items:{type:"array",items:[Y,W],minItems:2,maxItems:2}}}function J7(Q){let X=Q.values,W=Object.keys(Q.values).filter((J)=>{return typeof X[X[J]]!=="number"}).map((J)=>X[J]),$=Array.from(new Set(W.map((J)=>typeof J)));return{type:$.length===1?$[0]==="string"?"string":"number":["string","number"],enum:W}}function G7(Q){return Q.target==="openAi"?void 0:{not:B0({...Q,currentPath:[...Q.currentPath,"not"]})}}function H7(Q){return Q.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var O4={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function z7(Q,X){if(X.target==="openApi3")return B7(Q,X);let Y=Q.options instanceof Map?Array.from(Q.options.values()):Q.options;if(Y.every((W)=>(W._def.typeName in O4)&&(!W._def.checks||!W._def.checks.length))){let W=Y.reduce(($,J)=>{let G=O4[J._def.typeName];return G&&!$.includes(G)?[...$,G]:$},[]);return{type:W.length>1?W:W[0]}}else if(Y.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Y.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(W.length===Y.length){let $=W.filter((J,G,H)=>H.indexOf(J)===G);return{type:$.length>1?$:$[0],enum:Y.reduce((J,G)=>{return J.includes(G._def.value)?J:[...J,G._def.value]},[])}}}else if(Y.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Y.reduce((W,$)=>[...W,...$._def.values.filter((J)=>!W.includes(J))],[])};return B7(Q,X)}var B7=(Q,X)=>{let Y=(Q.options instanceof Map?Array.from(Q.options.values()):Q.options).map((W,$)=>g(W._def,{...X,currentPath:[...X.currentPath,"anyOf",`${$}`]})).filter((W)=>!!W&&(!X.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Y.length?{anyOf:Y}:void 0};function A7(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:O4[Q.innerType._def.typeName],nullable:!0};return{type:[O4[Q.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let W=g(Q.innerType._def,{...X,currentPath:[...X.currentPath]});if(W&&"$ref"in W)return{allOf:[W],nullable:!0};return W&&{...W,nullable:!0}}let Y=g(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Y&&{anyOf:[Y,{type:"null"}]}}function K7(Q,X){let Y={type:"number"};if(!Q.checks)return Y;for(let W of Q.checks)switch(W.kind){case"int":Y.type="integer",YY(Y,"type",W.message,X);break;case"min":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"minimum",W.value,W.message,X);else n(Y,"exclusiveMinimum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMinimum=!0;n(Y,"minimum",W.value,W.message,X)}break;case"max":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"maximum",W.value,W.message,X);else n(Y,"exclusiveMaximum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMaximum=!0;n(Y,"maximum",W.value,W.message,X)}break;case"multipleOf":n(Y,"multipleOf",W.value,W.message,X);break}return Y}function D7(Q,X){let Y=X.target==="openAi",W={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=kL(B);if(z&&Y){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let A=g(B._def,{...X,currentPath:[...X.currentPath,"properties",H],propertyPath:[...X.currentPath,"properties",H]});if(A===void 0)continue;if(W.properties[H]=A,!z)$.push(H)}if($.length)W.required=$;let G=vL(Q,X);if(G!==void 0)W.additionalProperties=G;return W}function vL(Q,X){if(Q.catchall._def.typeName!=="ZodNever")return g(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 kL(Q){try{return Q.isOptional()}catch{return!0}}var L7=(Q,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return g(Q.innerType._def,X);let Y=g(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Y?{anyOf:[{not:B0(X)},Y]}:B0(X)};var q7=(Q,X)=>{if(X.pipeStrategy==="input")return g(Q.in._def,X);else if(X.pipeStrategy==="output")return g(Q.out._def,X);let Y=g(Q.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),W=g(Q.out._def,{...X,currentPath:[...X.currentPath,"allOf",Y?"1":"0"]});return{allOf:[Y,W].filter(($)=>$!==void 0)}};function F7(Q,X){return g(Q.type._def,X)}function V7(Q,X){let W={type:"array",uniqueItems:!0,items:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if(Q.minSize)n(W,"minItems",Q.minSize.value,Q.minSize.message,X);if(Q.maxSize)n(W,"maxItems",Q.maxSize.value,Q.maxSize.message,X);return W}function U7(Q,X){if(Q.rest)return{type:"array",minItems:Q.items.length,items:Q.items.map((Y,W)=>g(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[]),additionalItems:g(Q.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:Q.items.length,maxItems:Q.items.length,items:Q.items.map((Y,W)=>g(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[])}}function O7(Q){return{not:B0(Q)}}function N7(Q){return B0(Q)}var w7=(Q,X)=>{return g(Q.innerType._def,X)};var M7=(Q,X,Y)=>{switch(X){case M.ZodString:return f9(Q,Y);case M.ZodNumber:return K7(Q,Y);case M.ZodObject:return D7(Q,Y);case M.ZodBigInt:return rJ(Q,Y);case M.ZodBoolean:return tJ();case M.ZodDate:return WY(Q,Y);case M.ZodUndefined:return O7(Y);case M.ZodNull:return H7(Y);case M.ZodArray:return oJ(Q,Y);case M.ZodUnion:case M.ZodDiscriminatedUnion:return z7(Q,Y);case M.ZodIntersection:return X7(Q,Y);case M.ZodTuple:return U7(Q,Y);case M.ZodRecord:return u9(Q,Y);case M.ZodLiteral:return Y7(Q,Y);case M.ZodEnum:return Q7(Q);case M.ZodNativeEnum:return J7(Q);case M.ZodNullable:return A7(Q,Y);case M.ZodOptional:return L7(Q,Y);case M.ZodMap:return $7(Q,Y);case M.ZodSet:return V7(Q,Y);case M.ZodLazy:return()=>Q.getter()._def;case M.ZodPromise:return F7(Q,Y);case M.ZodNaN:case M.ZodNever:return G7(Y);case M.ZodEffects:return eJ(Q,Y);case M.ZodAny:return B0(Y);case M.ZodUnknown:return N7(Y);case M.ZodDefault:return sJ(Q,Y);case M.ZodBranded:return h9(Q,Y);case M.ZodReadonly:return w7(Q,Y);case M.ZodCatch:return aJ(Q,Y);case M.ZodPipeline:return q7(Q,Y);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return((W)=>{return})(X)}};function g(Q,X,Y=!1){let W=X.seen.get(Q);if(X.override){let H=X.override?.(Q,X,W,Y);if(H!==iJ)return H}if(W&&!Y){let H=_L(W,X);if(H!==void 0)return H}let $={def:Q,path:X.currentPath,jsonSchema:void 0};X.seen.set(Q,$);let J=M7(Q,Q.typeName,X),G=typeof J==="function"?g(J(),X):J;if(G)xL(Q,X,G);if(X.postProcess){let H=X.postProcess(G,Q,X);return $.jsonSchema=G,H}return $.jsonSchema=G,G}var _L=(Q,X)=>{switch(X.$refStrategy){case"root":return{$ref:Q.path.join("/")};case"relative":return{$ref:y9(X.currentPath,Q.path)};case"none":case"seen":{if(Q.path.length<X.currentPath.length&&Q.path.every((Y,W)=>X.currentPath[W]===Y))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),B0(X);return X.$refStrategy==="seen"?B0(X):void 0}}},xL=(Q,X,Y)=>{if(Q.description){if(Y.description=Q.description,X.markdownDescription)Y.markdownDescription=Q.description}return Y};var GY=(Q,X)=>{let Y=dJ(X),W=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((B,[z,A])=>({...B,[z]:g(A._def,{...Y,currentPath:[...Y.basePath,Y.definitionPath,z]},!0)??B0(Y)}),{}):void 0,$=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,J=g(Q._def,$===void 0?Y:{...Y,currentPath:[...Y.basePath,Y.definitionPath,$]},!1)??B0(Y),G=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(G!==void 0)J.title=G;if(Y.flags.hasReferencedOpenAiAnyType){if(!W)W={};if(!W[Y.openAiAnyTypeName])W[Y.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Y.$refStrategy==="relative"?"1":[...Y.basePath,Y.definitionPath,Y.openAiAnyTypeName].join("/")}}}let H=$===void 0?W?{...J,[Y.definitionPath]:W}:J:{$ref:[...Y.$refStrategy==="relative"?[]:Y.basePath,Y.definitionPath,$].join("/"),[Y.definitionPath]:{...W,[$]:J}};if(Y.target==="jsonSchema7")H.$schema="http://json-schema.org/draft-07/schema#";else if(Y.target==="jsonSchema2019-09"||Y.target==="openAi")H.$schema="https://json-schema.org/draft/2019-09/schema#";if(Y.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 gL(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 HY(Q,X){if(u0(Q))return EX(Q,{target:gL(X?.target),io:X?.pipeStrategy??"input"});return GY(Q,{strictUnions:X?.strictUnions??!0,pipeStrategy:X?.pipeStrategy??"input"})}function BY(Q){let Y=P1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=g9(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function zY(Q,X){let Y=S1(Q,X);if(!Y.success)throw Y.error;return Y.data}var yL=60000;class AY{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(L9,(X)=>{this._oncancel(X)}),this.setNotificationHandler(F9,(X)=>{this._onprogress(X)}),this.setRequestHandler(q9,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(V9,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(v.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(O9,async(X,Y)=>{let W=async()=>{let $=X.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue($,Y.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 A=H,D=new C(A.error.code,A.error.message,A.error.data);z(D)}else{let A=G.type==="response"?"Response":"Error";this._onerror(Error(`${A} handler missing for request ${B}`))}continue}await this._transport?.send(G.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask($,Y.sessionId);if(!J)throw new C(v.InvalidParams,`Task not found: ${$}`);if(!I1(J.status))return await this._waitForTaskUpdate($,Y.signal),await W();if(I1(J.status)){let G=await this._taskStore.getTaskResult($,Y.sessionId);return this._clearTaskQueue($),{...G,_meta:{...G._meta,[N1]:{taskId:$}}}}return await W()};return await W()}),this.setRequestHandler(N9,async(X,Y)=>{try{let{tasks:W,nextCursor:$}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:$,_meta:{}}}catch(W){throw new C(v.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(M9,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(v.InvalidParams,`Task not found: ${X.params.taskId}`);if(I1(W.status))throw new C(v.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(X.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(X.params.taskId);let $=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!$)throw new C(v.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...$}}catch(W){if(W instanceof C)throw W;throw new C(v.InvalidRequest,`Failed to cancel task: ${W instanceof Error?W.message:String(W)}`)}})}async _oncancel(Q){if(!Q.params.requestId)return;this._requestHandlerAbortControllers.get(Q.params.requestId)?.abort(Q.params.reason)}_setupTimeout(Q,X,Y,W,$=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:$,onTimeout:W})}_resetTimeout(Q){let X=this._timeoutInfo.get(Q);if(!X)return!1;let Y=Date.now()-X.startTime;if(X.maxTotalTimeout&&Y>=X.maxTotalTimeout)throw this._timeoutInfo.delete(Q),C.fromError(v.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Y});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){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=($)=>{Y?.($),this._onerror($)};let W=this._transport?.onmessage;this._transport.onmessage=($,J)=>{if(W?.($,J),Y4($)||UJ($))this._onresponse($);else if(xX($))this._onrequest($,J);else if(VJ($))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();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();for(let Y of this._requestHandlerAbortControllers.values())Y.abort();this._requestHandlerAbortControllers.clear();let X=C.fromError(v.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(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((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,$=Q.params?._meta?.[N1]?.taskId;if(Y===void 0){let z={jsonrpc:"2.0",id:Q.id,error:{code:v.MethodNotFound,message:"Method not found"}};if($&&this._taskMessageQueue)this._enqueueTaskMessage($,{type:"error",message:z,timestamp:Date.now()},W?.sessionId).catch((A)=>this._onerror(Error(`Failed to enqueue error response: ${A}`)));else W?.send(z).catch((A)=>this._onerror(Error(`Failed to send an error response: ${A}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let G=LJ(Q.params)?Q.params.task:void 0,H=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,B={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(z)=>{if(J.signal.aborted)return;let A={relatedRequestId:Q.id};if($)A.relatedTask={taskId:$};await this.notification(z,A)},sendRequest:async(z,A,D)=>{if(J.signal.aborted)throw new C(v.ConnectionClosed,"Request was cancelled");let L={...D,relatedRequestId:Q.id};if($&&!L.relatedTask)L.relatedTask={taskId:$};let K=L.relatedTask?.taskId??$;if(K&&H)await H.updateTaskStatus(K,"input_required");return await this.request(z,A,L)},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(()=>Y(Q,B)).then(async(z)=>{if(J.signal.aborted)return;let A={result:z,jsonrpc:"2.0",id:Q.id};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"response",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)},async(z)=>{if(J.signal.aborted)return;let A={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(z.code)?z.code:v.InternalError,message:z.message??"Internal error",...z.data!==void 0&&{data:z.data}}};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"error",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===J)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),$=this._progressHandlers.get(W);if(!$){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),G=this._timeoutInfo.get(W);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(H){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(H);return}$(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),Y4(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===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(Y4(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(Y4(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(v.InternalError,String(J))}}return}let $;try{let J=await this.request(Q,G6,Y);if(J.task)$=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(v.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:$},Y);if(yield{type:"taskStatus",task:G},I1(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:$},X,Y)};else if(G.status==="failed")yield{type:"error",error:new C(v.InternalError,`Task ${$} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new C(v.InternalError,`Task ${$} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:$},X,Y)};return}let H=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,H)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(v.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J,task:G,relatedTask:H}=Y??{};return new Promise((B,z)=>{let A=(O)=>{z(O)};if(!this._transport){A(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),G)this.assertTaskCapability(Q.method)}catch(O){A(O);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,L={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),L.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if(G)L.params={...L.params,task:G};if(H)L.params={...L.params,_meta:{...L.params?._meta||{},[N1]:H}};let K=(O)=>{this._responseHandlers.delete(D),this._progressHandlers.delete(D),this._cleanupTimeout(D),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:D,reason:String(O)}},{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let b=O instanceof C?O:new C(v.RequestTimeout,String(O));z(b)};this._responseHandlers.set(D,(O)=>{if(Y?.signal?.aborted)return;if(O instanceof Error)return z(O);try{let b=S1(X,O.result);if(!b.success)z(b.error);else B(b.data)}catch(b){z(b)}}),Y?.signal?.addEventListener("abort",()=>{K(Y?.signal?.reason)});let q=Y?.timeout??yL,F=()=>K(C.fromError(v.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(D,q,Y?.maxTotalTimeout,F,Y?.resetTimeoutOnProgress??!1);let N=H?.taskId;if(N){let O=(b)=>{let E=this._responseHandlers.get(D);if(E)E(b);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,O),this._enqueueTaskMessage(N,{type:"request",message:L,timestamp:Date.now()}).catch((b)=>{this._cleanupTimeout(D),z(b)})}else this._transport.send(L,{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J}).catch((O)=>{this._cleanupTimeout(D),z(O)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},U9,X)}async getTaskResult(Q,X,Y){return this.request({method:"tasks/result",params:Q},X,Y)}async listTasks(Q,X){return this.request({method:"tasks/list",params:Q},w9,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},wJ,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let G={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[N1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{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||{},[N1]: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||{},[N1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=BY(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,$)=>{let J=zY(Q,W);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 Y=BY(Q);this._notificationHandlers.set(Y,(W)=>{let $=zY(Q,W);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,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let W=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(Q,X,Y,W)}async _clearTaskQueue(Q,X){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll(Q,X);for(let W of Y)if(W.type==="request"&&xX(W.message)){let $=W.message.id,J=this._requestResolvers.get($);if(J)J(new C(v.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 Y=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)Y=W.pollInterval}catch{}return new Promise((W,$)=>{if(X.aborted){$(new C(v.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),$(new C(v.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,X){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await Y.createTask(W,Q.id,{method:Q.method,params:Q.params},X)},getTask:async(W)=>{let $=await Y.getTask(W,X);if(!$)throw new C(v.InvalidParams,"Failed to retrieve task: Task not found");return $},storeTaskResult:async(W,$,J)=>{await Y.storeTaskResult(W,$,J,X);let G=await Y.getTask(W,X);if(G){let H=H4.parse({method:"notifications/tasks/status",params:G});if(await this.notification(H),I1(G.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,$,J)=>{let G=await Y.getTask(W,X);if(!G)throw new C(v.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(I1(G.status))throw new C(v.InvalidParams,`Cannot update task "${W}" from terminal status "${G.status}" to "${$}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,$,J,X);let H=await Y.getTask(W,X);if(H){let B=H4.parse({method:"notifications/tasks/status",params:H});if(await this.notification(B),I1(H.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function j7(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function b7(Q,X){let Y={...Q};for(let W in X){let $=W,J=X[$];if(J===void 0)continue;let G=Y[$];if(j7(G)&&j7(J))Y[$]={...G,...J};else Y[$]=J}return Y}var JB=SW(JW(),1),GB=SW($B(),1);function Jj(){let Q=new JB.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return GB.default(Q),Q}class FW{constructor(Q){this._ajv=Q??Jj()}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(Y)=>{if(X(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(X.errors)}}}}class VW{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}createMessageStream(Q,X){let Y=this._server.getClientCapabilities();if((Q.tools||Q.toolChoice)&&!Y?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(Q.messages.length>0){let W=Q.messages[Q.messages.length-1],$=Array.isArray(W.content)?W.content:[W.content],J=$.some((z)=>z.type==="tool_result"),G=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,H=G?Array.isArray(G.content)?G.content:[G.content]:[],B=H.some((z)=>z.type==="tool_use");if(J){if($.some((z)=>z.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!B)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(B){let z=new Set(H.filter((D)=>D.type==="tool_use").map((D)=>D.id)),A=new Set($.filter((D)=>D.type==="tool_result").map((D)=>D.toolUseId));if(z.size!==A.size||![...z].every((D)=>A.has(D)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:Q},A4,X)}elicitInputStream(Q,X){let Y=this._server.getClientCapabilities(),W=Q.mode??"form";switch(W){case"url":{if(!Y?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!Y?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let $=W==="form"&&Q.mode===void 0?{...Q,mode:"form"}:Q;return this.requestStream({method:"elicitation/create",params:$},z6,X)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,Y){return this._server.getTaskResult({taskId:Q},X,Y)}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 HB(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"tools/call":if(!Q.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${X})`);break;default:break}}function BB(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${X})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${X})`);break;default:break}}class UW extends AY{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(z4.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let $=this._loggingLevels.get(W);return $?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get($):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new FW,this.setRequestHandler(hX,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(fX,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(nX,async(Y,W)=>{let $=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,G=z4.safeParse(J);if(G.success)this._loggingLevels.set($,G.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new VW(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=b7(this._capabilities,Q)}setRequestHandler(Q,X){let W=P1(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let $;if(u0(W)){let G=W;$=G._zod?.def?.value??G.value}else{let G=W;$=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=S1(B6,H);if(!z.success){let K=z.error instanceof Error?z.error.message:String(z.error);throw new C(v.InvalidParams,`Invalid tools/call request: ${K}`)}let{params:A}=z.data,D=await Promise.resolve(X(H,B));if(A.task){let K=S1(G6,D);if(!K.success){let q=K.error instanceof Error?K.error.message:String(K.error);throw new C(v.InvalidParams,`Invalid task creation result: ${q}`)}return K.data}let L=S1(R9,D);if(!L.success){let K=L.error instanceof Error?L.error.message:String(L.error);throw new C(v.InvalidParams,`Invalid tools/call result: ${K}`)}return L.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){BB(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;HB(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:AJ.includes(X)?X:kX,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"},D9)}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 Y=Q.messages[Q.messages.length-1],W=Array.isArray(Y.content)?Y.content:[Y.content],$=W.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(W.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((A)=>A.type==="tool_use").map((A)=>A.id)),z=new Set(W.filter((A)=>A.type==="tool_result").map((A)=>A.toolUseId));if(B.size!==z.size||![...B].every((A)=>z.has(A)))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},dX,X);return this.request({method:"sampling/createMessage",params:Q},A4,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 W=Q;return this.request({method:"elicitation/create",params:W},z6,X)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let W=Q.mode==="form"?Q:{...Q,mode:"form"},$=await this.request({method:"elicitation/create",params:W},z6,X);if($.action==="accept"&&$.content&&W.requestedSchema)try{let G=this._jsonSchemaValidator.getValidator(W.requestedSchema)($.content);if(!G.valid)throw new C(v.InvalidParams,`Elicitation response content does not match requested schema: ${G.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(v.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},oX,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 AB=Symbol.for("mcp.completable");function OW(Q){return!!Q&&typeof Q==="object"&&AB in Q}function KB(Q){return Q[AB]?.complete}var zB;(function(Q){Q.Completable="McpCompletable"})(zB||(zB={}));var Gj=/^[A-Za-z0-9._-]{1,128}$/;function Hj(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(!Gj.test(Q)){let Y=Q.split("").filter((W)=>!/[A-Za-z0-9._-]/.test(W)).filter((W,$,J)=>J.indexOf(W)===$);return X.push(`Tool name contains invalid characters: ${Y.map((W)=>`"${W}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:X}}return{isValid:!0,warnings:X}}function Bj(Q,X){if(X.length>0){console.warn(`Tool name validation warning for "${Q}":`);for(let Y of X)console.warn(` - ${Y}`);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 NW(Q){let X=Hj(Q);return Bj(Q,X.warnings),X.isValid}class wW{constructor(Q){this._mcpServer=Q}registerToolTask(Q,X,Y){let W={taskSupport:"required",...X.execution};if(W.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,W,X._meta,Y)}}class jW{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 UW(Q,X)}get experimental(){if(!this._experimental)this._experimental={tasks:new wW(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(x1(I9)),this.server.assertCanSetRequestHandler(x1(B6)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(I9,()=>({tools:Object.entries(this._registeredTools).filter(([,Q])=>Q.enabled).map(([Q,X])=>{let Y={name:Q,title:X.title,description:X.description,inputSchema:(()=>{let W=S6(X.inputSchema);return W?HY(W,{strictUnions:!0,pipeStrategy:"input"}):zj})(),annotations:X.annotations,execution:X.execution,_meta:X._meta};if(X.outputSchema){let W=S6(X.outputSchema);if(W)Y.outputSchema=HY(W,{strictUnions:!0,pipeStrategy:"output"})}return Y})})),this.server.setRequestHandler(B6,async(Q,X)=>{try{let Y=this._registeredTools[Q.params.name];if(!Y)throw new C(v.InvalidParams,`Tool ${Q.params.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Tool ${Q.params.name} disabled`);let W=!!Q.params.task,$=Y.execution?.taskSupport,J="createTask"in Y.handler;if(($==="required"||$==="optional")&&!J)throw new C(v.InternalError,`Tool ${Q.params.name} has taskSupport '${$}' but was not registered with registerToolTask`);if($==="required"&&!W)throw new C(v.MethodNotFound,`Tool ${Q.params.name} requires task augmentation (taskSupport: 'required')`);if($==="optional"&&!W&&J)return await this.handleAutomaticTaskPolling(Y,Q,X);let G=await this.validateToolInput(Y,Q.params.arguments,Q.params.name),H=await this.executeToolHandler(Y,G,X);if(W)return H;return await this.validateToolOutput(Y,H,Q.params.name),H}catch(Y){if(Y instanceof C){if(Y.code===v.UrlElicitationRequired)throw Y}return this.createToolError(Y instanceof Error?Y.message:String(Y))}}),this._toolHandlersInitialized=!0}createToolError(Q){return{content:[{type:"text",text:Q}],isError:!0}}async validateToolInput(Q,X,Y){if(!Q.inputSchema)return;let $=S6(Q.inputSchema)??Q.inputSchema,J=await _9($,X);if(!J.success){let G="error"in J?J.error:"Unknown error",H=x9(G);throw new C(v.InvalidParams,`Input validation error: Invalid arguments for tool ${Y}: ${H}`)}return J.data}async validateToolOutput(Q,X,Y){if(!Q.outputSchema)return;if(!("content"in X))return;if(X.isError)return;if(!X.structuredContent)throw new C(v.InvalidParams,`Output validation error: Tool ${Y} has an output schema but no structured content was provided`);let W=S6(Q.outputSchema),$=await _9(W,X.structuredContent);if(!$.success){let J="error"in $?$.error:"Unknown error",G=x9(J);throw new C(v.InvalidParams,`Output validation error: Invalid structured content for tool ${Y}: ${G}`)}}async executeToolHandler(Q,X,Y){let W=Q.handler;if("createTask"in W){if(!Y.taskStore)throw Error("No task store provided.");let J={...Y,taskStore:Y.taskStore};if(Q.inputSchema)return await Promise.resolve(W.createTask(X,J));else return await Promise.resolve(W.createTask(J))}if(Q.inputSchema)return await Promise.resolve(W(X,Y));else return await Promise.resolve(W(Y))}async handleAutomaticTaskPolling(Q,X,Y){if(!Y.taskStore)throw Error("No task store provided for task-capable tool.");let W=await this.validateToolInput(Q,X.params.arguments,X.params.name),$=Q.handler,J={...Y,taskStore:Y.taskStore},G=W?await Promise.resolve($.createTask(W,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((D)=>setTimeout(D,z));let A=await Y.taskStore.getTask(H);if(!A)throw new C(v.InternalError,`Task ${H} not found during polling`);B=A}return await Y.taskStore.getTaskResult(H)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(x1(C9)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(C9,async(Q)=>{switch(Q.params.ref.type){case"ref/prompt":return PJ(Q),this.handlePromptCompletion(Q,Q.params.ref);case"ref/resource":return IJ(Q),this.handleResourceCompletion(Q,Q.params.ref);default:throw new C(v.InvalidParams,`Invalid completion reference: ${Q.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(Q,X){let Y=this._registeredPrompts[X.name];if(!Y)throw new C(v.InvalidParams,`Prompt ${X.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Prompt ${X.name} disabled`);if(!Y.argsSchema)return m4;let $=P1(Y.argsSchema)?.[Q.params.argument.name];if(!OW($))return m4;let J=KB($);if(!J)return m4;let G=await J(Q.params.argument.value,Q.params.context);return LB(G)}async handleResourceCompletion(Q,X){let Y=Object.values(this._registeredResourceTemplates).find((J)=>J.resourceTemplate.uriTemplate.toString()===X.uri);if(!Y){if(this._registeredResources[X.uri])return m4;throw new C(v.InvalidParams,`Resource template ${Q.params.ref.uri} not found`)}let W=Y.resourceTemplate.completeCallback(Q.params.argument.name);if(!W)return m4;let $=await W(Q.params.argument.value,Q.params.context);return LB($)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(x1(j9)),this.server.assertCanSetRequestHandler(x1(b9)),this.server.assertCanSetRequestHandler(x1(E9)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j9,async(Q,X)=>{let Y=Object.entries(this._registeredResources).filter(([$,J])=>J.enabled).map(([$,J])=>({uri:$,name:J.name,...J.metadata})),W=[];for(let $ of Object.values(this._registeredResourceTemplates)){if(!$.resourceTemplate.listCallback)continue;let J=await $.resourceTemplate.listCallback(X);for(let G of J.resources)W.push({...$.metadata,...G})}return{resources:[...Y,...W]}}),this.server.setRequestHandler(b9,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Y])=>({name:X,uriTemplate:Y.resourceTemplate.uriTemplate.toString(),...Y.metadata}))}}),this.server.setRequestHandler(E9,async(Q,X)=>{let Y=new URL(Q.params.uri),W=this._registeredResources[Y.toString()];if(W){if(!W.enabled)throw new C(v.InvalidParams,`Resource ${Y} disabled`);return W.readCallback(Y,X)}for(let $ of Object.values(this._registeredResourceTemplates)){let J=$.resourceTemplate.uriTemplate.match(Y.toString());if(J)return $.readCallback(Y,J,X)}throw new C(v.InvalidParams,`Resource ${Y} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(x1(S9)),this.server.assertCanSetRequestHandler(x1(P9)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(S9,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,Q])=>Q.enabled).map(([Q,X])=>{return{name:Q,title:X.title,description:X.description,arguments:X.argsSchema?Aj(X.argsSchema):void 0}})})),this.server.setRequestHandler(P9,async(Q,X)=>{let Y=this._registeredPrompts[Q.params.name];if(!Y)throw new C(v.InvalidParams,`Prompt ${Q.params.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Prompt ${Q.params.name} disabled`);if(Y.argsSchema){let W=S6(Y.argsSchema),$=await _9(W,Q.params.arguments);if(!$.success){let H="error"in $?$.error:"Unknown error",B=x9(H);throw new C(v.InvalidParams,`Invalid arguments for prompt ${Q.params.name}: ${B}`)}let J=$.data,G=Y.callback;return await Promise.resolve(G(J,X))}else{let W=Y.callback;return await Promise.resolve(W(X))}}),this._promptHandlersInitialized=!0}resource(Q,X,...Y){let W;if(typeof Y[0]==="object")W=Y.shift();let $=Y[0];if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let J=this._createRegisteredResource(Q,void 0,X,W,$);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,W,$);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}}registerResource(Q,X,Y,W){if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let $=this._createRegisteredResource(Q,Y.title,X,Y,W);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}else{if(this._registeredResourceTemplates[Q])throw Error(`Resource template ${Q} is already registered`);let $=this._createRegisteredResourceTemplate(Q,Y.title,X,Y,W);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}}_createRegisteredResource(Q,X,Y,W,$){let J={name:Q,title:X,metadata:W,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!==Y){if(delete this._registeredResources[Y],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[Y]=J,J}_createRegisteredResourceTemplate(Q,X,Y,W,$){let J={resourceTemplate:Y,title:X,metadata:W,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=Y.uriTemplate.variableNames;if(Array.isArray(G)&&G.some((B)=>!!Y.completeCallback(B)))this.setCompletionRequestHandler();return J}_createRegisteredPrompt(Q,X,Y,W,$){let J={title:X,description:Y,argsSchema:W===void 0?void 0:d1(W),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=d1(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,W){if(Object.values(W).some((H)=>{let B=H instanceof g0?H._def?.innerType:H;return OW(B)}))this.setCompletionRequestHandler()}return J}_createRegisteredTool(Q,X,Y,W,$,J,G,H,B){NW(Q);let z={title:X,description:Y,inputSchema:DB(W),outputSchema:DB($),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:(A)=>{if(typeof A.name<"u"&&A.name!==Q){if(typeof A.name==="string")NW(A.name);if(delete this._registeredTools[Q],A.name)this._registeredTools[A.name]=z}if(typeof A.title<"u")z.title=A.title;if(typeof A.description<"u")z.description=A.description;if(typeof A.paramsSchema<"u")z.inputSchema=d1(A.paramsSchema);if(typeof A.outputSchema<"u")z.outputSchema=d1(A.outputSchema);if(typeof A.callback<"u")z.handler=A.callback;if(typeof A.annotations<"u")z.annotations=A.annotations;if(typeof A._meta<"u")z._meta=A._meta;if(typeof A.enabled<"u")z.enabled=A.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 Y,W,$,J;if(typeof X[0]==="string")Y=X.shift();if(X.length>1){let H=X[0];if(MW(H)){if(W=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!MW(X[0]))J=X.shift()}else if(typeof H==="object"&&H!==null){if(Object.values(H).some((B)=>typeof B==="object"&&B!==null))throw Error(`Tool ${Q} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);J=X.shift()}}let G=X[0];return this._createRegisteredTool(Q,void 0,Y,W,$,J,{taskSupport:"forbidden"},void 0,G)}registerTool(Q,X,Y){if(this._registeredTools[Q])throw Error(`Tool ${Q} is already registered`);let{title:W,description:$,inputSchema:J,outputSchema:G,annotations:H,_meta:B}=X;return this._createRegisteredTool(Q,W,$,J,G,H,{taskSupport:"forbidden"},B,Y)}prompt(Q,...X){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let Y;if(typeof X[0]==="string")Y=X.shift();let W;if(X.length>1)W=X.shift();let $=X[0],J=this._createRegisteredPrompt(Q,void 0,Y,W,$);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),J}registerPrompt(Q,X,Y){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let{title:W,description:$,argsSchema:J}=X,G=this._createRegisteredPrompt(Q,W,$,J,Y);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 zj={type:"object",properties:{}};function qB(Q){return Q!==null&&typeof Q==="object"&&"parse"in Q&&typeof Q.parse==="function"&&"safeParse"in Q&&typeof Q.safeParse==="function"}function FB(Q){return"_def"in Q||"_zod"in Q||qB(Q)}function MW(Q){if(typeof Q!=="object"||Q===null)return!1;if(FB(Q))return!1;if(Object.keys(Q).length===0)return!0;return Object.values(Q).some(qB)}function DB(Q){if(!Q)return;if(MW(Q))return d1(Q);if(!FB(Q))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return Q}function Aj(Q){let X=P1(Q);if(!X)return[];return Object.entries(X).map(([Y,W])=>{let $=mJ(W),J=cJ(W);return{name:Y,description:$,required:!J}})}function x1(Q){let Y=P1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=g9(Y);if(typeof W==="string")return W;throw Error("Schema method literal must be a string")}function LB(Q){return{completion:{values:Q.slice(0,100),total:Q.length,hasMore:Q.length>100}}}var m4={completion:{values:[],hasMore:!1}};import{AsyncLocalStorage as Kj}from"node:async_hooks";var VB=new Kj;var Dj="https://api.stophy.dev/v1";class c4 extends Error{status;code;constructor(Q,X,Y){super(Y);this.status=Q;this.code=X;this.name="StophyError"}}async function c0(Q,X){let Y=VB.getStore()??process.env.STOPHY_API_KEY;if(!Y)throw new c4(0,"MISSING_API_KEY","No Stophy API key provided. Set STOPHY_API_KEY (stdio) or include your key in the URL path (hosted). Get a key at https://stophy.dev/dashboard.");let W=await fetch(`${Dj}${Q}`,{method:X!==void 0?"POST":"GET",headers:{Authorization:`Bearer ${Y}`,...X!==void 0?{"Content-Type":"application/json"}:{}},...X!==void 0?{body:JSON.stringify(X)}:{}}),$=await W.json();if(!$.success)throw new c4(W.status,$.code??"API_ERROR",$.error);return $.data}var UB={channelUrl:s.string().describe("YouTube channel URL. Accepts youtube.com/@handle or youtube.com/channel/UCxxx"),tab:s.enum(["video","short","playlist","about"]).optional().describe("Which tab to fetch. Defaults to video"),sortBy:s.enum(["latest","popular","oldest"]).optional().describe("Sort order for the video tab"),continuationToken:s.string().optional().describe("Pagination token from a previous channel response")};async function OB(Q){let X=await c0("/channel",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}async function NB(){let Q=await c0("/credits");return{content:[{type:"text",text:JSON.stringify(Q,null,2)}]}}var wB={playlistUrl:s.string().describe("YouTube playlist URL (youtube.com/playlist?list=PLxxx)"),continuationToken:s.string().optional().describe("Pagination token from a previous playlist response")};async function MB(Q){let X=await c0("/playlist",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}var jB={q:s.string().describe("Search query"),type:s.enum(["video","channel","playlist","short"]).optional().describe("Filter by content type"),uploadDate:s.enum(["hour","today","week","month","year"]).optional().describe("Filter by upload date"),duration:s.enum(["short","medium","long"]).optional().describe("short = under 4 min, medium = 4–20 min, long = over 20 min"),sortBy:s.enum(["relevance","popularity","date","rating"]).optional().describe("Sort order. Defaults to relevance"),continuationToken:s.string().optional().describe("Pagination token from a previous search response")};async function bB(Q){let X=await c0("/search",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}var EB={q:s.string().describe("Partial query to get autocomplete suggestions for"),hl:s.string().optional().describe("Language code (e.g. en, fr). Defaults to en"),gl:s.string().optional().describe("Country code (e.g. US, GB). Defaults to US")};async function SB(Q){let X=new URLSearchParams({q:Q.q});if(Q.hl)X.set("hl",Q.hl);if(Q.gl)X.set("gl",Q.gl);let Y=await c0(`/suggest?${X.toString()}`);return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}var PB={videoUrl:s.string().describe("YouTube video URL or ID (e.g. https://youtube.com/watch?v=VIDEO_ID)"),type:s.enum(["details","transcript","comments","livechat"]).describe("What to fetch: details = title/description/stats, transcript = timestamped captions, comments = threaded comments, livechat = live stream chat messages + status"),sortBy:s.enum(["latest","top"]).optional().describe("Sort order for comments. Defaults to top"),chatType:s.enum(["top","live"]).optional().describe("For livechat only: 'top' = Top chat (moderated, default), 'live' = Live chat (all messages). Applied on the first call; later polls keep the chosen mode."),continuationToken:s.string().optional().describe("Pagination token. For comments, pass a previous comments response token. For livechat, pass the continuationToken from a previous livechat response to poll for new messages.")};async function IB(Q){let X=await c0("/video",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}function f6(Q){return async(X)=>{try{return await Q(X)}catch(Y){return{content:[{type:"text",text:Y instanceof c4?`Stophy error (${Y.code}): ${Y.message}`:`Unexpected error: ${String(Y)}`}]}}}}var u6={readOnlyHint:!0,destructiveHint:!1};function RB(){let Q=new jW({name:"stophy",version:"1.0.0"});return Q.tool("stophy_search_videos","Search YouTube for videos, channels, playlists, or Shorts. Filter by upload date, duration, and sort order. Returns items with title, author, view count, duration, and publish date. Paginate with continuationToken. When you already have a video URL, use stophy_get_video instead.",jB,u6,f6(bB)),Q.tool("stophy_get_video",`Get YouTube data for a specific video. type="details": title, description, stats, tags, and related videos. type="transcript": timestamped captions with language info and speaker segments. type="comments": threaded comments with author, likes, and reply count — pass a comment's repliesToken as continuationToken to fetch its replies. type="livechat": real-time chat from a live stream. Poll with continuationToken every pollIntervalMs until it returns null (stream ended). Set chatType="top" for moderated chat or "live" for all messages. When discovering videos, use stophy_search_videos instead.`,PB,u6,f6(IB)),Q.tool("stophy_get_channel",'Browse a YouTube channel. Every tab returns channel info (name, handle, subscriber count, video count). tab="video", "short", or "playlist" lists content with pagination. tab="about" returns the full profile: country, join date, total views, and links. When you have a specific video URL, use stophy_get_video instead.',UB,u6,f6(OB)),Q.tool("stophy_get_playlist","Get all videos in a YouTube playlist. Returns the playlist title, author, and every video. Paginate with continuationToken.",wB,u6,f6(MB)),Q.tool("stophy_get_suggestions","YouTube autocomplete suggestions for a partial query. Returns an array of completions. Useful for topic discovery and query expansion.",EB,u6,f6(SB)),Q.tool("stophy_get_credits","Check your Stophy credit balance. Free — does not cost a credit. Returns remaining credits.",{},u6,f6(NB)),Q}var Lj=RB(),qj=new tX;await Lj.connect(qj);
33
+ path: iss.path ? [${Gt(E)}, ...iss.path] : [${Gt(E)}]
34
+ })));`),f.write(`newResult[${Gt(E)}] = ${S}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let w=f.compile();return(E,S)=>w(d,E,S)},n,s=Cr,i=!go.jitless,u=i&&Ra.value,c=t.catchall,l;e._zod.parse=(d,f)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;let h=[];if(i&&u&&f?.async===!1&&f.jitless!==!0){if(!n)n=o(t.shape);d=n(d,f)}else{d.value={};let S=l.shape;for(let N of l.keys){let v=S[N],b=v._zod.run({value:m[N],issues:[]},f),M=v._zod.optin==="optional"&&v._zod.optout==="optional";if(b instanceof Promise)h.push(b.then((re)=>M?Ec(re,d,N,m):ko(re,d,N)));else if(M)Ec(b,d,N,m);else ko(b,d,N)}}if(!c)return h.length?Promise.all(h).then(()=>d):d;let g=[],x=l.keySet,w=c._zod,E=w.def.type;for(let S of Object.keys(m)){if(x.has(S))continue;if(E==="never"){g.push(S);continue}let N=w.run({value:m[S],issues:[]},f);if(N instanceof Promise)h.push(N.then((v)=>ko(v,d,S)));else ko(N,d,S)}if(g.length)d.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:e});if(!h.length)return d;return Promise.all(h).then(()=>d)}});function Tc(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((s)=>Ve(s,o,Ce())))}),t}var vs=_("$ZodUnion",(e,t)=>{G.init(e,t),Q(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),Q(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>$o(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!n)return Tc(s,r,e,o);return Promise.all(s).then((i)=>Tc(i,r,e,o))}}),mu=_("$ZodDiscriminatedUnion",(e,t)=>{vs.init(e,t);let r=e._zod.parse;Q(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,u]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let c of u)n[a].add(c)}}return n});let o=yo(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let u of a){if(s.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Cr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback)return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),n}}),hu=_("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([u,c])=>Rc(r,u,c));return Rc(r,s,i)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Or(e)&&Or(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=_s(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=_s(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Rc(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(Yt(e))return e;let o=_s(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var gu=_("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Or(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let u of i)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){let c=t.valueType._zod.run({value:n[u],issues:[]},o);if(c instanceof Promise)s.push(c.then((l)=>{if(l.issues.length)r.issues.push(...rt(u,l.issues));r.value[u]=l.value}));else{if(c.issues.length)r.issues.push(...rt(u,c.issues));r.value[u]=c.value}}let a;for(let u in n)if(!i.has(u))a=a??[],a.push(u);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((c)=>Ve(c,o,Ce())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let u=t.valueType._zod.run({value:n[i],issues:[]},o);if(u instanceof Promise)s.push(u.then((c)=>{if(c.issues.length)r.issues.push(...rt(i,c.issues));r.value[a.value]=c.value}));else{if(u.issues.length)r.issues.push(...rt(i,u.issues));r.value[a.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var _u=_("$ZodEnum",(e,t)=>{G.init(e,t);let r=Pa(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>Ia.has(typeof o)).map((o)=>typeof o==="string"?Mt(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(e._zod.values.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),yu=_("$ZodLiteral",(e,t)=>{G.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Mt(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}});var vu=_("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new lt;return r.value=n,r}}),$u=_("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${$o(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),wu=_("$ZodNullable",(e,t)=>{G.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${$o(r.source)}|null)$`):void 0}),Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),xu=_("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Ic(s,t));return Ic(n,t)}});function Ic(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var bu=_("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),zu=_("$ZodNonOptional",(e,t)=>{G.init(e,t),Q(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Cc(s,e));return Cc(n,e)}});function Cc(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Su=_("$ZodCatch",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>Ve(i,o,Ce()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>Ve(s,o,Ce()))},input:r.value}),r.issues=[];return r}});var ku=_("$ZodPipe",(e,t)=>{G.init(e,t),Q(e._zod,"values",()=>t.in._zod.values),Q(e._zod,"optin",()=>t.in._zod.optin),Q(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Oc(s,t,o));return Oc(n,t,o)}});function Oc(e,t,r){if(Yt(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var Pu=_("$ZodReadonly",(e,t)=>{G.init(e,t),Q(e._zod,"propValues",()=>t.innerType._zod.propValues),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(jc);return jc(n)}});function jc(e){return e.value=Object.freeze(e.value),e}var Eu=_("$ZodCustom",(e,t)=>{be.init(e,t),G.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Nc(s,r,o,e));Nc(n,r,o,e);return}});function Nc(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Qt(n))}}var Wg=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Jg=()=>{let e={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 t(o){return e[o]??null}let r={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(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${Wg(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${is(o.values[0])}`;return`Invalid option: expected one of ${ns(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=t(o.origin);if(s)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${ns(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function $s(){return{localeError:Jg()}}var Gg=Symbol("ZodOutput"),Yg=Symbol("ZodInput");class Tu{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ru(){return new Tu}var Xt=Ru();function Iu(e,t){return new e({type:"string",...C(t)})}function Cu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(t)})}function ws(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(t)})}function Ou(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(t)})}function ju(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(t)})}function Nu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(t)})}function Au(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(t)})}function xs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(t)})}function Zu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(t)})}function qu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(t)})}function Mu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(t)})}function Du(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(t)})}function Lu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(t)})}function Uu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(t)})}function Vu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(t)})}function Fu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(t)})}function Hu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(t)})}function Ku(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(t)})}function Bu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(t)})}function Wu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(t)})}function Ju(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(t)})}function Gu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(t)})}function Yu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(t)})}function Qu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(t)})}function Xu(e,t){return new e({type:"string",format:"date",check:"string_format",...C(t)})}function el(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(t)})}function tl(e,t){return new e({type:"string",format:"duration",check:"string_format",...C(t)})}function rl(e,t){return new e({type:"number",checks:[],...C(t)})}function ol(e,t){return new e({type:"number",coerce:!0,checks:[],...C(t)})}function nl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(t)})}function sl(e,t){return new e({type:"boolean",...C(t)})}function il(e,t){return new e({type:"null",...C(t)})}function al(e){return new e({type:"any"})}function cl(e){return new e({type:"unknown"})}function ul(e,t){return new e({type:"never",...C(t)})}function Eo(e,t){return new ms({check:"less_than",...C(t),value:e,inclusive:!1})}function Ar(e,t){return new ms({check:"less_than",...C(t),value:e,inclusive:!0})}function To(e,t){return new hs({check:"greater_than",...C(t),value:e,inclusive:!1})}function Zr(e,t){return new hs({check:"greater_than",...C(t),value:e,inclusive:!0})}function Ro(e,t){return new fc({check:"multiple_of",...C(t),value:e})}function Io(e,t){return new hc({check:"max_length",...C(t),maximum:e})}function er(e,t){return new gc({check:"min_length",...C(t),minimum:e})}function Co(e,t){return new _c({check:"length_equals",...C(t),length:e})}function bs(e,t){return new yc({check:"string_format",format:"regex",...C(t),pattern:e})}function zs(e){return new vc({check:"string_format",format:"lowercase",...C(e)})}function Ss(e){return new $c({check:"string_format",format:"uppercase",...C(e)})}function ks(e,t){return new wc({check:"string_format",format:"includes",...C(t),includes:e})}function Ps(e,t){return new xc({check:"string_format",format:"starts_with",...C(t),prefix:e})}function Es(e,t){return new bc({check:"string_format",format:"ends_with",...C(t),suffix:e})}function Dt(e){return new zc({check:"overwrite",tx:e})}function Ts(e){return Dt((t)=>t.normalize(e))}function Rs(){return Dt((e)=>e.trim())}function Is(){return Dt((e)=>e.toLowerCase())}function Cs(){return Dt((e)=>e.toUpperCase())}function ll(e,t,r){return new e({type:"array",element:t,...C(r)})}function dl(e,t,r){let o=C(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function pl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...C(r)})}function pt(e){return!!e._zod}function ze(e,t){if(pt(e))return jr(e,t);return e.safeParse(t)}function rr(e){if(!e)return;let t;if(pt(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function fl(e){if(pt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var n_=_("ZodISODateTime",(e,t)=>{Bc.init(e,t),oe.init(e,t)});function Os(e){return Qu(n_,e)}var s_=_("ZodISODate",(e,t)=>{Wc.init(e,t),oe.init(e,t)});function ml(e){return Xu(s_,e)}var i_=_("ZodISOTime",(e,t)=>{Jc.init(e,t),oe.init(e,t)});function hl(e){return el(i_,e)}var a_=_("ZodISODuration",(e,t)=>{Gc.init(e,t),oe.init(e,t)});function gl(e){return tl(a_,e)}var yl=(e,t)=>{bo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>us(e,r)},flatten:{value:(r)=>cs(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},DP=_("ZodError",yl),qr=_("ZodError",yl,{Parent:Error});var vl=Na(qr),$l=Aa(qr),wl=ls(qr),xl=ds(qr);var ie=_("ZodType",(e,t)=>(G.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>Ue(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>vl(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>wl(e,r,o),e.parseAsync=async(r,o)=>$l(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>xl(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(J_(r,o)),e.superRefine=(r)=>e.check(G_(r)),e.overwrite=(r)=>e.check(Dt(r)),e.optional=()=>se(e),e.nullable=()=>Sl(e),e.nullish=()=>se(Sl(e)),e.nonoptional=(r)=>U_(e,r),e.array=()=>k(e),e.or=(r)=>te([e,r]),e.and=(r)=>No(e,r),e.transform=(r)=>As(e,Nl(r)),e.default=(r)=>M_(e,r),e.prefault=(r)=>L_(e,r),e.catch=(r)=>F_(e,r),e.pipe=(r)=>As(e,r),e.readonly=()=>B_(e),e.describe=(r)=>{let o=e.clone();return Xt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Xt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Xt.get(e);let o=e.clone();return Xt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),kl=_("_ZodString",(e,t)=>{Po.init(e,t),ie.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(bs(...o)),e.includes=(...o)=>e.check(ks(...o)),e.startsWith=(...o)=>e.check(Ps(...o)),e.endsWith=(...o)=>e.check(Es(...o)),e.min=(...o)=>e.check(er(...o)),e.max=(...o)=>e.check(Io(...o)),e.length=(...o)=>e.check(Co(...o)),e.nonempty=(...o)=>e.check(er(1,...o)),e.lowercase=(o)=>e.check(zs(o)),e.uppercase=(o)=>e.check(Ss(o)),e.trim=()=>e.check(Rs()),e.normalize=(...o)=>e.check(Ts(...o)),e.toLowerCase=()=>e.check(Is()),e.toUpperCase=()=>e.check(Cs())}),Pl=_("ZodString",(e,t)=>{Po.init(e,t),kl.init(e,t),e.email=(r)=>e.check(Cu(u_,r)),e.url=(r)=>e.check(xs(El,r)),e.jwt=(r)=>e.check(Yu(z_,r)),e.emoji=(r)=>e.check(Zu(l_,r)),e.guid=(r)=>e.check(ws(bl,r)),e.uuid=(r)=>e.check(Ou(Oo,r)),e.uuidv4=(r)=>e.check(ju(Oo,r)),e.uuidv6=(r)=>e.check(Nu(Oo,r)),e.uuidv7=(r)=>e.check(Au(Oo,r)),e.nanoid=(r)=>e.check(qu(d_,r)),e.guid=(r)=>e.check(ws(bl,r)),e.cuid=(r)=>e.check(Mu(p_,r)),e.cuid2=(r)=>e.check(Du(f_,r)),e.ulid=(r)=>e.check(Lu(m_,r)),e.base64=(r)=>e.check(Wu(w_,r)),e.base64url=(r)=>e.check(Ju(x_,r)),e.xid=(r)=>e.check(Uu(h_,r)),e.ksuid=(r)=>e.check(Vu(g_,r)),e.ipv4=(r)=>e.check(Fu(__,r)),e.ipv6=(r)=>e.check(Hu(y_,r)),e.cidrv4=(r)=>e.check(Ku(v_,r)),e.cidrv6=(r)=>e.check(Bu($_,r)),e.e164=(r)=>e.check(Gu(b_,r)),e.datetime=(r)=>e.check(Os(r)),e.date=(r)=>e.check(ml(r)),e.time=(r)=>e.check(hl(r)),e.duration=(r)=>e.check(gl(r))});function p(e){return Iu(Pl,e)}var oe=_("ZodStringFormat",(e,t)=>{ee.init(e,t),kl.init(e,t)}),u_=_("ZodEmail",(e,t)=>{qc.init(e,t),oe.init(e,t)});var bl=_("ZodGUID",(e,t)=>{Ac.init(e,t),oe.init(e,t)});var Oo=_("ZodUUID",(e,t)=>{Zc.init(e,t),oe.init(e,t)});var El=_("ZodURL",(e,t)=>{Mc.init(e,t),oe.init(e,t)});function Tl(e){return xs(El,e)}var l_=_("ZodEmoji",(e,t)=>{Dc.init(e,t),oe.init(e,t)});var d_=_("ZodNanoID",(e,t)=>{Lc.init(e,t),oe.init(e,t)});var p_=_("ZodCUID",(e,t)=>{Uc.init(e,t),oe.init(e,t)});var f_=_("ZodCUID2",(e,t)=>{Vc.init(e,t),oe.init(e,t)});var m_=_("ZodULID",(e,t)=>{Fc.init(e,t),oe.init(e,t)});var h_=_("ZodXID",(e,t)=>{Hc.init(e,t),oe.init(e,t)});var g_=_("ZodKSUID",(e,t)=>{Kc.init(e,t),oe.init(e,t)});var __=_("ZodIPv4",(e,t)=>{Yc.init(e,t),oe.init(e,t)});var y_=_("ZodIPv6",(e,t)=>{Qc.init(e,t),oe.init(e,t)});var v_=_("ZodCIDRv4",(e,t)=>{Xc.init(e,t),oe.init(e,t)});var $_=_("ZodCIDRv6",(e,t)=>{eu.init(e,t),oe.init(e,t)});var w_=_("ZodBase64",(e,t)=>{ru.init(e,t),oe.init(e,t)});var x_=_("ZodBase64URL",(e,t)=>{ou.init(e,t),oe.init(e,t)});var b_=_("ZodE164",(e,t)=>{nu.init(e,t),oe.init(e,t)});var z_=_("ZodJWT",(e,t)=>{su.init(e,t),oe.init(e,t)});var jo=_("ZodNumber",(e,t)=>{ys.init(e,t),ie.init(e,t),e.gt=(o,n)=>e.check(To(o,n)),e.gte=(o,n)=>e.check(Zr(o,n)),e.min=(o,n)=>e.check(Zr(o,n)),e.lt=(o,n)=>e.check(Eo(o,n)),e.lte=(o,n)=>e.check(Ar(o,n)),e.max=(o,n)=>e.check(Ar(o,n)),e.int=(o)=>e.check(zl(o)),e.safe=(o)=>e.check(zl(o)),e.positive=(o)=>e.check(To(0,o)),e.nonnegative=(o)=>e.check(Zr(0,o)),e.negative=(o)=>e.check(Eo(0,o)),e.nonpositive=(o)=>e.check(Ar(0,o)),e.multipleOf=(o,n)=>e.check(Ro(o,n)),e.step=(o,n)=>e.check(Ro(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function H(e){return rl(jo,e)}var S_=_("ZodNumberFormat",(e,t)=>{iu.init(e,t),jo.init(e,t)});function zl(e){return nl(S_,e)}var Rl=_("ZodBoolean",(e,t)=>{au.init(e,t),ie.init(e,t)});function Y(e){return sl(Rl,e)}var k_=_("ZodNull",(e,t)=>{cu.init(e,t),ie.init(e,t)});function Il(e){return il(k_,e)}var P_=_("ZodAny",(e,t)=>{uu.init(e,t),ie.init(e,t)});function Cl(){return al(P_)}var E_=_("ZodUnknown",(e,t)=>{lu.init(e,t),ie.init(e,t)});function ne(){return cl(E_)}var T_=_("ZodNever",(e,t)=>{du.init(e,t),ie.init(e,t)});function R_(e){return ul(T_,e)}var I_=_("ZodArray",(e,t)=>{pu.init(e,t),ie.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(er(r,o)),e.nonempty=(r)=>e.check(er(1,r)),e.max=(r,o)=>e.check(Io(r,o)),e.length=(r,o)=>e.check(Co(r,o)),e.unwrap=()=>e.element});function k(e,t){return ll(I_,e,t)}var Ol=_("ZodObject",(e,t)=>{fu.init(e,t),ie.init(e,t),Q(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ne()}),e.loose=()=>e.clone({...e._zod.def,catchall:ne()}),e.strict=()=>e.clone({...e._zod.def,catchall:R_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>Lg(e,r),e.merge=(r)=>Ug(e,r),e.pick=(r)=>Mg(e,r),e.omit=(r)=>Dg(e,r),e.partial=(...r)=>Vg(Al,e,r[0]),e.required=(...r)=>Fg(Zl,e,r[0])});function P(e,t){let r={type:"object",get shape(){return wo(this,"shape",{...e}),this.shape},...C(t)};return new Ol(r)}function ge(e,t){return new Ol({type:"object",get shape(){return wo(this,"shape",{...e}),this.shape},catchall:ne(),...C(t)})}var jl=_("ZodUnion",(e,t)=>{vs.init(e,t),ie.init(e,t),e.options=t.options});function te(e,t){return new jl({type:"union",options:e,...C(t)})}var C_=_("ZodDiscriminatedUnion",(e,t)=>{jl.init(e,t),mu.init(e,t)});function Zs(e,t,r){return new C_({type:"union",options:t,discriminator:e,...C(r)})}var O_=_("ZodIntersection",(e,t)=>{hu.init(e,t),ie.init(e,t)});function No(e,t){return new O_({type:"intersection",left:e,right:t})}var j_=_("ZodRecord",(e,t)=>{gu.init(e,t),ie.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function X(e,t,r){return new j_({type:"record",keyType:e,valueType:t,...C(r)})}var Ns=_("ZodEnum",(e,t)=>{_u.init(e,t),ie.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Ns({...t,checks:[],...C(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Ns({...t,checks:[],...C(n),entries:s})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ns({type:"enum",entries:r,...C(t)})}var N_=_("ZodLiteral",(e,t)=>{yu.init(e,t),ie.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new N_({type:"literal",values:Array.isArray(e)?e:[e],...C(t)})}var A_=_("ZodTransform",(e,t)=>{vu.init(e,t),ie.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(Qt(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(Qt(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function Nl(e){return new A_({type:"transform",transform:e})}var Al=_("ZodOptional",(e,t)=>{$u.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function se(e){return new Al({type:"optional",innerType:e})}var Z_=_("ZodNullable",(e,t)=>{wu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Sl(e){return new Z_({type:"nullable",innerType:e})}var q_=_("ZodDefault",(e,t)=>{xu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M_(e,t){return new q_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var D_=_("ZodPrefault",(e,t)=>{bu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function L_(e,t){return new D_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var Zl=_("ZodNonOptional",(e,t)=>{zu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function U_(e,t){return new Zl({type:"nonoptional",innerType:e,...C(t)})}var V_=_("ZodCatch",(e,t)=>{Su.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function F_(e,t){return new V_({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var H_=_("ZodPipe",(e,t)=>{ku.init(e,t),ie.init(e,t),e.in=t.in,e.out=t.out});function As(e,t){return new H_({type:"pipe",in:e,out:t})}var K_=_("ZodReadonly",(e,t)=>{Pu.init(e,t),ie.init(e,t)});function B_(e){return new K_({type:"readonly",innerType:e})}var ql=_("ZodCustom",(e,t)=>{Eu.init(e,t),ie.init(e,t)});function W_(e){let t=new be({check:"custom"});return t._zod.check=e,t}function Ml(e,t){return dl(ql,e??(()=>!0),t)}function J_(e,t={}){return pl(ql,e,t)}function G_(e){let t=W_((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Qt(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Qt(n))}},e(r.value,r)));return t}function qs(e,t){return As(Nl(e),t)}var Dl={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"};function Y_(e){return ol(jo,e)}Ce($s());var ft="2025-11-25";var Zo=[ft,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mt="io.modelcontextprotocol/related-task",qo="2.0",_e=Ml((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Ul=te([p(),H().int()]),Vl=p(),UE=ge({ttl:H().optional(),pollInterval:H().optional()}),X_=P({ttl:H().optional()}),ey=P({taskId:p()}),Ms=ge({progressToken:Ul.optional(),[mt]:ey.optional()}),Oe=P({_meta:Ms.optional()}),Mr=Oe.extend({task:X_.optional()}),Fl=(e)=>Mr.safeParse(e).success,ve=P({method:p(),params:Oe.loose().optional()}),je=P({_meta:Ms.optional()}),Ne=P({method:p(),params:je.loose().optional()}),$e=ge({_meta:Ms.optional()}),Mo=te([p(),H().int()]),Hl=P({jsonrpc:O(qo),id:Mo,...ve.shape}).strict(),Dr=(e)=>Hl.safeParse(e).success,Kl=P({jsonrpc:O(qo),...Ne.shape}).strict(),Bl=(e)=>Kl.safeParse(e).success,Ds=P({jsonrpc:O(qo),id:Mo,result:$e}).strict(),Lt=(e)=>Ds.safeParse(e).success;var Z;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Z||(Z={}));var Ls=P({jsonrpc:O(qo),id:Mo.optional(),error:P({code:H().int(),message:p(),data:ne().optional()})}).strict();var Wl=(e)=>Ls.safeParse(e).success;var nr=te([Hl,Kl,Ds,Ls]),VE=te([Ds,Ls]),ot=$e.strict(),ty=je.extend({requestId:Mo.optional(),reason:p().optional()}),Do=Ne.extend({method:O("notifications/cancelled"),params:ty}),ry=P({src:p(),mimeType:p().optional(),sizes:k(p()).optional(),theme:Pe(["light","dark"]).optional()}),Lr=P({icons:k(ry).optional()}),or=P({name:p(),title:p().optional()}),Jl=or.extend({...or.shape,...Lr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),oy=No(P({applyDefaults:Y().optional()}),X(p(),ne())),ny=qs((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},No(P({form:oy.optional(),url:_e.optional()}),X(p(),ne()).optional())),sy=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({sampling:ge({createMessage:_e.optional()}).optional(),elicitation:ge({create:_e.optional()}).optional()}).optional()}),iy=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({tools:ge({call:_e.optional()}).optional()}).optional()}),ay=P({experimental:X(p(),_e).optional(),sampling:P({context:_e.optional(),tools:_e.optional()}).optional(),elicitation:ny.optional(),roots:P({listChanged:Y().optional()}).optional(),tasks:sy.optional(),extensions:X(p(),_e).optional()}),cy=Oe.extend({protocolVersion:p(),capabilities:ay,clientInfo:Jl}),Us=ve.extend({method:O("initialize"),params:cy});var uy=P({experimental:X(p(),_e).optional(),logging:_e.optional(),completions:_e.optional(),prompts:P({listChanged:Y().optional()}).optional(),resources:P({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:P({listChanged:Y().optional()}).optional(),tasks:iy.optional(),extensions:X(p(),_e).optional()}),Vs=$e.extend({protocolVersion:p(),capabilities:uy,serverInfo:Jl,instructions:p().optional()}),Lo=Ne.extend({method:O("notifications/initialized"),params:je.optional()}),Gl=(e)=>Lo.safeParse(e).success,Uo=ve.extend({method:O("ping"),params:Oe.optional()}),ly=P({progress:H(),total:se(H()),message:se(p())}),dy=P({...je.shape,...ly.shape,progressToken:Ul}),Vo=Ne.extend({method:O("notifications/progress"),params:dy}),py=Oe.extend({cursor:Vl.optional()}),Ur=ve.extend({params:py.optional()}),Vr=$e.extend({nextCursor:Vl.optional()}),fy=Pe(["working","input_required","completed","failed","cancelled"]),Fr=P({taskId:p(),status:fy,ttl:te([H(),Il()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:se(H()),statusMessage:se(p())}),nt=$e.extend({task:Fr}),my=je.merge(Fr),Hr=Ne.extend({method:O("notifications/tasks/status"),params:my}),Fo=ve.extend({method:O("tasks/get"),params:Oe.extend({taskId:p()})}),Ho=$e.merge(Fr),Ko=ve.extend({method:O("tasks/result"),params:Oe.extend({taskId:p()})}),FE=$e.loose(),Bo=Ur.extend({method:O("tasks/list")}),Wo=Vr.extend({tasks:k(Fr)}),Jo=ve.extend({method:O("tasks/cancel"),params:Oe.extend({taskId:p()})}),Yl=$e.merge(Fr),Ql=P({uri:p(),mimeType:se(p()),_meta:X(p(),ne()).optional()}),Xl=Ql.extend({text:p()}),Fs=p().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ed=Ql.extend({blob:Fs}),Kr=Pe(["user","assistant"]),sr=P({audience:k(Kr).optional(),priority:H().min(0).max(1).optional(),lastModified:Os({offset:!0}).optional()}),td=P({...or.shape,...Lr.shape,uri:p(),description:se(p()),mimeType:se(p()),size:se(H()),annotations:sr.optional(),_meta:se(ge({}))}),hy=P({...or.shape,...Lr.shape,uriTemplate:p(),description:se(p()),mimeType:se(p()),annotations:sr.optional(),_meta:se(ge({}))}),gy=Ur.extend({method:O("resources/list")}),Hs=Vr.extend({resources:k(td)}),_y=Ur.extend({method:O("resources/templates/list")}),Ks=Vr.extend({resourceTemplates:k(hy)}),Bs=Oe.extend({uri:p()}),yy=Bs,vy=ve.extend({method:O("resources/read"),params:yy}),Ws=$e.extend({contents:k(te([Xl,ed]))}),Js=Ne.extend({method:O("notifications/resources/list_changed"),params:je.optional()}),$y=Bs,wy=ve.extend({method:O("resources/subscribe"),params:$y}),xy=Bs,by=ve.extend({method:O("resources/unsubscribe"),params:xy}),zy=je.extend({uri:p()}),Sy=Ne.extend({method:O("notifications/resources/updated"),params:zy}),ky=P({name:p(),description:se(p()),required:se(Y())}),Py=P({...or.shape,...Lr.shape,description:se(p()),arguments:se(k(ky)),_meta:se(ge({}))}),Ey=Ur.extend({method:O("prompts/list")}),Gs=Vr.extend({prompts:k(Py)}),Ty=Oe.extend({name:p(),arguments:X(p(),p()).optional()}),Ry=ve.extend({method:O("prompts/get"),params:Ty}),Ys=P({type:O("text"),text:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Qs=P({type:O("image"),data:Fs,mimeType:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Xs=P({type:O("audio"),data:Fs,mimeType:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Iy=P({type:O("tool_use"),name:p(),id:p(),input:X(p(),ne()),_meta:X(p(),ne()).optional()}),Cy=P({type:O("resource"),resource:te([Xl,ed]),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Oy=td.extend({type:O("resource_link")}),ei=te([Ys,Qs,Xs,Oy,Cy]),jy=P({role:Kr,content:ei}),ti=$e.extend({description:p().optional(),messages:k(jy)}),ri=Ne.extend({method:O("notifications/prompts/list_changed"),params:je.optional()}),Ny=P({title:p().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),Ay=P({taskSupport:Pe(["required","optional","forbidden"]).optional()}),rd=P({...or.shape,...Lr.shape,description:p().optional(),inputSchema:P({type:O("object"),properties:X(p(),_e).optional(),required:k(p()).optional()}).catchall(ne()),outputSchema:P({type:O("object"),properties:X(p(),_e).optional(),required:k(p()).optional()}).catchall(ne()).optional(),annotations:Ny.optional(),execution:Ay.optional(),_meta:X(p(),ne()).optional()}),oi=Ur.extend({method:O("tools/list")}),ni=Vr.extend({tools:k(rd)}),ht=$e.extend({content:k(ei).default([]),structuredContent:X(p(),ne()).optional(),isError:Y().optional()}),HE=ht.or($e.extend({toolResult:ne()})),Zy=Mr.extend({name:p(),arguments:X(p(),ne()).optional()}),Br=ve.extend({method:O("tools/call"),params:Zy}),Wr=Ne.extend({method:O("notifications/tools/list_changed"),params:je.optional()}),od=P({autoRefresh:Y().default(!0),debounceMs:H().int().nonnegative().default(300)}),Jr=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),qy=Oe.extend({level:Jr}),si=ve.extend({method:O("logging/setLevel"),params:qy}),My=je.extend({level:Jr,logger:p().optional(),data:ne()}),Dy=Ne.extend({method:O("notifications/message"),params:My}),Ly=P({name:p().optional()}),Uy=P({hints:k(Ly).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),Vy=P({mode:Pe(["auto","required","none"]).optional()}),Fy=P({type:O("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:k(ei).default([]),structuredContent:P({}).loose().optional(),isError:Y().optional(),_meta:X(p(),ne()).optional()}),Hy=Zs("type",[Ys,Qs,Xs]),Ao=Zs("type",[Ys,Qs,Xs,Iy,Fy]),Ky=P({role:Kr,content:te([Ao,k(Ao)]),_meta:X(p(),ne()).optional()}),By=Mr.extend({messages:k(Ky),modelPreferences:Uy.optional(),systemPrompt:p().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:k(p()).optional(),metadata:_e.optional(),tools:k(rd).optional(),toolChoice:Vy.optional()}),ii=ve.extend({method:O("sampling/createMessage"),params:By}),Ut=$e.extend({model:p(),stopReason:se(Pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:Kr,content:Hy}),Gr=$e.extend({model:p(),stopReason:se(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:Kr,content:te([Ao,k(Ao)])}),Wy=P({type:O("boolean"),title:p().optional(),description:p().optional(),default:Y().optional()}),Jy=P({type:O("string"),title:p().optional(),description:p().optional(),minLength:H().optional(),maxLength:H().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),Gy=P({type:Pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),Yy=P({type:O("string"),title:p().optional(),description:p().optional(),enum:k(p()),default:p().optional()}),Qy=P({type:O("string"),title:p().optional(),description:p().optional(),oneOf:k(P({const:p(),title:p()})),default:p().optional()}),Xy=P({type:O("string"),title:p().optional(),description:p().optional(),enum:k(p()),enumNames:k(p()).optional(),default:p().optional()}),ev=te([Yy,Qy]),tv=P({type:O("array"),title:p().optional(),description:p().optional(),minItems:H().optional(),maxItems:H().optional(),items:P({type:O("string"),enum:k(p())}),default:k(p()).optional()}),rv=P({type:O("array"),title:p().optional(),description:p().optional(),minItems:H().optional(),maxItems:H().optional(),items:P({anyOf:k(P({const:p(),title:p()}))}),default:k(p()).optional()}),ov=te([tv,rv]),nv=te([Xy,ev,ov]),sv=te([nv,Wy,Jy,Gy]),iv=Mr.extend({mode:O("form").optional(),message:p(),requestedSchema:P({type:O("object"),properties:X(p(),sv),required:k(p()).optional()})}),av=Mr.extend({mode:O("url"),message:p(),elicitationId:p(),url:p().url()}),cv=te([iv,av]),ai=ve.extend({method:O("elicitation/create"),params:cv}),uv=je.extend({elicitationId:p()}),lv=Ne.extend({method:O("notifications/elicitation/complete"),params:uv}),gt=$e.extend({action:Pe(["accept","decline","cancel"]),content:qs((e)=>e===null?void 0:e,X(p(),te([p(),H(),Y(),k(p())])).optional())}),dv=P({type:O("ref/resource"),uri:p()});var pv=P({type:O("ref/prompt"),name:p()}),fv=Oe.extend({ref:te([pv,dv]),argument:P({name:p(),value:p()}),context:P({arguments:X(p(),p()).optional()}).optional()}),mv=ve.extend({method:O("completion/complete"),params:fv});var ci=$e.extend({completion:ge({values:k(p()).max(100),total:se(H().int()),hasMore:se(Y())})}),hv=P({uri:p().startsWith("file://"),name:p().optional(),_meta:X(p(),ne()).optional()}),gv=ve.extend({method:O("roots/list"),params:Oe.optional()}),ui=$e.extend({roots:k(hv)}),_v=Ne.extend({method:O("notifications/roots/list_changed"),params:je.optional()}),KE=te([Uo,Us,mv,si,Ry,Ey,gy,_y,vy,wy,by,Br,oi,Fo,Ko,Bo,Jo]),BE=te([Do,Vo,Lo,_v,Hr]),WE=te([ot,Ut,Gr,gt,ui,Ho,Wo,nt]),JE=te([Uo,ii,ai,gv,Fo,Ko,Bo,Jo]),GE=te([Do,Vo,Dy,Sy,Js,Wr,ri,Hr,lv]),YE=te([ot,Vs,ci,ti,Gs,Hs,Ks,Ws,ht,ni,Ho,Wo,nt]);class j extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Z.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new nd(o.elicitations,t)}return new j(e,t,r)}}class nd extends j{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function _t(e){return e==="completed"||e==="failed"||e==="cancelled"}var yv=Symbol("Let zodToJsonSchema decide on which parser to use");var RT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function li(e){let r=rr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=fl(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function di(e,t){let r=ze(e,t);if(!r.success)throw r.error;return r.data}var zv=60000;class Qr{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Do,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Vo,(t)=>{this._onprogress(t)}),this.setRequestHandler(Uo,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Fo,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new j(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ko,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new j(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(n,r.sessionId);if(!s)throw new j(Z.InvalidParams,`Task not found: ${n}`);if(!_t(s.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(_t(s.status)){let i=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...i,_meta:{...i._meta,[mt]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(Bo,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new j(Z.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Jo,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new j(Z.InvalidParams,`Task not found: ${t.params.taskId}`);if(_t(o.status))throw new j(Z.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new j(Z.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof j)throw o;throw new j(Z.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),j.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),Lt(n)||Wl(n))this._onresponse(n);else if(Dr(n))this._onrequest(n,s);else if(Bl(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=j.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[mt]?.taskId;if(r===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:c,timestamp:Date.now()},o?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else o?.send(c).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Fl(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(c)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(n)l.relatedTask={taskId:n};await this.notification(c,l)},sendRequest:async(c,l,d)=>{if(s.signal.aborted)throw new j(Z.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:e.id};if(n&&!f.relatedTask)f.relatedTask={taskId:n};let m=f.relatedTask?.taskId??n;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(c,l,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async(c)=>{if(s.signal.aborted)return;let l={result:c,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)},async(c)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Z.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)}).catch((c)=>this._onerror(Error(`Failed to send response: ${c}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Lt(e))r(e);else{let s=new j(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Lt(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")n=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Lt(e))o(e);else{let s=j.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof j?s:new j(Z.InternalError,String(s))}}return}let n;try{let s=await this.request(e,nt,r);if(s.task)n=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new j(Z.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:i},_t(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(i.status==="failed")yield{type:"error",error:new j(Z.InternalError,`Task ${n} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new j(Z.InternalError,`Task ${n} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof j?s:new j(Z.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(w)=>{c(w)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(w){l(w);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[mt]:a}};let m=(w)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(w)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((S)=>this._onerror(Error(`Failed to send cancellation: ${S}`)));let E=w instanceof j?w:new j(Z.RequestTimeout,String(w));c(E)};this._responseHandlers.set(d,(w)=>{if(r?.signal?.aborted)return;if(w instanceof Error)return c(w);try{let E=ze(t,w.result);if(!E.success)c(E.error);else u(E.data)}catch(E){c(E)}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let h=r?.timeout??zv,g=()=>m(j.fromError(Z.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(d,h,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let x=a?.taskId;if(x){let w=(E)=>{let S=this._responseHandlers.get(d);if(S)S(E);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,w),this._enqueueTaskMessage(x,{type:"request",message:f,timestamp:Date.now()}).catch((E)=>{this._cleanupTimeout(d),c(E)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((w)=>{this._cleanupTimeout(d),c(w)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Ho,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Wo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Yl,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[mt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[mt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=li(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let s=di(e,o);return Promise.resolve(t(s,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=li(e);this._notificationHandlers.set(r,(o)=>{let n=di(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&Dr(o.message)){let n=o.message.id,s=this._requestResolvers.get(n);if(s)s(new j(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new j(Z.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(s),n(new j(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new j(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,s)=>{await r.storeTaskResult(o,n,s,t);let i=await r.getTask(o,t);if(i){let a=Hr.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),_t(i.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,s)=>{let i=await r.getTask(o,t);if(!i)throw new j(Z.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(_t(i.status))throw new j(Z.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,s,t);let a=await r.getTask(o,t);if(a){let u=Hr.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),_t(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function sd(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Go(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];if(sd(i)&&sd(s))r[n]={...i,...s};else r[n]=s}return r}var ug=ka(Ji(),1),lg=ka(cg(),1);function ck(){let e=new ug.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return lg.default(e),e}class po{constructor(e){this._ajv=e??ck()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class na{constructor(e){this._client=e}async*callToolStream(e,t=ht,r){let o=this._client,n={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},s=o.requestStream({method:"tools/call",params:e},t,n),i=o.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new j(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new j(Z.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof j){yield{type:"error",error:c};return}yield{type:"error",error:new j(Z.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Mn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Dn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function Ln(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)Ln(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Ln(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Ln(r,t)}}function uk(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class sa extends Qr{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new po,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",Wr,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",ri,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",Js,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new na(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Go(this._capabilities,e)}setRequestHandler(e,t){let o=rr(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(pt(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");let s=n;if(s==="elicitation/create"){let i=async(a,u)=>{let c=ze(ai,a);if(!c.success){let w=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid elicitation request: ${w}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:f}=uk(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new j(Z.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!f)throw new j(Z.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(t(a,u));if(l.task){let w=ze(nt,m);if(!w.success){let E=w.error instanceof Error?w.error.message:String(w.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${E}`)}return w.data}let h=ze(gt,m);if(!h.success){let w=h.error instanceof Error?h.error.message:String(h.error);throw new j(Z.InvalidParams,`Invalid elicitation result: ${w}`)}let g=h.data,x=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&x){if(this._capabilities.elicitation?.form?.applyDefaults)try{Ln(x,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=ze(ii,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=ze(nt,d);if(!g.success){let x=g.error instanceof Error?g.error.message:String(g.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${x}`)}return g.data}let m=l.tools||l.toolChoice?Gr:Ut,h=ze(m,d);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new j(Z.InvalidParams,`Invalid sampling result: ${g}`)}return h.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:ft,capabilities:this._capabilities,clientInfo:this._clientInfo}},Vs,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Zo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);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 ${e})`);break;case"ping":break}}assertTaskCapability(e){Mn(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Dn(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},ot,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},ci,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},ot,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ti,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Gs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Hs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ks,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ws,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},ot,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},ot,t)}async callTool(e,t=ht,r){if(this.isToolTaskRequired(e.name))throw new j(Z.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},t,r),n=this.getToolOutputValidator(e.name);if(n){if(!o.structuredContent&&!o.isError)throw new j(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=n(o.structuredContent);if(!s.valid)throw new j(Z.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof j)throw s;throw new j(Z.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},ni,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){let n=od.safeParse(r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await o();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Un(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function dg(e=fetch,t){if(!t)return e;return async(r,o)=>{let n={...t,...o,headers:o?.headers?{...Un(t.headers),...Un(o.headers)}:t.headers};return e(r,n)}}var ia;ia=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function lk(e){return(await ia).getRandomValues(new Uint8Array(e))}async function dk(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let n=await lk(e-o.length);for(let s of n)if(s<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return o}async function pk(e){return await dk(e)}async function fk(e){let t=await(await ia).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function aa(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await pk(e),r=await fk(t);return{code_verifier:t,code_challenge:r}}var xe=Tl().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Dl.custom,message:"URL must be parseable",fatal:!0}),rs}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),fg=ge({resource:p().url(),authorization_servers:k(xe).optional(),jwks_uri:p().url().optional(),scopes_supported:k(p()).optional(),bearer_methods_supported:k(p()).optional(),resource_signing_alg_values_supported:k(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:Y().optional(),authorization_details_types_supported:k(p()).optional(),dpop_signing_alg_values_supported:k(p()).optional(),dpop_bound_access_tokens_required:Y().optional()}),ca=ge({issuer:p(),authorization_endpoint:xe,token_endpoint:xe,registration_endpoint:xe.optional(),scopes_supported:k(p()).optional(),response_types_supported:k(p()),response_modes_supported:k(p()).optional(),grant_types_supported:k(p()).optional(),token_endpoint_auth_methods_supported:k(p()).optional(),token_endpoint_auth_signing_alg_values_supported:k(p()).optional(),service_documentation:xe.optional(),revocation_endpoint:xe.optional(),revocation_endpoint_auth_methods_supported:k(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:k(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:k(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:k(p()).optional(),code_challenge_methods_supported:k(p()).optional(),client_id_metadata_document_supported:Y().optional()}),mk=ge({issuer:p(),authorization_endpoint:xe,token_endpoint:xe,userinfo_endpoint:xe.optional(),jwks_uri:xe,registration_endpoint:xe.optional(),scopes_supported:k(p()).optional(),response_types_supported:k(p()),response_modes_supported:k(p()).optional(),grant_types_supported:k(p()).optional(),acr_values_supported:k(p()).optional(),subject_types_supported:k(p()),id_token_signing_alg_values_supported:k(p()),id_token_encryption_alg_values_supported:k(p()).optional(),id_token_encryption_enc_values_supported:k(p()).optional(),userinfo_signing_alg_values_supported:k(p()).optional(),userinfo_encryption_alg_values_supported:k(p()).optional(),userinfo_encryption_enc_values_supported:k(p()).optional(),request_object_signing_alg_values_supported:k(p()).optional(),request_object_encryption_alg_values_supported:k(p()).optional(),request_object_encryption_enc_values_supported:k(p()).optional(),token_endpoint_auth_methods_supported:k(p()).optional(),token_endpoint_auth_signing_alg_values_supported:k(p()).optional(),display_values_supported:k(p()).optional(),claim_types_supported:k(p()).optional(),claims_supported:k(p()).optional(),service_documentation:p().optional(),claims_locales_supported:k(p()).optional(),ui_locales_supported:k(p()).optional(),claims_parameter_supported:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:xe.optional(),op_tos_uri:xe.optional(),client_id_metadata_document_supported:Y().optional()}),mg=P({...mk.shape,...ca.pick({code_challenge_methods_supported:!0}).shape}),hg=P({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:Y_().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),gg=P({error:p(),error_description:p().optional(),error_uri:p().optional()}),pg=xe.optional().or(O("").transform(()=>{return})),hk=P({redirect_uris:k(xe),token_endpoint_auth_method:p().optional(),grant_types:k(p()).optional(),response_types:k(p()).optional(),client_name:p().optional(),client_uri:xe.optional(),logo_uri:pg,scope:p().optional(),contacts:k(p()).optional(),tos_uri:pg,policy_uri:p().optional(),jwks_uri:xe.optional(),jwks:Cl().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),gk=P({client_id:p(),client_secret:p().optional(),client_id_issued_at:H().optional(),client_secret_expires_at:H().optional()}).strip(),_g=hk.merge(gk),EO=P({error:p(),error_description:p().optional()}).strip(),TO=P({token:p(),token_type_hint:p().optional()}).strip();function yg(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function vg({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}class he extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Vn extends he{}Vn.errorCode="invalid_request";class Pr extends he{}Pr.errorCode="invalid_client";class Er extends he{}Er.errorCode="invalid_grant";class Tr extends he{}Tr.errorCode="unauthorized_client";class Fn extends he{}Fn.errorCode="unsupported_grant_type";class Hn extends he{}Hn.errorCode="invalid_scope";class Kn extends he{}Kn.errorCode="access_denied";class Zt extends he{}Zt.errorCode="server_error";class Bn extends he{}Bn.errorCode="temporarily_unavailable";class Wn extends he{}Wn.errorCode="unsupported_response_type";class Jn extends he{}Jn.errorCode="unsupported_token_type";class Gn extends he{}Gn.errorCode="invalid_token";class Yn extends he{}Yn.errorCode="method_not_allowed";class Qn extends he{}Qn.errorCode="too_many_requests";class Rr extends he{}Rr.errorCode="invalid_client_metadata";class Xn extends he{}Xn.errorCode="insufficient_scope";class es extends he{}es.errorCode="invalid_target";var $g={[Vn.errorCode]:Vn,[Pr.errorCode]:Pr,[Er.errorCode]:Er,[Tr.errorCode]:Tr,[Fn.errorCode]:Fn,[Hn.errorCode]:Hn,[Kn.errorCode]:Kn,[Zt.errorCode]:Zt,[Bn.errorCode]:Bn,[Wn.errorCode]:Wn,[Jn.errorCode]:Jn,[Gn.errorCode]:Gn,[Yn.errorCode]:Yn,[Qn.errorCode]:Qn,[Rr.errorCode]:Rr,[Xn.errorCode]:Xn,[es.errorCode]:es};class qt extends Error{constructor(e){super(e??"Unauthorized")}}function _k(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var ua="code",la="S256";function yk(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&_k(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function vk(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":$k(n,s,r);return;case"client_secret_post":wk(n,s,o);return;case"none":xk(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function $k(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function wk(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function xk(e,t){t.set("client_id",e)}async function xg(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=gg.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o;return new($g[n]||Zt)(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new Zt(n)}}async function fo(e,t){try{return await da(e,t)}catch(r){if(r instanceof Pr||r instanceof Tr)return await e.invalidateCredentials?.("all"),await da(e,t);else if(r instanceof Er)return await e.invalidateCredentials?.("tokens"),await da(e,t);throw r}}async function da(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,u,c,l=n;if(!l&&i?.resourceMetadataUrl)l=new URL(i.resourceMetadataUrl);if(i?.authorizationServerUrl){if(u=i.authorizationServerUrl,a=i.resourceMetadata,c=i.authorizationServerMetadata??await zg(u,{fetchFn:s}),!a)try{a=await bg(t,{resourceMetadataUrl:l},s)}catch{}if(c!==i.authorizationServerMetadata||a!==i.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let S=await Tk(t,{resourceMetadataUrl:l,fetchFn:s});u=S.authorizationServerUrl,c=S.authorizationServerMetadata,a=S.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await zk(t,e,a),f=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let S=c?.client_id_metadata_document_supported===!0,N=e.clientMetadataUrl;if(N&&!bk(N))throw new Rr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${N}`);if(S&&N)m={client_id:N},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let b=await jk(u,{metadata:c,clientMetadata:e.clientMetadata,scope:f,fetchFn:s});await e.saveClientInformation(b),m=b}}let h=!e.redirectUrl;if(r!==void 0||h){let S=await Ok(e,u,{metadata:c,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}let g=await e.tokens();if(g?.refresh_token)try{let S=await Ck(u,{metadata:c,clientInformation:m,refreshToken:g.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}catch(S){if(!(S instanceof he)||S instanceof Zt);else throw S}let x=e.state?await e.state():void 0,{authorizationUrl:w,codeVerifier:E}=await Rk(u,{metadata:c,clientInformation:m,state:x,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(E),await e.redirectToAuthorization(w),"REDIRECT"}function bk(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function zk(e,t,r){let o=yg(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!vg({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}function fa(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=pa(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=pa(e,"scope")||void 0,a=pa(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function pa(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);if(n)return n[1]||n[2];return null}async function bg(e,t,r=fetch){let o=await Pk(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return fg.parse(await o.json())}async function ma(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)if(t)return ma(e,void 0,r);else return;throw o}}function Sk(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function wg(e,t,r=fetch){return await ma(e,{"MCP-Protocol-Version":t},r)}function kk(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function Pk(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??ft,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let u=Sk(t,n.pathname);i=new URL(u,o?.metadataServerUrl??n),i.search=n.search}let a=await wg(i,s,r);if(!o?.metadataUrl&&kk(a,n.pathname)){let u=new URL(`/.well-known/${t}`,n);a=await wg(u,s,r)}return a}function Ek(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;if(n.endsWith("/"))n=n.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function zg(e,{fetchFn:t=fetch,protocolVersion:r=ft}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=Ek(e);for(let{url:s,type:i}of n){let a=await ma(s,o,t);if(!a)continue;if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(i==="oauth")return ca.parse(await a.json());else return mg.parse(await a.json())}return}async function Tk(e,t){let r,o;try{if(r=await bg(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch{}if(!o)o=String(new URL("/",e));let n=await zg(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function Rk(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(ua))throw Error(`Incompatible auth server: does not support response type ${ua}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(la))throw Error(`Incompatible auth server: does not support code challenge method ${la}`)}else a=new URL("/authorize",e);let u=await aa(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",ua),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",la),a.searchParams.set("redirect_uri",String(o)),s)a.searchParams.set("state",s);if(n)a.searchParams.set("scope",n);if(n?.includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",i.href);return{authorizationUrl:a,codeVerifier:c}}function Ik(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Sg(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",s.href);if(n)await n(u,r,a,t);else if(o){let l=t?.token_endpoint_auth_methods_supported??[],d=yk(o,l);vk(d,o,u,r)}let c=await(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await xg(c);return hg.parse(await c.json())}async function Ck(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),u=await Sg(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...u}}async function Ok(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=e.clientMetadata.scope,a;if(e.prepareTokenRequest)a=await e.prepareTokenRequest(i);if(!a){if(!n)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let c=await e.codeVerifier();a=Ik(n,c,e.redirectUrl)}let u=await e.clientInformation();return Sg(t,{metadata:r,tokenRequestParams:a,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function jk(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await xg(i);return _g.parse(await i.json())}class ts extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var kg=10,Nk=13,Wt=32;function ha(e){}function Tg(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=ha,onError:r=ha,onRetry:o=ha,onComment:n,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,f,m=!1;function h(v){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,v.charCodeAt(0)===239&&v.charCodeAt(1)===187&&v.charCodeAt(2)===191&&(v=v.slice(3))),i.length===0){let re=x(v);re!==""&&(i.push(re),a=re.length),g();return}if(v.indexOf(`
35
+ `)===-1&&v.indexOf("\r")===-1){i.push(v),a+=v.length,g();return}i.push(v);let b=i.join("");i.length=0,a=0;let M=x(b);M!==""&&(i.push(M),a=M.length),g()}function g(){s!==void 0&&(a+l.length<=s||(m=!0,i.length=0,a=0,c=void 0,l="",d=0,f=void 0,r(new ts(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function x(v){let b=0;if(v.indexOf("\r")===-1){let M=v.indexOf(`
36
+ `,b);for(;M!==-1;){if(b===M){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0,b=M+1,M=v.indexOf(`
37
+ `,b);continue}let re=v.charCodeAt(b);if(Pg(v,b,re)){let fe=v.charCodeAt(b+5)===Wt?b+6:b+5,ke=v.slice(fe,M);if(d===0&&v.charCodeAt(M+1)===kg){t({id:c,event:f,data:ke}),c=void 0,l="",f=void 0,b=M+2,M=v.indexOf(`
38
+ `,b);continue}l=d===0?ke:`${l}
39
+ ${ke}`,d++}else Eg(v,b,re)?f=v.slice(v.charCodeAt(b+6)===Wt?b+7:b+6,M)||void 0:w(v,b,M);b=M+1,M=v.indexOf(`
40
+ `,b)}return v.slice(b)}for(;b<v.length;){let M=v.indexOf("\r",b),re=v.indexOf(`
41
+ `,b),fe=-1;if(M!==-1&&re!==-1?fe=M<re?M:re:M!==-1?M===v.length-1?fe=-1:fe=M:re!==-1&&(fe=re),fe===-1)break;w(v,b,fe),b=fe+1,v.charCodeAt(b-1)===Nk&&v.charCodeAt(b)===kg&&b++}return v.slice(b)}function w(v,b,M){if(b===M){S();return}let re=v.charCodeAt(b);if(Pg(v,b,re)){let ut=v.charCodeAt(b+5)===Wt?b+6:b+5,ba=v.slice(ut,M);l=d===0?ba:`${l}
42
+ ${ba}`,d++;return}if(Eg(v,b,re)){f=v.slice(v.charCodeAt(b+6)===Wt?b+7:b+6,M)||void 0;return}if(re===105&&v.charCodeAt(b+1)===100&&v.charCodeAt(b+2)===58){let ut=v.slice(v.charCodeAt(b+3)===Wt?b+4:b+3,M);c=ut.includes("\x00")?void 0:ut;return}if(re===58){if(n){let ut=v.slice(b,M);n(ut.slice(v.charCodeAt(b+1)===Wt?2:1))}return}let fe=v.slice(b,M),ke=fe.indexOf(":");if(ke===-1){E(fe,"",fe);return}let Ir=fe.slice(0,ke),mo=fe.charCodeAt(ke+1)===Wt?2:1,ho=fe.slice(ke+mo);E(Ir,ho,fe)}function E(v,b,M){switch(v){case"event":f=b||void 0;break;case"data":l=d===0?b:`${l}
43
+ ${b}`,d++;break;case"id":c=b.includes("\x00")?void 0:b;break;case"retry":/^\d+$/.test(b)?o(parseInt(b,10)):r(new ts(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:M}));break;default:r(new ts(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:b,line:M}));break}}function S(){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0}function N(v={}){if(v.consume&&i.length>0){let b=i.join("");w(b,0,b.length)}u=!0,c=void 0,l="",d=0,f=void 0,i.length=0,a=0,m=!1}return{feed:h,reset:N}}function Pg(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Eg(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class ga extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let n;super({start(s){n=Tg({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:o})},transform(s){n.feed(s)}})}}var Ak={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Jt extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class _a{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=dg(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??Ak}async _authThenStart(){if(!this._authProvider)throw new qt("No auth provider");let e;try{e=await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new qt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let r=await this._authProvider.tokens();if(r)e.Authorization=`Bearer ${r.access_token}`}if(this._sessionId)e["mcp-session-id"]=this._sessionId;if(this._protocolVersion)e["mcp-protocol-version"]=this._protocolVersion;let t=Un(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();if(r.set("Accept","text/event-stream"),t)r.set("last-event-id",t);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Jt(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(r){throw this.onerror?.(r),r}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let o=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch((n)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,t+1)})},o)}_handleSseStream(e,t,r){if(!e)return;let{onresumptiontoken:o,replayMessageId:n}=t,s,i=!1,a=!1;(async()=>{try{let c=e.pipeThrough(new TextDecoderStream).pipeThrough(new ga({onRetry:(f)=>{this._serverRetryMs=f}})).getReader();while(!0){let{value:f,done:m}=await c.read();if(m)break;if(f.id)s=f.id,i=!0,o?.(f.id);if(!f.data)continue;if(!f.event||f.event==="message")try{let h=nr.parse(JSON.parse(f.data));if(Lt(h)){if(a=!0,n!==void 0)h.id=n}this.onmessage?.(h)}catch(h){this.onerror?.(h)}}if((r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:n},0)}catch(c){if(this.onerror?.(Error(`SSE stream disconnected: ${c}`)),(r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:n},0)}catch(f){this.onerror?.(Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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(e){if(!this._authProvider)throw new qt("No auth provider");if(await fo(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qt("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:o}=t||{};if(r){this._startOrAuthSse({resumptionToken:r,replayMessageId:Dr(e)?e.id:void 0}).catch((d)=>this.onerror?.(d));return}let n=await this._commonHeaders();n.set("content-type","application/json"),n.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,s),a=i.headers.get("mcp-session-id");if(a)this._sessionId=a;if(!i.ok){let d=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Jt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=fa(i);if(this._resourceMetadataUrl=f,this._scope=m,await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qt;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=fa(i);if(h==="insufficient_scope"){let g=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===g)throw new Jt(403,"Server returned 403 after trying upscoping");if(m)this._scope=m;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=g??void 0,await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new qt;return this.send(e)}}throw new Jt(i.status,`Error POSTing to endpoint: ${d}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Gl(e))this._startOrAuthSse({resumptionToken:void 0}).catch((d)=>this.onerror?.(d));return}let c=(Array.isArray(e)?e:[e]).filter((d)=>("method"in d)&&("id"in d)&&d.id!==void 0).length>0,l=i.headers.get("content-type");if(c)if(l?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:o},!1);else if(l?.includes("application/json")){let d=await i.json(),f=Array.isArray(d)?d.map((m)=>nr.parse(m)):[nr.parse(d)];for(let m of f)this.onmessage?.(m)}else throw await i.body?.cancel(),new Jt(-1,`Unexpected content type: ${l}`);else await i.body?.cancel()}catch(r){throw this.onerror?.(r),r}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await(this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&r.status!==405)throw new Jt(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}class ya{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),l=new Set(n.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==l.size||![...c].every((d)=>l.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Ut,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},gt,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class va extends Qr{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Jr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new po,this.setRequestHandler(Us,(r)=>this._oninitialize(r)),this.setNotificationHandler(Lo,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(si,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Jr.safeParse(s);if(i.success)this._loggingLevels.set(n,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new ya(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Go(this._capabilities,e)}setRequestHandler(e,t){let o=rr(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(pt(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let i=async(a,u)=>{let c=ze(Br,a);if(!c.success){let m=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let m=ze(nt,d);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=ze(ht,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new j(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);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 ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Dn(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Mn(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Zo.includes(t)?t:ft,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"},ot)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((u)=>u.type==="tool_use");if(n){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(o.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},Gr,t);return this.request({method:"sampling/createMessage",params:e},Ut,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},gt,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},gt,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!i.valid)throw new j(Z.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof j)throw s;throw new j(Z.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return n}}}createElicitationCompletionNotifier(e,t){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:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},ui,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import Ig from"node:process";class $a{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
44
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Zk(t)}clear(){this._buffer=void 0}}function Zk(e){return nr.parse(JSON.parse(e))}function Rg(e){return JSON.stringify(e)+`
45
+ `}class wa{constructor(e=Ig.stdin,t=Ig.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new $a,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Rg(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var xa={name:"@stophy/mcp",version:"1.2.0",description:"Web scraping API for AI agents. One API to search the web, read what people say, and look up products, places, jobs and homes. Pay only for answers.",type:"module",bin:{"stophy-mcp":"dist/index.js"},files:["dist"],scripts:{build:"bun build ./src/index.ts --outfile ./dist/index.js --target node --minify && chmod +x ./dist/index.js",prepare:"bun run build",start:"node ./dist/index.js",dev:"bun run ./src/index.ts","check-types":"tsc --noEmit",changeset:"changeset",version:"changeset version"},publishConfig:{access:"public"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0"},devDependencies:{"@changesets/cli":"^2.31.0","@types/node":"^22.0.0",typescript:"^5.8.3"},engines:{node:">=18"},keywords:["stophy","mcp","mcp-server","ai-agent","ai-agents","llm","web-data","web-search","google-search","linkedin","youtube","reddit","google-maps","transcripts","ads"],mcpName:"io.github.stophydotdev/mcp",homepage:"https://stophy.dev",license:"MIT",repository:{type:"git",url:"git+https://github.com/stophydotdev/mcp.git"},bugs:{url:"https://github.com/stophydotdev/mcp/issues"}};var Mk="https://api.stophy.dev/mcp",Dk=()=>{let e=process.env.STOPHY_MCP_URL??Mk;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},Lk=()=>{let e=process.env.STOPHY_API_KEY?.trim();return e?{Authorization:`Bearer ${e}`}:{}},Uk=async(e)=>{let t=new sa({name:"stophy-mcp",version:xa.version}),r=new _a(e,{requestInit:{headers:Lk()}});return await t.connect(r),t},Vk=async()=>{let e=Dk(),t;try{t=await Uk(e)}catch(o){let n=o instanceof Error?o.message:String(o),s=/401|unauthorized/iu.test(n)?" Check STOPHY_API_KEY, or unset it to use the free endpoints only.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${n}.${s}`)}let r=new va({name:"stophy",version:xa.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(oi,(o)=>t.listTools(o.params)),r.setRequestHandler(Br,(o)=>t.callTool(o.params)),t.setNotificationHandler(Wr,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new wa)};Vk().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
46
+ `),process.exit(1)});