@sleep2agi/agent-node 2.5.0-preview.30 → 2.5.0-preview.32

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.
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var uH=Object.create;var{getPrototypeOf:fH,defineProperty:E6,getOwnPropertyNames:lH}=Object;var mH=Object.prototype.hasOwnProperty;function cH(Q){return this[Q]}var pH,iH,GX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?pH??=new WeakMap:iH??=new WeakMap,J=G.get(Q);if(J)return J}Y=Q!=null?uH(fH(Q)):{};let $=X||!Q||!Q.__esModule?E6(Y,"default",{value:Q,enumerable:!0}):Y;for(let H of lH(Q))if(!mH.call($,H))E6($,H,{get:cH.bind(Q,H),enumerable:!0});if(W)G.set(Q,$);return $};var w=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var dH=(Q)=>Q;function nH(Q,X){this[Q]=dH.bind(null,X)}var JX=(Q,X)=>{for(var Y in X)E6(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:nH.bind(X,Y)})};var O9=w((wJ)=>{Object.defineProperty(wJ,"__esModule",{value:!0});wJ.regexpCode=wJ.getEsmExportName=wJ.getProperty=wJ.safeStringify=wJ.stringify=wJ.strConcat=wJ.addCodeArg=wJ.str=wJ._=wJ.nil=wJ._Code=wJ.Name=wJ.IDENTIFIER=wJ._CodeOrName=void 0;class vQ{}wJ._CodeOrName=vQ;wJ.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class k1 extends vQ{constructor(Q){super();if(!wJ.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}}}wJ.Name=k1;class v0 extends vQ{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 k1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}wJ._Code=v0;wJ.nil=new v0("");function MJ(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)x4(Y,X[W]),Y.push(Q[++W]);return new v0(Y)}wJ._=MJ;var _4=new v0("+");function OJ(Q,...X){let Y=[M9(Q[0])],W=0;while(W<X.length)Y.push(_4),x4(Y,X[W]),Y.push(_4,M9(Q[++W]));return ZA(Y),new v0(Y)}wJ.str=OJ;function x4(Q,X){if(X instanceof v0)Q.push(...X._items);else if(X instanceof k1)Q.push(X);else Q.push(MA(X))}wJ.addCodeArg=x4;function ZA(Q){let X=1;while(X<Q.length-1){if(Q[X]===_4){let Y=qA(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function qA(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof k1||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 k1))return`"${Q}${X.slice(1)}`;return}function NA(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:OJ`${Q}${X}`}wJ.strConcat=NA;function MA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:M9(Array.isArray(Q)?Q.join(","):Q)}function OA(Q){return new v0(M9(Q))}wJ.stringify=OA;function M9(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}wJ.safeStringify=M9;function wA(Q){return typeof Q=="string"&&wJ.IDENTIFIER.test(Q)?new v0(`.${Q}`):MJ`[${Q}]`}wJ.getProperty=wA;function PA(Q){if(typeof Q=="string"&&wJ.IDENTIFIER.test(Q))return new v0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}wJ.getEsmExportName=PA;function IA(Q){return new v0(Q.toString())}wJ.regexpCode=IA});var u4=w((bJ)=>{Object.defineProperty(bJ,"__esModule",{value:!0});bJ.ValueScope=bJ.ValueScopeName=bJ.Scope=bJ.varKinds=bJ.UsedValueState=void 0;var V0=O9();class IJ extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var xQ;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(xQ||(bJ.UsedValueState=xQ={}));bJ.varKinds={const:new V0.Name("const"),let:new V0.Name("let"),var:new V0.Name("var")};class y4{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof V0.Name?Q:this.name(Q)}name(Q){return new V0.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}}}bJ.Scope=y4;class h4 extends V0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=V0._`.${new V0.Name(X)}[${Y}]`}}bJ.ValueScopeName=h4;var yA=V0._`\n`;class EJ extends y4{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?yA:V0.nil}}get(){return this._scope}name(Q){return new h4(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:G}=W,J=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,$=this._values[G];if($){let K=$.get(J);if(K)return K}else $=this._values[G]=new Map;$.set(J,W);let H=this._scope[G]||(this._scope[G]=[]),B=H.length;return H[B]=X.ref,W.setValue(X,{property:G,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 V0._`${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 G=V0.nil;for(let J in Q){let $=Q[J];if(!$)continue;let H=Y[J]=Y[J]||new Map;$.forEach((B)=>{if(H.has(B))return;H.set(B,xQ.Started);let K=X(B);if(K){let z=this.opts.es5?bJ.varKinds.var:bJ.varKinds.const;G=V0._`${G}${z} ${B} = ${K};${this.opts._n}`}else if(K=W===null||W===void 0?void 0:W(B))G=V0._`${G}${K}${this.opts._n}`;else throw new IJ(B);H.set(B,xQ.Completed)})}return G}}bJ.ValueScope=EJ});var h=w((U0)=>{Object.defineProperty(U0,"__esModule",{value:!0});U0.or=U0.and=U0.not=U0.CodeGen=U0.operators=U0.varKinds=U0.ValueScopeName=U0.ValueScope=U0.Scope=U0.Name=U0.regexpCode=U0.stringify=U0.getProperty=U0.nil=U0.strConcat=U0.str=U0._=void 0;var l=O9(),_0=u4(),W1=O9();Object.defineProperty(U0,"_",{enumerable:!0,get:function(){return W1._}});Object.defineProperty(U0,"str",{enumerable:!0,get:function(){return W1.str}});Object.defineProperty(U0,"strConcat",{enumerable:!0,get:function(){return W1.strConcat}});Object.defineProperty(U0,"nil",{enumerable:!0,get:function(){return W1.nil}});Object.defineProperty(U0,"getProperty",{enumerable:!0,get:function(){return W1.getProperty}});Object.defineProperty(U0,"stringify",{enumerable:!0,get:function(){return W1.stringify}});Object.defineProperty(U0,"regexpCode",{enumerable:!0,get:function(){return W1.regexpCode}});Object.defineProperty(U0,"Name",{enumerable:!0,get:function(){return W1.Name}});var lQ=u4();Object.defineProperty(U0,"Scope",{enumerable:!0,get:function(){return lQ.Scope}});Object.defineProperty(U0,"ValueScope",{enumerable:!0,get:function(){return lQ.ValueScope}});Object.defineProperty(U0,"ValueScopeName",{enumerable:!0,get:function(){return lQ.ValueScopeName}});Object.defineProperty(U0,"varKinds",{enumerable:!0,get:function(){return lQ.varKinds}});U0.operators={GT:new l._Code(">"),GTE:new l._Code(">="),LT:new l._Code("<"),LTE:new l._Code("<="),EQ:new l._Code("==="),NEQ:new l._Code("!=="),NOT:new l._Code("!"),OR:new l._Code("||"),AND:new l._Code("&&"),ADD:new l._Code("+")};class G1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class TJ extends G1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?_0.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=_1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof l._CodeOrName?this.rhs.names:{}}}class m4 extends G1{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 l.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=_1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof l.Name?{}:{...this.lhs.names};return fQ(Q,this.rhs)}}class RJ extends m4{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class SJ extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class CJ extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class kJ extends G1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class vJ extends G1{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=_1(this.code,Q,X),this}get names(){return this.code instanceof l._CodeOrName?this.code.names:{}}}class mQ extends G1{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 G=Y[W];if(G.optimizeNames(Q,X))continue;lA(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>D1(Q,X.names),{})}}class J1 extends mQ{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class _J extends mQ{}class w9 extends J1{}w9.kind="else";class d0 extends J1{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 w9(Y):Y}if(X){if(Q===!1)return X instanceof d0?X:X.nodes;if(this.nodes.length)return this;return new d0(uJ(Q),X instanceof d0?[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=_1(this.condition,Q,X),this}get names(){let Q=super.names;if(fQ(Q,this.condition),this.else)D1(Q,this.else.names);return Q}}d0.kind="if";class v1 extends J1{}v1.kind="for";class xJ extends v1{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=_1(this.iteration,Q,X),this}get names(){return D1(super.names,this.iteration.names)}}class gJ extends v1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?_0.varKinds.var:this.varKind,{name:Y,from:W,to:G}=this;return`for(${X} ${Y}=${W}; ${Y}<${G}; ${Y}++)`+super.render(Q)}get names(){let Q=fQ(super.names,this.from);return fQ(Q,this.to)}}class f4 extends v1{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=_1(this.iterable,Q,X),this}get names(){return D1(super.names,this.iterable.names)}}class gQ extends J1{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)}}gQ.kind="func";class yQ extends mQ{render(Q){return"return "+super.render(Q)}}yQ.kind="return";class yJ extends J1{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)D1(Q,this.catch.names);if(this.finally)D1(Q,this.finally.names);return Q}}class hQ extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}hQ.kind="catch";class uQ extends J1{render(Q){return"finally"+super.render(Q)}}uQ.kind="finally";class hJ{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
4
+ `:""},this._extScope=Q,this._scope=new _0.Scope({parent:Q}),this._nodes=[new _J]}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 G=this._scope.toName(X);if(Y!==void 0&&W)this._constants[G.str]=Y;return this._leafNode(new TJ(Q,G,Y)),G}const(Q,X,Y){return this._def(_0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(_0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(_0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new m4(Q,X,Y))}add(Q,X){return this._leafNode(new RJ(Q,U0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==l.nil)this._leafNode(new vJ(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,l.addCodeArg)(X,W)}return X.push("}"),new l._Code(X)}if(Q,X,Y){if(this._blockNode(new d0(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 d0(Q))}else(){return this._elseNode(new w9)}endIf(){return this._endBlockNode(d0,w9)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new xJ(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?_0.varKinds.var:_0.varKinds.let){let J=this._scope.toName(Q);return this._for(new gJ(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=_0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof l.Name?X:this.var("_arr",X);return this.forRange("_i",0,l._`${J}.length`,($)=>{this.var(G,l._`${J}[${$}]`),Y(G)})}return this._for(new f4("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?_0.varKinds.var:_0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,l._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new f4("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(v1)}label(Q){return this._leafNode(new SJ(Q))}break(Q){return this._leafNode(new CJ(Q))}return(Q){let X=new yQ;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(yQ)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new yJ;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new hQ(G),X(G)}if(Y)this._currNode=W.finally=new uQ,this.code(Y);return this._endBlockNode(hQ,uQ)}throw(Q){return this._leafNode(new kJ(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=l.nil,Y,W){if(this._blockNode(new gQ(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(gQ)}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 d0))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}}U0.CodeGen=hJ;function D1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function fQ(Q,X){return X instanceof l._CodeOrName?D1(Q,X.names):Q}function _1(Q,X,Y){if(Q instanceof l.Name)return W(Q);if(!G(Q))return Q;return new l._Code(Q._items.reduce((J,$)=>{if($ instanceof l.Name)$=W($);if($ instanceof l._Code)J.push(...$._items);else J.push($);return J},[]));function W(J){let $=Y[J.str];if($===void 0||X[J.str]!==1)return J;return delete X[J.str],$}function G(J){return J instanceof l._Code&&J._items.some(($)=>$ instanceof l.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function lA(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function uJ(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:l._`!${l4(Q)}`}U0.not=uJ;var mA=fJ(U0.operators.AND);function cA(...Q){return Q.reduce(mA)}U0.and=cA;var pA=fJ(U0.operators.OR);function iA(...Q){return Q.reduce(pA)}U0.or=iA;function fJ(Q){return(X,Y)=>X===l.nil?Y:Y===l.nil?X:l._`${l4(X)} ${Q} ${l4(Y)}`}function l4(Q){return Q instanceof l.Name?Q:l._`(${Q})`}});var c=w((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});oJ.checkStrictMode=oJ.getErrorPath=oJ.Type=oJ.useFunc=oJ.setEvaluated=oJ.evaluatedPropsToName=oJ.mergeEvaluated=oJ.eachItem=oJ.unescapeJsonPointer=oJ.escapeJsonPointer=oJ.escapeFragment=oJ.unescapeFragment=oJ.schemaRefOrVal=oJ.schemaHasRulesButRef=oJ.schemaHasRules=oJ.checkUnknownRules=oJ.alwaysValidSchema=oJ.toHash=void 0;var r=h(),oA=O9();function tA(Q){let X={};for(let Y of Q)X[Y]=!0;return X}oJ.toHash=tA;function aA(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return pJ(Q,X),!iJ(X,Q.self.RULES.all)}oJ.alwaysValidSchema=aA;function pJ(Q,X=Q.schema){let{opts:Y,self:W}=Q;if(!Y.strictSchema)return;if(typeof X==="boolean")return;let G=W.RULES.keywords;for(let J in X)if(!G[J])rJ(Q,`unknown keyword: "${J}"`)}oJ.checkUnknownRules=pJ;function iJ(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}oJ.schemaHasRules=iJ;function sA(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}oJ.schemaHasRulesButRef=sA;function eA({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return r._`${Y}`}return r._`${Q}${X}${(0,r.getProperty)(W)}`}oJ.schemaRefOrVal=eA;function QF(Q){return dJ(decodeURIComponent(Q))}oJ.unescapeFragment=QF;function XF(Q){return encodeURIComponent(p4(Q))}oJ.escapeFragment=XF;function p4(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}oJ.escapeJsonPointer=p4;function dJ(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}oJ.unescapeJsonPointer=dJ;function YF(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}oJ.eachItem=YF;function mJ({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,J,$,H)=>{let B=$===void 0?J:$ instanceof r.Name?(J instanceof r.Name?Q(G,J,$):X(G,J,$),$):J instanceof r.Name?(X(G,$,J),J):Y(J,$);return H===r.Name&&!(B instanceof r.Name)?W(G,B):B}}oJ.mergeEvaluated={props:mJ({mergeNames:(Q,X,Y)=>Q.if(r._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(r._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,r._`${Y} || {}`).code(r._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(r._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,r._`${Y} || {}`),i4(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:nJ}),items:mJ({mergeNames:(Q,X,Y)=>Q.if(r._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,r._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(r._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:r._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function nJ(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",r._`{}`);if(X!==void 0)i4(Q,Y,X);return Y}oJ.evaluatedPropsToName=nJ;function i4(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(r._`${X}${(0,r.getProperty)(W)}`,!0))}oJ.setEvaluated=i4;var cJ={};function WF(Q,X){return Q.scopeValue("func",{ref:X,code:cJ[X.code]||(cJ[X.code]=new oA._Code(X.code))})}oJ.useFunc=WF;var c4;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(c4||(oJ.Type=c4={}));function GF(Q,X,Y){if(Q instanceof r.Name){let W=X===c4.Num;return Y?W?r._`"[" + ${Q} + "]"`:r._`"['" + ${Q} + "']"`:W?r._`"/" + ${Q}`:r._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,r.getProperty)(Q).toString():"/"+p4(Q)}oJ.getErrorPath=GF;function rJ(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}oJ.checkStrictMode=rJ});var n0=w((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});var A0=h(),wF={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};aJ.default=wF});var P9=w((X7)=>{Object.defineProperty(X7,"__esModule",{value:!0});X7.extendErrors=X7.resetErrorsCount=X7.reportExtraError=X7.reportError=X7.keyword$DataError=X7.keywordError=void 0;var p=h(),pQ=c(),L0=n0();X7.keywordError={message:({keyword:Q})=>p.str`must pass "${Q}" keyword validation`};X7.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?p.str`"${Q}" keyword must be ${X} ($data)`:p.str`"${Q}" keyword is invalid ($data)`};function IF(Q,X=X7.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:H}=G,B=Q7(Q,X,Y);if(W!==null&&W!==void 0?W:$||H)sJ(J,B);else eJ(G,p._`[${B}]`)}X7.reportError=IF;function EF(Q,X=X7.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,H=Q7(Q,X,Y);if(sJ(G,H),!(J||$))eJ(W,L0.default.vErrors)}X7.reportExtraError=EF;function bF(Q,X){Q.assign(L0.default.errors,X),Q.if(p._`${L0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(p._`${L0.default.vErrors}.length`,X),()=>Q.assign(L0.default.vErrors,null)))}X7.resetErrorsCount=bF;function jF({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let $=Q.name("err");Q.forRange("i",G,L0.default.errors,(H)=>{if(Q.const($,p._`${L0.default.vErrors}[${H}]`),Q.if(p._`${$}.instancePath === undefined`,()=>Q.assign(p._`${$}.instancePath`,(0,p.strConcat)(L0.default.instancePath,J.errorPath))),Q.assign(p._`${$}.schemaPath`,p.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(p._`${$}.schema`,Y),Q.assign(p._`${$}.data`,W)})}X7.extendErrors=jF;function sJ(Q,X){let Y=Q.const("err",X);Q.if(p._`${L0.default.vErrors} === null`,()=>Q.assign(L0.default.vErrors,p._`[${Y}]`),p._`${L0.default.vErrors}.push(${Y})`),Q.code(p._`${L0.default.errors}++`)}function eJ(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(p._`new ${Q.ValidationError}(${X})`);else Y.assign(p._`${W}.errors`,X),Y.return(!1)}var V1={keyword:new p.Name("keyword"),schemaPath:new p.Name("schemaPath"),params:new p.Name("params"),propertyName:new p.Name("propertyName"),message:new p.Name("message"),schema:new p.Name("schema"),parentSchema:new p.Name("parentSchema")};function Q7(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return p._`{}`;return TF(Q,X,Y)}function TF(Q,X,Y={}){let{gen:W,it:G}=Q,J=[RF(G,Y),SF(Q,Y)];return CF(Q,X,J),W.object(...J)}function RF({errorPath:Q},{instancePath:X}){let Y=X?p.str`${Q}${(0,pQ.getErrorPath)(X,pQ.Type.Str)}`:Q;return[L0.default.instancePath,(0,p.strConcat)(L0.default.instancePath,Y)]}function SF({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:p.str`${X}/${Q}`;if(Y)G=p.str`${G}${(0,pQ.getErrorPath)(Y,pQ.Type.Str)}`;return[V1.schemaPath,G]}function CF(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:H}=Q,{opts:B,propertyName:K,topSchemaRef:z,schemaPath:F}=H;if(W.push([V1.keyword,G],[V1.params,typeof X=="function"?X(Q):X||p._`{}`]),B.messages)W.push([V1.message,typeof Y=="function"?Y(Q):Y]);if(B.verbose)W.push([V1.schema,$],[V1.parentSchema,p._`${z}${F}`],[L0.default.data,J]);if(K)W.push([V1.propertyName,K])}});var $7=w((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});G7.boolOrEmptySchema=G7.topBoolOrEmptySchema=void 0;var gF=P9(),yF=h(),hF=n0(),uF={message:"boolean schema is false"};function fF(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)W7(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(hF.default.data);else X.assign(yF._`${W}.errors`,null),X.return(!0)}G7.topBoolOrEmptySchema=fF;function lF(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),W7(Q);else Y.var(X,!0)}G7.boolOrEmptySchema=lF;function W7(Q,X){let{gen:Y,data:W}=Q,G={gen:Y,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,gF.reportError)(G,uF,void 0,X)}});var n4=w((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});H7.getRules=H7.isJSONType=void 0;var cF=["string","number","integer","boolean","null","object","array"],pF=new Set(cF);function iF(Q){return typeof Q=="string"&&pF.has(Q)}H7.isJSONType=iF;function dF(){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:{}}}H7.getRules=dF});var r4=w((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});A7.shouldUseRule=A7.shouldUseGroup=A7.schemaHasRulesForType=void 0;function rF({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&K7(Q,W)}A7.schemaHasRulesForType=rF;function K7(Q,X){return X.rules.some((Y)=>z7(Q,Y))}A7.shouldUseGroup=K7;function z7(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))}A7.shouldUseRule=z7});var I9=w((U7)=>{Object.defineProperty(U7,"__esModule",{value:!0});U7.reportTypeError=U7.checkDataTypes=U7.checkDataType=U7.coerceAndCheckDataType=U7.getJSONTypes=U7.getSchemaTypes=U7.DataType=void 0;var aF=n4(),sF=r4(),eF=P9(),y=h(),L7=c(),x1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(x1||(U7.DataType=x1={}));function QL(Q){let X=D7(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}U7.getSchemaTypes=QL;function D7(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(aF.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}U7.getJSONTypes=D7;function XL(Q,X){let{gen:Y,data:W,opts:G}=Q,J=YL(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,sF.schemaHasRulesForType)(Q,X[0]));if($){let H=t4(X,W,G.strictNumbers,x1.Wrong);Y.if(H,()=>{if(J.length)WL(Q,X,J);else a4(Q)})}return $}U7.coerceAndCheckDataType=XL;var V7=new Set(["string","number","integer","boolean","null"]);function YL(Q,X){return X?Q.filter((Y)=>V7.has(Y)||X==="array"&&Y==="array"):[]}function WL(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",y._`typeof ${G}`),H=W.let("coerced",y._`undefined`);if(J.coerceTypes==="array")W.if(y._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,y._`${G}[0]`).assign($,y._`typeof ${G}`).if(t4(X,G,J.strictNumbers),()=>W.assign(H,G)));W.if(y._`${H} !== undefined`);for(let K of Y)if(V7.has(K)||K==="array"&&J.coerceTypes==="array")B(K);W.else(),a4(Q),W.endIf(),W.if(y._`${H} !== undefined`,()=>{W.assign(G,H),GL(Q,H)});function B(K){switch(K){case"string":W.elseIf(y._`${$} == "number" || ${$} == "boolean"`).assign(H,y._`"" + ${G}`).elseIf(y._`${G} === null`).assign(H,y._`""`);return;case"number":W.elseIf(y._`${$} == "boolean" || ${G} === null
5
+ || (${$} == "string" && ${G} && ${G} == +${G})`).assign(H,y._`+${G}`);return;case"integer":W.elseIf(y._`${$} === "boolean" || ${G} === null
6
+ || (${$} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(H,y._`+${G}`);return;case"boolean":W.elseIf(y._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(H,!1).elseIf(y._`${G} === "true" || ${G} === 1`).assign(H,!0);return;case"null":W.elseIf(y._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(H,null);return;case"array":W.elseIf(y._`${$} === "string" || ${$} === "number"
7
+ || ${$} === "boolean" || ${G} === null`).assign(H,y._`[${G}]`)}}}function GL({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(y._`${X} !== undefined`,()=>Q.assign(y._`${X}[${Y}]`,W))}function o4(Q,X,Y,W=x1.Correct){let G=W===x1.Correct?y.operators.EQ:y.operators.NEQ,J;switch(Q){case"null":return y._`${X} ${G} null`;case"array":J=y._`Array.isArray(${X})`;break;case"object":J=y._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(y._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return y._`typeof ${X} ${G} ${Q}`}return W===x1.Correct?J:(0,y.not)(J);function $(H=y.nil){return(0,y.and)(y._`typeof ${X} == "number"`,H,Y?y._`isFinite(${X})`:y.nil)}}U7.checkDataType=o4;function t4(Q,X,Y,W){if(Q.length===1)return o4(Q[0],X,Y,W);let G,J=(0,L7.toHash)(Q);if(J.array&&J.object){let $=y._`typeof ${X} != "object"`;G=J.null?$:y._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=y.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,y.and)(G,o4($,X,Y,W));return G}U7.checkDataTypes=t4;var JL={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?y._`{type: ${Q}}`:y._`{type: ${X}}`};function a4(Q){let X=$L(Q);(0,eF.reportError)(X,JL)}U7.reportTypeError=a4;function $L(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,L7.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var O7=w((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});N7.assignDefaults=void 0;var g1=h(),LL=c();function DL(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)q7(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>q7(Q,J,G.default))}N7.assignDefaults=DL;function q7(Q,X,Y){let{gen:W,compositeRule:G,data:J,opts:$}=Q;if(Y===void 0)return;let H=g1._`${J}${(0,g1.getProperty)(X)}`;if(G){(0,LL.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=g1._`${H} === undefined`;if($.useDefaults==="empty")B=g1._`${B} || ${H} === null || ${H} === ""`;W.if(B,g1._`${H} = ${(0,g1.stringify)(Y)}`)}});var T0=w((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.validateUnion=I7.validateArray=I7.usePattern=I7.callValidateCode=I7.schemaProperties=I7.allSchemaProperties=I7.noPropertyInData=I7.propertyInData=I7.isOwnProperty=I7.hasPropFunc=I7.reportMissingProp=I7.checkMissingProp=I7.checkReportMissingProp=void 0;var a=h(),s4=c(),$1=n0(),VL=c();function UL(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(Q8(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:a._`${X}`},!0),Q.error()})}I7.checkReportMissingProp=UL;function ZL({gen:Q,data:X,it:{opts:Y}},W,G){return(0,a.or)(...W.map((J)=>(0,a.and)(Q8(Q,X,J,Y.ownProperties),a._`${G} = ${J}`)))}I7.checkMissingProp=ZL;function qL(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}I7.reportMissingProp=qL;function w7(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a._`Object.prototype.hasOwnProperty`})}I7.hasPropFunc=w7;function e4(Q,X,Y){return a._`${w7(Q)}.call(${X}, ${Y})`}I7.isOwnProperty=e4;function NL(Q,X,Y,W){let G=a._`${X}${(0,a.getProperty)(Y)} !== undefined`;return W?a._`${G} && ${e4(Q,X,Y)}`:G}I7.propertyInData=NL;function Q8(Q,X,Y,W){let G=a._`${X}${(0,a.getProperty)(Y)} === undefined`;return W?(0,a.or)(G,(0,a.not)(e4(Q,X,Y))):G}I7.noPropertyInData=Q8;function P7(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}I7.allSchemaProperties=P7;function ML(Q,X){return P7(X).filter((Y)=>!(0,s4.alwaysValidSchema)(Q,X[Y]))}I7.schemaProperties=ML;function OL({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},H,B,K){let z=K?a._`${Q}, ${X}, ${W}${G}`:X,F=[[$1.default.instancePath,(0,a.strConcat)($1.default.instancePath,J)],[$1.default.parentData,$.parentData],[$1.default.parentDataProperty,$.parentDataProperty],[$1.default.rootData,$1.default.rootData]];if($.opts.dynamicRef)F.push([$1.default.dynamicAnchors,$1.default.dynamicAnchors]);let L=a._`${z}, ${Y.object(...F)}`;return B!==a.nil?a._`${H}.call(${B}, ${L})`:a._`${H}(${L})`}I7.callValidateCode=OL;var wL=a._`new RegExp`;function PL({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:G}=X.code,J=G(Y,W);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:a._`${G.code==="new RegExp"?wL:(0,VL.useFunc)(Q,G)}(${Y}, ${W})`})}I7.usePattern=PL;function IL(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,J=X.name("valid");if(G.allErrors){let H=X.let("valid",!0);return $(()=>X.assign(H,!1)),H}return X.var(J,!0),$(()=>X.break()),J;function $(H){let B=X.const("len",a._`${Y}.length`);X.forRange("i",0,B,(K)=>{Q.subschema({keyword:W,dataProp:K,dataPropType:s4.Type.Num},J),X.if((0,a.not)(J),H)})}}I7.validateArray=IL;function EL(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,s4.alwaysValidSchema)(G,B))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),H=X.name("_valid");X.block(()=>Y.forEach((B,K)=>{let z=Q.subschema({keyword:W,schemaProp:K,compositeRule:!0},H);if(X.assign($,a._`${$} || ${H}`),!Q.mergeValidEvaluated(z,H))X.if((0,a.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}I7.validateUnion=EL});var S7=w((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.validateKeywordUsage=T7.validSchemaType=T7.funcKeywordCode=T7.macroKeywordCode=void 0;var D0=h(),U1=n0(),hL=T0(),uL=P9();function fL(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,H=X.macro.call($.self,G,J,$),B=j7(Y,W,H);if($.opts.validateSchema!==!1)$.self.validateSchema(H,!0);let K=Y.name("valid");Q.subschema({schema:H,schemaPath:D0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:B,compositeRule:!0},K),Q.pass(K,()=>Q.error(!0))}T7.macroKeywordCode=fL;function lL(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:H,it:B}=Q;cL(B,X);let K=!H&&X.compile?X.compile.call(B.self,J,$,B):X.validate,z=j7(W,G,K),F=W.let("valid");Q.block$data(F,L),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:F);function L(){if(X.errors===!1){if(N(),X.modifying)b7(Q);M(()=>Q.error())}else{let O=X.async?D():Z();if(X.modifying)b7(Q);M(()=>mL(Q,O))}}function D(){let O=W.let("ruleErrs",null);return W.try(()=>N(D0._`await `),(k)=>W.assign(F,!1).if(D0._`${k} instanceof ${B.ValidationError}`,()=>W.assign(O,D0._`${k}.errors`),()=>W.throw(k))),O}function Z(){let O=D0._`${z}.errors`;return W.assign(O,null),N(D0.nil),O}function N(O=X.async?D0._`await `:D0.nil){let k=B.opts.passContext?U1.default.this:U1.default.self,j=!(("compile"in X)&&!H||X.schema===!1);W.assign(F,D0._`${O}${(0,hL.callValidateCode)(Q,z,k,j)}`,X.modifying)}function M(O){var k;W.if((0,D0.not)((k=X.valid)!==null&&k!==void 0?k:F),O)}}T7.funcKeywordCode=lL;function b7(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,D0._`${W.parentData}[${W.parentDataProperty}]`))}function mL(Q,X){let{gen:Y}=Q;Y.if(D0._`Array.isArray(${X})`,()=>{Y.assign(U1.default.vErrors,D0._`${U1.default.vErrors} === null ? ${X} : ${U1.default.vErrors}.concat(${X})`).assign(U1.default.errors,D0._`${U1.default.vErrors}.length`),(0,uL.extendErrors)(Q)},()=>Q.error())}function cL({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function j7(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,D0.stringify)(Y)})}function pL(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")}T7.validSchemaType=pL;function iL({schema:Q,opts:X,self:Y,errSchemaPath:W},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let $=G.dependencies;if($===null||$===void 0?void 0:$.some((H)=>!Object.prototype.hasOwnProperty.call(Q,H)))throw Error(`parent schema must have dependencies of ${J}: ${$.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[J])){let B=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}T7.validateKeywordUsage=iL});var _7=w((k7)=>{Object.defineProperty(k7,"__esModule",{value:!0});k7.extendSubschemaMode=k7.extendSubschemaData=k7.getSubschema=void 0;var u0=h(),C7=c();function oL(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:G,errSchemaPath:J,topSchemaRef:$}){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:u0._`${Q.schemaPath}${(0,u0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[Y],schemaPath:u0._`${Q.schemaPath}${(0,u0.getProperty)(X)}${(0,u0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,C7.escapeFragment)(Y)}`}}if(W!==void 0){if(G===void 0||J===void 0||$===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:$,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}k7.getSubschema=oL;function tL(Q,X,{dataProp:Y,dataPropType:W,data:G,dataTypes:J,propertyName:$}){if(G!==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:K,dataPathArr:z,opts:F}=X,L=H.let("data",u0._`${X.data}${(0,u0.getProperty)(Y)}`,!0);B(L),Q.errorPath=u0.str`${K}${(0,C7.getErrorPath)(Y,W,F.jsPropertySyntax)}`,Q.parentDataProperty=u0._`${Y}`,Q.dataPathArr=[...z,Q.parentDataProperty]}if(G!==void 0){let K=G instanceof u0.Name?G:H.let("data",G,!0);if(B(K),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function B(K){Q.data=K,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,K]}}k7.extendSubschemaData=tL;function aL(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:G,allErrors:J}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}k7.extendSubschemaMode=aL});var X8=w((jT,x7)=>{x7.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,G,J;if(Array.isArray(X)){if(W=X.length,W!=Y.length)return!1;for(G=W;G--!==0;)if(!Q(X[G],Y[G]))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(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[G]))return!1;for(G=W;G--!==0;){var $=J[G];if(!Q(X[$],Y[$]))return!1}return!0}return X!==X&&Y!==Y}});var y7=w((TT,g7)=>{var H1=g7.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(){},G=Y.post||function(){};iQ(X,W,G,Q,"",Q)};H1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H1.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 iQ(Q,X,Y,W,G,J,$,H,B,K){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,H,B,K);for(var z in W){var F=W[z];if(Array.isArray(F)){if(z in H1.arrayKeywords)for(var L=0;L<F.length;L++)iQ(Q,X,Y,F[L],G+"/"+z+"/"+L,J,G,z,W,L)}else if(z in H1.propsKeywords){if(F&&typeof F=="object")for(var D in F)iQ(Q,X,Y,F[D],G+"/"+z+"/"+QD(D),J,G,z,W,D)}else if(z in H1.keywords||Q.allKeys&&!(z in H1.skipKeywords))iQ(Q,X,Y,F,G+"/"+z,J,G,z,W)}Y(W,G,J,$,H,B,K)}}function QD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var E9=w((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.getSchemaRefs=l7.resolveUrl=l7.normalizeId=l7._getFullPath=l7.getFullPath=l7.inlineRef=void 0;var XD=c(),YD=X8(),WD=y7(),GD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JD(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!Y8(Q);if(!X)return!1;return h7(Q)<=X}l7.inlineRef=JD;var $D=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Y8(Q){for(let X in Q){if($D.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(Y8))return!0;if(typeof Y=="object"&&Y8(Y))return!0}return!1}function h7(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,GD.has(Y))continue;if(typeof Q[Y]=="object")(0,XD.eachItem)(Q[Y],(W)=>X+=h7(W));if(X===1/0)return 1/0}return X}function u7(Q,X="",Y){if(Y!==!1)X=y1(X);let W=Q.parse(X);return f7(Q,W)}l7.getFullPath=u7;function f7(Q,X){return Q.serialize(X).split("#")[0]+"#"}l7._getFullPath=f7;var HD=/#\/?$/;function y1(Q){return Q?Q.replace(HD,""):""}l7.normalizeId=y1;function BD(Q,X,Y){return Y=y1(Y),Q.resolve(X,Y)}l7.resolveUrl=BD;var KD=/^[a-z_][-a-z0-9._]*$/i;function zD(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=y1(Q[Y]||X),J={"":G},$=u7(W,G,!1),H={},B=new Set;return WD(Q,{allKeys:!0},(F,L,D,Z)=>{if(Z===void 0)return;let N=$+L,M=J[Z];if(typeof F[Y]=="string")M=O.call(this,F[Y]);k.call(this,F.$anchor),k.call(this,F.$dynamicAnchor),J[L]=M;function O(j){let S=this.opts.uriResolver.resolve;if(j=y1(M?S(M,j):j),B.has(j))throw z(j);B.add(j);let I=this.refs[j];if(typeof I=="string")I=this.refs[I];if(typeof I=="object")K(F,I.schema,j);else if(j!==y1(N))if(j[0]==="#")K(F,H[j],j),H[j]=F;else this.refs[j]=N;return j}function k(j){if(typeof j=="string"){if(!KD.test(j))throw Error(`invalid anchor "${j}"`);O.call(this,`#${j}`)}}}),H;function K(F,L,D){if(L!==void 0&&!YD(F,L))throw z(D)}function z(F){return Error(`reference "${F}" resolves to more than one schema`)}}l7.getSchemaRefs=zD});var T9=w((W5)=>{Object.defineProperty(W5,"__esModule",{value:!0});W5.getData=W5.KeywordCxt=W5.validateFunctionCode=void 0;var n7=$7(),c7=I9(),G8=r4(),dQ=I9(),UD=O7(),j9=S7(),W8=_7(),b=h(),_=n0(),ZD=E9(),r0=c(),b9=P9();function qD(Q){if(t7(Q)){if(a7(Q),o7(Q)){OD(Q);return}}r7(Q,()=>(0,n7.topBoolOrEmptySchema)(Q))}W5.validateFunctionCode=qD;function r7({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,b._`${_.default.data}, ${_.default.valCxt}`,W.$async,()=>{Q.code(b._`"use strict"; ${p7(Y,G)}`),MD(Q,G),Q.code(J)});else Q.func(X,b._`${_.default.data}, ${ND(G)}`,W.$async,()=>Q.code(p7(Y,G)).code(J))}function ND(Q){return b._`{${_.default.instancePath}="", ${_.default.parentData}, ${_.default.parentDataProperty}, ${_.default.rootData}=${_.default.data}${Q.dynamicRef?b._`, ${_.default.dynamicAnchors}={}`:b.nil}}={}`}function MD(Q,X){Q.if(_.default.valCxt,()=>{if(Q.var(_.default.instancePath,b._`${_.default.valCxt}.${_.default.instancePath}`),Q.var(_.default.parentData,b._`${_.default.valCxt}.${_.default.parentData}`),Q.var(_.default.parentDataProperty,b._`${_.default.valCxt}.${_.default.parentDataProperty}`),Q.var(_.default.rootData,b._`${_.default.valCxt}.${_.default.rootData}`),X.dynamicRef)Q.var(_.default.dynamicAnchors,b._`${_.default.valCxt}.${_.default.dynamicAnchors}`)},()=>{if(Q.var(_.default.instancePath,b._`""`),Q.var(_.default.parentData,b._`undefined`),Q.var(_.default.parentDataProperty,b._`undefined`),Q.var(_.default.rootData,_.default.data),X.dynamicRef)Q.var(_.default.dynamicAnchors,b._`{}`)})}function OD(Q){let{schema:X,opts:Y,gen:W}=Q;r7(Q,()=>{if(Y.$comment&&X.$comment)e7(Q);if(bD(Q),W.let(_.default.vErrors,null),W.let(_.default.errors,0),Y.unevaluated)wD(Q);s7(Q),RD(Q)});return}function wD(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",b._`${Y}.evaluated`),X.if(b._`${Q.evaluated}.dynamicProps`,()=>X.assign(b._`${Q.evaluated}.props`,b._`undefined`)),X.if(b._`${Q.evaluated}.dynamicItems`,()=>X.assign(b._`${Q.evaluated}.items`,b._`undefined`))}function p7(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?b._`/*# sourceURL=${Y} */`:b.nil}function PD(Q,X){if(t7(Q)){if(a7(Q),o7(Q)){ID(Q,X);return}}(0,n7.boolOrEmptySchema)(Q,X)}function o7({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 t7(Q){return typeof Q.schema!="boolean"}function ID(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)e7(Q);jD(Q),TD(Q);let J=W.const("_errs",_.default.errors);s7(Q,J),W.var(X,b._`${J} === ${_.default.errors}`)}function a7(Q){(0,r0.checkUnknownRules)(Q),ED(Q)}function s7(Q,X){if(Q.opts.jtd)return i7(Q,[],!1,X);let Y=(0,c7.getSchemaTypes)(Q.schema),W=(0,c7.coerceAndCheckDataType)(Q,Y);i7(Q,Y,!W,X)}function ED(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,r0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function bD(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,r0.checkStrictMode)(Q,"default is ignored in the schema root")}function jD(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,ZD.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function TD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function e7({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(b._`${_.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=b.str`${W}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(b._`${_.default.self}.opts.$comment(${J}, ${$}, ${H}.schema)`)}}function RD(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(b._`${_.default.errors} === 0`,()=>X.return(_.default.data),()=>X.throw(b._`new ${G}(${_.default.vErrors})`));else{if(X.assign(b._`${W}.errors`,_.default.vErrors),J.unevaluated)SD(Q);X.return(b._`${_.default.errors} === 0`)}}function SD({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof b.Name)Q.assign(b._`${X}.props`,Y);if(W instanceof b.Name)Q.assign(b._`${X}.items`,W)}function i7(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:H,opts:B,self:K}=Q,{RULES:z}=K;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,r0.schemaHasRulesButRef)(J,z))){G.block(()=>X5(Q,"$ref",z.all.$ref.definition));return}if(!B.jtd)CD(Q,X);G.block(()=>{for(let L of z.rules)F(L);F(z.post)});function F(L){if(!(0,G8.shouldUseGroup)(J,L))return;if(L.type){if(G.if((0,dQ.checkDataType)(L.type,$,B.strictNumbers)),d7(Q,L),X.length===1&&X[0]===L.type&&Y)G.else(),(0,dQ.reportTypeError)(Q);G.endIf()}else d7(Q,L);if(!H)G.if(b._`${_.default.errors} === ${W||0}`)}}function d7(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,UD.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,G8.shouldUseRule)(W,J))X5(Q,J.keyword,J.definition,X.type)})}function CD(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(kD(Q,X),!Q.opts.allowUnionTypes)vD(Q,X);_D(Q,Q.dataTypes)}function kD(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!Q5(Q.dataTypes,Y))J8(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),gD(Q,X)}function vD(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))J8(Q,"use allowUnionTypes to allow union type keyword")}function _D(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,G8.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>xD(X,$)))J8(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function xD(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function Q5(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function gD(Q,X){let Y=[];for(let W of Q.dataTypes)if(Q5(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function J8(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,r0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class $8{constructor(Q,X,Y){if((0,j9.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,r0.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",Y5(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,j9.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",_.default.errors)}result(Q,X,Y){this.failResult((0,b.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,b.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(b._`${X} !== undefined && (${(0,b.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?b9.reportExtraError:b9.reportError)(this,this.def.error,X)}$dataError(){(0,b9.reportError)(this,this.def.$dataError||b9.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,b9.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=b.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=b.nil,X=b.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,b.or)(b._`${W} === undefined`,X)),Q!==b.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==b.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,b.or)(J(),$());function J(){if(Y.length){if(!(X instanceof b.Name))throw Error("ajv implementation error");let H=Array.isArray(Y)?Y:[Y];return b._`${(0,dQ.checkDataTypes)(H,X,G.opts.strictNumbers,dQ.DataType.Wrong)}`}return b.nil}function $(){if(W.validateSchema){let H=Q.scopeValue("validate$data",{ref:W.validateSchema});return b._`!${H}(${X})`}return b.nil}}subschema(Q,X){let Y=(0,W8.getSubschema)(this.it,Q);(0,W8.extendSubschemaData)(Y,this.it,Q),(0,W8.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return PD(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=r0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=r0.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,b.Name)),!0}}W5.KeywordCxt=$8;function X5(Q,X,Y,W){let G=new $8(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,j9.funcKeywordCode)(G,Y);else if("macro"in Y)(0,j9.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,j9.funcKeywordCode)(G,Y)}var yD=/^\/(?:[^~]|~0|~1)*$/,hD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Y5(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return _.default.rootData;if(Q[0]==="/"){if(!yD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=_.default.rootData}else{let K=hD.exec(Q);if(!K)throw Error(`Invalid JSON-pointer: ${Q}`);let z=+K[1];if(G=K[2],G==="#"){if(z>=X)throw Error(B("property/index",z));return W[X-z]}if(z>X)throw Error(B("data",z));if(J=Y[X-z],!G)return J}let $=J,H=G.split("/");for(let K of H)if(K)J=b._`${J}${(0,b.getProperty)((0,r0.unescapeJsonPointer)(K))}`,$=b._`${$} && ${J}`;return $;function B(K,z){return`Cannot access ${K} ${z} levels up, current level is ${X}`}}W5.getData=Y5});var nQ=w(($5)=>{Object.defineProperty($5,"__esModule",{value:!0});class J5 extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}$5.default=J5});var R9=w((B5)=>{Object.defineProperty(B5,"__esModule",{value:!0});var H8=E9();class H5 extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,H8.resolveUrl)(Q,X,Y),this.missingSchema=(0,H8.normalizeId)((0,H8.getFullPath)(Q,this.missingRef))}}B5.default=H5});var oQ=w((A5)=>{Object.defineProperty(A5,"__esModule",{value:!0});A5.resolveSchema=A5.getCompilingSchema=A5.resolveRef=A5.compileSchema=A5.SchemaEnv=void 0;var x0=h(),cD=nQ(),Z1=n0(),g0=E9(),K5=c(),pD=T9();class S9{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,g0.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={}}}A5.SchemaEnv=S9;function K8(Q){let X=z5.call(this,Q);if(X)return X;let Y=(0,g0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new x0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),H;if(Q.$async)H=$.scopeValue("Error",{ref:cD.default,code:x0._`require("ajv/dist/runtime/validation_error").default`});let B=$.scopeName("validate");Q.validateName=B;let K={gen:$,allErrors:this.opts.allErrors,data:Z1.default.data,parentData:Z1.default.parentData,parentDataProperty:Z1.default.parentDataProperty,dataNames:[Z1.default.data],dataPathArr:[x0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,x0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:x0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:x0._`""`,opts:this.opts,self:this},z;try{this._compilations.add(Q),(0,pD.validateFunctionCode)(K),$.optimize(this.opts.code.optimize);let F=$.toString();if(z=`${$.scopeRefs(Z1.default.scope)}return ${F}`,this.opts.code.process)z=this.opts.code.process(z,Q);let D=Function(`${Z1.default.self}`,`${Z1.default.scope}`,z)(this,this.scope.get());if(this.scope.value(B,{ref:D}),D.errors=null,D.schema=Q.schema,D.schemaEnv=Q,Q.$async)D.$async=!0;if(this.opts.code.source===!0)D.source={validateName:B,validateCode:F,scopeValues:$._values};if(this.opts.unevaluated){let{props:Z,items:N}=K;if(D.evaluated={props:Z instanceof x0.Name?void 0:Z,items:N instanceof x0.Name?void 0:N,dynamicProps:Z instanceof x0.Name,dynamicItems:N instanceof x0.Name},D.source)D.source.evaluated=(0,x0.stringify)(D.evaluated)}return Q.validate=D,Q}catch(F){if(delete Q.validate,delete Q.validateName,z)this.logger.error("Error compiling schema, function code:",z);throw F}finally{this._compilations.delete(Q)}}A5.compileSchema=K8;function iD(Q,X,Y){var W;Y=(0,g0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=rD.call(this,Q,Y);if(J===void 0){let $=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:H}=this.opts;if($)J=new S9({schema:$,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=dD.call(this,J)}A5.resolveRef=iD;function dD(Q){if((0,g0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:K8.call(this,Q)}function z5(Q){for(let X of this._compilations)if(nD(X,Q))return X}A5.getCompilingSchema=z5;function nD(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function rD(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||rQ.call(this,Q,X)}function rQ(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,g0._getFullPath)(this.opts.uriResolver,Y),G=(0,g0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return B8.call(this,Y,Q);let J=(0,g0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let H=rQ.call(this,Q,$);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return B8.call(this,Y,H)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)K8.call(this,$);if(J===(0,g0.normalizeId)(X)){let{schema:H}=$,{schemaId:B}=this.opts,K=H[B];if(K)G=(0,g0.resolveUrl)(this.opts.uriResolver,G,K);return new S9({schema:H,schemaId:B,root:Q,baseId:G})}return B8.call(this,Y,$)}A5.resolveSchema=rQ;var oD=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function B8(Q,{baseId:X,schema:Y,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,K5.unescapeFragment)(H)];if(B===void 0)return;Y=B;let K=typeof Y==="object"&&Y[this.opts.schemaId];if(!oD.has(H)&&K)X=(0,g0.resolveUrl)(this.opts.uriResolver,X,K)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,K5.schemaHasRulesButRef)(Y,this.RULES)){let H=(0,g0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=rQ.call(this,W,H)}let{schemaId:$}=this.opts;if(J=J||new S9({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var L5=w((_T,QV)=>{QV.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 F8=w((xT,N5)=>{var XV=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),V5=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),z8=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),U5=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),YV=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function A8(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 WV=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function D5(Q){return Q.length=0,!0}function GV(Q,X,Y){if(Q.length){let W=A8(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function JV(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,H=GV;for(let B=0;B<Q.length;B++){let K=Q[B];if(K==="["||K==="]")continue;if(K===":"){if(J===!0)$=!0;if(!H(G,W,Y))break;if(++X>7){Y.error=!0;break}if(B>0&&Q[B-1]===":")J=!0;W.push(":");continue}else if(K==="%"){if(!H(G,W,Y))break;H=D5}else{G.push(K);continue}}if(G.length)if(H===D5)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(A8(G));return Y.address=W.join(""),Y}function Z5(Q){if($V(Q,":")<2)return{host:Q,isIPV6:!1};let X=JV(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 $V(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function HV(Q){let X=Q,Y=[],W=-1,G=0;while(G=X.length){if(G===1)if(X===".")break;else if(X==="/"){Y.push("/");break}else{Y.push(X);break}else if(G===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(G===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 BV={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},KV=/[@/?#:]/g,zV=/[@/?#]/g;function q5(Q,X){let Y=X?zV:KV;return Y.lastIndex=0,Q.replace(Y,(W)=>BV[W])}function AV(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 G=Q.slice(W+1,W+3);if(z8(G)){let J=G.toUpperCase(),$=String.fromCharCode(parseInt(J,16));if(X&&U5($))Y+=$;else Y+="%"+J;W+=2;continue}}Y+=Q[W]}return Y}function FV(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(z8(W)){let G=W.toUpperCase(),J=String.fromCharCode(parseInt(G,16));if(J!=="."&&U5(J))X+=J;else X+="%"+G;Y+=2;continue}}if(YV(Q[Y]))X+=Q[Y];else X+=escape(Q[Y])}return X}function LV(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(z8(W)){X+="%"+W.toUpperCase(),Y+=2;continue}}X+=escape(Q[Y])}return X}function DV(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(!V5(Y)){let W=Z5(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=q5(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}N5.exports={nonSimpleDomain:WV,recomposeAuthority:DV,reescapeHostDelimiters:q5,normalizePercentEncoding:AV,normalizePathEncoding:FV,escapePreservingEscapes:LV,removeDotSegments:HV,isIPv4:V5,isUUID:XV,normalizeIPv6:Z5,stringArrayToHexStripped:A8}});var I5=w((gT,P5)=>{var{isUUID:VV}=F8(),UV=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,ZV=["http","https","ws","wss","urn","urn:uuid"];function qV(Q){return ZV.indexOf(Q)!==-1}function L8(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 M5(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function O5(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 NV(Q){return Q.secure=L8(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function MV(Q){if(Q.port===(L8(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 OV(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(UV);if(Y){let W=X.scheme||Q.scheme||"urn";Q.nid=Y[1].toLowerCase(),Q.nss=Y[2];let G=`${W}:${X.nid||Q.nid}`,J=D8(G);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function wV(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(),G=`${Y}:${X.nid||W}`,J=D8(G);if(J)Q=J.serialize(Q,X);let $=Q,H=Q.nss;return $.path=`${W||X.nid}:${H}`,X.skipEscape=!0,$}function PV(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!VV(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function IV(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var w5={scheme:"http",domainHost:!0,parse:M5,serialize:O5},EV={scheme:"https",domainHost:w5.domainHost,parse:M5,serialize:O5},tQ={scheme:"ws",domainHost:!0,parse:NV,serialize:MV},bV={scheme:"wss",domainHost:tQ.domainHost,parse:tQ.parse,serialize:tQ.serialize},jV={scheme:"urn",parse:OV,serialize:wV,skipNormalize:!0},TV={scheme:"urn:uuid",parse:PV,serialize:IV,skipNormalize:!0},aQ={http:w5,https:EV,ws:tQ,wss:bV,urn:jV,"urn:uuid":TV};Object.setPrototypeOf(aQ,null);function D8(Q){return Q&&(aQ[Q]||aQ[Q.toLowerCase()])||void 0}P5.exports={wsIsSecure:L8,SCHEMES:aQ,isValidSchemeName:qV,getSchemeHandler:D8}});var R5=w((yT,Q6)=>{var{normalizeIPv6:RV,removeDotSegments:C9,recomposeAuthority:SV,normalizePercentEncoding:CV,normalizePathEncoding:kV,escapePreservingEscapes:vV,reescapeHostDelimiters:_V,isIPv4:xV,nonSimpleDomain:gV}=F8(),{SCHEMES:yV,getSchemeHandler:b5}=I5();function hV(Q,X){if(typeof Q==="string")Q=iV(Q,X);else if(typeof Q==="object")Q=eQ(q1(Q,X),X);return Q}function uV(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},{parsed:G,malformedAuthorityOrPort:J}=sQ(Q,W),{parsed:$,malformedAuthorityOrPort:H}=sQ(X,W);if(J||H)throw Error(G.error||$.error||"URI is malformed.");let B=j5(G,$,W,!0);return W.skipEscape=!0,q1(B,W)}function j5(Q,X,Y,W){let G={};if(!W)Q=eQ(q1(Q,Y),Y),X=eQ(q1(X,Y),Y);if(Y=Y||{},!Y.tolerant&&X.scheme)G.scheme=X.scheme,G.userinfo=X.userinfo,G.host=X.host,G.port=X.port,G.path=C9(X.path||""),G.query=X.query;else{if(X.userinfo!==void 0||X.host!==void 0||X.port!==void 0)G.userinfo=X.userinfo,G.host=X.host,G.port=X.port,G.path=C9(X.path||""),G.query=X.query;else{if(!X.path)if(G.path=Q.path,X.query!==void 0)G.query=X.query;else G.query=Q.query;else{if(X.path[0]==="/")G.path=C9(X.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)G.path="/"+X.path;else if(!Q.path)G.path=X.path;else G.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+X.path;G.path=C9(G.path)}G.query=X.query}G.userinfo=Q.userinfo,G.host=Q.host,G.port=Q.port}G.scheme=Q.scheme}return G.fragment=X.fragment,G}function fV(Q,X,Y){let W=E5(Q,Y),G=E5(X,Y);return W!==void 0&&G!==void 0&&W.toLowerCase()===G.toLowerCase()}function q1(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),G=[],J=b5(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=vV(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=CV(Y.path);if(W.reference!=="suffix"&&Y.scheme)G.push(Y.scheme,":");let $=SV(Y);if($!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push($),Y.path&&Y.path[0]!=="/")G.push("/")}if(Y.path!==void 0){let H=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))H=C9(H);if($===void 0&&H[0]==="/"&&H[1]==="/")H="/%2F"+H.slice(2);G.push(H)}if(Y.query!==void 0)G.push("?",Y.query);if(Y.fragment!==void 0)G.push("#",Y.fragment);return G.join("")}var lV=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,mV=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,cV=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function pV(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 sQ(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},G=!1,J=!1;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let $=Q.match(mV);if($!==null&&$[1].indexOf("\\")!==-1)W.error="URI authority must not contain a literal backslash.",G=!0;let H=Q.match(cV);if(H!==null){let K=H[1],z=K.replace(/[\t\n\r]/g,"");if(z.length>=2){if(z.slice(0,2)!=="//")W.error=W.error||"URI authority must not contain a literal backslash.",G=!0;else if(K.length!==z.length)W.error=W.error||"URI authority introducer must not contain whitespace.",G=!0}}let B=Q.match(lV);if(B){if(W.scheme=B[1],W.userinfo=B[3],W.host=B[4],W.port=parseInt(B[5],10),W.path=B[6]||"",W.query=B[7],W.fragment=B[8],isNaN(W.port))W.port=B[5];let K=pV(W,B);if(K!==void 0)W.error=W.error||K,G=!0;if(W.host)if(xV(W.host)===!1){let L=RV(W.host);W.host=L.host.toLowerCase(),J=L.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 z=b5(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!z||!z.unicodeSupport)){if(W.host&&(Y.domainHost||z&&z.domainHost)&&J===!1&&gV(W.host))try{W.host=new URL("http://"+W.host).hostname}catch(F){W.error=W.error||"Host's domain name can not be converted to ASCII: "+F}}if(!z||z&&!z.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=_V(unescape(W.host),J)}if(W.path)W.path=kV(W.path);if(W.fragment)try{W.fragment=encodeURI(decodeURIComponent(W.fragment))}catch{W.error=W.error||"URI malformed"}}if(z&&z.parse)z.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return{parsed:W,malformedAuthorityOrPort:G}}function eQ(Q,X){return sQ(Q,X).parsed}function iV(Q,X){return T5(Q,X).normalized}function T5(Q,X){let{parsed:Y,malformedAuthorityOrPort:W}=sQ(Q,X);return{normalized:W?Q:q1(Y,X),malformedAuthorityOrPort:W}}function E5(Q,X){if(typeof Q==="string"){let{normalized:Y,malformedAuthorityOrPort:W}=T5(Q,X);return W?void 0:Y}if(typeof Q==="object")return q1(Q,X)}var V8={SCHEMES:yV,normalize:hV,resolve:uV,resolveComponent:j5,equal:fV,serialize:q1,parse:eQ};Q6.exports=V8;Q6.exports.default=V8;Q6.exports.fastUri=V8});var k5=w((C5)=>{Object.defineProperty(C5,"__esModule",{value:!0});var S5=R5();S5.code='require("ajv/dist/runtime/uri").default';C5.default=S5});var f5=w((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var nV=T9();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return nV.KeywordCxt}});var h1=h();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return h1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return h1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return h1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return h1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return h1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return h1.CodeGen}});var rV=nQ(),y5=R9(),oV=n4(),k9=oQ(),tV=h(),v9=E9(),X6=I9(),Z8=c(),v5=L5(),aV=k5(),h5=(Q,X)=>new RegExp(Q,X);h5.code="new RegExp";var sV=["removeAdditional","useDefaults","coerceTypes"],eV=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),QU={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."},XU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_5=200;function YU(Q){var X,Y,W,G,J,$,H,B,K,z,F,L,D,Z,N,M,O,k,j,S,I,N0,I0,d1,P6;let n1=Q.strict,I6=(X=Q.code)===null||X===void 0?void 0:X.optimize,YX=I6===!0||I6===void 0?1:I6||0,WX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:h5,hH=(G=Q.uriResolver)!==null&&G!==void 0?G:aV.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:n1)!==null&&$!==void 0?$:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:n1)!==null&&B!==void 0?B:!0,strictTypes:(z=(K=Q.strictTypes)!==null&&K!==void 0?K:n1)!==null&&z!==void 0?z:"log",strictTuples:(L=(F=Q.strictTuples)!==null&&F!==void 0?F:n1)!==null&&L!==void 0?L:"log",strictRequired:(Z=(D=Q.strictRequired)!==null&&D!==void 0?D:n1)!==null&&Z!==void 0?Z:!1,code:Q.code?{...Q.code,optimize:YX,regExp:WX}:{optimize:YX,regExp:WX},loopRequired:(N=Q.loopRequired)!==null&&N!==void 0?N:_5,loopEnum:(M=Q.loopEnum)!==null&&M!==void 0?M:_5,meta:(O=Q.meta)!==null&&O!==void 0?O:!0,messages:(k=Q.messages)!==null&&k!==void 0?k:!0,inlineRefs:(j=Q.inlineRefs)!==null&&j!==void 0?j:!0,schemaId:(S=Q.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(I=Q.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(N0=Q.validateSchema)!==null&&N0!==void 0?N0:!0,validateFormats:(I0=Q.validateFormats)!==null&&I0!==void 0?I0:!0,unicodeRegExp:(d1=Q.unicodeRegExp)!==null&&d1!==void 0?d1:!0,int32range:(P6=Q.int32range)!==null&&P6!==void 0?P6:!0,uriResolver:hH}}class Y6{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,...YU(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new tV.ValueScope({scope:{},prefixes:eV,es5:X,lines:Y}),this.logger=BU(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,oV.getRules)(),x5.call(this,QU,Q,"NOT SUPPORTED"),x5.call(this,XU,Q,"DEPRECATED","warn"),this._metaOpts=$U.call(this),Q.formats)GU.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)JU.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);WU.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=v5;if(Y==="id")W={...v5},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(K,z){await G.call(this,K.$schema);let F=this._addSchema(K,z);return F.validate||J.call(this,F)}async function G(K){if(K&&!this.getSchema(K))await W.call(this,{$ref:K},!0)}async function J(K){try{return this._compileSchemaEnv(K)}catch(z){if(!(z instanceof y5.default))throw z;return $.call(this,z),await H.call(this,z.missingSchema),J.call(this,K)}}function $({missingSchema:K,missingRef:z}){if(this.refs[K])throw Error(`AnySchema ${K} is loaded but ${z} cannot be resolved`)}async function H(K){let z=await B.call(this,K);if(!this.refs[K])await G.call(this,z.$schema);if(!this.refs[K])this.addSchema(z,K,X)}async function B(K){let z=this._loading[K];if(z)return z;try{return await(this._loading[K]=Y(K))}finally{delete this._loading[K]}}}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 G;if(typeof Q==="object"){let{schemaId:J}=this.opts;if(G=Q[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return X=(0,v9.normalizeId)(X||G),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 G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw Error(G)}return W}getSchema(Q){let X;while(typeof(X=g5.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new k9.SchemaEnv({schema:{},schemaId:Y});if(X=k9.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=g5.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,v9.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(zU.call(this,Y,X),!X)return(0,Z8.eachItem)(Y,(G)=>U8.call(this,G)),this;FU.call(this,X);let W={...X,type:(0,X6.getJSONTypes)(X.type),schemaType:(0,X6.getJSONTypes)(X.schemaType)};return(0,Z8.eachItem)(Y,W.type.length===0?(G)=>U8.call(this,G,W):(G)=>W.type.forEach((J)=>U8.call(this,G,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((G)=>G.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,G)=>W+X+G)}$dataMetaSchema(Q,X){let Y=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of X){let G=W.split("/").slice(1),J=Q;for(let $ of G)J=J[$];for(let $ in Y){let H=Y[$];if(typeof H!="object")continue;let{$data:B}=H.definition,K=J[$];if(B&&K)J[$]=u5(K)}}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,G=this.opts.addUsedSchema){let J,{schemaId:$}=this.opts;if(typeof Q=="object")J=Q[$];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,v9.normalizeId)(J||Y);let B=v9.getSchemaRefs.call(this,Q,Y);if(H=new k9.SchemaEnv({schema:Q,schemaId:$,meta:X,baseId:Y,localRefs:B}),this._cache.set(H.schema,H),G&&!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 k9.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{k9.compileSchema.call(this,Q)}finally{this.opts=X}}}Y6.ValidationError=rV.default;Y6.MissingRefError=y5.default;o0.default=Y6;function x5(Q,X,Y,W="error"){for(let G in Q){let J=G;if(J in X)this.logger[W](`${Y}: option ${G}. ${Q[J]}`)}}function g5(Q){return Q=(0,v9.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function WU(){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 GU(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function JU(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 $U(){let Q={...this.opts};for(let X of sV)delete Q[X];return Q}var HU={log(){},warn(){},error(){}};function BU(Q){if(Q===!1)return HU;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 KU=/^[a-z_$][a-z0-9_$:-]*$/i;function zU(Q,X){let{RULES:Y}=this;if((0,Z8.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!KU.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 U8(Q,X,Y){var W;let G=X===null||X===void 0?void 0:X.post;if(Y&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,$=G?J.post:J.rules.find(({type:B})=>B===Y);if(!$)$={type:Y,rules:[]},J.rules.push($);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,X6.getJSONTypes)(X.type),schemaType:(0,X6.getJSONTypes)(X.schemaType)}};if(X.before)AU.call(this,$,H,X.before);else $.rules.push(H);J.all[Q]=H,(W=X.implements)===null||W===void 0||W.forEach((B)=>this.addKeyword(B))}function AU(Q,X,Y){let W=Q.rules.findIndex((G)=>G.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 FU(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=u5(X);Q.validateSchema=this.compile(X,!0)}var LU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function u5(Q){return{anyOf:[Q,LU]}}});var m5=w((l5)=>{Object.defineProperty(l5,"__esModule",{value:!0});var UU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};l5.default=UU});var r5=w((d5)=>{Object.defineProperty(d5,"__esModule",{value:!0});d5.callRef=d5.getValidate=void 0;var qU=R9(),c5=T0(),Z0=h(),u1=n0(),p5=oQ(),W6=c(),NU={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:J,validateName:$,opts:H,self:B}=W,{root:K}=J;if((Y==="#"||Y==="#/")&&G===K.baseId)return F();let z=p5.resolveRef.call(B,K,G,Y);if(z===void 0)throw new qU.default(W.opts.uriResolver,G,Y);if(z instanceof p5.SchemaEnv)return L(z);return D(z);function F(){if(J===K)return G6(Q,$,J,J.$async);let Z=X.scopeValue("root",{ref:K});return G6(Q,Z0._`${Z}.validate`,K,K.$async)}function L(Z){let N=i5(Q,Z);G6(Q,N,Z,Z.$async)}function D(Z){let N=X.scopeValue("schema",H.code.source===!0?{ref:Z,code:(0,Z0.stringify)(Z)}:{ref:Z}),M=X.name("valid"),O=Q.subschema({schema:Z,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:N,errSchemaPath:Y},M);Q.mergeEvaluated(O),Q.ok(M)}}};function i5(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):Z0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}d5.getValidate=i5;function G6(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:H,opts:B}=J,K=B.passContext?u1.default.this:Z0.nil;if(W)z();else F();function z(){if(!H.$async)throw Error("async schema referenced by sync schema");let Z=G.let("valid");G.try(()=>{if(G.code(Z0._`await ${(0,c5.callValidateCode)(Q,X,K)}`),D(X),!$)G.assign(Z,!0)},(N)=>{if(G.if(Z0._`!(${N} instanceof ${J.ValidationError})`,()=>G.throw(N)),L(N),!$)G.assign(Z,!1)}),Q.ok(Z)}function F(){Q.result((0,c5.callValidateCode)(Q,X,K),()=>D(X),()=>L(X))}function L(Z){let N=Z0._`${Z}.errors`;G.assign(u1.default.vErrors,Z0._`${u1.default.vErrors} === null ? ${N} : ${u1.default.vErrors}.concat(${N})`),G.assign(u1.default.errors,Z0._`${u1.default.vErrors}.length`)}function D(Z){var N;if(!J.opts.unevaluated)return;let M=(N=Y===null||Y===void 0?void 0:Y.validate)===null||N===void 0?void 0:N.evaluated;if(J.props!==!0)if(M&&!M.dynamicProps){if(M.props!==void 0)J.props=W6.mergeEvaluated.props(G,M.props,J.props)}else{let O=G.var("props",Z0._`${Z}.evaluated.props`);J.props=W6.mergeEvaluated.props(G,O,J.props,Z0.Name)}if(J.items!==!0)if(M&&!M.dynamicItems){if(M.items!==void 0)J.items=W6.mergeEvaluated.items(G,M.items,J.items)}else{let O=G.var("items",Z0._`${Z}.evaluated.items`);J.items=W6.mergeEvaluated.items(G,O,J.items,Z0.Name)}}}d5.callRef=G6;d5.default=NU});var t5=w((o5)=>{Object.defineProperty(o5,"__esModule",{value:!0});var wU=m5(),PU=r5(),IU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wU.default,PU.default];o5.default=IU});var s5=w((a5)=>{Object.defineProperty(a5,"__esModule",{value:!0});var J6=h(),B1=J6.operators,$6={maximum:{okStr:"<=",ok:B1.LTE,fail:B1.GT},minimum:{okStr:">=",ok:B1.GTE,fail:B1.LT},exclusiveMaximum:{okStr:"<",ok:B1.LT,fail:B1.GTE},exclusiveMinimum:{okStr:">",ok:B1.GT,fail:B1.LTE}},bU={message:({keyword:Q,schemaCode:X})=>J6.str`must be ${$6[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>J6._`{comparison: ${$6[Q].okStr}, limit: ${X}}`},jU={keyword:Object.keys($6),type:"number",schemaType:"number",$data:!0,error:bU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(J6._`${Y} ${$6[X].fail} ${W} || isNaN(${Y})`)}};a5.default=jU});var Q3=w((e5)=>{Object.defineProperty(e5,"__esModule",{value:!0});var _9=h(),RU={message:({schemaCode:Q})=>_9.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>_9._`{multipleOf: ${Q}}`},SU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:RU,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),H=J?_9._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:_9._`${$} !== parseInt(${$})`;Q.fail$data(_9._`(${W} === 0 || (${$} = ${Y}/${W}, ${H}))`)}};e5.default=SU});var W3=w((Y3)=>{Object.defineProperty(Y3,"__esModule",{value:!0});function X3(Q){let X=Q.length,Y=0,W=0,G;while(W<X)if(Y++,G=Q.charCodeAt(W++),G>=55296&&G<=56319&&W<X){if(G=Q.charCodeAt(W),(G&64512)===56320)W++}return Y}Y3.default=X3;X3.code='require("ajv/dist/runtime/ucs2length").default'});var J3=w((G3)=>{Object.defineProperty(G3,"__esModule",{value:!0});var N1=h(),vU=c(),_U=W3(),xU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return N1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>N1._`{limit: ${Q}}`},gU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xU,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?N1.operators.GT:N1.operators.LT,$=G.opts.unicode===!1?N1._`${Y}.length`:N1._`${(0,vU.useFunc)(Q.gen,_U.default)}(${Y})`;Q.fail$data(N1._`${$} ${J} ${W}`)}};G3.default=gU});var H3=w(($3)=>{Object.defineProperty($3,"__esModule",{value:!0});var hU=T0(),uU=c(),f1=h(),fU={message:({schemaCode:Q})=>f1.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>f1._`{pattern: ${Q}}`},lU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:fU,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:J,it:$}=Q,H=$.opts.unicodeRegExp?"u":"";if(W){let{regExp:B}=$.opts.code,K=B.code==="new RegExp"?f1._`new RegExp`:(0,uU.useFunc)(X,B),z=X.let("valid");X.try(()=>X.assign(z,f1._`${K}(${J}, ${H}).test(${Y})`),()=>X.assign(z,!1)),Q.fail$data(f1._`!${z}`)}else{let B=(0,hU.usePattern)(Q,G);Q.fail$data(f1._`!${B}.test(${Y})`)}}};$3.default=lU});var K3=w((B3)=>{Object.defineProperty(B3,"__esModule",{value:!0});var x9=h(),cU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return x9.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>x9._`{limit: ${Q}}`},pU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?x9.operators.GT:x9.operators.LT;Q.fail$data(x9._`Object.keys(${Y}).length ${G} ${W}`)}};B3.default=pU});var A3=w((z3)=>{Object.defineProperty(z3,"__esModule",{value:!0});var g9=T0(),y9=h(),dU=c(),nU={message:({params:{missingProperty:Q}})=>y9.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>y9._`{missingProperty: ${Q}}`},rU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nU,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:J,it:$}=Q,{opts:H}=$;if(!J&&Y.length===0)return;let B=Y.length>=H.loopRequired;if($.allErrors)K();else z();if(H.strictRequired){let D=Q.parentSchema.properties,{definedProperties:Z}=Q.it;for(let N of Y)if((D===null||D===void 0?void 0:D[N])===void 0&&!Z.has(N)){let M=$.schemaEnv.baseId+$.errSchemaPath,O=`required property "${N}" is not defined at "${M}" (strictRequired)`;(0,dU.checkStrictMode)($,O,$.opts.strictRequired)}}function K(){if(B||J)Q.block$data(y9.nil,F);else for(let D of Y)(0,g9.checkReportMissingProp)(Q,D)}function z(){let D=X.let("missing");if(B||J){let Z=X.let("valid",!0);Q.block$data(Z,()=>L(D,Z)),Q.ok(Z)}else X.if((0,g9.checkMissingProp)(Q,Y,D)),(0,g9.reportMissingProp)(Q,D),X.else()}function F(){X.forOf("prop",W,(D)=>{Q.setParams({missingProperty:D}),X.if((0,g9.noPropertyInData)(X,G,D,H.ownProperties),()=>Q.error())})}function L(D,Z){Q.setParams({missingProperty:D}),X.forOf(D,W,()=>{X.assign(Z,(0,g9.propertyInData)(X,G,D,H.ownProperties)),X.if((0,y9.not)(Z),()=>{Q.error(),X.break()})},y9.nil)}}};z3.default=rU});var L3=w((F3)=>{Object.defineProperty(F3,"__esModule",{value:!0});var h9=h(),tU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return h9.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>h9._`{limit: ${Q}}`},aU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:tU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?h9.operators.GT:h9.operators.LT;Q.fail$data(h9._`${Y}.length ${G} ${W}`)}};F3.default=aU});var H6=w((V3)=>{Object.defineProperty(V3,"__esModule",{value:!0});var D3=X8();D3.code='require("ajv/dist/runtime/equal").default';V3.default=D3});var Z3=w((U3)=>{Object.defineProperty(U3,"__esModule",{value:!0});var q8=I9(),B0=h(),QZ=c(),XZ=H6(),YZ={message:({params:{i:Q,j:X}})=>B0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>B0._`{i: ${Q}, j: ${X}}`},WZ={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:YZ,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:J,schemaCode:$,it:H}=Q;if(!W&&!G)return;let B=X.let("valid"),K=J.items?(0,q8.getSchemaTypes)(J.items):[];Q.block$data(B,z,B0._`${$} === false`),Q.ok(B);function z(){let Z=X.let("i",B0._`${Y}.length`),N=X.let("j");Q.setParams({i:Z,j:N}),X.assign(B,!0),X.if(B0._`${Z} > 1`,()=>(F()?L:D)(Z,N))}function F(){return K.length>0&&!K.some((Z)=>Z==="object"||Z==="array")}function L(Z,N){let M=X.name("item"),O=(0,q8.checkDataTypes)(K,M,H.opts.strictNumbers,q8.DataType.Wrong),k=X.const("indices",B0._`{}`);X.for(B0._`;${Z}--;`,()=>{if(X.let(M,B0._`${Y}[${Z}]`),X.if(O,B0._`continue`),K.length>1)X.if(B0._`typeof ${M} == "string"`,B0._`${M} += "_"`);X.if(B0._`typeof ${k}[${M}] == "number"`,()=>{X.assign(N,B0._`${k}[${M}]`),Q.error(),X.assign(B,!1).break()}).code(B0._`${k}[${M}] = ${Z}`)})}function D(Z,N){let M=(0,QZ.useFunc)(X,XZ.default),O=X.name("outer");X.label(O).for(B0._`;${Z}--;`,()=>X.for(B0._`${N} = ${Z}; ${N}--;`,()=>X.if(B0._`${M}(${Y}[${Z}], ${Y}[${N}])`,()=>{Q.error(),X.assign(B,!1).break(O)})))}}};U3.default=WZ});var N3=w((q3)=>{Object.defineProperty(q3,"__esModule",{value:!0});var N8=h(),JZ=c(),$Z=H6(),HZ={message:"must be equal to constant",params:({schemaCode:Q})=>N8._`{allowedValue: ${Q}}`},BZ={keyword:"const",$data:!0,error:HZ,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(N8._`!${(0,JZ.useFunc)(X,$Z.default)}(${Y}, ${G})`);else Q.fail(N8._`${J} !== ${Y}`)}};q3.default=BZ});var O3=w((M3)=>{Object.defineProperty(M3,"__esModule",{value:!0});var u9=h(),zZ=c(),AZ=H6(),FZ={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>u9._`{allowedValues: ${Q}}`},LZ={keyword:"enum",schemaType:"array",$data:!0,error:FZ,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:J,it:$}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let H=G.length>=$.opts.loopEnum,B,K=()=>B!==null&&B!==void 0?B:B=(0,zZ.useFunc)(X,AZ.default),z;if(H||W)z=X.let("valid"),Q.block$data(z,F);else{if(!Array.isArray(G))throw Error("ajv implementation error");let D=X.const("vSchema",J);z=(0,u9.or)(...G.map((Z,N)=>L(D,N)))}Q.pass(z);function F(){X.assign(z,!1),X.forOf("v",J,(D)=>X.if(u9._`${K()}(${Y}, ${D})`,()=>X.assign(z,!0).break()))}function L(D,Z){let N=G[Z];return typeof N==="object"&&N!==null?u9._`${K()}(${Y}, ${D}[${Z}])`:u9._`${Y} === ${N}`}}};M3.default=LZ});var P3=w((w3)=>{Object.defineProperty(w3,"__esModule",{value:!0});var VZ=s5(),UZ=Q3(),ZZ=J3(),qZ=H3(),NZ=K3(),MZ=A3(),OZ=L3(),wZ=Z3(),PZ=N3(),IZ=O3(),EZ=[VZ.default,UZ.default,ZZ.default,qZ.default,NZ.default,MZ.default,OZ.default,wZ.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},PZ.default,IZ.default];w3.default=EZ});var O8=w((E3)=>{Object.defineProperty(E3,"__esModule",{value:!0});E3.validateAdditionalItems=void 0;var M1=h(),M8=c(),jZ={message:({params:{len:Q}})=>M1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>M1._`{limit: ${Q}}`},TZ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:jZ,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,M8.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}I3(Q,W)}};function I3(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let H=Y.const("len",M1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(M1._`${H} <= ${X.length}`);else if(typeof W=="object"&&!(0,M8.alwaysValidSchema)($,W)){let K=Y.var("valid",M1._`${H} <= ${X.length}`);Y.if((0,M1.not)(K),()=>B(K)),Q.ok(K)}function B(K){Y.forRange("i",X.length,H,(z)=>{if(Q.subschema({keyword:J,dataProp:z,dataPropType:M8.Type.Num},K),!$.allErrors)Y.if((0,M1.not)(K),()=>Y.break())})}}E3.validateAdditionalItems=I3;E3.default=TZ});var w8=w((R3)=>{Object.defineProperty(R3,"__esModule",{value:!0});R3.validateTuple=void 0;var j3=h(),B6=c(),SZ=T0(),CZ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return T3(Q,"additionalItems",X);if(Y.items=!0,(0,B6.alwaysValidSchema)(Y,X))return;Q.ok((0,SZ.validateArray)(Q))}};function T3(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:H}=Q;if(z(G),H.opts.unevaluated&&Y.length&&H.items!==!0)H.items=B6.mergeEvaluated.items(W,Y.length,H.items);let B=W.name("valid"),K=W.const("len",j3._`${J}.length`);Y.forEach((F,L)=>{if((0,B6.alwaysValidSchema)(H,F))return;W.if(j3._`${K} > ${L}`,()=>Q.subschema({keyword:$,schemaProp:L,dataProp:L},B)),Q.ok(B)});function z(F){let{opts:L,errSchemaPath:D}=H,Z=Y.length,N=Z===F.minItems&&(Z===F.maxItems||F[X]===!1);if(L.strictTuples&&!N){let M=`"${$}" is ${Z}-tuple, but minItems or maxItems/${X} are not specified or different at path "${D}"`;(0,B6.checkStrictMode)(H,M,L.strictTuples)}}}R3.validateTuple=T3;R3.default=CZ});var k3=w((C3)=>{Object.defineProperty(C3,"__esModule",{value:!0});var vZ=w8(),_Z={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,vZ.validateTuple)(Q,"items")};C3.default=_Z});var x3=w((_3)=>{Object.defineProperty(_3,"__esModule",{value:!0});var v3=h(),gZ=c(),yZ=T0(),hZ=O8(),uZ={message:({params:{len:Q}})=>v3.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>v3._`{limit: ${Q}}`},fZ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:uZ,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,gZ.alwaysValidSchema)(W,X))return;if(G)(0,hZ.validateAdditionalItems)(Q,G);else Q.ok((0,yZ.validateArray)(Q))}};_3.default=fZ});var y3=w((g3)=>{Object.defineProperty(g3,"__esModule",{value:!0});var R0=h(),K6=c(),mZ={message:({params:{min:Q,max:X}})=>X===void 0?R0.str`must contain at least ${Q} valid item(s)`:R0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?R0._`{minContains: ${Q}}`:R0._`{minContains: ${Q}, maxContains: ${X}}`},cZ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:mZ,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,H,{minContains:B,maxContains:K}=W;if(J.opts.next)$=B===void 0?1:B,H=K;else $=1;let z=X.const("len",R0._`${G}.length`);if(Q.setParams({min:$,max:H}),H===void 0&&$===0){(0,K6.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&$>H){(0,K6.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,K6.alwaysValidSchema)(J,Y)){let N=R0._`${z} >= ${$}`;if(H!==void 0)N=R0._`${N} && ${z} <= ${H}`;Q.pass(N);return}J.items=!0;let F=X.name("valid");if(H===void 0&&$===1)D(F,()=>X.if(F,()=>X.break()));else if($===0){if(X.let(F,!0),H!==void 0)X.if(R0._`${G}.length > 0`,L)}else X.let(F,!1),L();Q.result(F,()=>Q.reset());function L(){let N=X.name("_valid"),M=X.let("count",0);D(N,()=>X.if(N,()=>Z(M)))}function D(N,M){X.forRange("i",0,z,(O)=>{Q.subschema({keyword:"contains",dataProp:O,dataPropType:K6.Type.Num,compositeRule:!0},N),M()})}function Z(N){if(X.code(R0._`${N}++`),H===void 0)X.if(R0._`${N} >= ${$}`,()=>X.assign(F,!0).break());else if(X.if(R0._`${N} > ${H}`,()=>X.assign(F,!1).break()),$===1)X.assign(F,!0);else X.if(R0._`${N} >= ${$}`,()=>X.assign(F,!0))}}};g3.default=cZ});var c3=w((f3)=>{Object.defineProperty(f3,"__esModule",{value:!0});f3.validateSchemaDeps=f3.validatePropertyDeps=f3.error=void 0;var P8=h(),iZ=c(),f9=T0();f3.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return P8.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>P8._`{property: ${Q},
8
+ missingProperty: ${W},
9
+ depsCount: ${X},
10
+ deps: ${Y}}`};var dZ={keyword:"dependencies",type:"object",schemaType:"object",error:f3.error,code(Q){let[X,Y]=nZ(Q);h3(Q,X),u3(Q,Y)}};function nZ({schema:Q}){let X={},Y={};for(let W in Q){if(W==="__proto__")continue;let G=Array.isArray(Q[W])?X:Y;G[W]=Q[W]}return[X,Y]}function h3(Q,X=Q.schema){let{gen:Y,data:W,it:G}=Q;if(Object.keys(X).length===0)return;let J=Y.let("missing");for(let $ in X){let H=X[$];if(H.length===0)continue;let B=(0,f9.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:H.length,deps:H.join(", ")}),G.allErrors)Y.if(B,()=>{for(let K of H)(0,f9.checkReportMissingProp)(Q,K)});else Y.if(P8._`${B} && (${(0,f9.checkMissingProp)(Q,H,J)})`),(0,f9.reportMissingProp)(Q,J),Y.else()}}f3.validatePropertyDeps=h3;function u3(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let H in X){if((0,iZ.alwaysValidSchema)(J,X[H]))continue;Y.if((0,f9.propertyInData)(Y,W,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:G,schemaProp:H},$);Q.mergeValidEvaluated(B,$)},()=>Y.var($,!0)),Q.ok($)}}f3.validateSchemaDeps=u3;f3.default=dZ});var d3=w((i3)=>{Object.defineProperty(i3,"__esModule",{value:!0});var p3=h(),tZ=c(),aZ={message:"property name must be valid",params:({params:Q})=>p3._`{propertyName: ${Q.propertyName}}`},sZ={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:aZ,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,tZ.alwaysValidSchema)(G,Y))return;let J=X.name("valid");X.forIn("key",W,($)=>{Q.setParams({propertyName:$}),Q.subschema({keyword:"propertyNames",data:$,dataTypes:["string"],propertyName:$,compositeRule:!0},J),X.if((0,p3.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};i3.default=sZ});var I8=w((n3)=>{Object.defineProperty(n3,"__esModule",{value:!0});var z6=T0(),y0=h(),Qq=n0(),A6=c(),Xq={message:"must NOT have additional properties",params:({params:Q})=>y0._`{additionalProperty: ${Q.additionalProperty}}`},Yq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Xq,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:J,it:$}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:H,opts:B}=$;if($.props=!0,B.removeAdditional!=="all"&&(0,A6.alwaysValidSchema)($,Y))return;let K=(0,z6.allSchemaProperties)(W.properties),z=(0,z6.allSchemaProperties)(W.patternProperties);F(),Q.ok(y0._`${J} === ${Qq.default.errors}`);function F(){X.forIn("key",G,(M)=>{if(!K.length&&!z.length)Z(M);else X.if(L(M),()=>Z(M))})}function L(M){let O;if(K.length>8){let k=(0,A6.schemaRefOrVal)($,W.properties,"properties");O=(0,z6.isOwnProperty)(X,k,M)}else if(K.length)O=(0,y0.or)(...K.map((k)=>y0._`${M} === ${k}`));else O=y0.nil;if(z.length)O=(0,y0.or)(O,...z.map((k)=>y0._`${(0,z6.usePattern)(Q,k)}.test(${M})`));return(0,y0.not)(O)}function D(M){X.code(y0._`delete ${G}[${M}]`)}function Z(M){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){D(M);return}if(Y===!1){if(Q.setParams({additionalProperty:M}),Q.error(),!H)X.break();return}if(typeof Y=="object"&&!(0,A6.alwaysValidSchema)($,Y)){let O=X.name("valid");if(B.removeAdditional==="failing")N(M,O,!1),X.if((0,y0.not)(O),()=>{Q.reset(),D(M)});else if(N(M,O),!H)X.if((0,y0.not)(O),()=>X.break())}}function N(M,O,k){let j={keyword:"additionalProperties",dataProp:M,dataPropType:A6.Type.Str};if(k===!1)Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(j,O)}}};n3.default=Yq});var a3=w((t3)=>{Object.defineProperty(t3,"__esModule",{value:!0});var Gq=T9(),r3=T0(),E8=c(),o3=I8(),Jq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q;if(J.opts.removeAdditional==="all"&&W.additionalProperties===void 0)o3.default.code(new Gq.KeywordCxt(J,o3.default,"additionalProperties"));let $=(0,r3.allSchemaProperties)(Y);for(let F of $)J.definedProperties.add(F);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=E8.mergeEvaluated.props(X,(0,E8.toHash)($),J.props);let H=$.filter((F)=>!(0,E8.alwaysValidSchema)(J,Y[F]));if(H.length===0)return;let B=X.name("valid");for(let F of H){if(K(F))z(F);else{if(X.if((0,r3.propertyInData)(X,G,F,J.opts.ownProperties)),z(F),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(F),Q.ok(B)}function K(F){return J.opts.useDefaults&&!J.compositeRule&&Y[F].default!==void 0}function z(F){Q.subschema({keyword:"properties",schemaProp:F,dataProp:F},B)}}};t3.default=Jq});var Y$=w((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});var s3=T0(),F6=h(),e3=c(),Q$=c(),Hq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,H=(0,s3.allSchemaProperties)(Y),B=H.filter((N)=>(0,e3.alwaysValidSchema)(J,Y[N]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let K=$.strictSchema&&!$.allowMatchingProperties&&G.properties,z=X.name("valid");if(J.props!==!0&&!(J.props instanceof F6.Name))J.props=(0,Q$.evaluatedPropsToName)(X,J.props);let{props:F}=J;L();function L(){for(let N of H){if(K)D(N);if(J.allErrors)Z(N);else X.var(z,!0),Z(N),X.if(z)}}function D(N){for(let M in K)if(new RegExp(N).test(M))(0,e3.checkStrictMode)(J,`property ${M} matches pattern ${N} (use allowMatchingProperties)`)}function Z(N){X.forIn("key",W,(M)=>{X.if(F6._`${(0,s3.usePattern)(Q,N)}.test(${M})`,()=>{let O=B.includes(N);if(!O)Q.subschema({keyword:"patternProperties",schemaProp:N,dataProp:M,dataPropType:Q$.Type.Str},z);if(J.opts.unevaluated&&F!==!0)X.assign(F6._`${F}[${M}]`,!0);else if(!O&&!J.allErrors)X.if((0,F6.not)(z),()=>X.break())})})}}};X$.default=Hq});var G$=w((W$)=>{Object.defineProperty(W$,"__esModule",{value:!0});var Kq=c(),zq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,Kq.alwaysValidSchema)(W,Y)){Q.fail();return}let G=X.name("valid");Q.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},G),Q.failResult(G,()=>Q.reset(),()=>Q.error())},error:{message:"must NOT be valid"}};W$.default=zq});var $$=w((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});var Fq=T0(),Lq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Fq.validateUnion,error:{message:"must match a schema in anyOf"}};J$.default=Lq});var B$=w((H$)=>{Object.defineProperty(H$,"__esModule",{value:!0});var L6=h(),Vq=c(),Uq={message:"must match exactly one schema in oneOf",params:({params:Q})=>L6._`{passingSchemas: ${Q.passing}}`},Zq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Uq,code(Q){let{gen:X,schema:Y,parentSchema:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let J=Y,$=X.let("valid",!1),H=X.let("passing",null),B=X.name("_valid");Q.setParams({passing:H}),X.block(K),Q.result($,()=>Q.reset(),()=>Q.error(!0));function K(){J.forEach((z,F)=>{let L;if((0,Vq.alwaysValidSchema)(G,z))X.var(B,!0);else L=Q.subschema({keyword:"oneOf",schemaProp:F,compositeRule:!0},B);if(F>0)X.if(L6._`${B} && ${$}`).assign($,!1).assign(H,L6._`[${H}, ${F}]`).else();X.if(B,()=>{if(X.assign($,!0),X.assign(H,F),L)Q.mergeEvaluated(L,L6.Name)})})}}};H$.default=Zq});var z$=w((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});var Nq=c(),Mq={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:Y,it:W}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");let G=X.name("valid");Y.forEach((J,$)=>{if((0,Nq.alwaysValidSchema)(W,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(H)})}};K$.default=Mq});var D$=w((L$)=>{Object.defineProperty(L$,"__esModule",{value:!0});var D6=h(),F$=c(),wq={message:({params:Q})=>D6.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>D6._`{failingKeyword: ${Q.ifClause}}`},Pq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:wq,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,F$.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=A$(W,"then"),J=A$(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),G&&J){let z=X.let("ifClause");Q.setParams({ifClause:z}),X.if(H,K("then",z),K("else",z))}else if(G)X.if(H,K("then"));else X.if((0,D6.not)(H),K("else"));Q.pass($,()=>Q.error(!0));function B(){let z=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(z)}function K(z,F){return()=>{let L=Q.subschema({keyword:z},H);if(X.assign($,H),Q.mergeValidEvaluated(L,$),F)X.assign(F,D6._`${z}`);else Q.setParams({ifClause:z})}}}};function A$(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,F$.alwaysValidSchema)(Q,Y)}L$.default=Pq});var U$=w((V$)=>{Object.defineProperty(V$,"__esModule",{value:!0});var Eq=c(),bq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,Eq.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};V$.default=bq});var q$=w((Z$)=>{Object.defineProperty(Z$,"__esModule",{value:!0});var Tq=O8(),Rq=k3(),Sq=w8(),Cq=x3(),kq=y3(),vq=c3(),_q=d3(),xq=I8(),gq=a3(),yq=Y$(),hq=G$(),uq=$$(),fq=B$(),lq=z$(),mq=D$(),cq=U$();function pq(Q=!1){let X=[hq.default,uq.default,fq.default,lq.default,mq.default,cq.default,_q.default,xq.default,vq.default,gq.default,yq.default];if(Q)X.push(Rq.default,Cq.default);else X.push(Tq.default,Sq.default);return X.push(kq.default),X}Z$.default=pq});var M$=w((N$)=>{Object.defineProperty(N$,"__esModule",{value:!0});var X0=h(),dq={message:({schemaCode:Q})=>X0.str`must match format "${Q}"`,params:({schemaCode:Q})=>X0._`{format: ${Q}}`},nq={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dq,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:H}=Q,{opts:B,errSchemaPath:K,schemaEnv:z,self:F}=H;if(!B.validateFormats)return;if(G)L();else D();function L(){let Z=Y.scopeValue("formats",{ref:F.formats,code:B.code.formats}),N=Y.const("fDef",X0._`${Z}[${$}]`),M=Y.let("fType"),O=Y.let("format");Y.if(X0._`typeof ${N} == "object" && !(${N} instanceof RegExp)`,()=>Y.assign(M,X0._`${N}.type || "string"`).assign(O,X0._`${N}.validate`),()=>Y.assign(M,X0._`"string"`).assign(O,N)),Q.fail$data((0,X0.or)(k(),j()));function k(){if(B.strictSchema===!1)return X0.nil;return X0._`${$} && !${O}`}function j(){let S=z.$async?X0._`(${N}.async ? await ${O}(${W}) : ${O}(${W}))`:X0._`${O}(${W})`,I=X0._`(typeof ${O} == "function" ? ${S} : ${O}.test(${W}))`;return X0._`${O} && ${O} !== true && ${M} === ${X} && !${I}`}}function D(){let Z=F.formats[J];if(!Z){k();return}if(Z===!0)return;let[N,M,O]=j(Z);if(N===X)Q.pass(S());function k(){if(B.strictSchema===!1){F.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${J}" ignored in schema at path "${K}"`}}function j(I){let N0=I instanceof RegExp?(0,X0.regexpCode)(I):B.code.formats?X0._`${B.code.formats}${(0,X0.getProperty)(J)}`:void 0,I0=Y.scopeValue("formats",{key:J,ref:I,code:N0});if(typeof I=="object"&&!(I instanceof RegExp))return[I.type||"string",I.validate,X0._`${I0}.validate`];return["string",I,I0]}function S(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!z.$async)throw Error("async format in sync schema");return X0._`await ${O}(${W})`}return typeof M=="function"?X0._`${O}(${W})`:X0._`${O}.test(${W})`}}}};N$.default=nq});var w$=w((O$)=>{Object.defineProperty(O$,"__esModule",{value:!0});var oq=M$(),tq=[oq.default];O$.default=tq});var E$=w((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});P$.contentVocabulary=P$.metadataVocabulary=void 0;P$.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];P$.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var T$=w((j$)=>{Object.defineProperty(j$,"__esModule",{value:!0});var eq=t5(),QN=P3(),XN=q$(),YN=w$(),b$=E$(),WN=[eq.default,QN.default,(0,XN.default)(),YN.default,b$.metadataVocabulary,b$.contentVocabulary];j$.default=WN});var k$=w((S$)=>{Object.defineProperty(S$,"__esModule",{value:!0});S$.DiscrError=void 0;var R$;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(R$||(S$.DiscrError=R$={}))});var x$=w((_$)=>{Object.defineProperty(_$,"__esModule",{value:!0});var l1=h(),b8=k$(),v$=oQ(),JN=R9(),$N=c(),HN={message:({params:{discrError:Q,tagName:X}})=>Q===b8.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>l1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},BN={keyword:"discriminator",type:"object",schemaType:"object",error:HN,code(Q){let{gen:X,data:Y,schema:W,parentSchema:G,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(!$)throw Error("discriminator: requires oneOf keyword");let B=X.let("valid",!1),K=X.const("tag",l1._`${Y}${(0,l1.getProperty)(H)}`);X.if(l1._`typeof ${K} == "string"`,()=>z(),()=>Q.error(!1,{discrError:b8.DiscrError.Tag,tag:K,tagName:H})),Q.ok(B);function z(){let D=L();X.if(!1);for(let Z in D)X.elseIf(l1._`${K} === ${Z}`),X.assign(B,F(D[Z]));X.else(),Q.error(!1,{discrError:b8.DiscrError.Mapping,tag:K,tagName:H}),X.endIf()}function F(D){let Z=X.name("valid"),N=Q.subschema({keyword:"oneOf",schemaProp:D},Z);return Q.mergeEvaluated(N,l1.Name),Z}function L(){var D;let Z={},N=O(G),M=!0;for(let S=0;S<$.length;S++){let I=$[S];if((I===null||I===void 0?void 0:I.$ref)&&!(0,$N.schemaHasRulesButRef)(I,J.self.RULES)){let I0=I.$ref;if(I=v$.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,I0),I instanceof v$.SchemaEnv)I=I.schema;if(I===void 0)throw new JN.default(J.opts.uriResolver,J.baseId,I0)}let N0=(D=I===null||I===void 0?void 0:I.properties)===null||D===void 0?void 0:D[H];if(typeof N0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);M=M&&(N||O(I)),k(N0,S)}if(!M)throw Error(`discriminator: "${H}" must be required`);return Z;function O({required:S}){return Array.isArray(S)&&S.includes(H)}function k(S,I){if(S.const)j(S.const,I);else if(S.enum)for(let N0 of S.enum)j(N0,I);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function j(S,I){if(typeof S!="string"||S in Z)throw Error(`discriminator: "${H}" values must be unique strings`);Z[S]=I}}}};_$.default=BN});var g$=w((CR,zN)=>{zN.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 T8=w((q0,j8)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.MissingRefError=q0.ValidationError=q0.CodeGen=q0.Name=q0.nil=q0.stringify=q0.str=q0._=q0.KeywordCxt=q0.Ajv=void 0;var AN=f5(),FN=T$(),LN=x$(),y$=g$(),DN=["/properties"],V6="http://json-schema.org/draft-07/schema";class l9 extends AN.default{_addVocabularies(){if(super._addVocabularies(),FN.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(LN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(y$,DN):y$;this.addMetaSchema(Q,V6,!1),this.refs["http://json-schema.org/schema"]=V6}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(V6)?V6:void 0)}}q0.Ajv=l9;j8.exports=q0=l9;j8.exports.Ajv=l9;Object.defineProperty(q0,"__esModule",{value:!0});q0.default=l9;var VN=T9();Object.defineProperty(q0,"KeywordCxt",{enumerable:!0,get:function(){return VN.KeywordCxt}});var m1=h();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return m1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return m1.str}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return m1.stringify}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return m1.nil}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return m1.Name}});Object.defineProperty(q0,"CodeGen",{enumerable:!0,get:function(){return m1.CodeGen}});var UN=nQ();Object.defineProperty(q0,"ValidationError",{enumerable:!0,get:function(){return UN.default}});var ZN=R9();Object.defineProperty(q0,"MissingRefError",{enumerable:!0,get:function(){return ZN.default}})});var n$=w((i$)=>{Object.defineProperty(i$,"__esModule",{value:!0});i$.formatNames=i$.fastFormats=i$.fullFormats=void 0;function f0(Q,X){return{validate:Q,compare:X}}i$.fullFormats={date:f0(l$,k8),time:f0(S8(!0),v8),"date-time":f0(h$(!0),c$),"iso-time":f0(S8(),m$),"iso-date-time":f0(h$(),p$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:EN,"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:kN,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:bN,int32:{type:"number",validate:RN},int64:{type:"number",validate:SN},float:{type:"number",validate:f$},double:{type:"number",validate:f$},password:!0,binary:!0};i$.fastFormats={...i$.fullFormats,date:f0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,k8),time:f0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,v8),"date-time":f0(/^\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,c$),"iso-time":f0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m$),"iso-date-time":f0(/^\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,p$),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};i$.formatNames=Object.keys(i$.fullFormats);function MN(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var ON=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,wN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function l$(Q){let X=ON.exec(Q);if(!X)return!1;let Y=+X[1],W=+X[2],G=+X[3];return W>=1&&W<=12&&G>=1&&G<=(W===2&&MN(Y)?29:wN[W])}function k8(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var R8=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function S8(Q){return function(Y){let W=R8.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],H=W[4],B=W[5]==="-"?-1:1,K=+(W[6]||0),z=+(W[7]||0);if(K>23||z>59||Q&&!H)return!1;if(G<=23&&J<=59&&$<60)return!0;let F=J-z*B,L=G-K*B-(F<0?1:0);return(L===23||L===-1)&&(F===59||F===-1)&&$<61}}function v8(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 m$(Q,X){if(!(Q&&X))return;let Y=R8.exec(Q),W=R8.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 C8=/t|\s/i;function h$(Q){let X=S8(Q);return function(W){let G=W.split(C8);return G.length===2&&l$(G[0])&&X(G[1])}}function c$(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 p$(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(C8),[G,J]=X.split(C8),$=k8(Y,G);if($===void 0)return;return $||v8(W,J)}var PN=/\/|:/,IN=/^(?:[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 EN(Q){return PN.test(Q)&&IN.test(Q)}var u$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function bN(Q){return u$.lastIndex=0,u$.test(Q)}var jN=-2147483648,TN=2147483647;function RN(Q){return Number.isInteger(Q)&&Q<=TN&&Q>=jN}function SN(Q){return Number.isInteger(Q)}function f$(){return!0}var CN=/[^\\]\\Z/;function kN(Q){if(CN.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var o$=w((r$)=>{Object.defineProperty(r$,"__esModule",{value:!0});r$.formatLimitDefinition=void 0;var _N=T8(),h0=h(),K1=h0.operators,U6={formatMaximum:{okStr:"<=",ok:K1.LTE,fail:K1.GT},formatMinimum:{okStr:">=",ok:K1.GTE,fail:K1.LT},formatExclusiveMaximum:{okStr:"<",ok:K1.LT,fail:K1.GTE},formatExclusiveMinimum:{okStr:">",ok:K1.GT,fail:K1.LTE}},xN={message:({keyword:Q,schemaCode:X})=>h0.str`should be ${U6[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>h0._`{comparison: ${U6[Q].okStr}, limit: ${X}}`};r$.formatLimitDefinition={keyword:Object.keys(U6),type:"string",schemaType:"string",$data:!0,error:xN,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:H}=J;if(!$.validateFormats)return;let B=new _N.KeywordCxt(J,H.RULES.all.format.definition,"format");if(B.$data)K();else z();function K(){let L=X.scopeValue("formats",{ref:H.formats,code:$.code.formats}),D=X.const("fmt",h0._`${L}[${B.schemaCode}]`);Q.fail$data((0,h0.or)(h0._`typeof ${D} != "object"`,h0._`${D} instanceof RegExp`,h0._`typeof ${D}.compare != "function"`,F(D)))}function z(){let L=B.schema,D=H.formats[L];if(!D||D===!0)return;if(typeof D!="object"||D instanceof RegExp||typeof D.compare!="function")throw Error(`"${G}": format "${L}" does not define "compare" function`);let Z=X.scopeValue("formats",{key:L,ref:D,code:$.code.formats?h0._`${$.code.formats}${(0,h0.getProperty)(L)}`:void 0});Q.fail$data(F(Z))}function F(L){return h0._`${L}.compare(${Y}, ${W}) ${U6[G].fail} 0`}},dependencies:["format"]};var gN=(Q)=>{return Q.addKeyword(r$.formatLimitDefinition),Q};r$.default=gN});var e$=w((m9,s$)=>{Object.defineProperty(m9,"__esModule",{value:!0});var c1=n$(),hN=o$(),g8=h(),t$=new g8.Name("fullFormats"),uN=new g8.Name("fastFormats"),y8=(Q,X={keywords:!0})=>{if(Array.isArray(X))return a$(Q,X,c1.fullFormats,t$),Q;let[Y,W]=X.mode==="fast"?[c1.fastFormats,uN]:[c1.fullFormats,t$],G=X.formats||c1.formatNames;if(a$(Q,G,Y,W),X.keywords)(0,hN.default)(Q);return Q};y8.get=(Q,X="full")=>{let W=(X==="fast"?c1.fastFormats:c1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function a$(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=g8._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}s$.exports=m9=y8;Object.defineProperty(m9,"__esModule",{value:!0});m9.default=y8});var $X;function U(Q,X,Y){function W(H,B){if(!H._zod)Object.defineProperty(H,"_zod",{value:{def:B,constr:$,traits:new Set},enumerable:!1});if(H._zod.traits.has(Q))return;H._zod.traits.add(Q),X(H,B);let K=$.prototype,z=Object.keys(K);for(let F=0;F<z.length;F++){let L=z[F];if(!(L in H))H[L]=K[L].bind(H)}}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function $(H){var B;let K=Y?.Parent?new J:this;W(K,H),(B=K._zod).deferred??(B.deferred=[]);for(let z of K._zod.deferred)z();return K}return Object.defineProperty($,"init",{value:W}),Object.defineProperty($,Symbol.hasInstance,{value:(H)=>{if(Y?.Parent&&H instanceof Y.Parent)return!0;return H?._zod?.traits?.has(Q)}}),Object.defineProperty($,"name",{value:Q}),$}var nO=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class r1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}($X=globalThis).__zod_globalConfig??($X.__zod_globalConfig={});var O1=globalThis.__zod_globalConfig;function M0(Q){if(Q)Object.assign(O1,Q);return O1}var m={};JX(m,{unwrapMessage:()=>o1,uint8ArrayToHex:()=>qB,uint8ArrayToBase64url:()=>UB,uint8ArrayToBase64:()=>LX,stringifyPrimitive:()=>s9,slugify:()=>T6,shallowClone:()=>BX,safeExtend:()=>zB,required:()=>LB,randomString:()=>WB,propertyKeyTypes:()=>S6,promiseAllObject:()=>YB,primitiveTypes:()=>KX,prefixIssues:()=>p0,pick:()=>HB,partial:()=>FB,parsedType:()=>_6,optionalKeys:()=>C6,omit:()=>BB,objectClone:()=>eH,numKeys:()=>GB,nullish:()=>a1,normalizeParams:()=>T,mergeDefs:()=>m0,merge:()=>AB,jsonStringifyReplacer:()=>w1,joinValues:()=>o9,issue:()=>I1,isPlainObject:()=>a0,isObject:()=>z1,hexToUint8Array:()=>ZB,getSizableOrigin:()=>AX,getParsedType:()=>JB,getLengthableOrigin:()=>e1,getEnumValues:()=>t1,getElementAtPath:()=>XB,floatSafeRemainder:()=>j6,finalizeIssue:()=>E0,extend:()=>KB,explicitlyAborted:()=>v6,escapeRegex:()=>c0,esc:()=>t9,defineLazy:()=>i,createTransparentProxy:()=>$B,cloneDef:()=>QB,clone:()=>k0,cleanRegex:()=>s1,cleanEnum:()=>DB,captureStackTrace:()=>a9,cached:()=>P1,base64urlToUint8Array:()=>VB,base64ToUint8Array:()=>FX,assignProp:()=>t0,assertNotEqual:()=>oH,assertNever:()=>aH,assertIs:()=>tH,assertEqual:()=>rH,assert:()=>sH,allowsEval:()=>R6,aborted:()=>s0,NUMBER_FORMAT_RANGES:()=>k6,Class:()=>DX,BIGINT_FORMAT_RANGES:()=>zX});function rH(Q){return Q}function oH(Q){return Q}function tH(Q){}function aH(Q){throw Error("Unexpected value in exhaustive check")}function sH(Q){}function t1(Q){let X=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,G])=>X.indexOf(+W)===-1).map(([W,G])=>G)}function o9(Q,X="|"){return Q.map((Y)=>s9(Y)).join(X)}function w1(Q,X){if(typeof X==="bigint")return X.toString();return X}function P1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function a1(Q){return Q===null||Q===void 0}function s1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function j6(Q,X){let Y=Q/X,W=Math.round(Y),G=Number.EPSILON*Math.max(Math.abs(Y),1);if(Math.abs(Y-W)<G)return 0;return Y-W}var HX=Symbol("evaluating");function i(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===HX)return;if(W===void 0)W=HX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function eH(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function t0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function m0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function QB(Q){return m0(Q._zod.def)}function XB(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function YB(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let G={};for(let J=0;J<X.length;J++)G[X[J]]=W[J];return G})}function WB(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function t9(Q){return JSON.stringify(Q)}function T6(Q){return Q.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var a9="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function z1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var R6=P1(()=>{if(O1.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function a0(Q){if(z1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let Y=X.prototype;if(z1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function BX(Q){if(a0(Q))return{...Q};if(Array.isArray(Q))return[...Q];if(Q instanceof Map)return new Map(Q);if(Q instanceof Set)return new Set(Q);return Q}function GB(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var JB=(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}`)}},S6=new Set(["string","number","symbol"]),KX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function c0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function T(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 $B(Q){let X;return new Proxy({},{get(Y,W,G){return X??(X=Q()),Reflect.get(X,W,G)},set(Y,W,G,J){return X??(X=Q()),Reflect.set(X,W,G,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,G){return X??(X=Q()),Reflect.defineProperty(X,W,G)}})}function s9(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function C6(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var k6={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]},zX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function HB(Q,X){let Y=Q._zod.def,W=Y.checks;if(W&&W.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=m0(Q._zod.def,{get shape(){let $={};for(let H in X){if(!(H in Y.shape))throw Error(`Unrecognized key: "${H}"`);if(!X[H])continue;$[H]=Y.shape[H]}return t0(this,"shape",$),$},checks:[]});return k0(Q,J)}function BB(Q,X){let Y=Q._zod.def,W=Y.checks;if(W&&W.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=m0(Q._zod.def,{get shape(){let $={...Q._zod.def.shape};for(let H in X){if(!(H in Y.shape))throw Error(`Unrecognized key: "${H}"`);if(!X[H])continue;delete $[H]}return t0(this,"shape",$),$},checks:[]});return k0(Q,J)}function KB(Q,X){if(!a0(X))throw Error("Invalid input to extend: expected a plain object");let Y=Q._zod.def.checks;if(Y&&Y.length>0){let J=Q._zod.def.shape;for(let $ in X)if(Object.getOwnPropertyDescriptor(J,$)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=m0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return t0(this,"shape",J),J}});return k0(Q,G)}function zB(Q,X){if(!a0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y=m0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X};return t0(this,"shape",W),W}});return k0(Q,Y)}function AB(Q,X){if(Q._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Y=m0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return t0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:X._zod.def.checks??[]});return k0(Q,Y)}function FB(Q,X,Y){let G=X._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let $=m0(X._zod.def,{get shape(){let H=X._zod.def.shape,B={...H};if(Y)for(let K in Y){if(!(K in H))throw Error(`Unrecognized key: "${K}"`);if(!Y[K])continue;B[K]=Q?new Q({type:"optional",innerType:H[K]}):H[K]}else for(let K in H)B[K]=Q?new Q({type:"optional",innerType:H[K]}):H[K];return t0(this,"shape",B),B},checks:[]});return k0(X,$)}function LB(Q,X,Y){let W=m0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in J))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=new Q({type:"nonoptional",innerType:G[$]})}else for(let $ in G)J[$]=new Q({type:"nonoptional",innerType:G[$]});return t0(this,"shape",J),J}});return k0(X,W)}function s0(Q,X=0){if(Q.aborted===!0)return!0;for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue!==!0)return!0;return!1}function v6(Q,X=0){if(Q.aborted===!0)return!0;for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue===!1)return!0;return!1}function p0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function o1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W=Q.message?Q.message:o1(Q.inst?._zod.def?.error?.(Q))??o1(X?.error?.(Q))??o1(Y.customError?.(Q))??o1(Y.localeError?.(Q))??"Invalid input",{inst:G,continue:J,input:$,...H}=Q;if(H.path??(H.path=[]),H.message=W,X?.reportInput)H.input=$;return H}function AX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function e1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function _6(Q){let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"nan":"number";case"object":{if(Q===null)return"null";if(Array.isArray(Q))return"array";let Y=Q;if(Y&&Object.getPrototypeOf(Y)!==Object.prototype&&"constructor"in Y&&Y.constructor)return Y.constructor.name}}return X}function I1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function DB(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function FX(Q){let X=atob(Q),Y=new Uint8Array(X.length);for(let W=0;W<X.length;W++)Y[W]=X.charCodeAt(W);return Y}function LX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function VB(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return FX(X+Y)}function UB(Q){return LX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ZB(Q){let X=Q.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let Y=new Uint8Array(X.length/2);for(let W=0;W<X.length;W+=2)Y[W/2]=Number.parseInt(X.slice(W,W+2),16);return Y}function qB(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class DX{constructor(...Q){}}var VX=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Q.message=JSON.stringify(X,w1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},e9=U("$ZodError",VX),x6=U("$ZodError",VX,{Parent:Error});function UX(Q,X=(Y)=>Y.message){let Y={},W=[];for(let G of Q.issues)if(G.path.length>0)Y[G.path[0]]=Y[G.path[0]]||[],Y[G.path[0]].push(X(G));else W.push(X(G));return{formErrors:W,fieldErrors:Y}}function ZX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G,J=[])=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((H)=>W({issues:H},[...J,...$.path]));else if($.code==="invalid_key")W({issues:$.issues},[...J,...$.path]);else if($.code==="invalid_element")W({issues:$.issues},[...J,...$.path]);else{let H=[...J,...$.path];if(H.length===0)Y._errors.push(X($));else{let B=Y,K=0;while(K<H.length){let z=H[K];if(K!==H.length-1)B[z]=B[z]||{_errors:[]};else B[z]=B[z]||{_errors:[]},B[z]._errors.push(X($));B=B[z],K++}}}};return W(Q),Y}var QQ=(Q)=>(X,Y,W,G)=>{let J=W?{...W,async:!1}:{async:!1},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)throw new l0;if($.issues.length){let H=new(G?.Err??Q)($.issues.map((B)=>E0(B,J,M0())));throw a9(H,G?.callee),H}return $.value};var XQ=(Q)=>async(X,Y,W,G)=>{let J=W?{...W,async:!0}:{async:!0},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)$=await $;if($.issues.length){let H=new(G?.Err??Q)($.issues.map((B)=>E0(B,J,M0())));throw a9(H,G?.callee),H}return $.value};var Q9=(Q)=>(X,Y,W)=>{let G=W?{...W,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)throw new l0;return J.issues.length?{success:!1,error:new(Q??e9)(J.issues.map(($)=>E0($,G,M0())))}:{success:!0,data:J.value}},X9=Q9(x6),Y9=(Q)=>async(X,Y,W)=>{let G=W?{...W,async:!0}:{async:!0},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map(($)=>E0($,G,M0())))}:{success:!0,data:J.value}},YQ=Y9(x6),qX=(Q)=>(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return QQ(Q)(X,Y,G)};var NX=(Q)=>(X,Y,W)=>{return QQ(Q)(X,Y,W)};var MX=(Q)=>async(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return XQ(Q)(X,Y,G)};var OX=(Q)=>async(X,Y,W)=>{return XQ(Q)(X,Y,W)};var wX=(Q)=>(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return Q9(Q)(X,Y,G)};var PX=(Q)=>(X,Y,W)=>{return Q9(Q)(X,Y,W)};var IX=(Q)=>async(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return Y9(Q)(X,Y,G)};var EX=(Q)=>async(X,Y,W)=>{return Y9(Q)(X,Y,W)};var bX=/^[cC][0-9a-z]{6,}$/,jX=/^[0-9a-z]+$/,TX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,RX=/^[0-9a-vA-V]{20}$/,SX=/^[A-Za-z0-9]{27}$/,CX=/^[a-zA-Z0-9_-]{21}$/,kX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vX=/^([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})$/,g6=(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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;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 _X=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var MB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xX(){return new RegExp(MB,"u")}var gX=/^(?:(?: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])$/,yX=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var hX=/^((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])$/,uX=/^(([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])$/,fX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,y6=/^[A-Za-z0-9_-]*$/;var lX=/^https?$/,mX=/^\+[1-9]\d{6,14}$/,cX="(?:(?:\\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])))",pX=new RegExp(`^${cX}$`);function iX(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 dX(Q){return new RegExp(`^${iX(Q)}$`)}function nX(Q){let X=iX({precision:Q.precision}),Y=["Z"];if(Q.local)Y.push("");if(Q.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${X}(?:${Y.join("|")})`;return new RegExp(`^${cX}T(?:${W})$`)}var rX=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var oX=/^-?\d+$/,WQ=/^-?\d+(?:\.\d+)?$/,tX=/^(?:true|false)$/i,aX=/^null$/i;var sX=/^[^A-Z]*$/,eX=/^[^a-z]*$/;var G0=U("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),QY={number:"number",bigint:"bigint",object:"date"},h6=U("$ZodCheckLessThan",(Q,X)=>{G0.init(Q,X);let Y=QY[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)G.maximum=X.value;else G.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:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),u6=U("$ZodCheckGreaterThan",(Q,X)=>{G0.init(Q,X);let Y=QY[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)G.minimum=X.value;else G.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:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),XY=U("$ZodCheckMultipleOf",(Q,X)=>{G0.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):j6(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})}}),YY=U("$ZodCheckNumberFormat",(Q,X)=>{G0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=k6[X.format];Q._zod.onattach.push(($)=>{let H=$._zod.bag;if(H.format=X.format,H.minimum=G,H.maximum=J,Y)H.pattern=oX}),Q._zod.check=($)=>{let H=$.value;if(Y){if(!Number.isInteger(H)){$.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:H,inst:Q});return}if(!Number.isSafeInteger(H)){if(H>0)$.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,inclusive:!0,continue:!X.abort});else $.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,inclusive:!0,continue:!X.abort});return}}if(H<G)$.issues.push({origin:"number",input:H,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(H>J)$.issues.push({origin:"number",input:H,code:"too_big",maximum:J,inclusive:!0,inst:Q,continue:!X.abort})}});var WY=U("$ZodCheckMaxLength",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)W._zod.bag.maximum=X.maximum}),Q._zod.check=(W)=>{let G=W.value;if(G.length<=X.maximum)return;let $=e1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),GY=U("$ZodCheckMinLength",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)W._zod.bag.minimum=X.minimum}),Q._zod.check=(W)=>{let G=W.value;if(G.length>=X.minimum)return;let $=e1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),JY=U("$ZodCheckLengthEquals",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),Q._zod.check=(W)=>{let G=W.value,J=G.length;if(J===X.length)return;let $=e1(G),H=J>X.length;W.issues.push({origin:$,...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})}}),W9=U("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(G0.init(Q,X),Q._zod.onattach.push((G)=>{let J=G._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=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(W=Q._zod).check??(W.check=()=>{})}),$Y=U("$ZodCheckRegex",(Q,X)=>{W9.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})}}),HY=U("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=sX),W9.init(Q,X)}),BY=U("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=eX),W9.init(Q,X)}),KY=U("$ZodCheckIncludes",(Q,X)=>{G0.init(Q,X);let Y=c0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:Q,continue:!X.abort})}}),zY=U("$ZodCheckStartsWith",(Q,X)=>{G0.init(Q,X);let Y=new RegExp(`^${c0(X.prefix)}.*`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.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})}}),AY=U("$ZodCheckEndsWith",(Q,X)=>{G0.init(Q,X);let Y=new RegExp(`.*${c0(X.suffix)}$`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.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 FY=U("$ZodCheckOverwrite",(Q,X)=>{G0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class f6{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(`
11
+ `).filter((J)=>J),W=Math.min(...Y.map((J)=>J.length-J.trimStart().length)),G=Y.map((J)=>J.slice(W)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,W.join(`
12
+ `))}}var DY={major:4,minor:4,patch:3};var o=U("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=DY;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let J of G._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 G=($,H,B)=>{let K=s0($),z;for(let F of H){if(F._zod.def.when){if(v6($))continue;if(!F._zod.def.when($))continue}else if(K)continue;let L=$.issues.length,D=F._zod.check($);if(D instanceof Promise&&B?.async===!1)throw new l0;if(z||D instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await D,$.issues.length===L)return;if(!K)K=s0($,L)});else{if($.issues.length===L)continue;if(!K)K=s0($,L)}}if(z)return z.then(()=>{return $});return $},J=($,H,B)=>{if(s0($))return $.aborted=!0,$;let K=G(H,W,B);if(K instanceof Promise){if(B.async===!1)throw new l0;return K.then((z)=>Q._zod.parse(z,B))}return Q._zod.parse(K,B)};Q._zod.run=($,H)=>{if(H.skipChecks)return Q._zod.parse($,H);if(H.direction==="backward"){let K=Q._zod.parse({value:$.value,issues:[]},{...H,skipChecks:!0});if(K instanceof Promise)return K.then((z)=>{return J(z,$,H)});return J(K,$,H)}let B=Q._zod.parse($,H);if(B instanceof Promise){if(H.async===!1)throw new l0;return B.then((K)=>G(K,W,H))}return G(B,W,H)}}i(Q,"~standard",()=>({validate:(G)=>{try{let J=X9(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return YQ(Q,G).then(($)=>$.success?{value:$.data}:{issues:$.error?.issues})}},vendor:"zod",version:1}))}),HQ=U("$ZodString",(Q,X)=>{o.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??rX(Q._zod.bag),Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(G){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:Q}),Y}}),t=U("$ZodStringFormat",(Q,X)=>{W9.init(Q,X),HQ.init(Q,X)}),PY=U("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=vX),t.init(Q,X)}),IY=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=g6(W))}else X.pattern??(X.pattern=g6());t.init(Q,X)}),EY=U("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=_X),t.init(Q,X)}),bY=U("$ZodURL",(Q,X)=>{t.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value.trim();if(!X.normalize&&X.protocol?.source===lX.source){if(!/^https?:\/\//i.test(W)){Y.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Y.value,inst:Q,continue:!X.abort});return}}let G=new URL(W);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.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(X.normalize)Y.value=G.href;else Y.value=W;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:Q,continue:!X.abort})}}}),jY=U("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=xX()),t.init(Q,X)}),TY=U("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=CX),t.init(Q,X)}),RY=U("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=bX),t.init(Q,X)}),SY=U("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=jX),t.init(Q,X)}),CY=U("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=TX),t.init(Q,X)}),kY=U("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=RX),t.init(Q,X)}),vY=U("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=SX),t.init(Q,X)}),_Y=U("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=nX(X)),t.init(Q,X)}),xY=U("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=pX),t.init(Q,X)}),gY=U("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=dX(X)),t.init(Q,X)}),yY=U("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=kX),t.init(Q,X)}),hY=U("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=gX),t.init(Q,X),Q._zod.bag.format="ipv4"}),uY=U("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=yX),t.init(Q,X),Q._zod.bag.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})}}});var fY=U("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=hX),t.init(Q,X)}),lY=U("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=uX),t.init(Q,X),Q._zod.check=(Y)=>{let W=Y.value.split("/");try{if(W.length!==2)throw Error();let[G,J]=W;if(!J)throw Error();let $=Number(J);if(`${$}`!==J)throw Error();if($<0||$>128)throw Error();new URL(`http://[${G}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:Q,continue:!X.abort})}}});function mY(Q){if(Q==="")return!0;if(/\s/.test(Q))return!1;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var cY=U("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=fX),t.init(Q,X),Q._zod.bag.contentEncoding="base64",Q._zod.check=(Y)=>{if(mY(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function PB(Q){if(!y6.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return mY(Y)}var pY=U("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=y6),t.init(Q,X),Q._zod.bag.contentEncoding="base64url",Q._zod.check=(Y)=>{if(PB(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),iY=U("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=mX),t.init(Q,X)});function IB(Q,X=null){try{let Y=Q.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let G=JSON.parse(atob(W));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var dY=U("$ZodJWT",(Q,X)=>{t.init(Q,X),Q._zod.check=(Y)=>{if(IB(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var m6=U("$ZodNumber",(Q,X)=>{o.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??WQ,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch($){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...J?{received:J}:{}}),Y}}),nY=U("$ZodNumberFormat",(Q,X)=>{YY.init(Q,X),m6.init(Q,X)}),rY=U("$ZodBoolean",(Q,X)=>{o.init(Q,X),Q._zod.pattern=tX,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(J){}let G=Y.value;if(typeof G==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),Y}});var oY=U("$ZodNull",(Q,X)=>{o.init(Q,X),Q._zod.pattern=aX,Q._zod.values=new Set([null]),Q._zod.parse=(Y,W)=>{let G=Y.value;if(G===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:G,inst:Q}),Y}});var tY=U("$ZodUnknown",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y)=>Y}),aY=U("$ZodNever",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function VY(Q,X,Y){if(Q.issues.length)X.issues.push(...p0(Y,Q.issues));X.value[Y]=Q.value}var sY=U("$ZodArray",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!Array.isArray(G))return Y.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),Y;Y.value=Array(G.length);let J=[];for(let $=0;$<G.length;$++){let H=G[$],B=X.element._zod.run({value:H,issues:[]},W);if(B instanceof Promise)J.push(B.then((K)=>VY(K,Y,$)));else VY(B,Y,$)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function $Q(Q,X,Y,W,G,J){let $=Y in W;if(Q.issues.length){if(G&&J&&!$)return;X.issues.push(...p0(Y,Q.issues))}if(!$&&!G){if(!Q.issues.length)X.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Y]});return}if(Q.value===void 0){if($)X.value[Y]=void 0}else X.value[Y]=Q.value}function eY(Q){let X=Object.keys(Q.shape);for(let W of X)if(!Q.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let Y=C6(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function QW(Q,X,Y,W,G,J){let $=[],H=G.keySet,B=G.catchall._zod,K=B.def.type,z=B.optin==="optional",F=B.optout==="optional";for(let L in X){if(L==="__proto__")continue;if(H.has(L))continue;if(K==="never"){$.push(L);continue}let D=B.run({value:X[L],issues:[]},W);if(D instanceof Promise)Q.push(D.then((Z)=>$Q(Z,Y,L,X,z,F)));else $Q(D,Y,L,X,z,F)}if($.length)Y.issues.push({code:"unrecognized_keys",keys:$,input:X,inst:J});if(!Q.length)return Y;return Promise.all(Q).then(()=>{return Y})}var EB=U("$ZodObject",(Q,X)=>{if(o.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let H=X.shape;Object.defineProperty(X,"shape",{get:()=>{let B={...H};return Object.defineProperty(X,"shape",{value:B}),B}})}let W=P1(()=>eY(X));i(Q._zod,"propValues",()=>{let H=X.shape,B={};for(let K in H){let z=H[K]._zod;if(z.values){B[K]??(B[K]=new Set);for(let F of z.values)B[K].add(F)}}return B});let G=z1,J=X.catchall,$;Q._zod.parse=(H,B)=>{$??($=W.value);let K=H.value;if(!G(K))return H.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),H;H.value={};let z=[],F=$.shape;for(let L of $.keys){let D=F[L],Z=D._zod.optin==="optional",N=D._zod.optout==="optional",M=D._zod.run({value:K[L],issues:[]},B);if(M instanceof Promise)z.push(M.then((O)=>$Q(O,H,L,K,Z,N)));else $Q(M,H,L,K,Z,N)}if(!J)return z.length?Promise.all(z).then(()=>H):H;return QW(z,K,H,B,W.value,Q)}}),XW=U("$ZodObjectJIT",(Q,X)=>{EB.init(Q,X);let Y=Q._zod.parse,W=P1(()=>eY(X)),G=(L)=>{let D=new f6(["shape","payload","ctx"]),Z=W.value,N=(j)=>{let S=t9(j);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};D.write("const input = payload.value;");let M=Object.create(null),O=0;for(let j of Z.keys)M[j]=`key_${O++}`;D.write("const newResult = {};");for(let j of Z.keys){let S=M[j],I=t9(j),N0=L[j],I0=N0?._zod?.optin==="optional",d1=N0?._zod?.optout==="optional";if(D.write(`const ${S} = ${N(j)};`),I0&&d1)D.write(`
13
+ if (${S}.issues.length) {
14
+ if (${I} in input) {
15
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
16
+ ...iss,
17
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
18
+ })));
19
+ }
20
+ }
21
+
22
+ if (${S}.value === undefined) {
23
+ if (${I} in input) {
24
+ newResult[${I}] = undefined;
25
+ }
26
+ } else {
27
+ newResult[${I}] = ${S}.value;
28
+ }
29
+
30
+ `);else if(!I0)D.write(`
31
+ const ${S}_present = ${I} in input;
32
+ if (${S}.issues.length) {
33
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
34
+ ...iss,
35
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
36
+ })));
37
+ }
38
+ if (!${S}_present && !${S}.issues.length) {
39
+ payload.issues.push({
40
+ code: "invalid_type",
41
+ expected: "nonoptional",
42
+ input: undefined,
43
+ path: [${I}]
44
+ });
45
+ }
46
+
47
+ if (${S}_present) {
48
+ if (${S}.value === undefined) {
49
+ newResult[${I}] = undefined;
50
+ } else {
51
+ newResult[${I}] = ${S}.value;
52
+ }
53
+ }
54
+
55
+ `);else D.write(`
56
+ if (${S}.issues.length) {
57
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
58
+ ...iss,
59
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
60
+ })));
61
+ }
62
+
63
+ if (${S}.value === undefined) {
64
+ if (${I} in input) {
65
+ newResult[${I}] = undefined;
66
+ }
67
+ } else {
68
+ newResult[${I}] = ${S}.value;
69
+ }
70
+
71
+ `)}D.write("payload.value = newResult;"),D.write("return payload;");let k=D.compile();return(j,S)=>k(L,j,S)},J,$=z1,H=!O1.jitless,K=H&&R6.value,z=X.catchall,F;Q._zod.parse=(L,D)=>{F??(F=W.value);let Z=L.value;if(!$(Z))return L.issues.push({expected:"object",code:"invalid_type",input:Z,inst:Q}),L;if(H&&K&&D?.async===!1&&D.jitless!==!0){if(!J)J=G(X.shape);if(L=J(L,D),!z)return L;return QW([],Z,L,D,F,Q)}return Y(L,D)}});function UY(Q,X,Y,W){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!s0(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map((J)=>J.issues.map(($)=>E0($,W,M0())))}),X}var c6=U("$ZodUnion",(Q,X)=>{o.init(Q,X),i(Q._zod,"optin",()=>X.options.some((W)=>W._zod.optin==="optional")?"optional":void 0),i(Q._zod,"optout",()=>X.options.some((W)=>W._zod.optout==="optional")?"optional":void 0),i(Q._zod,"values",()=>{if(X.options.every((W)=>W._zod.values))return new Set(X.options.flatMap((W)=>Array.from(W._zod.values)));return}),i(Q._zod,"pattern",()=>{if(X.options.every((W)=>W._zod.pattern)){let W=X.options.map((G)=>G._zod.pattern);return new RegExp(`^(${W.map((G)=>s1(G.source)).join("|")})$`)}return});let Y=X.options.length===1?X.options[0]._zod.run:null;Q._zod.parse=(W,G)=>{if(Y)return Y(W,G);let J=!1,$=[];for(let H of X.options){let B=H._zod.run({value:W.value,issues:[]},G);if(B instanceof Promise)$.push(B),J=!0;else{if(B.issues.length===0)return B;$.push(B)}}if(!J)return UY($,W,Q,G);return Promise.all($).then((H)=>{return UY(H,W,Q,G)})}});var YW=U("$ZodDiscriminatedUnion",(Q,X)=>{X.inclusive=!1,c6.init(Q,X);let Y=Q._zod.parse;i(Q._zod,"propValues",()=>{let G={};for(let J of X.options){let $=J._zod.propValues;if(!$||Object.keys($).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[H,B]of Object.entries($)){if(!G[H])G[H]=new Set;for(let K of B)G[H].add(K)}}return G});let W=P1(()=>{let G=X.options,J=new Map;for(let $ of G){let H=$._zod.propValues?.[X.discriminator];if(!H||H.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let B of H){if(J.has(B))throw Error(`Duplicate discriminator value "${String(B)}"`);J.set(B,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!z1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let H=W.value.get($?.[X.discriminator]);if(H)return H._zod.run(G,J);if(X.unionFallback||J.direction==="backward")return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,options:Array.from(W.value.keys()),input:$,path:[X.discriminator],inst:Q}),G}}),WW=U("$ZodIntersection",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,J=X.left._zod.run({value:G,issues:[]},W),$=X.right._zod.run({value:G,issues:[]},W);if(J instanceof Promise||$ instanceof Promise)return Promise.all([J,$]).then(([B,K])=>{return ZY(Y,B,K)});return ZY(Y,J,$)}});function l6(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(a0(Q)&&a0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),G={...Q,...X};for(let J of W){let $=l6(Q[J],X[J]);if(!$.valid)return{valid:!1,mergeErrorPath:[J,...$.mergeErrorPath]};G[J]=$.data}return{valid:!0,data:G}}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 G=Q[W],J=X[W],$=l6(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function ZY(Q,X,Y){let W=new Map,G;for(let H of X.issues)if(H.code==="unrecognized_keys"){G??(G=H);for(let B of H.keys){if(!W.has(B))W.set(B,{});W.get(B).l=!0}}else Q.issues.push(H);for(let H of Y.issues)if(H.code==="unrecognized_keys")for(let B of H.keys){if(!W.has(B))W.set(B,{});W.get(B).r=!0}else Q.issues.push(H);let J=[...W].filter(([,H])=>H.l&&H.r).map(([H])=>H);if(J.length&&G)Q.issues.push({...G,keys:J});if(s0(Q))return Q;let $=l6(X.value,Y.value);if(!$.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify($.mergeErrorPath)}`);return Q.value=$.data,Q}var GW=U("$ZodRecord",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!a0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let J=[],$=X.keyType._zod.values;if($){Y.value={};let H=new Set;for(let K of $)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){H.add(typeof K==="number"?K.toString():K);let z=X.keyType._zod.run({value:K,issues:[]},W);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((D)=>E0(D,W,M0())),input:K,path:[K],inst:Q});continue}let F=z.value,L=X.valueType._zod.run({value:G[K],issues:[]},W);if(L instanceof Promise)J.push(L.then((D)=>{if(D.issues.length)Y.issues.push(...p0(K,D.issues));Y.value[F]=D.value}));else{if(L.issues.length)Y.issues.push(...p0(K,L.issues));Y.value[F]=L.value}}let B;for(let K in G)if(!H.has(K))B=B??[],B.push(K);if(B&&B.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:B})}else{Y.value={};for(let H of Reflect.ownKeys(G)){if(H==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(G,H))continue;let B=X.keyType._zod.run({value:H,issues:[]},W);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof H==="string"&&WQ.test(H)&&B.issues.length){let F=X.keyType._zod.run({value:Number(H),issues:[]},W);if(F instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(F.issues.length===0)B=F}if(B.issues.length){if(X.mode==="loose")Y.value[H]=G[H];else Y.issues.push({code:"invalid_key",origin:"record",issues:B.issues.map((F)=>E0(F,W,M0())),input:H,path:[H],inst:Q});continue}let z=X.valueType._zod.run({value:G[H],issues:[]},W);if(z instanceof Promise)J.push(z.then((F)=>{if(F.issues.length)Y.issues.push(...p0(H,F.issues));Y.value[B.value]=F.value}));else{if(z.issues.length)Y.issues.push(...p0(H,z.issues));Y.value[B.value]=z.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var JW=U("$ZodEnum",(Q,X)=>{o.init(Q,X);let Y=t1(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>S6.has(typeof G)).map((G)=>typeof G==="string"?c0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let $=G.value;if(W.has($))return G;return G.issues.push({code:"invalid_value",values:Y,input:$,inst:Q}),G}}),$W=U("$ZodLiteral",(Q,X)=>{if(o.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let Y=new Set(X.values);Q._zod.values=Y,Q._zod.pattern=new RegExp(`^(${X.values.map((W)=>typeof W==="string"?c0(W):W?c0(W.toString()):String(W)).join("|")})$`),Q._zod.parse=(W,G)=>{let J=W.value;if(Y.has(J))return W;return W.issues.push({code:"invalid_value",values:X.values,input:J,inst:Q}),W}});var HW=U("$ZodTransform",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new r1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then(($)=>{return Y.value=$,Y.fallback=!0,Y});if(G instanceof Promise)throw new l0;return Y.value=G,Y.fallback=!0,Y}});function qY(Q,X){if(X===void 0&&(Q.issues.length||Q.fallback))return{issues:[],value:void 0};return Q}var p6=U("$ZodOptional",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",i(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),i(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${s1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=Y.value,J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>qY($,G));return qY(J,G)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),BW=U("$ZodExactOptional",(Q,X)=>{p6.init(Q,X),i(Q._zod,"values",()=>X.innerType._zod.values),i(Q._zod,"pattern",()=>X.innerType._zod.pattern),Q._zod.parse=(Y,W)=>{return X.innerType._zod.run(Y,W)}}),KW=U("$ZodNullable",(Q,X)=>{o.init(Q,X),i(Q._zod,"optin",()=>X.innerType._zod.optin),i(Q._zod,"optout",()=>X.innerType._zod.optout),i(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${s1(Y.source)}|null)$`):void 0}),i(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)}}),zW=U("$ZodDefault",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>NY(J,X));return NY(G,X)}});function NY(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var AW=U("$ZodPrefault",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),FW=U("$ZodNonOptional",(Q,X)=>{o.init(Q,X),i(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 G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>MY(J,Q));return MY(G,Q)}});function MY(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 LW=U("$ZodCatch",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(Q._zod,"optout",()=>X.innerType._zod.optout),i(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map(($)=>E0($,W,M0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>E0(J,W,M0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y}});var i6=U("$ZodPipe",(Q,X)=>{o.init(Q,X),i(Q._zod,"values",()=>X.in._zod.values),i(Q._zod,"optin",()=>X.in._zod.optin),i(Q._zod,"optout",()=>X.out._zod.optout),i(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let J=X.out._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>JQ($,X.in,W));return JQ(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>JQ(J,X.out,W));return JQ(G,X.out,W)}});function JQ(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues,fallback:Q.fallback},Y)}var DW=U("$ZodPreprocess",(Q,X)=>{i6.init(Q,X)}),VW=U("$ZodReadonly",(Q,X)=>{o.init(Q,X),i(Q._zod,"propValues",()=>X.innerType._zod.propValues),i(Q._zod,"values",()=>X.innerType._zod.values),i(Q._zod,"optin",()=>X.innerType?._zod?.optin),i(Q._zod,"optout",()=>X.innerType?._zod?.optout),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then(OY);return OY(G)}});function OY(Q){return Q.value=Object.freeze(Q.value),Q}var UW=U("$ZodCustom",(Q,X)=>{G0.init(Q,X),o.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,G=X.fn(W);if(G instanceof Promise)return G.then((J)=>wY(J,Y,W,Q));wY(G,Y,W,Q);return}});function wY(Q,X,Y,W){if(!Q){let G={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;X.issues.push(I1(G))}}var bB=()=>{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"},map:{unit:"entries",verb:"to have"}};function X(G){return Q[G]??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",mac:"MAC 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"},W={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=W[G.expected]??G.expected,$=_6(G.input),H=W[$]??$;return`Invalid input: expected ${J}, received ${H}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${s9(G.values[0])}`;return`Invalid option: expected one of ${o9(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",$=X(G.origin);if($)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",$=X(G.origin);if($)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${$.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${Y[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${o9(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":if(G.options&&Array.isArray(G.options)&&G.options.length>0)return`Invalid discriminator value. Expected ${G.options.map(($)=>`'${$}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function d6(){return{localeError:bB()}}var ZW,Kw=Symbol("ZodOutput"),zw=Symbol("ZodInput");class qW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...X){let Y=X[0];if(this._map.set(Q,Y),Y&&typeof Y==="object"&&"id"in Y)this._idmap.set(Y.id,Q);return this}clear(){return this._map=new WeakMap,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)??{}};delete Y.id;let W={...Y,...this._map.get(Q)};return Object.keys(W).length?W:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function jB(){return new qW}(ZW=globalThis).__zod_globalRegistry??(ZW.__zod_globalRegistry=jB());var A1=globalThis.__zod_globalRegistry;function NW(Q,X){return new Q({type:"string",...T(X)})}function MW(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...T(X)})}function n6(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...T(X)})}function OW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...T(X)})}function wW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(X)})}function PW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(X)})}function IW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(X)})}function EW(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...T(X)})}function bW(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...T(X)})}function jW(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(X)})}function TW(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...T(X)})}function RW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(X)})}function SW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...T(X)})}function CW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...T(X)})}function kW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(X)})}function vW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(X)})}function _W(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(X)})}function xW(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(X)})}function gW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(X)})}function yW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...T(X)})}function hW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...T(X)})}function uW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...T(X)})}function fW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...T(X)})}function lW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(X)})}function mW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...T(X)})}function cW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...T(X)})}function pW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...T(X)})}function iW(Q,X){return new Q({type:"number",checks:[],...T(X)})}function dW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...T(X)})}function nW(Q,X){return new Q({type:"boolean",...T(X)})}function rW(Q,X){return new Q({type:"null",...T(X)})}function oW(Q){return new Q({type:"unknown"})}function tW(Q,X){return new Q({type:"never",...T(X)})}function BQ(Q,X){return new h6({check:"less_than",...T(X),value:Q,inclusive:!1})}function G9(Q,X){return new h6({check:"less_than",...T(X),value:Q,inclusive:!0})}function KQ(Q,X){return new u6({check:"greater_than",...T(X),value:Q,inclusive:!1})}function J9(Q,X){return new u6({check:"greater_than",...T(X),value:Q,inclusive:!0})}function zQ(Q,X){return new XY({check:"multiple_of",...T(X),value:Q})}function AQ(Q,X){return new WY({check:"max_length",...T(X),maximum:Q})}function E1(Q,X){return new GY({check:"min_length",...T(X),minimum:Q})}function FQ(Q,X){return new JY({check:"length_equals",...T(X),length:Q})}function r6(Q,X){return new $Y({check:"string_format",format:"regex",...T(X),pattern:Q})}function o6(Q){return new HY({check:"string_format",format:"lowercase",...T(Q)})}function t6(Q){return new BY({check:"string_format",format:"uppercase",...T(Q)})}function a6(Q,X){return new KY({check:"string_format",format:"includes",...T(X),includes:Q})}function s6(Q,X){return new zY({check:"string_format",format:"starts_with",...T(X),prefix:Q})}function e6(Q,X){return new AY({check:"string_format",format:"ends_with",...T(X),suffix:Q})}function e0(Q){return new FY({check:"overwrite",tx:Q})}function Q4(Q){return e0((X)=>X.normalize(Q))}function X4(){return e0((Q)=>Q.trim())}function Y4(){return e0((Q)=>Q.toLowerCase())}function W4(){return e0((Q)=>Q.toUpperCase())}function G4(){return e0((Q)=>T6(Q))}function aW(Q,X,Y){return new Q({type:"array",element:X,...T(Y)})}function sW(Q,X,Y){let W=T(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function eW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...T(Y)})}function QG(Q,X){let Y=TB((W)=>{return W.addIssue=(G)=>{if(typeof G==="string")W.issues.push(I1(G,W.value,Y._zod.def));else{let J=G;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=W.value),J.inst??(J.inst=Y),J.continue??(J.continue=!Y._zod.def.abort),W.issues.push(I1(J))}},Q(W.value,W)},X);return Y}function TB(Q,X){let Y=new G0({check:"custom",...T(X)});return Y._zod.check=Q,Y}function J4(Q){let X=Q?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:Q.processors??{},metadataRegistry:Q?.metadata??A1,target:X,unrepresentable:Q?.unrepresentable??"throw",override:Q?.override??(()=>{}),io:Q?.io??"output",counter:0,seen:new Map,cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0}}function Q0(Q,X,Y={path:[],schemaPath:[]}){var W;let G=Q._zod.def,J=X.seen.get(Q);if(J){if(J.count++,Y.schemaPath.includes(Q))J.cycle=Y.path;return J.schema}let $={schema:{},count:1,cycle:void 0,path:Y.path};X.seen.set(Q,$);let H=Q._zod.toJSONSchema?.();if(H)$.schema=H;else{let z={...Y,schemaPath:[...Y.schemaPath,Q],path:Y.path};if(Q._zod.processJSONSchema)Q._zod.processJSONSchema(X,$.schema,z);else{let L=$.schema,D=X.processors[G.type];if(!D)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);D(Q,X,L,z)}let F=Q._zod.parent;if(F){if(!$.ref)$.ref=F;Q0(F,X,z),X.seen.get(F).isParent=!0}}let B=X.metadataRegistry.get(Q);if(B)Object.assign($.schema,B);if(X.io==="input"&&F0(Q))delete $.schema.examples,delete $.schema.default;if(X.io==="input"&&"_prefault"in $.schema)(W=$.schema).default??(W.default=$.schema._prefault);return delete $.schema._prefault,X.seen.get(Q).schema}function $4(Q,X){let Y=Q.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let W=new Map;for(let $ of Q.seen.entries()){let H=Q.metadataRegistry.get($[0])?.id;if(H){let B=W.get(H);if(B&&B!==$[0])throw Error(`Duplicate schema id "${H}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);W.set(H,$[0])}}let G=($)=>{let H=Q.target==="draft-2020-12"?"$defs":"definitions";if(Q.external){let F=Q.external.registry.get($[0])?.id,L=Q.external.uri??((Z)=>Z);if(F)return{ref:L(F)};let D=$[1].defId??$[1].schema.id??`schema${Q.counter++}`;return $[1].defId=D,{defId:D,ref:`${L("__shared")}#/${H}/${D}`}}if($[1]===Y)return{ref:"#"};let K=`${"#"}/${H}/`,z=$[1].schema.id??`__schema${Q.counter++}`;return{defId:z,ref:K+z}},J=($)=>{if($[1].schema.$ref)return;let H=$[1],{ref:B,defId:K}=G($);if(H.def={...H.schema},K)H.defId=K;let z=H.schema;for(let F in z)delete z[F];z.$ref=B};if(Q.cycles==="throw")for(let $ of Q.seen.entries()){let H=$[1];if(H.cycle)throw Error(`Cycle detected: #/${H.cycle?.join("/")}/<root>
72
+
73
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let $ of Q.seen.entries()){let H=$[1];if(X===$[0]){J($);continue}if(Q.external){let K=Q.external.registry.get($[0])?.id;if(X!==$[0]&&K){J($);continue}}if(Q.metadataRegistry.get($[0])?.id){J($);continue}if(H.cycle){J($);continue}if(H.count>1){if(Q.reused==="ref"){J($);continue}}}}function H4(Q,X){let Y=Q.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let W=(H)=>{let B=Q.seen.get(H);if(B.ref===null)return;let K=B.def??B.schema,z={...K},F=B.ref;if(B.ref=null,F){W(F);let D=Q.seen.get(F),Z=D.schema;if(Z.$ref&&(Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(Z);else Object.assign(K,Z);if(Object.assign(K,z),H._zod.parent===F)for(let M in K){if(M==="$ref"||M==="allOf")continue;if(!(M in z))delete K[M]}if(Z.$ref&&D.def)for(let M in K){if(M==="$ref"||M==="allOf")continue;if(M in D.def&&JSON.stringify(K[M])===JSON.stringify(D.def[M]))delete K[M]}}let L=H._zod.parent;if(L&&L!==F){W(L);let D=Q.seen.get(L);if(D?.schema.$ref){if(K.$ref=D.schema.$ref,D.def)for(let Z in K){if(Z==="$ref"||Z==="allOf")continue;if(Z in D.def&&JSON.stringify(K[Z])===JSON.stringify(D.def[Z]))delete K[Z]}}}Q.override({zodSchema:H,jsonSchema:K,path:B.path??[]})};for(let H of[...Q.seen.entries()].reverse())W(H[0]);let G={};if(Q.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(Q.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(Q.target==="openapi-3.0");if(Q.external?.uri){let H=Q.external.registry.get(X)?.id;if(!H)throw Error("Schema is missing an `id` property");G.$id=Q.external.uri(H)}Object.assign(G,Y.def??Y.schema);let J=Q.metadataRegistry.get(X)?.id;if(J!==void 0&&G.id===J)delete G.id;let $=Q.external?.defs??{};for(let H of Q.seen.entries()){let B=H[1];if(B.def&&B.defId){if(B.def.id===B.defId)delete B.def.id;$[B.defId]=B.def}}if(Q.external);else if(Object.keys($).length>0)if(Q.target==="draft-2020-12")G.$defs=$;else G.definitions=$;try{let H=JSON.parse(JSON.stringify(G));return Object.defineProperty(H,"~standard",{value:{...X["~standard"],jsonSchema:{input:$9(X,"input",Q.processors),output:$9(X,"output",Q.processors)}},enumerable:!1,writable:!1}),H}catch(H){throw Error("Error converting schema to JSON.")}}function F0(Q,X){let Y=X??{seen:new Set};if(Y.seen.has(Q))return!1;Y.seen.add(Q);let W=Q._zod.def;if(W.type==="transform")return!0;if(W.type==="array")return F0(W.element,Y);if(W.type==="set")return F0(W.valueType,Y);if(W.type==="lazy")return F0(W.getter(),Y);if(W.type==="promise"||W.type==="optional"||W.type==="nonoptional"||W.type==="nullable"||W.type==="readonly"||W.type==="default"||W.type==="prefault")return F0(W.innerType,Y);if(W.type==="intersection")return F0(W.left,Y)||F0(W.right,Y);if(W.type==="record"||W.type==="map")return F0(W.keyType,Y)||F0(W.valueType,Y);if(W.type==="pipe"){if(Q._zod.traits.has("$ZodCodec"))return!0;return F0(W.in,Y)||F0(W.out,Y)}if(W.type==="object"){for(let G in W.shape)if(F0(W.shape[G],Y))return!0;return!1}if(W.type==="union"){for(let G of W.options)if(F0(G,Y))return!0;return!1}if(W.type==="tuple"){for(let G of W.items)if(F0(G,Y))return!0;if(W.rest&&F0(W.rest,Y))return!0;return!1}return!1}var XG=(Q,X={})=>(Y)=>{let W=J4({...Y,processors:X});return Q0(Q,W),$4(W,Q),H4(W,Q)},$9=(Q,X,Y={})=>(W)=>{let{libraryOptions:G,target:J}=W??{},$=J4({...G??{},target:J,io:X,processors:Y});return Q0(Q,$),$4($,Q),H4($,Q)};var RB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},YG=(Q,X,Y,W)=>{let G=Y;G.type="string";let{minimum:J,maximum:$,format:H,patterns:B,contentEncoding:K}=Q._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof $==="number")G.maxLength=$;if(H){if(G.format=RB[H]??H,G.format==="")delete G.format;if(H==="time")delete G.format}if(K)G.contentEncoding=K;if(B&&B.size>0){let z=[...B];if(z.length===1)G.pattern=z[0].source;else if(z.length>1)G.allOf=[...z.map((F)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:F.source}))]}},WG=(Q,X,Y,W)=>{let G=Y,{minimum:J,maximum:$,format:H,multipleOf:B,exclusiveMaximum:K,exclusiveMinimum:z}=Q._zod.bag;if(typeof H==="string"&&H.includes("int"))G.type="integer";else G.type="number";let F=typeof z==="number"&&z>=(J??Number.NEGATIVE_INFINITY),L=typeof K==="number"&&K<=($??Number.POSITIVE_INFINITY),D=X.target==="draft-04"||X.target==="openapi-3.0";if(F)if(D)G.minimum=z,G.exclusiveMinimum=!0;else G.exclusiveMinimum=z;else if(typeof J==="number")G.minimum=J;if(L)if(D)G.maximum=K,G.exclusiveMaximum=!0;else G.exclusiveMaximum=K;else if(typeof $==="number")G.maximum=$;if(typeof B==="number")G.multipleOf=B},GG=(Q,X,Y,W)=>{Y.type="boolean"};var JG=(Q,X,Y,W)=>{if(X.target==="openapi-3.0")Y.type="string",Y.nullable=!0,Y.enum=[null];else Y.type="null"};var $G=(Q,X,Y,W)=>{Y.not={}};var HG=(Q,X,Y,W)=>{};var BG=(Q,X,Y,W)=>{let G=Q._zod.def,J=t1(G.entries);if(J.every(($)=>typeof $==="number"))Y.type="number";if(J.every(($)=>typeof $==="string"))Y.type="string";Y.enum=J},KG=(Q,X,Y,W)=>{let G=Q._zod.def,J=[];for(let $ of G.values)if($===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof $==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number($));else J.push($);if(J.length===0);else if(J.length===1){let $=J[0];if(Y.type=$===null?"null":typeof $,X.target==="draft-04"||X.target==="openapi-3.0")Y.enum=[$];else Y.const=$}else{if(J.every(($)=>typeof $==="number"))Y.type="number";if(J.every(($)=>typeof $==="string"))Y.type="string";if(J.every(($)=>typeof $==="boolean"))Y.type="boolean";if(J.every(($)=>$===null))Y.type="null";Y.enum=J}};var zG=(Q,X,Y,W)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var AG=(Q,X,Y,W)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var FG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def,{minimum:$,maximum:H}=Q._zod.bag;if(typeof $==="number")G.minItems=$;if(typeof H==="number")G.maxItems=H;G.type="array",G.items=Q0(J.element,X,{...W,path:[...W.path,"items"]})},LG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def;G.type="object",G.properties={};let $=J.shape;for(let K in $)G.properties[K]=Q0($[K],X,{...W,path:[...W.path,"properties",K]});let H=new Set(Object.keys($)),B=new Set([...H].filter((K)=>{let z=J.shape[K]._zod;if(X.io==="input")return z.optin===void 0;else return z.optout===void 0}));if(B.size>0)G.required=Array.from(B);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(X.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=Q0(J.catchall,X,{...W,path:[...W.path,"additionalProperties"]})},DG=(Q,X,Y,W)=>{let G=Q._zod.def,J=G.inclusive===!1,$=G.options.map((H,B)=>Q0(H,X,{...W,path:[...W.path,J?"oneOf":"anyOf",B]}));if(J)Y.oneOf=$;else Y.anyOf=$},VG=(Q,X,Y,W)=>{let G=Q._zod.def,J=Q0(G.left,X,{...W,path:[...W.path,"allOf",0]}),$=Q0(G.right,X,{...W,path:[...W.path,"allOf",1]}),H=(K)=>("allOf"in K)&&Object.keys(K).length===1,B=[...H(J)?J.allOf:[J],...H($)?$.allOf:[$]];Y.allOf=B};var UG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def;G.type="object";let $=J.keyType,B=$._zod.bag?.patterns;if(J.mode==="loose"&&B&&B.size>0){let z=Q0(J.valueType,X,{...W,path:[...W.path,"patternProperties","*"]});G.patternProperties={};for(let F of B)G.patternProperties[F.source]=z}else{if(X.target==="draft-07"||X.target==="draft-2020-12")G.propertyNames=Q0(J.keyType,X,{...W,path:[...W.path,"propertyNames"]});G.additionalProperties=Q0(J.valueType,X,{...W,path:[...W.path,"additionalProperties"]})}let K=$._zod.values;if(K){let z=[...K].filter((F)=>typeof F==="string"||typeof F==="number");if(z.length>0)G.required=z}},ZG=(Q,X,Y,W)=>{let G=Q._zod.def,J=Q0(G.innerType,X,W),$=X.seen.get(Q);if(X.target==="openapi-3.0")$.ref=G.innerType,Y.nullable=!0;else Y.anyOf=[J,{type:"null"}]},qG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType},NG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType,Y.default=JSON.parse(JSON.stringify(G.defaultValue))},MG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);if(J.ref=G.innerType,X.io==="input")Y._prefault=JSON.parse(JSON.stringify(G.defaultValue))},OG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType;let $;try{$=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Y.default=$},wG=(Q,X,Y,W)=>{let G=Q._zod.def,J=G.in._zod.traits.has("$ZodTransform"),$=X.io==="input"?J?G.out:G.in:G.out;Q0($,X,W);let H=X.seen.get(Q);H.ref=$},PG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType,Y.readOnly=!0};var B4=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType};function LQ(Q){return!!Q._zod}function Q1(Q,X){if(LQ(Q))return X9(Q,X);return Q.safeParse(X)}function DQ(Q){if(!Q)return;let X;if(LQ(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 VQ(Q){if(LQ(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}var F1={};JX(F1,{time:()=>A4,duration:()=>F4,datetime:()=>K4,date:()=>z4,ZodISOTime:()=>bG,ZodISODuration:()=>jG,ZodISODateTime:()=>IG,ZodISODate:()=>EG});var IG=U("ZodISODateTime",(Q,X)=>{_Y.init(Q,X),s.init(Q,X)});function K4(Q){return lW(IG,Q)}var EG=U("ZodISODate",(Q,X)=>{xY.init(Q,X),s.init(Q,X)});function z4(Q){return mW(EG,Q)}var bG=U("ZodISOTime",(Q,X)=>{gY.init(Q,X),s.init(Q,X)});function A4(Q){return cW(bG,Q)}var jG=U("ZodISODuration",(Q,X)=>{yY.init(Q,X),s.init(Q,X)});function F4(Q){return pW(jG,Q)}var hB=(Q,X)=>{e9.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>ZX(Q,Y)},flatten:{value:(Y)=>UX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,w1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,w1,2)}},isEmpty:{get(){return Q.issues.length===0}}})};var O0=U("ZodError",hB,{Parent:Error});var TG=QQ(O0),RG=XQ(O0),SG=Q9(O0),CG=Y9(O0),kG=qX(O0),vG=NX(O0),_G=MX(O0),xG=OX(O0),gG=wX(O0),yG=PX(O0),hG=IX(O0),uG=EX(O0);var fG=new WeakMap;function B9(Q,X,Y){let W=Object.getPrototypeOf(Q),G=fG.get(W);if(!G)G=new Set,fG.set(W,G);if(G.has(X))return;G.add(X);for(let J in Y){let $=Y[J];Object.defineProperty(W,J,{configurable:!0,enumerable:!1,get(){let H=$.bind(this);return Object.defineProperty(this,J,{configurable:!0,writable:!0,enumerable:!0,value:H}),H},set(H){Object.defineProperty(this,J,{configurable:!0,writable:!0,enumerable:!0,value:H})}})}}var e=U("ZodType",(Q,X)=>{return o.init(Q,X),Object.assign(Q["~standard"],{jsonSchema:{input:$9(Q,"input"),output:$9(Q,"output")}}),Q.toJSONSchema=XG(Q,{}),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.parse=(Y,W)=>TG(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>SG(Q,Y,W),Q.parseAsync=async(Y,W)=>RG(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>CG(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>kG(Q,Y,W),Q.decode=(Y,W)=>vG(Q,Y,W),Q.encodeAsync=async(Y,W)=>_G(Q,Y,W),Q.decodeAsync=async(Y,W)=>xG(Q,Y,W),Q.safeEncode=(Y,W)=>gG(Q,Y,W),Q.safeDecode=(Y,W)=>yG(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>hG(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>uG(Q,Y,W),B9(Q,"ZodType",{check(...Y){let W=this.def;return this.clone(m.mergeDefs(W,{checks:[...W.checks??[],...Y.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},with(...Y){return this.check(...Y)},clone(Y,W){return k0(this,Y,W)},brand(){return this},register(Y,W){return Y.add(this,W),this},refine(Y,W){return this.check(TK(Y,W))},superRefine(Y,W){return this.check(RK(Y,W))},overwrite(Y){return this.check(e0(Y))},optional(){return v(this)},exactOptional(){return UK(this)},nullable(){return pG(this)},nullish(){return v(pG(this))},nonoptional(Y){return wK(this,Y)},array(){return P(this)},or(Y){return C([this,Y])},and(Y){return L1(this,Y)},transform(Y){return iG(this,tG(Y))},default(Y){return NK(this,Y)},prefault(Y){return OK(this,Y)},catch(Y){return IK(this,Y)},pipe(Y){return iG(this,Y)},readonly(){return jK(this)},describe(Y){let W=this.clone();return A1.add(W,{description:Y}),W},meta(...Y){if(Y.length===0)return A1.get(this);let W=this.clone();return A1.add(W,Y[0]),W},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Y){return Y(this)}}),Object.defineProperty(Q,"description",{get(){return A1.get(Q)?.description},configurable:!0}),Q}),dG=U("_ZodString",(Q,X)=>{HQ.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>YG(Q,W,G,J);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,B9(Q,"_ZodString",{regex(...W){return this.check(r6(...W))},includes(...W){return this.check(a6(...W))},startsWith(...W){return this.check(s6(...W))},endsWith(...W){return this.check(e6(...W))},min(...W){return this.check(E1(...W))},max(...W){return this.check(AQ(...W))},length(...W){return this.check(FQ(...W))},nonempty(...W){return this.check(E1(1,...W))},lowercase(W){return this.check(o6(W))},uppercase(W){return this.check(t6(W))},trim(){return this.check(X4())},normalize(...W){return this.check(Q4(...W))},toLowerCase(){return this.check(Y4())},toUpperCase(){return this.check(W4())},slugify(){return this.check(G4())}})}),fB=U("ZodString",(Q,X)=>{HQ.init(Q,X),dG.init(Q,X),Q.email=(Y)=>Q.check(MW(lB,Y)),Q.url=(Y)=>Q.check(EW(mB,Y)),Q.jwt=(Y)=>Q.check(fW(WK,Y)),Q.emoji=(Y)=>Q.check(bW(cB,Y)),Q.guid=(Y)=>Q.check(n6(lG,Y)),Q.uuid=(Y)=>Q.check(OW(UQ,Y)),Q.uuidv4=(Y)=>Q.check(wW(UQ,Y)),Q.uuidv6=(Y)=>Q.check(PW(UQ,Y)),Q.uuidv7=(Y)=>Q.check(IW(UQ,Y)),Q.nanoid=(Y)=>Q.check(jW(pB,Y)),Q.guid=(Y)=>Q.check(n6(lG,Y)),Q.cuid=(Y)=>Q.check(TW(iB,Y)),Q.cuid2=(Y)=>Q.check(RW(dB,Y)),Q.ulid=(Y)=>Q.check(SW(nB,Y)),Q.base64=(Y)=>Q.check(yW(QK,Y)),Q.base64url=(Y)=>Q.check(hW(XK,Y)),Q.xid=(Y)=>Q.check(CW(rB,Y)),Q.ksuid=(Y)=>Q.check(kW(oB,Y)),Q.ipv4=(Y)=>Q.check(vW(tB,Y)),Q.ipv6=(Y)=>Q.check(_W(aB,Y)),Q.cidrv4=(Y)=>Q.check(xW(sB,Y)),Q.cidrv6=(Y)=>Q.check(gW(eB,Y)),Q.e164=(Y)=>Q.check(uW(YK,Y)),Q.datetime=(Y)=>Q.check(K4(Y)),Q.date=(Y)=>Q.check(z4(Y)),Q.time=(Y)=>Q.check(A4(Y)),Q.duration=(Y)=>Q.check(F4(Y))});function A(Q){return NW(fB,Q)}var s=U("ZodStringFormat",(Q,X)=>{t.init(Q,X),dG.init(Q,X)}),lB=U("ZodEmail",(Q,X)=>{EY.init(Q,X),s.init(Q,X)});var lG=U("ZodGUID",(Q,X)=>{PY.init(Q,X),s.init(Q,X)});var UQ=U("ZodUUID",(Q,X)=>{IY.init(Q,X),s.init(Q,X)});var mB=U("ZodURL",(Q,X)=>{bY.init(Q,X),s.init(Q,X)});var cB=U("ZodEmoji",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});var pB=U("ZodNanoID",(Q,X)=>{TY.init(Q,X),s.init(Q,X)});var iB=U("ZodCUID",(Q,X)=>{RY.init(Q,X),s.init(Q,X)});var dB=U("ZodCUID2",(Q,X)=>{SY.init(Q,X),s.init(Q,X)});var nB=U("ZodULID",(Q,X)=>{CY.init(Q,X),s.init(Q,X)});var rB=U("ZodXID",(Q,X)=>{kY.init(Q,X),s.init(Q,X)});var oB=U("ZodKSUID",(Q,X)=>{vY.init(Q,X),s.init(Q,X)});var tB=U("ZodIPv4",(Q,X)=>{hY.init(Q,X),s.init(Q,X)});var aB=U("ZodIPv6",(Q,X)=>{uY.init(Q,X),s.init(Q,X)});var sB=U("ZodCIDRv4",(Q,X)=>{fY.init(Q,X),s.init(Q,X)});var eB=U("ZodCIDRv6",(Q,X)=>{lY.init(Q,X),s.init(Q,X)});var QK=U("ZodBase64",(Q,X)=>{cY.init(Q,X),s.init(Q,X)});var XK=U("ZodBase64URL",(Q,X)=>{pY.init(Q,X),s.init(Q,X)});var YK=U("ZodE164",(Q,X)=>{iY.init(Q,X),s.init(Q,X)});var WK=U("ZodJWT",(Q,X)=>{dY.init(Q,X),s.init(Q,X)});var nG=U("ZodNumber",(Q,X)=>{m6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>WG(Q,W,G,J),B9(Q,"ZodNumber",{gt(W,G){return this.check(KQ(W,G))},gte(W,G){return this.check(J9(W,G))},min(W,G){return this.check(J9(W,G))},lt(W,G){return this.check(BQ(W,G))},lte(W,G){return this.check(G9(W,G))},max(W,G){return this.check(G9(W,G))},int(W){return this.check(mG(W))},safe(W){return this.check(mG(W))},positive(W){return this.check(KQ(0,W))},nonnegative(W){return this.check(J9(0,W))},negative(W){return this.check(BQ(0,W))},nonpositive(W){return this.check(G9(0,W))},multipleOf(W,G){return this.check(zQ(W,G))},step(W,G){return this.check(zQ(W,G))},finite(){return this}});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 E(Q){return iW(nG,Q)}var GK=U("ZodNumberFormat",(Q,X)=>{nY.init(Q,X),nG.init(Q,X)});function mG(Q){return dW(GK,Q)}var JK=U("ZodBoolean",(Q,X)=>{rY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>GG(Q,Y,W,G)});function u(Q){return nW(JK,Q)}var $K=U("ZodNull",(Q,X)=>{oY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>JG(Q,Y,W,G)});function ZQ(Q){return rW($K,Q)}var HK=U("ZodUnknown",(Q,X)=>{tY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>HG(Q,Y,W,G)});function x(){return oW(HK)}var BK=U("ZodNever",(Q,X)=>{aY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>$G(Q,Y,W,G)});function KK(Q){return tW(BK,Q)}var zK=U("ZodArray",(Q,X)=>{sY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>FG(Q,Y,W,G),Q.element=X.element,B9(Q,"ZodArray",{min(Y,W){return this.check(E1(Y,W))},nonempty(Y){return this.check(E1(1,Y))},max(Y,W){return this.check(AQ(Y,W))},length(Y,W){return this.check(FQ(Y,W))},unwrap(){return this.element}})});function P(Q,X){return aW(zK,Q,X)}var rG=U("ZodObject",(Q,X)=>{XW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>LG(Q,Y,W,G),m.defineLazy(Q,"shape",()=>{return X.shape}),B9(Q,"ZodObject",{keyof(){return n(Object.keys(this._zod.def.shape))},catchall(Y){return this.clone({...this._zod.def,catchall:Y})},passthrough(){return this.clone({...this._zod.def,catchall:x()})},loose(){return this.clone({...this._zod.def,catchall:x()})},strict(){return this.clone({...this._zod.def,catchall:KK()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Y){return m.extend(this,Y)},safeExtend(Y){return m.safeExtend(this,Y)},merge(Y){return m.merge(this,Y)},pick(Y){return m.pick(this,Y)},omit(Y){return m.omit(this,Y)},partial(...Y){return m.partial(aG,this,Y[0])},required(...Y){return m.required(sG,this,Y[0])}})});function V(Q,X){let Y={type:"object",shape:Q??{},...m.normalizeParams(X)};return new rG(Y)}function d(Q,X){return new rG({type:"object",shape:Q,catchall:x(),...m.normalizeParams(X)})}var oG=U("ZodUnion",(Q,X)=>{c6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>DG(Q,Y,W,G),Q.options=X.options});function C(Q,X){return new oG({type:"union",options:Q,...m.normalizeParams(X)})}var AK=U("ZodDiscriminatedUnion",(Q,X)=>{oG.init(Q,X),YW.init(Q,X)});function b1(Q,X,Y){return new AK({type:"union",options:X,discriminator:Q,...m.normalizeParams(Y)})}var FK=U("ZodIntersection",(Q,X)=>{WW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>VG(Q,Y,W,G)});function L1(Q,X){return new FK({type:"intersection",left:Q,right:X})}var cG=U("ZodRecord",(Q,X)=>{GW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>UG(Q,Y,W,G),Q.keyType=X.keyType,Q.valueType=X.valueType});function R(Q,X,Y){if(!X||!X._zod)return new cG({type:"record",keyType:A(),valueType:Q,...m.normalizeParams(X)});return new cG({type:"record",keyType:Q,valueType:X,...m.normalizeParams(Y)})}var L4=U("ZodEnum",(Q,X)=>{JW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>BG(Q,W,G,J),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,G)=>{let J={};for(let $ of W)if(Y.has($))J[$]=X.entries[$];else throw Error(`Key ${$} not found in enum`);return new L4({...X,checks:[],...m.normalizeParams(G),entries:J})},Q.exclude=(W,G)=>{let J={...X.entries};for(let $ of W)if(Y.has($))delete J[$];else throw Error(`Key ${$} not found in enum`);return new L4({...X,checks:[],...m.normalizeParams(G),entries:J})}});function n(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new L4({type:"enum",entries:Y,...m.normalizeParams(X)})}var LK=U("ZodLiteral",(Q,X)=>{$W.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>KG(Q,Y,W,G),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function q(Q,X){return new LK({type:"literal",values:Array.isArray(Q)?Q:[Q],...m.normalizeParams(X)})}var DK=U("ZodTransform",(Q,X)=>{HW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>AG(Q,Y,W,G),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new r1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(m.issue(J,Y.value,X));else{let $=J;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=Q),Y.issues.push(m.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y.fallback=!0,Y});return Y.value=G,Y.fallback=!0,Y}});function tG(Q){return new DK({type:"transform",transform:Q})}var aG=U("ZodOptional",(Q,X)=>{p6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>B4(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function v(Q){return new aG({type:"optional",innerType:Q})}var VK=U("ZodExactOptional",(Q,X)=>{BW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>B4(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function UK(Q){return new VK({type:"optional",innerType:Q})}var ZK=U("ZodNullable",(Q,X)=>{KW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>ZG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function pG(Q){return new ZK({type:"nullable",innerType:Q})}var qK=U("ZodDefault",(Q,X)=>{zW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>NG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function NK(Q,X){return new qK({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():m.shallowClone(X)}})}var MK=U("ZodPrefault",(Q,X)=>{AW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>MG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function OK(Q,X){return new MK({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():m.shallowClone(X)}})}var sG=U("ZodNonOptional",(Q,X)=>{FW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>qG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function wK(Q,X){return new sG({type:"nonoptional",innerType:Q,...m.normalizeParams(X)})}var PK=U("ZodCatch",(Q,X)=>{LW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>OG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function IK(Q,X){return new PK({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var eG=U("ZodPipe",(Q,X)=>{i6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>wG(Q,Y,W,G),Q.in=X.in,Q.out=X.out});function iG(Q,X){return new eG({type:"pipe",in:Q,out:X})}var EK=U("ZodPreprocess",(Q,X)=>{eG.init(Q,X),DW.init(Q,X)}),bK=U("ZodReadonly",(Q,X)=>{VW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>PG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function jK(Q){return new bK({type:"readonly",innerType:Q})}var QJ=U("ZodCustom",(Q,X)=>{UW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>zG(Q,Y,W,G)});function qQ(Q,X){return sW(QJ,Q??(()=>!0),X)}function TK(Q,X={}){return eW(QJ,Q,X)}function RK(Q,X){return QG(Q,X)}function j1(Q,X){return new EK({type:"pipe",in:tG(Q),out:X})}M0(d6());var D4="2025-11-25";var XJ=[D4,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",MQ="2.0",Y0=qQ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),YJ=C([A(),E().int()]),WJ=A(),DI=d({ttl:E().optional(),pollInterval:E().optional()}),CK=V({ttl:E().optional()}),kK=V({taskId:A()}),V4=d({progressToken:YJ.optional(),[X1]:kK.optional()}),w0=V({_meta:V4.optional()}),K9=w0.extend({task:CK.optional()}),GJ=(Q)=>K9.safeParse(Q).success,J0=V({method:A(),params:w0.loose().optional()}),b0=V({_meta:V4.optional()}),j0=V({method:A(),params:b0.loose().optional()}),$0=d({_meta:V4.optional()}),OQ=C([A(),E().int()]),JJ=V({jsonrpc:q(MQ),id:OQ,...J0.shape}).strict(),U4=(Q)=>JJ.safeParse(Q).success,$J=V({jsonrpc:q(MQ),...j0.shape}).strict(),HJ=(Q)=>$J.safeParse(Q).success,Z4=V({jsonrpc:q(MQ),id:OQ,result:$0}).strict(),z9=(Q)=>Z4.safeParse(Q).success;var f;(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"})(f||(f={}));var q4=V({jsonrpc:q(MQ),id:OQ.optional(),error:V({code:E().int(),message:A(),data:x().optional()})}).strict();var BJ=(Q)=>q4.safeParse(Q).success;var KJ=C([JJ,$J,Z4,q4]),VI=C([Z4,q4]),wQ=$0.strict(),vK=b0.extend({requestId:OQ.optional(),reason:A().optional()}),PQ=j0.extend({method:q("notifications/cancelled"),params:vK}),_K=V({src:A(),mimeType:A().optional(),sizes:P(A()).optional(),theme:n(["light","dark"]).optional()}),A9=V({icons:P(_K).optional()}),T1=V({name:A(),title:A().optional()}),zJ=T1.extend({...T1.shape,...A9.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),xK=L1(V({applyDefaults:u().optional()}),R(A(),x())),gK=j1((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},L1(V({form:xK.optional(),url:Y0.optional()}),R(A(),x()).optional())),yK=d({list:Y0.optional(),cancel:Y0.optional(),requests:d({sampling:d({createMessage:Y0.optional()}).optional(),elicitation:d({create:Y0.optional()}).optional()}).optional()}),hK=d({list:Y0.optional(),cancel:Y0.optional(),requests:d({tools:d({call:Y0.optional()}).optional()}).optional()}),uK=V({experimental:R(A(),Y0).optional(),sampling:V({context:Y0.optional(),tools:Y0.optional()}).optional(),elicitation:gK.optional(),roots:V({listChanged:u().optional()}).optional(),tasks:yK.optional(),extensions:R(A(),Y0).optional()}),fK=w0.extend({protocolVersion:A(),capabilities:uK,clientInfo:zJ}),N4=J0.extend({method:q("initialize"),params:fK});var lK=V({experimental:R(A(),Y0).optional(),logging:Y0.optional(),completions:Y0.optional(),prompts:V({listChanged:u().optional()}).optional(),resources:V({subscribe:u().optional(),listChanged:u().optional()}).optional(),tools:V({listChanged:u().optional()}).optional(),tasks:hK.optional(),extensions:R(A(),Y0).optional()}),mK=$0.extend({protocolVersion:A(),capabilities:lK,serverInfo:zJ,instructions:A().optional()}),M4=j0.extend({method:q("notifications/initialized"),params:b0.optional()});var IQ=J0.extend({method:q("ping"),params:w0.optional()}),cK=V({progress:E(),total:v(E()),message:v(A())}),pK=V({...b0.shape,...cK.shape,progressToken:YJ}),EQ=j0.extend({method:q("notifications/progress"),params:pK}),iK=w0.extend({cursor:WJ.optional()}),F9=J0.extend({params:iK.optional()}),L9=$0.extend({nextCursor:WJ.optional()}),dK=n(["working","input_required","completed","failed","cancelled"]),D9=V({taskId:A(),status:dK,ttl:C([E(),ZQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:v(E()),statusMessage:v(A())}),R1=$0.extend({task:D9}),nK=b0.merge(D9),V9=j0.extend({method:q("notifications/tasks/status"),params:nK}),bQ=J0.extend({method:q("tasks/get"),params:w0.extend({taskId:A()})}),jQ=$0.merge(D9),TQ=J0.extend({method:q("tasks/result"),params:w0.extend({taskId:A()})}),UI=$0.loose(),RQ=F9.extend({method:q("tasks/list")}),SQ=L9.extend({tasks:P(D9)}),CQ=J0.extend({method:q("tasks/cancel"),params:w0.extend({taskId:A()})}),AJ=$0.merge(D9),FJ=V({uri:A(),mimeType:v(A()),_meta:R(A(),x()).optional()}),LJ=FJ.extend({text:A()}),O4=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),DJ=FJ.extend({blob:O4}),U9=n(["user","assistant"]),S1=V({audience:P(U9).optional(),priority:E().min(0).max(1).optional(),lastModified:F1.datetime({offset:!0}).optional()}),VJ=V({...T1.shape,...A9.shape,uri:A(),description:v(A()),mimeType:v(A()),size:v(E()),annotations:S1.optional(),_meta:v(d({}))}),rK=V({...T1.shape,...A9.shape,uriTemplate:A(),description:v(A()),mimeType:v(A()),annotations:S1.optional(),_meta:v(d({}))}),oK=F9.extend({method:q("resources/list")}),tK=L9.extend({resources:P(VJ)}),aK=F9.extend({method:q("resources/templates/list")}),sK=L9.extend({resourceTemplates:P(rK)}),w4=w0.extend({uri:A()}),eK=w4,Qz=J0.extend({method:q("resources/read"),params:eK}),Xz=$0.extend({contents:P(C([LJ,DJ]))}),Yz=j0.extend({method:q("notifications/resources/list_changed"),params:b0.optional()}),Wz=w4,Gz=J0.extend({method:q("resources/subscribe"),params:Wz}),Jz=w4,$z=J0.extend({method:q("resources/unsubscribe"),params:Jz}),Hz=b0.extend({uri:A()}),Bz=j0.extend({method:q("notifications/resources/updated"),params:Hz}),Kz=V({name:A(),description:v(A()),required:v(u())}),zz=V({...T1.shape,...A9.shape,description:v(A()),arguments:v(P(Kz)),_meta:v(d({}))}),Az=F9.extend({method:q("prompts/list")}),Fz=L9.extend({prompts:P(zz)}),Lz=w0.extend({name:A(),arguments:R(A(),A()).optional()}),Dz=J0.extend({method:q("prompts/get"),params:Lz}),P4=V({type:q("text"),text:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),I4=V({type:q("image"),data:O4,mimeType:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),E4=V({type:q("audio"),data:O4,mimeType:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),Vz=V({type:q("tool_use"),name:A(),id:A(),input:R(A(),x()),_meta:R(A(),x()).optional()}),Uz=V({type:q("resource"),resource:C([LJ,DJ]),annotations:S1.optional(),_meta:R(A(),x()).optional()}),Zz=VJ.extend({type:q("resource_link")}),b4=C([P4,I4,E4,Zz,Uz]),qz=V({role:U9,content:b4}),Nz=$0.extend({description:A().optional(),messages:P(qz)}),Mz=j0.extend({method:q("notifications/prompts/list_changed"),params:b0.optional()}),Oz=V({title:A().optional(),readOnlyHint:u().optional(),destructiveHint:u().optional(),idempotentHint:u().optional(),openWorldHint:u().optional()}),wz=V({taskSupport:n(["required","optional","forbidden"]).optional()}),UJ=V({...T1.shape,...A9.shape,description:A().optional(),inputSchema:V({type:q("object"),properties:R(A(),Y0).optional(),required:P(A()).optional()}).catchall(x()),outputSchema:V({type:q("object"),properties:R(A(),Y0).optional(),required:P(A()).optional()}).catchall(x()).optional(),annotations:Oz.optional(),execution:wz.optional(),_meta:R(A(),x()).optional()}),Pz=F9.extend({method:q("tools/list")}),Iz=L9.extend({tools:P(UJ)}),kQ=$0.extend({content:P(b4).default([]),structuredContent:R(A(),x()).optional(),isError:u().optional()}),ZI=kQ.or($0.extend({toolResult:x()})),Ez=K9.extend({name:A(),arguments:R(A(),x()).optional()}),j4=J0.extend({method:q("tools/call"),params:Ez}),bz=j0.extend({method:q("notifications/tools/list_changed"),params:b0.optional()}),qI=V({autoRefresh:u().default(!0),debounceMs:E().int().nonnegative().default(300)}),Z9=n(["debug","info","notice","warning","error","critical","alert","emergency"]),jz=w0.extend({level:Z9}),T4=J0.extend({method:q("logging/setLevel"),params:jz}),Tz=b0.extend({level:Z9,logger:A().optional(),data:x()}),Rz=j0.extend({method:q("notifications/message"),params:Tz}),Sz=V({name:A().optional()}),Cz=V({hints:P(Sz).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),kz=V({mode:n(["auto","required","none"]).optional()}),vz=V({type:q("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:P(b4).default([]),structuredContent:V({}).loose().optional(),isError:u().optional(),_meta:R(A(),x()).optional()}),_z=b1("type",[P4,I4,E4]),NQ=b1("type",[P4,I4,E4,Vz,vz]),xz=V({role:U9,content:C([NQ,P(NQ)]),_meta:R(A(),x()).optional()}),gz=K9.extend({messages:P(xz),modelPreferences:Cz.optional(),systemPrompt:A().optional(),includeContext:n(["none","thisServer","allServers"]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:P(A()).optional(),metadata:Y0.optional(),tools:P(UJ).optional(),toolChoice:kz.optional()}),yz=J0.extend({method:q("sampling/createMessage"),params:gz}),q9=$0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens"]).or(A())),role:U9,content:_z}),R4=$0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:U9,content:C([NQ,P(NQ)])}),hz=V({type:q("boolean"),title:A().optional(),description:A().optional(),default:u().optional()}),uz=V({type:q("string"),title:A().optional(),description:A().optional(),minLength:E().optional(),maxLength:E().optional(),format:n(["email","uri","date","date-time"]).optional(),default:A().optional()}),fz=V({type:n(["number","integer"]),title:A().optional(),description:A().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),lz=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),default:A().optional()}),mz=V({type:q("string"),title:A().optional(),description:A().optional(),oneOf:P(V({const:A(),title:A()})),default:A().optional()}),cz=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),enumNames:P(A()).optional(),default:A().optional()}),pz=C([lz,mz]),iz=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({type:q("string"),enum:P(A())}),default:P(A()).optional()}),dz=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({anyOf:P(V({const:A(),title:A()}))}),default:P(A()).optional()}),nz=C([iz,dz]),rz=C([cz,pz,nz]),oz=C([rz,hz,uz,fz]),tz=K9.extend({mode:q("form").optional(),message:A(),requestedSchema:V({type:q("object"),properties:R(A(),oz),required:P(A()).optional()})}),az=K9.extend({mode:q("url"),message:A(),elicitationId:A(),url:A().url()}),sz=C([tz,az]),ez=J0.extend({method:q("elicitation/create"),params:sz}),QA=b0.extend({elicitationId:A()}),XA=j0.extend({method:q("notifications/elicitation/complete"),params:QA}),C1=$0.extend({action:n(["accept","decline","cancel"]),content:j1((Q)=>Q===null?void 0:Q,R(A(),C([A(),E(),u(),P(A())])).optional())}),YA=V({type:q("ref/resource"),uri:A()});var WA=V({type:q("ref/prompt"),name:A()}),GA=w0.extend({ref:C([WA,YA]),argument:V({name:A(),value:A()}),context:V({arguments:R(A(),A()).optional()}).optional()}),JA=J0.extend({method:q("completion/complete"),params:GA});var $A=$0.extend({completion:d({values:P(A()).max(100),total:v(E().int()),hasMore:v(u())})}),HA=V({uri:A().startsWith("file://"),name:A().optional(),_meta:R(A(),x()).optional()}),BA=J0.extend({method:q("roots/list"),params:w0.optional()}),S4=$0.extend({roots:P(HA)}),KA=j0.extend({method:q("notifications/roots/list_changed"),params:b0.optional()}),NI=C([IQ,N4,JA,T4,Dz,Az,oK,aK,Qz,Gz,$z,j4,Pz,bQ,TQ,RQ,CQ]),MI=C([PQ,EQ,M4,KA,V9]),OI=C([wQ,q9,R4,C1,S4,jQ,SQ,R1]),wI=C([IQ,yz,ez,BA,bQ,TQ,RQ,CQ]),PI=C([PQ,EQ,Rz,Bz,Yz,bz,Mz,V9,XA]),II=C([wQ,mK,$A,Nz,Fz,tK,sK,Xz,kQ,Iz,jQ,SQ,R1]);class g 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===f.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new ZJ(W.elicitations,X)}return new g(Q,X,Y)}}class ZJ extends g{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(f.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function Y1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var zA=Symbol("Let zodToJsonSchema decide on which parser to use");var WE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function C4(Q){let Y=DQ(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=VQ(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function k4(Q,X){let Y=Q1(Q,X);if(!Y.success)throw Y.error;return Y.data}var UA=60000;class v4{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(PQ,(X)=>{this._oncancel(X)}),this.setNotificationHandler(EQ,(X)=>{this._onprogress(X)}),this.setRequestHandler(IQ,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(bQ,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new g(f.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(TQ,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let $;while($=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if($.type==="response"||$.type==="error"){let H=$.message,B=H.id,K=this._requestResolvers.get(B);if(K)if(this._requestResolvers.delete(B),$.type==="response")K(H);else{let z=H,F=new g(z.error.code,z.error.message,z.error.data);K(F)}else{let z=$.type==="response"?"Response":"Error";this._onerror(Error(`${z} handler missing for request ${B}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new g(f.InvalidParams,`Task not found: ${G}`);if(!Y1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(Y1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(RQ,async(X,Y)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new g(f.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(CQ,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new g(f.InvalidParams,`Task not found: ${X.params.taskId}`);if(Y1(W.status))throw new g(f.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 G=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!G)throw new g(f.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof g)throw W;throw new g(f.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,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:G,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),g.fromError(f.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=(G)=>{Y?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(W?.(G,J),z9(G)||BJ(G))this._onresponse(G);else if(U4(G))this._onrequest(G,J);else if(HJ(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},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=g.fromError(f.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,G=Q.params?._meta?.[X1]?.taskId;if(Y===void 0){let K={jsonrpc:"2.0",id:Q.id,error:{code:f.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((z)=>this._onerror(Error(`Failed to enqueue error response: ${z}`)));else W?.send(K).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=GJ(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(K)=>{if(J.signal.aborted)return;let z={relatedRequestId:Q.id};if(G)z.relatedTask={taskId:G};await this.notification(K,z)},sendRequest:async(K,z,F)=>{if(J.signal.aborted)throw new g(f.ConnectionClosed,"Request was cancelled");let L={...F,relatedRequestId:Q.id};if(G&&!L.relatedTask)L.relatedTask={taskId:G};let D=L.relatedTask?.taskId??G;if(D&&H)await H.updateTaskStatus(D,"input_required");return await this.request(K,z,L)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:H,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,B)).then(async(K)=>{if(J.signal.aborted)return;let z={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:z,timestamp:Date.now()},W?.sessionId);else await W?.send(z)},async(K)=>{if(J.signal.aborted)return;let z={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:f.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:z,timestamp:Date.now()},W?.sessionId);else await W?.send(z)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===J)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),$=this._timeoutInfo.get(W);if($&&J&&$.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(H){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(H);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),z9(Q))Y(Q);else{let J=new g(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 G=!1;if(z9(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let $=J.task;if(typeof $.taskId==="string")G=!0,this._taskProgressTokens.set($.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(z9(Q))W(Q);else{let J=g.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 g?J:new g(f.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,R1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new g(f.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},Y1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new g(f.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new g(f.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let H=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,H)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof g?J:new g(f.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:H}=Y??{};return new Promise((B,K)=>{let z=(O)=>{K(O)};if(!this._transport){z(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(O){z(O);return}Y?.signal?.throwIfAborted();let F=this._requestMessageId++,L={...Q,jsonrpc:"2.0",id:F};if(Y?.onprogress)this._progressHandlers.set(F,Y.onprogress),L.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:F}};if($)L.params={...L.params,task:$};if(H)L.params={...L.params,_meta:{...L.params?._meta||{},[X1]:H}};let D=(O)=>{this._responseHandlers.delete(F),this._progressHandlers.delete(F),this._cleanupTimeout(F),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:F,reason:String(O)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((j)=>this._onerror(Error(`Failed to send cancellation: ${j}`)));let k=O instanceof g?O:new g(f.RequestTimeout,String(O));K(k)};this._responseHandlers.set(F,(O)=>{if(Y?.signal?.aborted)return;if(O instanceof Error)return K(O);try{let k=Q1(X,O.result);if(!k.success)K(k.error);else B(k.data)}catch(k){K(k)}}),Y?.signal?.addEventListener("abort",()=>{D(Y?.signal?.reason)});let Z=Y?.timeout??UA,N=()=>D(g.fromError(f.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(F,Z,Y?.maxTotalTimeout,N,Y?.resetTimeoutOnProgress??!1);let M=H?.taskId;if(M){let O=(k)=>{let j=this._responseHandlers.get(F);if(j)j(k);else this._onerror(Error(`Response handler missing for side-channeled request ${F}`))};this._requestResolvers.set(F,O),this._enqueueTaskMessage(M,{type:"request",message:L,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(F),K(k)})}else this._transport.send(L,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((O)=>{this._cleanupTimeout(F),K(O)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},jQ,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},SQ,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},AJ,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,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 $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[X1]:X.relatedTask}}};this._transport?.send($,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||{},[X1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=C4(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=k4(Q,W);return Promise.resolve(X(J,G))})}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=C4(Q);this._notificationHandlers.set(Y,(W)=>{let G=k4(Q,W);return Promise.resolve(X(G))})}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"&&U4(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new g(f.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} 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,G)=>{if(X.aborted){G(new g(f.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new g(f.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 G=await Y.getTask(W,X);if(!G)throw new g(f.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,J)=>{await Y.storeTaskResult(W,G,J,X);let $=await Y.getTask(W,X);if($){let H=V9.parse({method:"notifications/tasks/status",params:$});if(await this.notification(H),Y1($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new g(f.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(Y1($.status))throw new g(f.InvalidParams,`Cannot update task "${W}" from terminal status "${$.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,J,X);let H=await Y.getTask(W,X);if(H){let B=V9.parse({method:"notifications/tasks/status",params:H});if(await this.notification(B),Y1(H.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function qJ(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function NJ(Q,X){let Y={...Q};for(let W in X){let G=W,J=X[G];if(J===void 0)continue;let $=Y[G];if(qJ($)&&qJ(J))Y[G]={...$,...J};else Y[G]=J}return Y}var QH=GX(T8(),1),XH=GX(e$(),1);function fN(){let Q=new QH.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return XH.default(Q),Q}class h8{constructor(Q){this._ajv=Q??fN()}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 u8{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],G=Array.isArray(W.content)?W.content:[W.content],J=G.some((K)=>K.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,H=$?Array.isArray($.content)?$.content:[$.content]:[],B=H.some((K)=>K.type==="tool_use");if(J){if(G.some((K)=>K.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 K=new Set(H.filter((F)=>F.type==="tool_use").map((F)=>F.id)),z=new Set(G.filter((F)=>F.type==="tool_result").map((F)=>F.toolUseId));if(K.size!==z.size||![...K].every((F)=>z.has(F)))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},q9,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 G=W==="form"&&Q.mode===void 0?{...Q,mode:"form"}:Q;return this.requestStream({method:"elicitation/create",params:G},C1,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 YH(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 WH(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 f8 extends v4{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Z9.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new h8,this.setRequestHandler(N4,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(M4,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(T4,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=Z9.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new u8(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=NJ(this._capabilities,Q)}setRequestHandler(Q,X){let W=DQ(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G=VQ(W);if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(H,B)=>{let K=Q1(j4,H);if(!K.success){let D=K.error instanceof Error?K.error.message:String(K.error);throw new g(f.InvalidParams,`Invalid tools/call request: ${D}`)}let{params:z}=K.data,F=await Promise.resolve(X(H,B));if(z.task){let D=Q1(R1,F);if(!D.success){let Z=D.error instanceof Error?D.error.message:String(D.error);throw new g(f.InvalidParams,`Invalid task creation result: ${Z}`)}return D.data}let L=Q1(kQ,F);if(!L.success){let D=L.error instanceof Error?L.error.message:String(L.error);throw new g(f.InvalidParams,`Invalid tools/call result: ${D}`)}return L.data};return super.setRequestHandler(Q,$)}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){WH(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;YH(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:XJ.includes(X)?X:D4,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"},wQ)}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],G=W.some((B)=>B.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,$=J?Array.isArray(J.content)?J.content:[J.content]:[],H=$.some((B)=>B.type==="tool_use");if(G){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($.filter((z)=>z.type==="tool_use").map((z)=>z.id)),K=new Set(W.filter((z)=>z.type==="tool_result").map((z)=>z.toolUseId));if(B.size!==K.size||![...B].every((z)=>K.has(z)))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},R4,X);return this.request({method:"sampling/createMessage",params:Q},q9,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},C1,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"},G=await this.request({method:"elicitation/create",params:W},C1,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new g(f.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof g)throw J;throw new g(f.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}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},S4,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"})}}import JH from"node:process";var lN=10485760;class l8{constructor(Q){this._maxBufferSize=Q?.maxBufferSize??lN}append(Q){if((this._buffer?.length??0)+Q.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
74
+ `);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),mN(X)}clear(){this._buffer=void 0}}function mN(Q){return KJ.parse(JSON.parse(Q))}function GH(Q){return JSON.stringify(Q)+`
75
+ `}class m8{constructor(Q=JH.stdin,X=JH.stdout,Y){this._stdin=Q,this._stdout=X,this._started=!1,this._ondata=(W)=>{try{this._readBuffer.append(W),this.processReadBuffer()}catch(G){this.onerror?.(G),this.close().catch(()=>{})}},this._onerror=(W)=>{this.onerror?.(W)},this._readBuffer=new l8({maxBufferSize:Y?.maxBufferSize})}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=GH(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var cN="io.modelcontextprotocol/related-task",q6="2.0",W0=qQ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),HH=C([A(),E().int()]),BH=A(),GS=d({ttl:E().optional(),pollInterval:E().optional()}),pN=V({ttl:E().optional()}),iN=V({taskId:A()}),c8=d({progressToken:HH.optional(),[cN]:iN.optional()}),P0=V({_meta:c8.optional()}),N6=P0.extend({task:pN.optional()});var K0=V({method:A(),params:P0.loose().optional()}),S0=V({_meta:c8.optional()}),C0=V({method:A(),params:S0.loose().optional()}),z0=d({_meta:c8.optional()}),M6=C([A(),E().int()]),dN=V({jsonrpc:q(q6),id:M6,...K0.shape}).strict();var nN=V({jsonrpc:q(q6),...C0.shape}).strict();var KH=V({jsonrpc:q(q6),id:M6,result:z0}).strict();var $H;(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"})($H||($H={}));var zH=V({jsonrpc:q(q6),id:M6.optional(),error:V({code:E().int(),message:A(),data:x().optional()})}).strict();var JS=C([dN,nN,KH,zH]),$S=C([KH,zH]),AH=z0.strict(),rN=S0.extend({requestId:M6.optional(),reason:A().optional()}),FH=C0.extend({method:q("notifications/cancelled"),params:rN}),oN=V({src:A(),mimeType:A().optional(),sizes:P(A()).optional(),theme:n(["light","dark"]).optional()}),c9=V({icons:P(oN).optional()}),p1=V({name:A(),title:A().optional()}),LH=p1.extend({...p1.shape,...c9.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),tN=L1(V({applyDefaults:u().optional()}),R(A(),x())),aN=j1((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},L1(V({form:tN.optional(),url:W0.optional()}),R(A(),x()).optional())),sN=d({list:W0.optional(),cancel:W0.optional(),requests:d({sampling:d({createMessage:W0.optional()}).optional(),elicitation:d({create:W0.optional()}).optional()}).optional()}),eN=d({list:W0.optional(),cancel:W0.optional(),requests:d({tools:d({call:W0.optional()}).optional()}).optional()}),QM=V({experimental:R(A(),W0).optional(),sampling:V({context:W0.optional(),tools:W0.optional()}).optional(),elicitation:aN.optional(),roots:V({listChanged:u().optional()}).optional(),tasks:sN.optional(),extensions:R(A(),W0).optional()}),XM=P0.extend({protocolVersion:A(),capabilities:QM,clientInfo:LH}),YM=K0.extend({method:q("initialize"),params:XM});var WM=V({experimental:R(A(),W0).optional(),logging:W0.optional(),completions:W0.optional(),prompts:V({listChanged:u().optional()}).optional(),resources:V({subscribe:u().optional(),listChanged:u().optional()}).optional(),tools:V({listChanged:u().optional()}).optional(),tasks:eN.optional(),extensions:R(A(),W0).optional()}),GM=z0.extend({protocolVersion:A(),capabilities:WM,serverInfo:LH,instructions:A().optional()}),JM=C0.extend({method:q("notifications/initialized"),params:S0.optional()});var DH=K0.extend({method:q("ping"),params:P0.optional()}),$M=V({progress:E(),total:v(E()),message:v(A())}),HM=V({...S0.shape,...$M.shape,progressToken:HH}),VH=C0.extend({method:q("notifications/progress"),params:HM}),BM=P0.extend({cursor:BH.optional()}),p9=K0.extend({params:BM.optional()}),i9=z0.extend({nextCursor:BH.optional()}),KM=n(["working","input_required","completed","failed","cancelled"]),d9=V({taskId:A(),status:KM,ttl:C([E(),ZQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:v(E()),statusMessage:v(A())}),UH=z0.extend({task:d9}),zM=S0.merge(d9),ZH=C0.extend({method:q("notifications/tasks/status"),params:zM}),qH=K0.extend({method:q("tasks/get"),params:P0.extend({taskId:A()})}),NH=z0.merge(d9),MH=K0.extend({method:q("tasks/result"),params:P0.extend({taskId:A()})}),HS=z0.loose(),OH=p9.extend({method:q("tasks/list")}),wH=i9.extend({tasks:P(d9)}),PH=K0.extend({method:q("tasks/cancel"),params:P0.extend({taskId:A()})}),BS=z0.merge(d9),IH=V({uri:A(),mimeType:v(A()),_meta:R(A(),x()).optional()}),EH=IH.extend({text:A()}),p8=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),bH=IH.extend({blob:p8}),n9=n(["user","assistant"]),i1=V({audience:P(n9).optional(),priority:E().min(0).max(1).optional(),lastModified:F1.datetime({offset:!0}).optional()}),jH=V({...p1.shape,...c9.shape,uri:A(),description:v(A()),mimeType:v(A()),size:v(E()),annotations:i1.optional(),_meta:v(d({}))}),AM=V({...p1.shape,...c9.shape,uriTemplate:A(),description:v(A()),mimeType:v(A()),annotations:i1.optional(),_meta:v(d({}))}),FM=p9.extend({method:q("resources/list")}),LM=i9.extend({resources:P(jH)}),DM=p9.extend({method:q("resources/templates/list")}),VM=i9.extend({resourceTemplates:P(AM)}),i8=P0.extend({uri:A()}),UM=i8,ZM=K0.extend({method:q("resources/read"),params:UM}),qM=z0.extend({contents:P(C([EH,bH]))}),NM=C0.extend({method:q("notifications/resources/list_changed"),params:S0.optional()}),MM=i8,OM=K0.extend({method:q("resources/subscribe"),params:MM}),wM=i8,PM=K0.extend({method:q("resources/unsubscribe"),params:wM}),IM=S0.extend({uri:A()}),EM=C0.extend({method:q("notifications/resources/updated"),params:IM}),bM=V({name:A(),description:v(A()),required:v(u())}),jM=V({...p1.shape,...c9.shape,description:v(A()),arguments:v(P(bM)),_meta:v(d({}))}),TM=p9.extend({method:q("prompts/list")}),RM=i9.extend({prompts:P(jM)}),SM=P0.extend({name:A(),arguments:R(A(),A()).optional()}),CM=K0.extend({method:q("prompts/get"),params:SM}),d8=V({type:q("text"),text:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),n8=V({type:q("image"),data:p8,mimeType:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),r8=V({type:q("audio"),data:p8,mimeType:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),kM=V({type:q("tool_use"),name:A(),id:A(),input:R(A(),x()),_meta:R(A(),x()).optional()}),vM=V({type:q("resource"),resource:C([EH,bH]),annotations:i1.optional(),_meta:R(A(),x()).optional()}),_M=jH.extend({type:q("resource_link")}),o8=C([d8,n8,r8,_M,vM]),xM=V({role:n9,content:o8}),gM=z0.extend({description:A().optional(),messages:P(xM)}),yM=C0.extend({method:q("notifications/prompts/list_changed"),params:S0.optional()}),hM=V({title:A().optional(),readOnlyHint:u().optional(),destructiveHint:u().optional(),idempotentHint:u().optional(),openWorldHint:u().optional()}),uM=V({taskSupport:n(["required","optional","forbidden"]).optional()}),TH=V({...p1.shape,...c9.shape,description:A().optional(),inputSchema:V({type:q("object"),properties:R(A(),W0).optional(),required:P(A()).optional()}).catchall(x()),outputSchema:V({type:q("object"),properties:R(A(),W0).optional(),required:P(A()).optional()}).catchall(x()).optional(),annotations:hM.optional(),execution:uM.optional(),_meta:R(A(),x()).optional()}),t8=p9.extend({method:q("tools/list")}),fM=i9.extend({tools:P(TH)}),RH=z0.extend({content:P(o8).default([]),structuredContent:R(A(),x()).optional(),isError:u().optional()}),KS=RH.or(z0.extend({toolResult:x()})),lM=N6.extend({name:A(),arguments:R(A(),x()).optional()}),a8=K0.extend({method:q("tools/call"),params:lM}),mM=C0.extend({method:q("notifications/tools/list_changed"),params:S0.optional()}),zS=V({autoRefresh:u().default(!0),debounceMs:E().int().nonnegative().default(300)}),SH=n(["debug","info","notice","warning","error","critical","alert","emergency"]),cM=P0.extend({level:SH}),pM=K0.extend({method:q("logging/setLevel"),params:cM}),iM=S0.extend({level:SH,logger:A().optional(),data:x()}),dM=C0.extend({method:q("notifications/message"),params:iM}),nM=V({name:A().optional()}),rM=V({hints:P(nM).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),oM=V({mode:n(["auto","required","none"]).optional()}),tM=V({type:q("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:P(o8).default([]),structuredContent:V({}).loose().optional(),isError:u().optional(),_meta:R(A(),x()).optional()}),aM=b1("type",[d8,n8,r8]),Z6=b1("type",[d8,n8,r8,kM,tM]),sM=V({role:n9,content:C([Z6,P(Z6)]),_meta:R(A(),x()).optional()}),eM=N6.extend({messages:P(sM),modelPreferences:rM.optional(),systemPrompt:A().optional(),includeContext:n(["none","thisServer","allServers"]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:P(A()).optional(),metadata:W0.optional(),tools:P(TH).optional(),toolChoice:oM.optional()}),QO=K0.extend({method:q("sampling/createMessage"),params:eM}),XO=z0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens"]).or(A())),role:n9,content:aM}),YO=z0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:n9,content:C([Z6,P(Z6)])}),WO=V({type:q("boolean"),title:A().optional(),description:A().optional(),default:u().optional()}),GO=V({type:q("string"),title:A().optional(),description:A().optional(),minLength:E().optional(),maxLength:E().optional(),format:n(["email","uri","date","date-time"]).optional(),default:A().optional()}),JO=V({type:n(["number","integer"]),title:A().optional(),description:A().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),$O=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),default:A().optional()}),HO=V({type:q("string"),title:A().optional(),description:A().optional(),oneOf:P(V({const:A(),title:A()})),default:A().optional()}),BO=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),enumNames:P(A()).optional(),default:A().optional()}),KO=C([$O,HO]),zO=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({type:q("string"),enum:P(A())}),default:P(A()).optional()}),AO=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({anyOf:P(V({const:A(),title:A()}))}),default:P(A()).optional()}),FO=C([zO,AO]),LO=C([BO,KO,FO]),DO=C([LO,WO,GO,JO]),VO=N6.extend({mode:q("form").optional(),message:A(),requestedSchema:V({type:q("object"),properties:R(A(),DO),required:P(A()).optional()})}),UO=N6.extend({mode:q("url"),message:A(),elicitationId:A(),url:A().url()}),ZO=C([VO,UO]),qO=K0.extend({method:q("elicitation/create"),params:ZO}),NO=S0.extend({elicitationId:A()}),MO=C0.extend({method:q("notifications/elicitation/complete"),params:NO}),OO=z0.extend({action:n(["accept","decline","cancel"]),content:j1((Q)=>Q===null?void 0:Q,R(A(),C([A(),E(),u(),P(A())])).optional())}),wO=V({type:q("ref/resource"),uri:A()});var PO=V({type:q("ref/prompt"),name:A()}),IO=P0.extend({ref:C([PO,wO]),argument:V({name:A(),value:A()}),context:V({arguments:R(A(),A()).optional()}).optional()}),EO=K0.extend({method:q("completion/complete"),params:IO});var bO=z0.extend({completion:d({values:P(A()).max(100),total:v(E().int()),hasMore:v(u())})}),jO=V({uri:A().startsWith("file://"),name:A().optional(),_meta:R(A(),x()).optional()}),TO=K0.extend({method:q("roots/list"),params:P0.optional()}),RO=z0.extend({roots:P(jO)}),SO=C0.extend({method:q("notifications/roots/list_changed"),params:S0.optional()}),AS=C([DH,YM,EO,pM,CM,TM,FM,DM,ZM,OM,PM,a8,t8,qH,MH,OH,PH]),FS=C([FH,VH,JM,SO,ZH]),LS=C([AH,XO,YO,OO,RO,NH,wH,UH]),DS=C([DH,QO,qO,TO,qH,MH,OH,PH]),VS=C([FH,VH,dM,EM,NM,mM,yM,ZH,MO]),US=C([AH,GM,bO,gM,RM,LM,VM,qM,RH,fM,NH,wH,UH]);import{closeSync as CO,constants as r9,existsSync as kO,fstatSync as vO,openSync as _O,readSync as CH,realpathSync as w6,readlinkSync as xO}from"node:fs";import{basename as gO,isAbsolute as yO,join as O6,relative as vH,sep as s8}from"node:path";import{homedir as hO}from"node:os";var _H=12582912,uO=65536;function fO(Q){let X=Q.toLowerCase().split(".").pop()??"";return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",json:"application/json",md:"text/markdown",mp4:"video/mp4",webm:"video/webm"}[X]??"application/octet-stream"}function kH(Q,X="upload.bin"){return((Q&&typeof Q==="string"?Q:X).split(/[\\/]/).pop()||X).replace(/[\u0000-\u001f\u007f]/g,"_").replace(/^\.+/,"").slice(0,255)||X}function QX(Q={}){let X=Q.home??hO(),Y=Q.env??process.env,W=[],G=Q.alias?.trim();if(G)W.push(O6(X,".anet","cache","attachments",G));if(W.push(O6(X,".anet","cache","attachments")),Q.nodeDir)W.push(Q.nodeDir);if(W.push(O6(X,".grok","sessions")),W.push(O6(X,".grok","images")),W.push("/work/feishu-attachments"),Y.ANET_FEISHU_MEDIA_DIR?.trim())W.push(Y.ANET_FEISHU_MEDIA_DIR.trim());if(Y.ANET_UPLOAD_ROOTS?.trim())for(let $ of Y.ANET_UPLOAD_ROOTS.split(":")){let H=$.trim();if(H)W.push(H)}let J=Q.cwd??process.cwd();try{let $=w6(J),H=w6(X),B=vH(H,$);if(B===".anet"||B.startsWith(`.anet${s8}`)||B===".grok"||B.startsWith(`.grok${s8}`))W.push($)}catch{}return W}function e8(Q,X){for(let Y of X){if(!Y)continue;try{if(!kO(Y))continue;let W=w6(Y),G=vH(W,Q);if(G!==""&&G!==".."&&!G.startsWith(`..${s8}`)&&!yO(G))return!0}catch{}}return!1}function lO(Q,X){if(!Q||typeof Q!=="string"||!Q.trim())return{ok:!1,error:"path_required",message:"path is required"};if(Q.includes("\x00"))return{ok:!1,error:"path_nul",message:"path must not contain NUL bytes"};let Y=Q.trim();if(!Y)return{ok:!1,error:"path_required",message:"path is required"};let W;try{W=w6(Y)}catch{return{ok:!1,error:"path_not_found",message:"path does not exist or cannot be realpath'd"}}if(!e8(W,X))return{ok:!1,error:"path_untrusted",message:"path is outside this node's controlled upload roots (generated assets / attachment cache only)"};return{ok:!0,canonicalPath:W}}function mO(Q,X,Y=_H){if(!e8(Q,X))return{ok:!1,error:"path_untrusted",message:"path is outside this node's controlled upload roots"};let W=r9.O_RDONLY|(typeof r9.O_NOFOLLOW==="number"?r9.O_NOFOLLOW:0)|(typeof r9.O_CLOEXEC==="number"?r9.O_CLOEXEC:0),G;try{G=_O(Q,W)}catch(J){let $=J?.message??String(J);if(J?.code==="ELOOP"||/symlink|ELOOP/i.test($))return{ok:!1,error:"path_symlink",message:"symlink paths are not allowed for upload"};return{ok:!1,error:"path_not_found",message:$}}try{try{let K=xO(`/proc/self/fd/${G}`);if(K&&!e8(K,X))return{ok:!1,error:"path_untrusted",message:"opened fd resolved outside controlled roots"}}catch{}let J=vO(G);if(J.isSymbolicLink?.()===!0)return{ok:!1,error:"path_symlink",message:"symlink fd rejected"};if(!J.isFile())return{ok:!1,error:"path_not_regular",message:"path is not a regular file"};if(J.size<=0)return{ok:!1,error:"path_empty",message:"file is empty"};if(J.size>Y)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit (observed ${J.size})`};let $=[],H=0,B=Buffer.alloc(Math.min(uO,Y));while(H<Y){let K=Math.min(B.length,Y-H),z;try{z=CH(G,B,0,K,H)}catch(F){return{ok:!1,error:"read_failed",message:F?.message??"read failed"}}if(z===0)break;if($.push(Buffer.from(B.subarray(0,z))),H+=z,H>Y)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit during read`}}if(H>=Y){let K=Buffer.alloc(1),z=0;try{z=CH(G,K,0,1,H)}catch{z=0}if(z>0)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit (extra bytes after cap)`}}if(H<=0)return{ok:!1,error:"path_empty",message:"file is empty"};return{ok:!0,bytes:Buffer.concat($,H),size:H,canonicalPath:Q}}finally{try{CO(G)}catch{}}}async function xH(Q,X,Y={}){if(!X.hubUrl?.trim())return{ok:!1,error:"hub_url_required",message:"hubUrl is required"};if(!X.authToken?.trim())return{ok:!1,error:"auth_required",message:"auth token is required (token-bound node)"};let W=X.allowedRoots??QX({home:X.home,alias:X.alias,nodeDir:X.nodeDir}),G=lO(Q,W);if(!G.ok)return G;let J=mO(G.canonicalPath,W,_H);if(!J.ok)return J;let $=kH(Y.name??gO(J.canonicalPath)),H=Y.mime&&Y.mime.slice(0,100)||fO($),B=new FormData;B.append("file",new Blob([new Uint8Array(J.bytes)],{type:H}),$);let K=`${X.hubUrl.replace(/\/+$/,"")}/api/upload`,z=X.fetch??fetch,F;try{F=await z(K,{method:"POST",headers:{Authorization:`Bearer ${X.authToken}`},body:B})}catch(Z){return{ok:!1,error:"upload_failed",message:Z?.message??"network error"}}let L;try{L=await F.json()}catch{return{ok:!1,error:"bad_response",message:`hub returned non-JSON (HTTP ${F.status})`}}if(!F.ok)return{ok:!1,error:"upload_failed",message:L?.message||L?.error||`HTTP ${F.status}`};let D=L?.file_id??L?.fileId;if(typeof D!=="string"||!/^[A-Za-z0-9_-]{8,64}$/.test(D))return{ok:!1,error:"missing_file_id",message:"hub response missing valid file_id"};return{ok:!0,file_id:D,name:typeof L?.name==="string"&&L.name?kH(L.name,$):$,mime:typeof L?.mime==="string"&&L.mime?L.mime.slice(0,100):H,size:typeof L?.size==="number"?L.size:J.size,url:typeof L?.url==="string"?L.url:`/api/files/${D}`}}var cO=(process.env.COMMHUB_URL||"").replace(/\/+$/,""),pO=process.env.COMMHUB_TOKEN||process.env.AUTH_TOKEN||"",gH=process.env.ANET_UPLOAD_ALIAS||process.env.COMMHUB_ALIAS||"",yH=process.env.ANET_NODE_DIR||"",XX=new f8({name:"commhub-upload",version:"0.1.0"},{capabilities:{tools:{}}});XX.setRequestHandler(t8,async()=>({tools:[{name:"upload_file",description:"Upload a controlled local file (generated image/attachment under this node's allowlisted dirs) to CommHub. Returns {file_id,name,mime,size} for send_reply attachments. Rejects arbitrary paths, traversal, and symlinks. Max 12 MiB. Cross-host safe: bytes stream to Hub; do not pass raw paths into send_reply.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Absolute or relative path to a file under this node's controlled roots (e.g. Grok images/, .anet cache attachments)"},name:{type:"string",description:"Optional display filename (basename only)"},mime:{type:"string",description:"Optional MIME type hint"}},required:["path"]}}]}));XX.setRequestHandler(a8,async(Q)=>{if(Q.params.name!=="upload_file")return{content:[{type:"text",text:JSON.stringify({ok:!1,error:"unknown_tool"})}],isError:!0};let Y=Q.params.arguments||{},W=await xH(String(Y.path||""),{hubUrl:cO,authToken:pO,alias:gH||void 0,nodeDir:yH||void 0,allowedRoots:QX({alias:gH||void 0,nodeDir:yH||void 0})},{name:Y.name,mime:Y.mime});return{content:[{type:"text",text:JSON.stringify(W)}],isError:!W.ok}});var iO=new m8;await XX.connect(iO);