@sequenzy/mcp 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- var O5=Object.create;var{getPrototypeOf:M5,defineProperty:HQ,getOwnPropertyNames:V5}=Object;var q5=Object.prototype.hasOwnProperty;function Z5(Q){return this[Q]}var N5,w5,RX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?N5??=new WeakMap:w5??=new WeakMap,J=G.get(Q);if(J)return J}Y=Q!=null?O5(M5(Q)):{};let $=X||!Q||!Q.__esModule?HQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let z of V5(Q))if(!q5.call($,z))HQ($,z,{get:Z5.bind(Q,z),enumerable:!0});if(W)G.set(Q,$);return $};var Z=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var j5=(Q)=>Q;function P5(Q,X){this[Q]=j5.bind(null,X)}var CX=(Q,X)=>{for(var Y in X)HQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:P5.bind(X,Y)})};var F6=Z((jG)=>{Object.defineProperty(jG,"__esModule",{value:!0});jG.regexpCode=jG.getEsmExportName=jG.getProperty=jG.safeStringify=jG.stringify=jG.strConcat=jG.addCodeArg=jG.str=jG._=jG.nil=jG._Code=jG.Name=jG.IDENTIFIER=jG._CodeOrName=void 0;class q4{}jG._CodeOrName=q4;jG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class T1 extends q4{constructor(Q){super();if(!jG.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}}}jG.Name=T1;class I0 extends q4{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 T1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}jG._Code=I0;jG.nil=new I0("");function NG(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)O9(Y,X[W]),Y.push(Q[++W]);return new I0(Y)}jG._=NG;var U9=new I0("+");function wG(Q,...X){let Y=[A6(Q[0])],W=0;while(W<X.length)Y.push(U9),O9(Y,X[W]),Y.push(U9,A6(Q[++W]));return fK(Y),new I0(Y)}jG.str=wG;function O9(Q,X){if(X instanceof I0)Q.push(...X._items);else if(X instanceof T1)Q.push(X);else Q.push(cK(X))}jG.addCodeArg=O9;function fK(Q){let X=1;while(X<Q.length-1){if(Q[X]===U9){let Y=mK(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function mK(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof T1||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 T1))return`"${Q}${X.slice(1)}`;return}function lK(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:wG`${Q}${X}`}jG.strConcat=lK;function cK(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:A6(Array.isArray(Q)?Q.join(","):Q)}function pK(Q){return new I0(A6(Q))}jG.stringify=pK;function A6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}jG.safeStringify=A6;function iK(Q){return typeof Q=="string"&&jG.IDENTIFIER.test(Q)?new I0(`.${Q}`):NG`[${Q}]`}jG.getProperty=iK;function nK(Q){if(typeof Q=="string"&&jG.IDENTIFIER.test(Q))return new I0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}jG.getEsmExportName=nK;function dK(Q){return new I0(Q.toString())}jG.regexpCode=dK});var Z9=Z((IG)=>{Object.defineProperty(IG,"__esModule",{value:!0});IG.ValueScope=IG.ValueScopeName=IG.Scope=IG.varKinds=IG.UsedValueState=void 0;var L0=F6();class bG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var N4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(N4||(IG.UsedValueState=N4={}));IG.varKinds={const:new L0.Name("const"),let:new L0.Name("let"),var:new L0.Name("var")};class V9{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof L0.Name?Q:this.name(Q)}name(Q){return new L0.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}}}IG.Scope=V9;class q9 extends L0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=L0._`.${new L0.Name(X)}[${Y}]`}}IG.ValueScopeName=q9;var $B=L0._`\n`;class EG extends V9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?$B:L0.nil}}get(){return this._scope}name(Q){return new q9(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 z=this._scope[G]||(this._scope[G]=[]),H=z.length;return z[H]=X.ref,W.setValue(X,{property:G,itemIndex:H}),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 L0._`${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=L0.nil;for(let J in Q){let $=Q[J];if(!$)continue;let z=Y[J]=Y[J]||new Map;$.forEach((H)=>{if(z.has(H))return;z.set(H,N4.Started);let K=X(H);if(K){let B=this.opts.es5?IG.varKinds.var:IG.varKinds.const;G=L0._`${G}${B} ${H} = ${K};${this.opts._n}`}else if(K=W===null||W===void 0?void 0:W(H))G=L0._`${G}${K}${this.opts._n}`;else throw new bG(H);z.set(H,N4.Completed)})}return G}}IG.ValueScope=EG});var k=Z((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 y=F6(),T0=Z9(),Y1=F6();Object.defineProperty(U0,"_",{enumerable:!0,get:function(){return Y1._}});Object.defineProperty(U0,"str",{enumerable:!0,get:function(){return Y1.str}});Object.defineProperty(U0,"strConcat",{enumerable:!0,get:function(){return Y1.strConcat}});Object.defineProperty(U0,"nil",{enumerable:!0,get:function(){return Y1.nil}});Object.defineProperty(U0,"getProperty",{enumerable:!0,get:function(){return Y1.getProperty}});Object.defineProperty(U0,"stringify",{enumerable:!0,get:function(){return Y1.stringify}});Object.defineProperty(U0,"regexpCode",{enumerable:!0,get:function(){return Y1.regexpCode}});Object.defineProperty(U0,"Name",{enumerable:!0,get:function(){return Y1.Name}});var I4=Z9();Object.defineProperty(U0,"Scope",{enumerable:!0,get:function(){return I4.Scope}});Object.defineProperty(U0,"ValueScope",{enumerable:!0,get:function(){return I4.ValueScope}});Object.defineProperty(U0,"ValueScopeName",{enumerable:!0,get:function(){return I4.ValueScopeName}});Object.defineProperty(U0,"varKinds",{enumerable:!0,get:function(){return I4.varKinds}});U0.operators={GT:new y._Code(">"),GTE:new y._Code(">="),LT:new y._Code("<"),LTE:new y._Code("<="),EQ:new y._Code("==="),NEQ:new y._Code("!=="),NOT:new y._Code("!"),OR:new y._Code("||"),AND:new y._Code("&&"),ADD:new y._Code("+")};class W1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class SG extends W1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?T0.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=R1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof y._CodeOrName?this.rhs.names:{}}}class j9 extends W1{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 y.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=R1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof y.Name?{}:{...this.lhs.names};return E4(Q,this.rhs)}}class RG extends j9{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class CG extends W1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class kG extends W1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class vG extends W1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class xG extends W1{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=R1(this.code,Q,X),this}get names(){return this.code instanceof y._CodeOrName?this.code.names:{}}}class T4 extends W1{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;BB(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>F1(Q,X.names),{})}}class G1 extends T4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class _G extends T4{}class L6 extends G1{}L6.kind="else";class c0 extends G1{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 L6(Y):Y}if(X){if(Q===!1)return X instanceof c0?X:X.nodes;if(this.nodes.length)return this;return new c0(fG(Q),X instanceof c0?[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=R1(this.condition,Q,X),this}get names(){let Q=super.names;if(E4(Q,this.condition),this.else)F1(Q,this.else.names);return Q}}c0.kind="if";class S1 extends G1{}S1.kind="for";class yG extends S1{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=R1(this.iteration,Q,X),this}get names(){return F1(super.names,this.iteration.names)}}class hG extends S1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?T0.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=E4(super.names,this.from);return E4(Q,this.to)}}class N9 extends S1{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=R1(this.iterable,Q,X),this}get names(){return F1(super.names,this.iterable.names)}}class w4 extends G1{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)}}w4.kind="func";class j4 extends T4{render(Q){return"return "+super.render(Q)}}j4.kind="return";class uG extends G1{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)F1(Q,this.catch.names);if(this.finally)F1(Q,this.finally.names);return Q}}class P4 extends G1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}P4.kind="catch";class b4 extends G1{render(Q){return"finally"+super.render(Q)}}b4.kind="finally";class gG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
3
- `:""},this._extScope=Q,this._scope=new T0.Scope({parent:Q}),this._nodes=[new _G]}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 SG(Q,G,Y)),G}const(Q,X,Y){return this._def(T0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(T0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(T0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new j9(Q,X,Y))}add(Q,X){return this._leafNode(new RG(Q,U0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==y.nil)this._leafNode(new xG(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,y.addCodeArg)(X,W)}return X.push("}"),new y._Code(X)}if(Q,X,Y){if(this._blockNode(new c0(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 c0(Q))}else(){return this._elseNode(new L6)}endIf(){return this._endBlockNode(c0,L6)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new yG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?T0.varKinds.var:T0.varKinds.let){let J=this._scope.toName(Q);return this._for(new hG(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=T0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof y.Name?X:this.var("_arr",X);return this.forRange("_i",0,y._`${J}.length`,($)=>{this.var(G,y._`${J}[${$}]`),Y(G)})}return this._for(new N9("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?T0.varKinds.var:T0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,y._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new N9("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(S1)}label(Q){return this._leafNode(new CG(Q))}break(Q){return this._leafNode(new kG(Q))}return(Q){let X=new j4;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(j4)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new uG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new P4(G),X(G)}if(Y)this._currNode=W.finally=new b4,this.code(Y);return this._endBlockNode(P4,b4)}throw(Q){return this._leafNode(new vG(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=y.nil,Y,W){if(this._blockNode(new w4(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(w4)}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 c0))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=gG;function F1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function E4(Q,X){return X instanceof y._CodeOrName?F1(Q,X.names):Q}function R1(Q,X,Y){if(Q instanceof y.Name)return W(Q);if(!G(Q))return Q;return new y._Code(Q._items.reduce((J,$)=>{if($ instanceof y.Name)$=W($);if($ instanceof y._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 y._Code&&J._items.some(($)=>$ instanceof y.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function BB(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function fG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:y._`!${w9(Q)}`}U0.not=fG;var DB=mG(U0.operators.AND);function AB(...Q){return Q.reduce(DB)}U0.and=AB;var FB=mG(U0.operators.OR);function LB(...Q){return Q.reduce(FB)}U0.or=LB;function mG(Q){return(X,Y)=>X===y.nil?Y:Y===y.nil?X:y._`${w9(X)} ${Q} ${w9(Y)}`}function w9(Q){return Q instanceof y.Name?Q:y._`(${Q})`}});var g=Z((tG)=>{Object.defineProperty(tG,"__esModule",{value:!0});tG.checkStrictMode=tG.getErrorPath=tG.Type=tG.useFunc=tG.setEvaluated=tG.evaluatedPropsToName=tG.mergeEvaluated=tG.eachItem=tG.unescapeJsonPointer=tG.escapeJsonPointer=tG.escapeFragment=tG.unescapeFragment=tG.schemaRefOrVal=tG.schemaHasRulesButRef=tG.schemaHasRules=tG.checkUnknownRules=tG.alwaysValidSchema=tG.toHash=void 0;var c=k(),VB=F6();function qB(Q){let X={};for(let Y of Q)X[Y]=!0;return X}tG.toHash=qB;function ZB(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return iG(Q,X),!nG(X,Q.self.RULES.all)}tG.alwaysValidSchema=ZB;function iG(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])oG(Q,`unknown keyword: "${J}"`)}tG.checkUnknownRules=iG;function nG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}tG.schemaHasRules=nG;function NB(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}tG.schemaHasRulesButRef=NB;function wB({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return c._`${Y}`}return c._`${Q}${X}${(0,c.getProperty)(W)}`}tG.schemaRefOrVal=wB;function jB(Q){return dG(decodeURIComponent(Q))}tG.unescapeFragment=jB;function PB(Q){return encodeURIComponent(b9(Q))}tG.escapeFragment=PB;function b9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}tG.escapeJsonPointer=b9;function dG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}tG.unescapeJsonPointer=dG;function bB(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}tG.eachItem=bB;function cG({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,J,$,z)=>{let H=$===void 0?J:$ instanceof c.Name?(J instanceof c.Name?Q(G,J,$):X(G,J,$),$):J instanceof c.Name?(X(G,$,J),J):Y(J,$);return z===c.Name&&!(H instanceof c.Name)?W(G,H):H}}tG.mergeEvaluated={props:cG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(c._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,c._`${Y} || {}`).code(c._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,c._`${Y} || {}`),E9(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:rG}),items:cG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,c._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:c._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function rG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",c._`{}`);if(X!==void 0)E9(Q,Y,X);return Y}tG.evaluatedPropsToName=rG;function E9(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(c._`${X}${(0,c.getProperty)(W)}`,!0))}tG.setEvaluated=E9;var pG={};function EB(Q,X){return Q.scopeValue("func",{ref:X,code:pG[X.code]||(pG[X.code]=new VB._Code(X.code))})}tG.useFunc=EB;var P9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(P9||(tG.Type=P9={}));function IB(Q,X,Y){if(Q instanceof c.Name){let W=X===P9.Num;return Y?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,c.getProperty)(Q).toString():"/"+b9(Q)}tG.getErrorPath=IB;function oG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}tG.checkStrictMode=oG});var p0=Z((sG)=>{Object.defineProperty(sG,"__esModule",{value:!0});var K0=k(),iB={data:new K0.Name("data"),valCxt:new K0.Name("valCxt"),instancePath:new K0.Name("instancePath"),parentData:new K0.Name("parentData"),parentDataProperty:new K0.Name("parentDataProperty"),rootData:new K0.Name("rootData"),dynamicAnchors:new K0.Name("dynamicAnchors"),vErrors:new K0.Name("vErrors"),errors:new K0.Name("errors"),this:new K0.Name("this"),self:new K0.Name("self"),scope:new K0.Name("scope"),json:new K0.Name("json"),jsonPos:new K0.Name("jsonPos"),jsonLen:new K0.Name("jsonLen"),jsonPart:new K0.Name("jsonPart")};sG.default=iB});var U6=Z((YJ)=>{Object.defineProperty(YJ,"__esModule",{value:!0});YJ.extendErrors=YJ.resetErrorsCount=YJ.reportExtraError=YJ.reportError=YJ.keyword$DataError=YJ.keywordError=void 0;var h=k(),R4=g(),D0=p0();YJ.keywordError={message:({keyword:Q})=>h.str`must pass "${Q}" keyword validation`};YJ.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?h.str`"${Q}" keyword must be ${X} ($data)`:h.str`"${Q}" keyword is invalid ($data)`};function dB(Q,X=YJ.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:z}=G,H=XJ(Q,X,Y);if(W!==null&&W!==void 0?W:$||z)eG(J,H);else QJ(G,h._`[${H}]`)}YJ.reportError=dB;function rB(Q,X=YJ.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,z=XJ(Q,X,Y);if(eG(G,z),!(J||$))QJ(W,D0.default.vErrors)}YJ.reportExtraError=rB;function oB(Q,X){Q.assign(D0.default.errors,X),Q.if(h._`${D0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(h._`${D0.default.vErrors}.length`,X),()=>Q.assign(D0.default.vErrors,null)))}YJ.resetErrorsCount=oB;function tB({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,D0.default.errors,(z)=>{if(Q.const($,h._`${D0.default.vErrors}[${z}]`),Q.if(h._`${$}.instancePath === undefined`,()=>Q.assign(h._`${$}.instancePath`,(0,h.strConcat)(D0.default.instancePath,J.errorPath))),Q.assign(h._`${$}.schemaPath`,h.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(h._`${$}.schema`,Y),Q.assign(h._`${$}.data`,W)})}YJ.extendErrors=tB;function eG(Q,X){let Y=Q.const("err",X);Q.if(h._`${D0.default.vErrors} === null`,()=>Q.assign(D0.default.vErrors,h._`[${Y}]`),h._`${D0.default.vErrors}.push(${Y})`),Q.code(h._`${D0.default.errors}++`)}function QJ(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(h._`new ${Q.ValidationError}(${X})`);else Y.assign(h._`${W}.errors`,X),Y.return(!1)}var L1={keyword:new h.Name("keyword"),schemaPath:new h.Name("schemaPath"),params:new h.Name("params"),propertyName:new h.Name("propertyName"),message:new h.Name("message"),schema:new h.Name("schema"),parentSchema:new h.Name("parentSchema")};function XJ(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return h._`{}`;return aB(Q,X,Y)}function aB(Q,X,Y={}){let{gen:W,it:G}=Q,J=[sB(G,Y),eB(Q,Y)];return QD(Q,X,J),W.object(...J)}function sB({errorPath:Q},{instancePath:X}){let Y=X?h.str`${Q}${(0,R4.getErrorPath)(X,R4.Type.Str)}`:Q;return[D0.default.instancePath,(0,h.strConcat)(D0.default.instancePath,Y)]}function eB({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:h.str`${X}/${Q}`;if(Y)G=h.str`${G}${(0,R4.getErrorPath)(Y,R4.Type.Str)}`;return[L1.schemaPath,G]}function QD(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:z}=Q,{opts:H,propertyName:K,topSchemaRef:B,schemaPath:D}=z;if(W.push([L1.keyword,G],[L1.params,typeof X=="function"?X(Q):X||h._`{}`]),H.messages)W.push([L1.message,typeof Y=="function"?Y(Q):Y]);if(H.verbose)W.push([L1.schema,$],[L1.parentSchema,h._`${B}${D}`],[D0.default.data,J]);if(K)W.push([L1.propertyName,K])}});var zJ=Z((JJ)=>{Object.defineProperty(JJ,"__esModule",{value:!0});JJ.boolOrEmptySchema=JJ.topBoolOrEmptySchema=void 0;var JD=U6(),$D=k(),zD=p0(),HD={message:"boolean schema is false"};function KD(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)GJ(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(zD.default.data);else X.assign($D._`${W}.errors`,null),X.return(!0)}JJ.topBoolOrEmptySchema=KD;function BD(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),GJ(Q);else Y.var(X,!0)}JJ.boolOrEmptySchema=BD;function GJ(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,JD.reportError)(G,HD,void 0,X)}});var T9=Z((HJ)=>{Object.defineProperty(HJ,"__esModule",{value:!0});HJ.getRules=HJ.isJSONType=void 0;var AD=["string","number","integer","boolean","null","object","array"],FD=new Set(AD);function LD(Q){return typeof Q=="string"&&FD.has(Q)}HJ.isJSONType=LD;function UD(){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:{}}}HJ.getRules=UD});var S9=Z((AJ)=>{Object.defineProperty(AJ,"__esModule",{value:!0});AJ.shouldUseRule=AJ.shouldUseGroup=AJ.schemaHasRulesForType=void 0;function MD({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&BJ(Q,W)}AJ.schemaHasRulesForType=MD;function BJ(Q,X){return X.rules.some((Y)=>DJ(Q,Y))}AJ.shouldUseGroup=BJ;function DJ(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))}AJ.shouldUseRule=DJ});var O6=Z((MJ)=>{Object.defineProperty(MJ,"__esModule",{value:!0});MJ.reportTypeError=MJ.checkDataTypes=MJ.checkDataType=MJ.coerceAndCheckDataType=MJ.getJSONTypes=MJ.getSchemaTypes=MJ.DataType=void 0;var ZD=T9(),ND=S9(),wD=U6(),R=k(),LJ=g(),C1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(C1||(MJ.DataType=C1={}));function jD(Q){let X=UJ(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}MJ.getSchemaTypes=jD;function UJ(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(ZD.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}MJ.getJSONTypes=UJ;function PD(Q,X){let{gen:Y,data:W,opts:G}=Q,J=bD(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,ND.schemaHasRulesForType)(Q,X[0]));if($){let z=C9(X,W,G.strictNumbers,C1.Wrong);Y.if(z,()=>{if(J.length)ED(Q,X,J);else k9(Q)})}return $}MJ.coerceAndCheckDataType=PD;var OJ=new Set(["string","number","integer","boolean","null"]);function bD(Q,X){return X?Q.filter((Y)=>OJ.has(Y)||X==="array"&&Y==="array"):[]}function ED(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",R._`typeof ${G}`),z=W.let("coerced",R._`undefined`);if(J.coerceTypes==="array")W.if(R._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,R._`${G}[0]`).assign($,R._`typeof ${G}`).if(C9(X,G,J.strictNumbers),()=>W.assign(z,G)));W.if(R._`${z} !== undefined`);for(let K of Y)if(OJ.has(K)||K==="array"&&J.coerceTypes==="array")H(K);W.else(),k9(Q),W.endIf(),W.if(R._`${z} !== undefined`,()=>{W.assign(G,z),ID(Q,z)});function H(K){switch(K){case"string":W.elseIf(R._`${$} == "number" || ${$} == "boolean"`).assign(z,R._`"" + ${G}`).elseIf(R._`${G} === null`).assign(z,R._`""`);return;case"number":W.elseIf(R._`${$} == "boolean" || ${G} === null
2
+ var M5=Object.create;var{getPrototypeOf:V5,defineProperty:HQ,getOwnPropertyNames:q5}=Object;var Z5=Object.prototype.hasOwnProperty;function N5(Q){return this[Q]}var w5,j5,RX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?w5??=new WeakMap:j5??=new WeakMap,J=G.get(Q);if(J)return J}Y=Q!=null?M5(V5(Q)):{};let $=X||!Q||!Q.__esModule?HQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let z of q5(Q))if(!Z5.call($,z))HQ($,z,{get:N5.bind(Q,z),enumerable:!0});if(W)G.set(Q,$);return $};var Z=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var P5=(Q)=>Q;function b5(Q,X){this[Q]=P5.bind(null,X)}var CX=(Q,X)=>{for(var Y in X)HQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:b5.bind(X,Y)})};var F6=Z((jG)=>{Object.defineProperty(jG,"__esModule",{value:!0});jG.regexpCode=jG.getEsmExportName=jG.getProperty=jG.safeStringify=jG.stringify=jG.strConcat=jG.addCodeArg=jG.str=jG._=jG.nil=jG._Code=jG.Name=jG.IDENTIFIER=jG._CodeOrName=void 0;class q4{}jG._CodeOrName=q4;jG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class T1 extends q4{constructor(Q){super();if(!jG.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}}}jG.Name=T1;class I0 extends q4{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 T1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}jG._Code=I0;jG.nil=new I0("");function NG(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)O9(Y,X[W]),Y.push(Q[++W]);return new I0(Y)}jG._=NG;var U9=new I0("+");function wG(Q,...X){let Y=[A6(Q[0])],W=0;while(W<X.length)Y.push(U9),O9(Y,X[W]),Y.push(U9,A6(Q[++W]));return mK(Y),new I0(Y)}jG.str=wG;function O9(Q,X){if(X instanceof I0)Q.push(...X._items);else if(X instanceof T1)Q.push(X);else Q.push(pK(X))}jG.addCodeArg=O9;function mK(Q){let X=1;while(X<Q.length-1){if(Q[X]===U9){let Y=lK(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function lK(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof T1||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 T1))return`"${Q}${X.slice(1)}`;return}function cK(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:wG`${Q}${X}`}jG.strConcat=cK;function pK(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:A6(Array.isArray(Q)?Q.join(","):Q)}function iK(Q){return new I0(A6(Q))}jG.stringify=iK;function A6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}jG.safeStringify=A6;function nK(Q){return typeof Q=="string"&&jG.IDENTIFIER.test(Q)?new I0(`.${Q}`):NG`[${Q}]`}jG.getProperty=nK;function dK(Q){if(typeof Q=="string"&&jG.IDENTIFIER.test(Q))return new I0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}jG.getEsmExportName=dK;function rK(Q){return new I0(Q.toString())}jG.regexpCode=rK});var Z9=Z((IG)=>{Object.defineProperty(IG,"__esModule",{value:!0});IG.ValueScope=IG.ValueScopeName=IG.Scope=IG.varKinds=IG.UsedValueState=void 0;var L0=F6();class bG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var N4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(N4||(IG.UsedValueState=N4={}));IG.varKinds={const:new L0.Name("const"),let:new L0.Name("let"),var:new L0.Name("var")};class V9{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof L0.Name?Q:this.name(Q)}name(Q){return new L0.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}}}IG.Scope=V9;class q9 extends L0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=L0._`.${new L0.Name(X)}[${Y}]`}}IG.ValueScopeName=q9;var zB=L0._`\n`;class EG extends V9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?zB:L0.nil}}get(){return this._scope}name(Q){return new q9(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 z=this._scope[G]||(this._scope[G]=[]),H=z.length;return z[H]=X.ref,W.setValue(X,{property:G,itemIndex:H}),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 L0._`${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=L0.nil;for(let J in Q){let $=Q[J];if(!$)continue;let z=Y[J]=Y[J]||new Map;$.forEach((H)=>{if(z.has(H))return;z.set(H,N4.Started);let K=X(H);if(K){let B=this.opts.es5?IG.varKinds.var:IG.varKinds.const;G=L0._`${G}${B} ${H} = ${K};${this.opts._n}`}else if(K=W===null||W===void 0?void 0:W(H))G=L0._`${G}${K}${this.opts._n}`;else throw new bG(H);z.set(H,N4.Completed)})}return G}}IG.ValueScope=EG});var k=Z((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 y=F6(),T0=Z9(),Y1=F6();Object.defineProperty(U0,"_",{enumerable:!0,get:function(){return Y1._}});Object.defineProperty(U0,"str",{enumerable:!0,get:function(){return Y1.str}});Object.defineProperty(U0,"strConcat",{enumerable:!0,get:function(){return Y1.strConcat}});Object.defineProperty(U0,"nil",{enumerable:!0,get:function(){return Y1.nil}});Object.defineProperty(U0,"getProperty",{enumerable:!0,get:function(){return Y1.getProperty}});Object.defineProperty(U0,"stringify",{enumerable:!0,get:function(){return Y1.stringify}});Object.defineProperty(U0,"regexpCode",{enumerable:!0,get:function(){return Y1.regexpCode}});Object.defineProperty(U0,"Name",{enumerable:!0,get:function(){return Y1.Name}});var I4=Z9();Object.defineProperty(U0,"Scope",{enumerable:!0,get:function(){return I4.Scope}});Object.defineProperty(U0,"ValueScope",{enumerable:!0,get:function(){return I4.ValueScope}});Object.defineProperty(U0,"ValueScopeName",{enumerable:!0,get:function(){return I4.ValueScopeName}});Object.defineProperty(U0,"varKinds",{enumerable:!0,get:function(){return I4.varKinds}});U0.operators={GT:new y._Code(">"),GTE:new y._Code(">="),LT:new y._Code("<"),LTE:new y._Code("<="),EQ:new y._Code("==="),NEQ:new y._Code("!=="),NOT:new y._Code("!"),OR:new y._Code("||"),AND:new y._Code("&&"),ADD:new y._Code("+")};class W1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class SG extends W1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?T0.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=R1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof y._CodeOrName?this.rhs.names:{}}}class j9 extends W1{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 y.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=R1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof y.Name?{}:{...this.lhs.names};return E4(Q,this.rhs)}}class RG extends j9{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class CG extends W1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class kG extends W1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class vG extends W1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class xG extends W1{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=R1(this.code,Q,X),this}get names(){return this.code instanceof y._CodeOrName?this.code.names:{}}}class T4 extends W1{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;DB(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>F1(Q,X.names),{})}}class G1 extends T4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class _G extends T4{}class L6 extends G1{}L6.kind="else";class c0 extends G1{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 L6(Y):Y}if(X){if(Q===!1)return X instanceof c0?X:X.nodes;if(this.nodes.length)return this;return new c0(fG(Q),X instanceof c0?[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=R1(this.condition,Q,X),this}get names(){let Q=super.names;if(E4(Q,this.condition),this.else)F1(Q,this.else.names);return Q}}c0.kind="if";class S1 extends G1{}S1.kind="for";class yG extends S1{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=R1(this.iteration,Q,X),this}get names(){return F1(super.names,this.iteration.names)}}class hG extends S1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?T0.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=E4(super.names,this.from);return E4(Q,this.to)}}class N9 extends S1{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=R1(this.iterable,Q,X),this}get names(){return F1(super.names,this.iterable.names)}}class w4 extends G1{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)}}w4.kind="func";class j4 extends T4{render(Q){return"return "+super.render(Q)}}j4.kind="return";class uG extends G1{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)F1(Q,this.catch.names);if(this.finally)F1(Q,this.finally.names);return Q}}class P4 extends G1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}P4.kind="catch";class b4 extends G1{render(Q){return"finally"+super.render(Q)}}b4.kind="finally";class gG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
3
+ `:""},this._extScope=Q,this._scope=new T0.Scope({parent:Q}),this._nodes=[new _G]}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 SG(Q,G,Y)),G}const(Q,X,Y){return this._def(T0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(T0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(T0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new j9(Q,X,Y))}add(Q,X){return this._leafNode(new RG(Q,U0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==y.nil)this._leafNode(new xG(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,y.addCodeArg)(X,W)}return X.push("}"),new y._Code(X)}if(Q,X,Y){if(this._blockNode(new c0(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 c0(Q))}else(){return this._elseNode(new L6)}endIf(){return this._endBlockNode(c0,L6)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new yG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?T0.varKinds.var:T0.varKinds.let){let J=this._scope.toName(Q);return this._for(new hG(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=T0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof y.Name?X:this.var("_arr",X);return this.forRange("_i",0,y._`${J}.length`,($)=>{this.var(G,y._`${J}[${$}]`),Y(G)})}return this._for(new N9("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?T0.varKinds.var:T0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,y._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new N9("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(S1)}label(Q){return this._leafNode(new CG(Q))}break(Q){return this._leafNode(new kG(Q))}return(Q){let X=new j4;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(j4)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new uG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new P4(G),X(G)}if(Y)this._currNode=W.finally=new b4,this.code(Y);return this._endBlockNode(P4,b4)}throw(Q){return this._leafNode(new vG(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=y.nil,Y,W){if(this._blockNode(new w4(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(w4)}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 c0))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=gG;function F1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function E4(Q,X){return X instanceof y._CodeOrName?F1(Q,X.names):Q}function R1(Q,X,Y){if(Q instanceof y.Name)return W(Q);if(!G(Q))return Q;return new y._Code(Q._items.reduce((J,$)=>{if($ instanceof y.Name)$=W($);if($ instanceof y._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 y._Code&&J._items.some(($)=>$ instanceof y.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function DB(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function fG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:y._`!${w9(Q)}`}U0.not=fG;var AB=mG(U0.operators.AND);function FB(...Q){return Q.reduce(AB)}U0.and=FB;var LB=mG(U0.operators.OR);function UB(...Q){return Q.reduce(LB)}U0.or=UB;function mG(Q){return(X,Y)=>X===y.nil?Y:Y===y.nil?X:y._`${w9(X)} ${Q} ${w9(Y)}`}function w9(Q){return Q instanceof y.Name?Q:y._`(${Q})`}});var g=Z((tG)=>{Object.defineProperty(tG,"__esModule",{value:!0});tG.checkStrictMode=tG.getErrorPath=tG.Type=tG.useFunc=tG.setEvaluated=tG.evaluatedPropsToName=tG.mergeEvaluated=tG.eachItem=tG.unescapeJsonPointer=tG.escapeJsonPointer=tG.escapeFragment=tG.unescapeFragment=tG.schemaRefOrVal=tG.schemaHasRulesButRef=tG.schemaHasRules=tG.checkUnknownRules=tG.alwaysValidSchema=tG.toHash=void 0;var c=k(),qB=F6();function ZB(Q){let X={};for(let Y of Q)X[Y]=!0;return X}tG.toHash=ZB;function NB(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return iG(Q,X),!nG(X,Q.self.RULES.all)}tG.alwaysValidSchema=NB;function iG(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])oG(Q,`unknown keyword: "${J}"`)}tG.checkUnknownRules=iG;function nG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}tG.schemaHasRules=nG;function wB(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}tG.schemaHasRulesButRef=wB;function jB({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return c._`${Y}`}return c._`${Q}${X}${(0,c.getProperty)(W)}`}tG.schemaRefOrVal=jB;function PB(Q){return dG(decodeURIComponent(Q))}tG.unescapeFragment=PB;function bB(Q){return encodeURIComponent(b9(Q))}tG.escapeFragment=bB;function b9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}tG.escapeJsonPointer=b9;function dG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}tG.unescapeJsonPointer=dG;function EB(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}tG.eachItem=EB;function cG({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,J,$,z)=>{let H=$===void 0?J:$ instanceof c.Name?(J instanceof c.Name?Q(G,J,$):X(G,J,$),$):J instanceof c.Name?(X(G,$,J),J):Y(J,$);return z===c.Name&&!(H instanceof c.Name)?W(G,H):H}}tG.mergeEvaluated={props:cG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(c._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,c._`${Y} || {}`).code(c._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,c._`${Y} || {}`),E9(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:rG}),items:cG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,c._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:c._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function rG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",c._`{}`);if(X!==void 0)E9(Q,Y,X);return Y}tG.evaluatedPropsToName=rG;function E9(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(c._`${X}${(0,c.getProperty)(W)}`,!0))}tG.setEvaluated=E9;var pG={};function IB(Q,X){return Q.scopeValue("func",{ref:X,code:pG[X.code]||(pG[X.code]=new qB._Code(X.code))})}tG.useFunc=IB;var P9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(P9||(tG.Type=P9={}));function TB(Q,X,Y){if(Q instanceof c.Name){let W=X===P9.Num;return Y?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,c.getProperty)(Q).toString():"/"+b9(Q)}tG.getErrorPath=TB;function oG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}tG.checkStrictMode=oG});var p0=Z((sG)=>{Object.defineProperty(sG,"__esModule",{value:!0});var K0=k(),nB={data:new K0.Name("data"),valCxt:new K0.Name("valCxt"),instancePath:new K0.Name("instancePath"),parentData:new K0.Name("parentData"),parentDataProperty:new K0.Name("parentDataProperty"),rootData:new K0.Name("rootData"),dynamicAnchors:new K0.Name("dynamicAnchors"),vErrors:new K0.Name("vErrors"),errors:new K0.Name("errors"),this:new K0.Name("this"),self:new K0.Name("self"),scope:new K0.Name("scope"),json:new K0.Name("json"),jsonPos:new K0.Name("jsonPos"),jsonLen:new K0.Name("jsonLen"),jsonPart:new K0.Name("jsonPart")};sG.default=nB});var U6=Z((YJ)=>{Object.defineProperty(YJ,"__esModule",{value:!0});YJ.extendErrors=YJ.resetErrorsCount=YJ.reportExtraError=YJ.reportError=YJ.keyword$DataError=YJ.keywordError=void 0;var h=k(),R4=g(),D0=p0();YJ.keywordError={message:({keyword:Q})=>h.str`must pass "${Q}" keyword validation`};YJ.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?h.str`"${Q}" keyword must be ${X} ($data)`:h.str`"${Q}" keyword is invalid ($data)`};function rB(Q,X=YJ.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:z}=G,H=XJ(Q,X,Y);if(W!==null&&W!==void 0?W:$||z)eG(J,H);else QJ(G,h._`[${H}]`)}YJ.reportError=rB;function oB(Q,X=YJ.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,z=XJ(Q,X,Y);if(eG(G,z),!(J||$))QJ(W,D0.default.vErrors)}YJ.reportExtraError=oB;function tB(Q,X){Q.assign(D0.default.errors,X),Q.if(h._`${D0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(h._`${D0.default.vErrors}.length`,X),()=>Q.assign(D0.default.vErrors,null)))}YJ.resetErrorsCount=tB;function aB({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,D0.default.errors,(z)=>{if(Q.const($,h._`${D0.default.vErrors}[${z}]`),Q.if(h._`${$}.instancePath === undefined`,()=>Q.assign(h._`${$}.instancePath`,(0,h.strConcat)(D0.default.instancePath,J.errorPath))),Q.assign(h._`${$}.schemaPath`,h.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(h._`${$}.schema`,Y),Q.assign(h._`${$}.data`,W)})}YJ.extendErrors=aB;function eG(Q,X){let Y=Q.const("err",X);Q.if(h._`${D0.default.vErrors} === null`,()=>Q.assign(D0.default.vErrors,h._`[${Y}]`),h._`${D0.default.vErrors}.push(${Y})`),Q.code(h._`${D0.default.errors}++`)}function QJ(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(h._`new ${Q.ValidationError}(${X})`);else Y.assign(h._`${W}.errors`,X),Y.return(!1)}var L1={keyword:new h.Name("keyword"),schemaPath:new h.Name("schemaPath"),params:new h.Name("params"),propertyName:new h.Name("propertyName"),message:new h.Name("message"),schema:new h.Name("schema"),parentSchema:new h.Name("parentSchema")};function XJ(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return h._`{}`;return sB(Q,X,Y)}function sB(Q,X,Y={}){let{gen:W,it:G}=Q,J=[eB(G,Y),QD(Q,Y)];return XD(Q,X,J),W.object(...J)}function eB({errorPath:Q},{instancePath:X}){let Y=X?h.str`${Q}${(0,R4.getErrorPath)(X,R4.Type.Str)}`:Q;return[D0.default.instancePath,(0,h.strConcat)(D0.default.instancePath,Y)]}function QD({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:h.str`${X}/${Q}`;if(Y)G=h.str`${G}${(0,R4.getErrorPath)(Y,R4.Type.Str)}`;return[L1.schemaPath,G]}function XD(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:z}=Q,{opts:H,propertyName:K,topSchemaRef:B,schemaPath:D}=z;if(W.push([L1.keyword,G],[L1.params,typeof X=="function"?X(Q):X||h._`{}`]),H.messages)W.push([L1.message,typeof Y=="function"?Y(Q):Y]);if(H.verbose)W.push([L1.schema,$],[L1.parentSchema,h._`${B}${D}`],[D0.default.data,J]);if(K)W.push([L1.propertyName,K])}});var zJ=Z((JJ)=>{Object.defineProperty(JJ,"__esModule",{value:!0});JJ.boolOrEmptySchema=JJ.topBoolOrEmptySchema=void 0;var $D=U6(),zD=k(),HD=p0(),KD={message:"boolean schema is false"};function BD(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)GJ(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(HD.default.data);else X.assign(zD._`${W}.errors`,null),X.return(!0)}JJ.topBoolOrEmptySchema=BD;function DD(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),GJ(Q);else Y.var(X,!0)}JJ.boolOrEmptySchema=DD;function GJ(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,$D.reportError)(G,KD,void 0,X)}});var T9=Z((HJ)=>{Object.defineProperty(HJ,"__esModule",{value:!0});HJ.getRules=HJ.isJSONType=void 0;var FD=["string","number","integer","boolean","null","object","array"],LD=new Set(FD);function UD(Q){return typeof Q=="string"&&LD.has(Q)}HJ.isJSONType=UD;function OD(){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:{}}}HJ.getRules=OD});var S9=Z((AJ)=>{Object.defineProperty(AJ,"__esModule",{value:!0});AJ.shouldUseRule=AJ.shouldUseGroup=AJ.schemaHasRulesForType=void 0;function VD({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&BJ(Q,W)}AJ.schemaHasRulesForType=VD;function BJ(Q,X){return X.rules.some((Y)=>DJ(Q,Y))}AJ.shouldUseGroup=BJ;function DJ(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))}AJ.shouldUseRule=DJ});var O6=Z((MJ)=>{Object.defineProperty(MJ,"__esModule",{value:!0});MJ.reportTypeError=MJ.checkDataTypes=MJ.checkDataType=MJ.coerceAndCheckDataType=MJ.getJSONTypes=MJ.getSchemaTypes=MJ.DataType=void 0;var ND=T9(),wD=S9(),jD=U6(),R=k(),LJ=g(),C1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(C1||(MJ.DataType=C1={}));function PD(Q){let X=UJ(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}MJ.getSchemaTypes=PD;function UJ(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(ND.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}MJ.getJSONTypes=UJ;function bD(Q,X){let{gen:Y,data:W,opts:G}=Q,J=ED(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,wD.schemaHasRulesForType)(Q,X[0]));if($){let z=C9(X,W,G.strictNumbers,C1.Wrong);Y.if(z,()=>{if(J.length)ID(Q,X,J);else k9(Q)})}return $}MJ.coerceAndCheckDataType=bD;var OJ=new Set(["string","number","integer","boolean","null"]);function ED(Q,X){return X?Q.filter((Y)=>OJ.has(Y)||X==="array"&&Y==="array"):[]}function ID(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",R._`typeof ${G}`),z=W.let("coerced",R._`undefined`);if(J.coerceTypes==="array")W.if(R._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,R._`${G}[0]`).assign($,R._`typeof ${G}`).if(C9(X,G,J.strictNumbers),()=>W.assign(z,G)));W.if(R._`${z} !== undefined`);for(let K of Y)if(OJ.has(K)||K==="array"&&J.coerceTypes==="array")H(K);W.else(),k9(Q),W.endIf(),W.if(R._`${z} !== undefined`,()=>{W.assign(G,z),TD(Q,z)});function H(K){switch(K){case"string":W.elseIf(R._`${$} == "number" || ${$} == "boolean"`).assign(z,R._`"" + ${G}`).elseIf(R._`${G} === null`).assign(z,R._`""`);return;case"number":W.elseIf(R._`${$} == "boolean" || ${G} === null
4
4
  || (${$} == "string" && ${G} && ${G} == +${G})`).assign(z,R._`+${G}`);return;case"integer":W.elseIf(R._`${$} === "boolean" || ${G} === null
5
5
  || (${$} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(z,R._`+${G}`);return;case"boolean":W.elseIf(R._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(z,!1).elseIf(R._`${G} === "true" || ${G} === 1`).assign(z,!0);return;case"null":W.elseIf(R._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(z,null);return;case"array":W.elseIf(R._`${$} === "string" || ${$} === "number"
6
- || ${$} === "boolean" || ${G} === null`).assign(z,R._`[${G}]`)}}}function ID({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(R._`${X} !== undefined`,()=>Q.assign(R._`${X}[${Y}]`,W))}function R9(Q,X,Y,W=C1.Correct){let G=W===C1.Correct?R.operators.EQ:R.operators.NEQ,J;switch(Q){case"null":return R._`${X} ${G} null`;case"array":J=R._`Array.isArray(${X})`;break;case"object":J=R._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(R._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return R._`typeof ${X} ${G} ${Q}`}return W===C1.Correct?J:(0,R.not)(J);function $(z=R.nil){return(0,R.and)(R._`typeof ${X} == "number"`,z,Y?R._`isFinite(${X})`:R.nil)}}MJ.checkDataType=R9;function C9(Q,X,Y,W){if(Q.length===1)return R9(Q[0],X,Y,W);let G,J=(0,LJ.toHash)(Q);if(J.array&&J.object){let $=R._`typeof ${X} != "object"`;G=J.null?$:R._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=R.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,R.and)(G,R9($,X,Y,W));return G}MJ.checkDataTypes=C9;var TD={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?R._`{type: ${Q}}`:R._`{type: ${X}}`};function k9(Q){let X=SD(Q);(0,wD.reportError)(X,TD)}MJ.reportTypeError=k9;function SD(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,LJ.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var wJ=Z((ZJ)=>{Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.assignDefaults=void 0;var k1=k(),yD=g();function hD(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)qJ(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>qJ(Q,J,G.default))}ZJ.assignDefaults=hD;function qJ(Q,X,Y){let{gen:W,compositeRule:G,data:J,opts:$}=Q;if(Y===void 0)return;let z=k1._`${J}${(0,k1.getProperty)(X)}`;if(G){(0,yD.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let H=k1._`${z} === undefined`;if($.useDefaults==="empty")H=k1._`${H} || ${z} === null || ${z} === ""`;W.if(H,k1._`${z} = ${(0,k1.stringify)(Y)}`)}});var j0=Z((bJ)=>{Object.defineProperty(bJ,"__esModule",{value:!0});bJ.validateUnion=bJ.validateArray=bJ.usePattern=bJ.callValidateCode=bJ.schemaProperties=bJ.allSchemaProperties=bJ.noPropertyInData=bJ.propertyInData=bJ.isOwnProperty=bJ.hasPropFunc=bJ.reportMissingProp=bJ.checkMissingProp=bJ.checkReportMissingProp=void 0;var d=k(),v9=g(),J1=p0(),uD=g();function gD(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(_9(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:d._`${X}`},!0),Q.error()})}bJ.checkReportMissingProp=gD;function fD({gen:Q,data:X,it:{opts:Y}},W,G){return(0,d.or)(...W.map((J)=>(0,d.and)(_9(Q,X,J,Y.ownProperties),d._`${G} = ${J}`)))}bJ.checkMissingProp=fD;function mD(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}bJ.reportMissingProp=mD;function jJ(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:d._`Object.prototype.hasOwnProperty`})}bJ.hasPropFunc=jJ;function x9(Q,X,Y){return d._`${jJ(Q)}.call(${X}, ${Y})`}bJ.isOwnProperty=x9;function lD(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} !== undefined`;return W?d._`${G} && ${x9(Q,X,Y)}`:G}bJ.propertyInData=lD;function _9(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} === undefined`;return W?(0,d.or)(G,(0,d.not)(x9(Q,X,Y))):G}bJ.noPropertyInData=_9;function PJ(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}bJ.allSchemaProperties=PJ;function cD(Q,X){return PJ(X).filter((Y)=>!(0,v9.alwaysValidSchema)(Q,X[Y]))}bJ.schemaProperties=cD;function pD({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},z,H,K){let B=K?d._`${Q}, ${X}, ${W}${G}`:X,D=[[J1.default.instancePath,(0,d.strConcat)(J1.default.instancePath,J)],[J1.default.parentData,$.parentData],[J1.default.parentDataProperty,$.parentDataProperty],[J1.default.rootData,J1.default.rootData]];if($.opts.dynamicRef)D.push([J1.default.dynamicAnchors,J1.default.dynamicAnchors]);let A=d._`${B}, ${Y.object(...D)}`;return H!==d.nil?d._`${z}.call(${H}, ${A})`:d._`${z}(${A})`}bJ.callValidateCode=pD;var iD=d._`new RegExp`;function nD({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:d._`${G.code==="new RegExp"?iD:(0,uD.useFunc)(Q,G)}(${Y}, ${W})`})}bJ.usePattern=nD;function dD(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,J=X.name("valid");if(G.allErrors){let z=X.let("valid",!0);return $(()=>X.assign(z,!1)),z}return X.var(J,!0),$(()=>X.break()),J;function $(z){let H=X.const("len",d._`${Y}.length`);X.forRange("i",0,H,(K)=>{Q.subschema({keyword:W,dataProp:K,dataPropType:v9.Type.Num},J),X.if((0,d.not)(J),z)})}}bJ.validateArray=dD;function rD(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((H)=>(0,v9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((H,K)=>{let B=Q.subschema({keyword:W,schemaProp:K,compositeRule:!0},z);if(X.assign($,d._`${$} || ${z}`),!Q.mergeValidEvaluated(B,z))X.if((0,d.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}bJ.validateUnion=rD});var CJ=Z((SJ)=>{Object.defineProperty(SJ,"__esModule",{value:!0});SJ.validateKeywordUsage=SJ.validSchemaType=SJ.funcKeywordCode=SJ.macroKeywordCode=void 0;var A0=k(),U1=p0(),zA=j0(),HA=U6();function KA(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,z=X.macro.call($.self,G,J,$),H=TJ(Y,W,z);if($.opts.validateSchema!==!1)$.self.validateSchema(z,!0);let K=Y.name("valid");Q.subschema({schema:z,schemaPath:A0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},K),Q.pass(K,()=>Q.error(!0))}SJ.macroKeywordCode=KA;function BA(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:z,it:H}=Q;AA(H,X);let K=!z&&X.compile?X.compile.call(H.self,J,$,H):X.validate,B=TJ(W,G,K),D=W.let("valid");Q.block$data(D,A),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:D);function A(){if(X.errors===!1){if(M(),X.modifying)IJ(Q);q(()=>Q.error())}else{let V=X.async?U():O();if(X.modifying)IJ(Q);q(()=>DA(Q,V))}}function U(){let V=W.let("ruleErrs",null);return W.try(()=>M(A0._`await `),(T)=>W.assign(D,!1).if(A0._`${T} instanceof ${H.ValidationError}`,()=>W.assign(V,A0._`${T}.errors`),()=>W.throw(T))),V}function O(){let V=A0._`${B}.errors`;return W.assign(V,null),M(A0.nil),V}function M(V=X.async?A0._`await `:A0.nil){let T=H.opts.passContext?U1.default.this:U1.default.self,E=!(("compile"in X)&&!z||X.schema===!1);W.assign(D,A0._`${V}${(0,zA.callValidateCode)(Q,B,T,E)}`,X.modifying)}function q(V){var T;W.if((0,A0.not)((T=X.valid)!==null&&T!==void 0?T:D),V)}}SJ.funcKeywordCode=BA;function IJ(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,A0._`${W.parentData}[${W.parentDataProperty}]`))}function DA(Q,X){let{gen:Y}=Q;Y.if(A0._`Array.isArray(${X})`,()=>{Y.assign(U1.default.vErrors,A0._`${U1.default.vErrors} === null ? ${X} : ${U1.default.vErrors}.concat(${X})`).assign(U1.default.errors,A0._`${U1.default.vErrors}.length`),(0,HA.extendErrors)(Q)},()=>Q.error())}function AA({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function TJ(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,A0.stringify)(Y)})}function FA(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")}SJ.validSchemaType=FA;function LA({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((z)=>!Object.prototype.hasOwnProperty.call(Q,z)))throw Error(`parent schema must have dependencies of ${J}: ${$.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[J])){let H=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(H);else throw Error(H)}}}SJ.validateKeywordUsage=LA});var _J=Z((vJ)=>{Object.defineProperty(vJ,"__esModule",{value:!0});vJ.extendSubschemaMode=vJ.extendSubschemaData=vJ.getSubschema=void 0;var x0=k(),kJ=g();function VA(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 z=Q.schema[X];return Y===void 0?{schema:z,schemaPath:x0._`${Q.schemaPath}${(0,x0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:x0._`${Q.schemaPath}${(0,x0.getProperty)(X)}${(0,x0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,kJ.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')}vJ.getSubschema=VA;function qA(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:z}=X;if(Y!==void 0){let{errorPath:K,dataPathArr:B,opts:D}=X,A=z.let("data",x0._`${X.data}${(0,x0.getProperty)(Y)}`,!0);H(A),Q.errorPath=x0.str`${K}${(0,kJ.getErrorPath)(Y,W,D.jsPropertySyntax)}`,Q.parentDataProperty=x0._`${Y}`,Q.dataPathArr=[...B,Q.parentDataProperty]}if(G!==void 0){let K=G instanceof x0.Name?G:z.let("data",G,!0);if(H(K),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function H(K){Q.data=K,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,K]}}vJ.extendSubschemaData=qA;function ZA(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}vJ.extendSubschemaMode=ZA});var y9=Z((jP,yJ)=>{yJ.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 uJ=Z((PP,hJ)=>{var $1=hJ.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(){};C4(X,W,G,Q,"",Q)};$1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};$1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};$1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};$1.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 C4(Q,X,Y,W,G,J,$,z,H,K){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,z,H,K);for(var B in W){var D=W[B];if(Array.isArray(D)){if(B in $1.arrayKeywords)for(var A=0;A<D.length;A++)C4(Q,X,Y,D[A],G+"/"+B+"/"+A,J,G,B,W,A)}else if(B in $1.propsKeywords){if(D&&typeof D=="object")for(var U in D)C4(Q,X,Y,D[U],G+"/"+B+"/"+jA(U),J,G,B,W,U)}else if(B in $1.keywords||Q.allKeys&&!(B in $1.skipKeywords))C4(Q,X,Y,D,G+"/"+B,J,G,B,W)}Y(W,G,J,$,z,H,K)}}function jA(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var M6=Z((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});lJ.getSchemaRefs=lJ.resolveUrl=lJ.normalizeId=lJ._getFullPath=lJ.getFullPath=lJ.inlineRef=void 0;var PA=g(),bA=y9(),EA=uJ(),IA=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function TA(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!h9(Q);if(!X)return!1;return gJ(Q)<=X}lJ.inlineRef=TA;var SA=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h9(Q){for(let X in Q){if(SA.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(h9))return!0;if(typeof Y=="object"&&h9(Y))return!0}return!1}function gJ(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,IA.has(Y))continue;if(typeof Q[Y]=="object")(0,PA.eachItem)(Q[Y],(W)=>X+=gJ(W));if(X===1/0)return 1/0}return X}function fJ(Q,X="",Y){if(Y!==!1)X=v1(X);let W=Q.parse(X);return mJ(Q,W)}lJ.getFullPath=fJ;function mJ(Q,X){return Q.serialize(X).split("#")[0]+"#"}lJ._getFullPath=mJ;var RA=/#\/?$/;function v1(Q){return Q?Q.replace(RA,""):""}lJ.normalizeId=v1;function CA(Q,X,Y){return Y=v1(Y),Q.resolve(X,Y)}lJ.resolveUrl=CA;var kA=/^[a-z_][-a-z0-9._]*$/i;function vA(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=v1(Q[Y]||X),J={"":G},$=fJ(W,G,!1),z={},H=new Set;return EA(Q,{allKeys:!0},(D,A,U,O)=>{if(O===void 0)return;let M=$+A,q=J[O];if(typeof D[Y]=="string")q=V.call(this,D[Y]);T.call(this,D.$anchor),T.call(this,D.$dynamicAnchor),J[A]=q;function V(E){let v=this.opts.uriResolver.resolve;if(E=v1(q?v(q,E):E),H.has(E))throw B(E);H.add(E);let I=this.refs[E];if(typeof I=="string")I=this.refs[I];if(typeof I=="object")K(D,I.schema,E);else if(E!==v1(M))if(E[0]==="#")K(D,z[E],E),z[E]=D;else this.refs[E]=M;return E}function T(E){if(typeof E=="string"){if(!kA.test(E))throw Error(`invalid anchor "${E}"`);V.call(this,`#${E}`)}}}),z;function K(D,A,U){if(A!==void 0&&!bA(D,A))throw B(U)}function B(D){return Error(`reference "${D}" resolves to more than one schema`)}}lJ.getSchemaRefs=vA});var Z6=Z((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});G$.getData=G$.KeywordCxt=G$.validateFunctionCode=void 0;var rJ=zJ(),pJ=O6(),g9=S9(),k4=O6(),gA=wJ(),q6=CJ(),u9=_J(),P=k(),S=p0(),fA=M6(),i0=g(),V6=U6();function mA(Q){if(aJ(Q)){if(sJ(Q),tJ(Q)){pA(Q);return}}oJ(Q,()=>(0,rJ.topBoolOrEmptySchema)(Q))}G$.validateFunctionCode=mA;function oJ({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,P._`${S.default.data}, ${S.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${iJ(Y,G)}`),cA(Q,G),Q.code(J)});else Q.func(X,P._`${S.default.data}, ${lA(G)}`,W.$async,()=>Q.code(iJ(Y,G)).code(J))}function lA(Q){return P._`{${S.default.instancePath}="", ${S.default.parentData}, ${S.default.parentDataProperty}, ${S.default.rootData}=${S.default.data}${Q.dynamicRef?P._`, ${S.default.dynamicAnchors}={}`:P.nil}}={}`}function cA(Q,X){Q.if(S.default.valCxt,()=>{if(Q.var(S.default.instancePath,P._`${S.default.valCxt}.${S.default.instancePath}`),Q.var(S.default.parentData,P._`${S.default.valCxt}.${S.default.parentData}`),Q.var(S.default.parentDataProperty,P._`${S.default.valCxt}.${S.default.parentDataProperty}`),Q.var(S.default.rootData,P._`${S.default.valCxt}.${S.default.rootData}`),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`${S.default.valCxt}.${S.default.dynamicAnchors}`)},()=>{if(Q.var(S.default.instancePath,P._`""`),Q.var(S.default.parentData,P._`undefined`),Q.var(S.default.parentDataProperty,P._`undefined`),Q.var(S.default.rootData,S.default.data),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`{}`)})}function pA(Q){let{schema:X,opts:Y,gen:W}=Q;oJ(Q,()=>{if(Y.$comment&&X.$comment)Q$(Q);if(oA(Q),W.let(S.default.vErrors,null),W.let(S.default.errors,0),Y.unevaluated)iA(Q);eJ(Q),sA(Q)});return}function iA(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",P._`${Y}.evaluated`),X.if(P._`${Q.evaluated}.dynamicProps`,()=>X.assign(P._`${Q.evaluated}.props`,P._`undefined`)),X.if(P._`${Q.evaluated}.dynamicItems`,()=>X.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function iJ(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?P._`/*# sourceURL=${Y} */`:P.nil}function nA(Q,X){if(aJ(Q)){if(sJ(Q),tJ(Q)){dA(Q,X);return}}(0,rJ.boolOrEmptySchema)(Q,X)}function tJ({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 aJ(Q){return typeof Q.schema!="boolean"}function dA(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)Q$(Q);tA(Q),aA(Q);let J=W.const("_errs",S.default.errors);eJ(Q,J),W.var(X,P._`${J} === ${S.default.errors}`)}function sJ(Q){(0,i0.checkUnknownRules)(Q),rA(Q)}function eJ(Q,X){if(Q.opts.jtd)return nJ(Q,[],!1,X);let Y=(0,pJ.getSchemaTypes)(Q.schema),W=(0,pJ.coerceAndCheckDataType)(Q,Y);nJ(Q,Y,!W,X)}function rA(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,i0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function oA(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,i0.checkStrictMode)(Q,"default is ignored in the schema root")}function tA(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,fA.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function aA(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Q$({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(P._`${S.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=P.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(P._`${S.default.self}.opts.$comment(${J}, ${$}, ${z}.schema)`)}}function sA(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(P._`${S.default.errors} === 0`,()=>X.return(S.default.data),()=>X.throw(P._`new ${G}(${S.default.vErrors})`));else{if(X.assign(P._`${W}.errors`,S.default.vErrors),J.unevaluated)eA(Q);X.return(P._`${S.default.errors} === 0`)}}function eA({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof P.Name)Q.assign(P._`${X}.props`,Y);if(W instanceof P.Name)Q.assign(P._`${X}.items`,W)}function nJ(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:z,opts:H,self:K}=Q,{RULES:B}=K;if(J.$ref&&(H.ignoreKeywordsWithRef||!(0,i0.schemaHasRulesButRef)(J,B))){G.block(()=>Y$(Q,"$ref",B.all.$ref.definition));return}if(!H.jtd)QF(Q,X);G.block(()=>{for(let A of B.rules)D(A);D(B.post)});function D(A){if(!(0,g9.shouldUseGroup)(J,A))return;if(A.type){if(G.if((0,k4.checkDataType)(A.type,$,H.strictNumbers)),dJ(Q,A),X.length===1&&X[0]===A.type&&Y)G.else(),(0,k4.reportTypeError)(Q);G.endIf()}else dJ(Q,A);if(!z)G.if(P._`${S.default.errors} === ${W||0}`)}}function dJ(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,gA.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,g9.shouldUseRule)(W,J))Y$(Q,J.keyword,J.definition,X.type)})}function QF(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(XF(Q,X),!Q.opts.allowUnionTypes)YF(Q,X);WF(Q,Q.dataTypes)}function XF(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!X$(Q.dataTypes,Y))f9(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),JF(Q,X)}function YF(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))f9(Q,"use allowUnionTypes to allow union type keyword")}function WF(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,g9.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>GF(X,$)))f9(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function GF(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function X$(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function JF(Q,X){let Y=[];for(let W of Q.dataTypes)if(X$(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function f9(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,i0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class m9{constructor(Q,X,Y){if((0,q6.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,i0.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",W$(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,q6.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",S.default.errors)}result(Q,X,Y){this.failResult((0,P.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,P.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(P._`${X} !== undefined && (${(0,P.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?V6.reportExtraError:V6.reportError)(this,this.def.error,X)}$dataError(){(0,V6.reportError)(this,this.def.$dataError||V6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,V6.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=P.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=P.nil,X=P.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,P.or)(P._`${W} === undefined`,X)),Q!==P.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,P.or)(J(),$());function J(){if(Y.length){if(!(X instanceof P.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return P._`${(0,k4.checkDataTypes)(z,X,G.opts.strictNumbers,k4.DataType.Wrong)}`}return P.nil}function $(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${z}(${X})`}return P.nil}}subschema(Q,X){let Y=(0,u9.getSubschema)(this.it,Q);(0,u9.extendSubschemaData)(Y,this.it,Q),(0,u9.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return nA(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=i0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=i0.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,P.Name)),!0}}G$.KeywordCxt=m9;function Y$(Q,X,Y,W){let G=new m9(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,q6.funcKeywordCode)(G,Y);else if("macro"in Y)(0,q6.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,q6.funcKeywordCode)(G,Y)}var $F=/^\/(?:[^~]|~0|~1)*$/,zF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W$(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return S.default.rootData;if(Q[0]==="/"){if(!$F.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=S.default.rootData}else{let K=zF.exec(Q);if(!K)throw Error(`Invalid JSON-pointer: ${Q}`);let B=+K[1];if(G=K[2],G==="#"){if(B>=X)throw Error(H("property/index",B));return W[X-B]}if(B>X)throw Error(H("data",B));if(J=Y[X-B],!G)return J}let $=J,z=G.split("/");for(let K of z)if(K)J=P._`${J}${(0,P.getProperty)((0,i0.unescapeJsonPointer)(K))}`,$=P._`${$} && ${J}`;return $;function H(K,B){return`Cannot access ${K} ${B} levels up, current level is ${X}`}}G$.getData=W$});var v4=Z((z$)=>{Object.defineProperty(z$,"__esModule",{value:!0});class $$ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}z$.default=$$});var N6=Z((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});var l9=M6();class H$ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,l9.resolveUrl)(Q,X,Y),this.missingSchema=(0,l9.normalizeId)((0,l9.getFullPath)(Q,this.missingRef))}}K$.default=H$});var _4=Z((A$)=>{Object.defineProperty(A$,"__esModule",{value:!0});A$.resolveSchema=A$.getCompilingSchema=A$.resolveRef=A$.compileSchema=A$.SchemaEnv=void 0;var S0=k(),AF=v4(),O1=p0(),R0=M6(),B$=g(),FF=Z6();class w6{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,R0.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={}}}A$.SchemaEnv=w6;function p9(Q){let X=D$.call(this,Q);if(X)return X;let Y=(0,R0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new S0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),z;if(Q.$async)z=$.scopeValue("Error",{ref:AF.default,code:S0._`require("ajv/dist/runtime/validation_error").default`});let H=$.scopeName("validate");Q.validateName=H;let K={gen:$,allErrors:this.opts.allErrors,data:O1.default.data,parentData:O1.default.parentData,parentDataProperty:O1.default.parentDataProperty,dataNames:[O1.default.data],dataPathArr:[S0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,S0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:S0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:S0._`""`,opts:this.opts,self:this},B;try{this._compilations.add(Q),(0,FF.validateFunctionCode)(K),$.optimize(this.opts.code.optimize);let D=$.toString();if(B=`${$.scopeRefs(O1.default.scope)}return ${D}`,this.opts.code.process)B=this.opts.code.process(B,Q);let U=Function(`${O1.default.self}`,`${O1.default.scope}`,B)(this,this.scope.get());if(this.scope.value(H,{ref:U}),U.errors=null,U.schema=Q.schema,U.schemaEnv=Q,Q.$async)U.$async=!0;if(this.opts.code.source===!0)U.source={validateName:H,validateCode:D,scopeValues:$._values};if(this.opts.unevaluated){let{props:O,items:M}=K;if(U.evaluated={props:O instanceof S0.Name?void 0:O,items:M instanceof S0.Name?void 0:M,dynamicProps:O instanceof S0.Name,dynamicItems:M instanceof S0.Name},U.source)U.source.evaluated=(0,S0.stringify)(U.evaluated)}return Q.validate=U,Q}catch(D){if(delete Q.validate,delete Q.validateName,B)this.logger.error("Error compiling schema, function code:",B);throw D}finally{this._compilations.delete(Q)}}A$.compileSchema=p9;function LF(Q,X,Y){var W;Y=(0,R0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=MF.call(this,Q,Y);if(J===void 0){let $=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:z}=this.opts;if($)J=new w6({schema:$,schemaId:z,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=UF.call(this,J)}A$.resolveRef=LF;function UF(Q){if((0,R0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:p9.call(this,Q)}function D$(Q){for(let X of this._compilations)if(OF(X,Q))return X}A$.getCompilingSchema=D$;function OF(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function MF(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||x4.call(this,Q,X)}function x4(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,R0._getFullPath)(this.opts.uriResolver,Y),G=(0,R0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return c9.call(this,Y,Q);let J=(0,R0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let z=x4.call(this,Q,$);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return c9.call(this,Y,z)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)p9.call(this,$);if(J===(0,R0.normalizeId)(X)){let{schema:z}=$,{schemaId:H}=this.opts,K=z[H];if(K)G=(0,R0.resolveUrl)(this.opts.uriResolver,G,K);return new w6({schema:z,schemaId:H,root:Q,baseId:G})}return c9.call(this,Y,$)}A$.resolveSchema=x4;var VF=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function c9(Q,{baseId:X,schema:Y,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let z of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let H=Y[(0,B$.unescapeFragment)(z)];if(H===void 0)return;Y=H;let K=typeof Y==="object"&&Y[this.opts.schemaId];if(!VF.has(z)&&K)X=(0,R0.resolveUrl)(this.opts.uriResolver,X,K)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,B$.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,R0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=x4.call(this,W,z)}let{schemaId:$}=this.opts;if(J=J||new w6({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var L$=Z((RP,jF)=>{jF.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 n9=Z((CP,V$)=>{var PF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),O$=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i9(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 bF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function U$(Q){return Q.length=0,!0}function EF(Q,X,Y){if(Q.length){let W=i9(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function IF(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,z=EF;for(let H=0;H<Q.length;H++){let K=Q[H];if(K==="["||K==="]")continue;if(K===":"){if(J===!0)$=!0;if(!z(G,W,Y))break;if(++X>7){Y.error=!0;break}if(H>0&&Q[H-1]===":")J=!0;W.push(":");continue}else if(K==="%"){if(!z(G,W,Y))break;z=U$}else{G.push(K);continue}}if(G.length)if(z===U$)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(i9(G));return Y.address=W.join(""),Y}function M$(Q){if(TF(Q,":")<2)return{host:Q,isIPV6:!1};let X=IF(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 TF(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function SF(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("")}function RF(Q,X){let Y=X!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=Y(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=Y(Q.userinfo);if(Q.host!==void 0)Q.host=Y(Q.host);if(Q.path!==void 0)Q.path=Y(Q.path);if(Q.query!==void 0)Q.query=Y(Q.query);if(Q.fragment!==void 0)Q.fragment=Y(Q.fragment);return Q}function CF(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(!O$(Y)){let W=M$(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=Q.host}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}V$.exports={nonSimpleDomain:bF,recomposeAuthority:CF,normalizeComponentEncoding:RF,removeDotSegments:SF,isIPv4:O$,isUUID:PF,normalizeIPv6:M$,stringArrayToHexStripped:i9}});var j$=Z((kP,w$)=>{var{isUUID:kF}=n9(),vF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,xF=["http","https","ws","wss","urn","urn:uuid"];function _F(Q){return xF.indexOf(Q)!==-1}function d9(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 q$(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function Z$(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 yF(Q){return Q.secure=d9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function hF(Q){if(Q.port===(d9(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 uF(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(vF);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=r9(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 gF(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=r9(G);if(J)Q=J.serialize(Q,X);let $=Q,z=Q.nss;return $.path=`${W||X.nid}:${z}`,X.skipEscape=!0,$}function fF(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!kF(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function mF(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var N$={scheme:"http",domainHost:!0,parse:q$,serialize:Z$},lF={scheme:"https",domainHost:N$.domainHost,parse:q$,serialize:Z$},y4={scheme:"ws",domainHost:!0,parse:yF,serialize:hF},cF={scheme:"wss",domainHost:y4.domainHost,parse:y4.parse,serialize:y4.serialize},pF={scheme:"urn",parse:uF,serialize:gF,skipNormalize:!0},iF={scheme:"urn:uuid",parse:fF,serialize:mF,skipNormalize:!0},h4={http:N$,https:lF,ws:y4,wss:cF,urn:pF,"urn:uuid":iF};Object.setPrototypeOf(h4,null);function r9(Q){return Q&&(h4[Q]||h4[Q.toLowerCase()])||void 0}w$.exports={wsIsSecure:d9,SCHEMES:h4,isValidSchemeName:_F,getSchemeHandler:r9}});var E$=Z((vP,g4)=>{var{normalizeIPv6:nF,removeDotSegments:j6,recomposeAuthority:dF,normalizeComponentEncoding:u4,isIPv4:rF,nonSimpleDomain:oF}=n9(),{SCHEMES:tF,getSchemeHandler:P$}=j$();function aF(Q,X){if(typeof Q==="string")Q=_0(n0(Q,X),X);else if(typeof Q==="object")Q=n0(_0(Q,X),X);return Q}function sF(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=b$(n0(Q,W),n0(X,W),W,!0);return W.skipEscape=!0,_0(G,W)}function b$(Q,X,Y,W){let G={};if(!W)Q=n0(_0(Q,Y),Y),X=n0(_0(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=j6(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=j6(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=j6(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=j6(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 eF(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=_0(u4(n0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=_0(u4(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=_0(u4(n0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=_0(u4(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function _0(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=P$(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=escape(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=unescape(Y.path);if(W.reference!=="suffix"&&Y.scheme)G.push(Y.scheme,":");let $=dF(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 z=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))z=j6(z);if($===void 0&&z[0]==="/"&&z[1]==="/")z="/%2F"+z.slice(2);G.push(z)}if(Y.query!==void 0)G.push("?",Y.query);if(Y.fragment!==void 0)G.push("#",Y.fragment);return G.join("")}var QL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function n0(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;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let J=Q.match(QL);if(J){if(W.scheme=J[1],W.userinfo=J[3],W.host=J[4],W.port=parseInt(J[5],10),W.path=J[6]||"",W.query=J[7],W.fragment=J[8],isNaN(W.port))W.port=J[5];if(W.host)if(rF(W.host)===!1){let H=nF(W.host);W.host=H.host.toLowerCase(),G=H.isIPV6}else G=!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 $=P$(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!$||!$.unicodeSupport)){if(W.host&&(Y.domainHost||$&&$.domainHost)&&G===!1&&oF(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(z){W.error=W.error||"Host's domain name can not be converted to ASCII: "+z}}if(!$||$&&!$.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if($&&$.parse)$.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return W}var o9={SCHEMES:tF,normalize:aF,resolve:sF,resolveComponent:b$,equal:eF,serialize:_0,parse:n0};g4.exports=o9;g4.exports.default=o9;g4.exports.fastUri=o9});var S$=Z((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});var I$=E$();I$.code='require("ajv/dist/runtime/uri").default';T$.default=I$});var h$=Z((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.CodeGen=d0.Name=d0.nil=d0.stringify=d0.str=d0._=d0.KeywordCxt=void 0;var YL=Z6();Object.defineProperty(d0,"KeywordCxt",{enumerable:!0,get:function(){return YL.KeywordCxt}});var x1=k();Object.defineProperty(d0,"_",{enumerable:!0,get:function(){return x1._}});Object.defineProperty(d0,"str",{enumerable:!0,get:function(){return x1.str}});Object.defineProperty(d0,"stringify",{enumerable:!0,get:function(){return x1.stringify}});Object.defineProperty(d0,"nil",{enumerable:!0,get:function(){return x1.nil}});Object.defineProperty(d0,"Name",{enumerable:!0,get:function(){return x1.Name}});Object.defineProperty(d0,"CodeGen",{enumerable:!0,get:function(){return x1.CodeGen}});var WL=v4(),x$=N6(),GL=T9(),P6=_4(),JL=k(),b6=M6(),f4=O6(),a9=g(),R$=L$(),$L=S$(),_$=(Q,X)=>new RegExp(Q,X);_$.code="new RegExp";var zL=["removeAdditional","useDefaults","coerceTypes"],HL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),KL={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."},BL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C$=200;function DL(Q){var X,Y,W,G,J,$,z,H,K,B,D,A,U,O,M,q,V,T,E,v,I,v0,u0,JQ,$Q;let f1=Q.strict,zQ=(X=Q.code)===null||X===void 0?void 0:X.optimize,TX=zQ===!0||zQ===void 0?1:zQ||0,SX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:_$,U5=(G=Q.uriResolver)!==null&&G!==void 0?G:$L.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:f1)!==null&&$!==void 0?$:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:f1)!==null&&H!==void 0?H:!0,strictTypes:(B=(K=Q.strictTypes)!==null&&K!==void 0?K:f1)!==null&&B!==void 0?B:"log",strictTuples:(A=(D=Q.strictTuples)!==null&&D!==void 0?D:f1)!==null&&A!==void 0?A:"log",strictRequired:(O=(U=Q.strictRequired)!==null&&U!==void 0?U:f1)!==null&&O!==void 0?O:!1,code:Q.code?{...Q.code,optimize:TX,regExp:SX}:{optimize:TX,regExp:SX},loopRequired:(M=Q.loopRequired)!==null&&M!==void 0?M:C$,loopEnum:(q=Q.loopEnum)!==null&&q!==void 0?q:C$,meta:(V=Q.meta)!==null&&V!==void 0?V:!0,messages:(T=Q.messages)!==null&&T!==void 0?T:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(v=Q.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(I=Q.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(v0=Q.validateSchema)!==null&&v0!==void 0?v0:!0,validateFormats:(u0=Q.validateFormats)!==null&&u0!==void 0?u0:!0,unicodeRegExp:(JQ=Q.unicodeRegExp)!==null&&JQ!==void 0?JQ:!0,int32range:($Q=Q.int32range)!==null&&$Q!==void 0?$Q:!0,uriResolver:U5}}class m4{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...DL(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new JL.ValueScope({scope:{},prefixes:HL,es5:X,lines:Y}),this.logger=ML(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,GL.getRules)(),k$.call(this,KL,Q,"NOT SUPPORTED"),k$.call(this,BL,Q,"DEPRECATED","warn"),this._metaOpts=UL.call(this),Q.formats)FL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)LL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);AL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=R$;if(Y==="id")W={...R$},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,B){await G.call(this,K.$schema);let D=this._addSchema(K,B);return D.validate||J.call(this,D)}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(B){if(!(B instanceof x$.default))throw B;return $.call(this,B),await z.call(this,B.missingSchema),J.call(this,K)}}function $({missingSchema:K,missingRef:B}){if(this.refs[K])throw Error(`AnySchema ${K} is loaded but ${B} cannot be resolved`)}async function z(K){let B=await H.call(this,K);if(!this.refs[K])await G.call(this,B.$schema);if(!this.refs[K])this.addSchema(B,K,X)}async function H(K){let B=this._loading[K];if(B)return B;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,b6.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=v$.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new P6.SchemaEnv({schema:{},schemaId:Y});if(X=P6.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=v$.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,b6.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(qL.call(this,Y,X),!X)return(0,a9.eachItem)(Y,(G)=>t9.call(this,G)),this;NL.call(this,X);let W={...X,type:(0,f4.getJSONTypes)(X.type),schemaType:(0,f4.getJSONTypes)(X.schemaType)};return(0,a9.eachItem)(Y,W.type.length===0?(G)=>t9.call(this,G,W):(G)=>W.type.forEach((J)=>t9.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 z=Y[$];if(typeof z!="object")continue;let{$data:H}=z.definition,K=J[$];if(H&&K)J[$]=y$(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 z=this._cache.get(Q);if(z!==void 0)return z;Y=(0,b6.normalizeId)(J||Y);let H=b6.getSchemaRefs.call(this,Q,Y);if(z=new P6.SchemaEnv({schema:Q,schemaId:$,meta:X,baseId:Y,localRefs:H}),this._cache.set(z.schema,z),G&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=z}if(W)this.validateSchema(Q,!0);return z}_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 P6.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{P6.compileSchema.call(this,Q)}finally{this.opts=X}}}m4.ValidationError=WL.default;m4.MissingRefError=x$.default;d0.default=m4;function k$(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 v$(Q){return Q=(0,b6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function AL(){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 FL(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function LL(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 UL(){let Q={...this.opts};for(let X of zL)delete Q[X];return Q}var OL={log(){},warn(){},error(){}};function ML(Q){if(Q===!1)return OL;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 VL=/^[a-z_$][a-z0-9_$:-]*$/i;function qL(Q,X){let{RULES:Y}=this;if((0,a9.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!VL.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 t9(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:H})=>H===Y);if(!$)$={type:Y,rules:[]},J.rules.push($);if(J.keywords[Q]=!0,!X)return;let z={keyword:Q,definition:{...X,type:(0,f4.getJSONTypes)(X.type),schemaType:(0,f4.getJSONTypes)(X.schemaType)}};if(X.before)ZL.call(this,$,z,X.before);else $.rules.push(z);J.all[Q]=z,(W=X.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function ZL(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 NL(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=y$(X);Q.validateSchema=this.compile(X,!0)}var wL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function y$(Q){return{anyOf:[Q,wL]}}});var g$=Z((u$)=>{Object.defineProperty(u$,"__esModule",{value:!0});var bL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};u$.default=bL});var i$=Z((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.callRef=c$.getValidate=void 0;var IL=N6(),f$=j0(),O0=k(),_1=p0(),m$=_4(),l4=g(),TL={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:J,validateName:$,opts:z,self:H}=W,{root:K}=J;if((Y==="#"||Y==="#/")&&G===K.baseId)return D();let B=m$.resolveRef.call(H,K,G,Y);if(B===void 0)throw new IL.default(W.opts.uriResolver,G,Y);if(B instanceof m$.SchemaEnv)return A(B);return U(B);function D(){if(J===K)return c4(Q,$,J,J.$async);let O=X.scopeValue("root",{ref:K});return c4(Q,O0._`${O}.validate`,K,K.$async)}function A(O){let M=l$(Q,O);c4(Q,M,O,O.$async)}function U(O){let M=X.scopeValue("schema",z.code.source===!0?{ref:O,code:(0,O0.stringify)(O)}:{ref:O}),q=X.name("valid"),V=Q.subschema({schema:O,dataTypes:[],schemaPath:O0.nil,topSchemaRef:M,errSchemaPath:Y},q);Q.mergeEvaluated(V),Q.ok(q)}}};function l$(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):O0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}c$.getValidate=l$;function c4(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:z,opts:H}=J,K=H.passContext?_1.default.this:O0.nil;if(W)B();else D();function B(){if(!z.$async)throw Error("async schema referenced by sync schema");let O=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,f$.callValidateCode)(Q,X,K)}`),U(X),!$)G.assign(O,!0)},(M)=>{if(G.if(O0._`!(${M} instanceof ${J.ValidationError})`,()=>G.throw(M)),A(M),!$)G.assign(O,!1)}),Q.ok(O)}function D(){Q.result((0,f$.callValidateCode)(Q,X,K),()=>U(X),()=>A(X))}function A(O){let M=O0._`${O}.errors`;G.assign(_1.default.vErrors,O0._`${_1.default.vErrors} === null ? ${M} : ${_1.default.vErrors}.concat(${M})`),G.assign(_1.default.errors,O0._`${_1.default.vErrors}.length`)}function U(O){var M;if(!J.opts.unevaluated)return;let q=(M=Y===null||Y===void 0?void 0:Y.validate)===null||M===void 0?void 0:M.evaluated;if(J.props!==!0)if(q&&!q.dynamicProps){if(q.props!==void 0)J.props=l4.mergeEvaluated.props(G,q.props,J.props)}else{let V=G.var("props",O0._`${O}.evaluated.props`);J.props=l4.mergeEvaluated.props(G,V,J.props,O0.Name)}if(J.items!==!0)if(q&&!q.dynamicItems){if(q.items!==void 0)J.items=l4.mergeEvaluated.items(G,q.items,J.items)}else{let V=G.var("items",O0._`${O}.evaluated.items`);J.items=l4.mergeEvaluated.items(G,V,J.items,O0.Name)}}}c$.callRef=c4;c$.default=TL});var d$=Z((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});var CL=g$(),kL=i$(),vL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",CL.default,kL.default];n$.default=vL});var o$=Z((r$)=>{Object.defineProperty(r$,"__esModule",{value:!0});var p4=k(),z1=p4.operators,i4={maximum:{okStr:"<=",ok:z1.LTE,fail:z1.GT},minimum:{okStr:">=",ok:z1.GTE,fail:z1.LT},exclusiveMaximum:{okStr:"<",ok:z1.LT,fail:z1.GTE},exclusiveMinimum:{okStr:">",ok:z1.GT,fail:z1.LTE}},_L={message:({keyword:Q,schemaCode:X})=>p4.str`must be ${i4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>p4._`{comparison: ${i4[Q].okStr}, limit: ${X}}`},yL={keyword:Object.keys(i4),type:"number",schemaType:"number",$data:!0,error:_L,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(p4._`${Y} ${i4[X].fail} ${W} || isNaN(${Y})`)}};r$.default=yL});var a$=Z((t$)=>{Object.defineProperty(t$,"__esModule",{value:!0});var E6=k(),uL={message:({schemaCode:Q})=>E6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>E6._`{multipleOf: ${Q}}`},gL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:uL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),z=J?E6._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:E6._`${$} !== parseInt(${$})`;Q.fail$data(E6._`(${W} === 0 || (${$} = ${Y}/${W}, ${z}))`)}};t$.default=gL});var Qz=Z((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});function s$(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}e$.default=s$;s$.code='require("ajv/dist/runtime/ucs2length").default'});var Yz=Z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});var M1=k(),lL=g(),cL=Qz(),pL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return M1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>M1._`{limit: ${Q}}`},iL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:pL,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?M1.operators.GT:M1.operators.LT,$=G.opts.unicode===!1?M1._`${Y}.length`:M1._`${(0,lL.useFunc)(Q.gen,cL.default)}(${Y})`;Q.fail$data(M1._`${$} ${J} ${W}`)}};Xz.default=iL});var Gz=Z((Wz)=>{Object.defineProperty(Wz,"__esModule",{value:!0});var dL=j0(),n4=k(),rL={message:({schemaCode:Q})=>n4.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>n4._`{pattern: ${Q}}`},oL={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:rL,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:J}=Q,$=J.opts.unicodeRegExp?"u":"",z=Y?n4._`(new RegExp(${G}, ${$}))`:(0,dL.usePattern)(Q,W);Q.fail$data(n4._`!${z}.test(${X})`)}};Wz.default=oL});var $z=Z((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});var I6=k(),aL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return I6.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>I6._`{limit: ${Q}}`},sL={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:aL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?I6.operators.GT:I6.operators.LT;Q.fail$data(I6._`Object.keys(${Y}).length ${G} ${W}`)}};Jz.default=sL});var Hz=Z((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});var T6=j0(),S6=k(),QU=g(),XU={message:({params:{missingProperty:Q}})=>S6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>S6._`{missingProperty: ${Q}}`},YU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:XU,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:J,it:$}=Q,{opts:z}=$;if(!J&&Y.length===0)return;let H=Y.length>=z.loopRequired;if($.allErrors)K();else B();if(z.strictRequired){let U=Q.parentSchema.properties,{definedProperties:O}=Q.it;for(let M of Y)if((U===null||U===void 0?void 0:U[M])===void 0&&!O.has(M)){let q=$.schemaEnv.baseId+$.errSchemaPath,V=`required property "${M}" is not defined at "${q}" (strictRequired)`;(0,QU.checkStrictMode)($,V,$.opts.strictRequired)}}function K(){if(H||J)Q.block$data(S6.nil,D);else for(let U of Y)(0,T6.checkReportMissingProp)(Q,U)}function B(){let U=X.let("missing");if(H||J){let O=X.let("valid",!0);Q.block$data(O,()=>A(U,O)),Q.ok(O)}else X.if((0,T6.checkMissingProp)(Q,Y,U)),(0,T6.reportMissingProp)(Q,U),X.else()}function D(){X.forOf("prop",W,(U)=>{Q.setParams({missingProperty:U}),X.if((0,T6.noPropertyInData)(X,G,U,z.ownProperties),()=>Q.error())})}function A(U,O){Q.setParams({missingProperty:U}),X.forOf(U,W,()=>{X.assign(O,(0,T6.propertyInData)(X,G,U,z.ownProperties)),X.if((0,S6.not)(O),()=>{Q.error(),X.break()})},S6.nil)}}};zz.default=YU});var Bz=Z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var R6=k(),GU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return R6.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>R6._`{limit: ${Q}}`},JU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:GU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?R6.operators.GT:R6.operators.LT;Q.fail$data(R6._`${Y}.length ${G} ${W}`)}};Kz.default=JU});var d4=Z((Az)=>{Object.defineProperty(Az,"__esModule",{value:!0});var Dz=y9();Dz.code='require("ajv/dist/runtime/equal").default';Az.default=Dz});var Lz=Z((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var s9=O6(),$0=k(),HU=g(),KU=d4(),BU={message:({params:{i:Q,j:X}})=>$0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>$0._`{i: ${Q}, j: ${X}}`},DU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:BU,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:J,schemaCode:$,it:z}=Q;if(!W&&!G)return;let H=X.let("valid"),K=J.items?(0,s9.getSchemaTypes)(J.items):[];Q.block$data(H,B,$0._`${$} === false`),Q.ok(H);function B(){let O=X.let("i",$0._`${Y}.length`),M=X.let("j");Q.setParams({i:O,j:M}),X.assign(H,!0),X.if($0._`${O} > 1`,()=>(D()?A:U)(O,M))}function D(){return K.length>0&&!K.some((O)=>O==="object"||O==="array")}function A(O,M){let q=X.name("item"),V=(0,s9.checkDataTypes)(K,q,z.opts.strictNumbers,s9.DataType.Wrong),T=X.const("indices",$0._`{}`);X.for($0._`;${O}--;`,()=>{if(X.let(q,$0._`${Y}[${O}]`),X.if(V,$0._`continue`),K.length>1)X.if($0._`typeof ${q} == "string"`,$0._`${q} += "_"`);X.if($0._`typeof ${T}[${q}] == "number"`,()=>{X.assign(M,$0._`${T}[${q}]`),Q.error(),X.assign(H,!1).break()}).code($0._`${T}[${q}] = ${O}`)})}function U(O,M){let q=(0,HU.useFunc)(X,KU.default),V=X.name("outer");X.label(V).for($0._`;${O}--;`,()=>X.for($0._`${M} = ${O}; ${M}--;`,()=>X.if($0._`${q}(${Y}[${O}], ${Y}[${M}])`,()=>{Q.error(),X.assign(H,!1).break(V)})))}}};Fz.default=DU});var Oz=Z((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});var e9=k(),FU=g(),LU=d4(),UU={message:"must be equal to constant",params:({schemaCode:Q})=>e9._`{allowedValue: ${Q}}`},OU={keyword:"const",$data:!0,error:UU,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(e9._`!${(0,FU.useFunc)(X,LU.default)}(${Y}, ${G})`);else Q.fail(e9._`${J} !== ${Y}`)}};Uz.default=OU});var Vz=Z((Mz)=>{Object.defineProperty(Mz,"__esModule",{value:!0});var C6=k(),VU=g(),qU=d4(),ZU={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>C6._`{allowedValues: ${Q}}`},NU={keyword:"enum",schemaType:"array",$data:!0,error:ZU,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 z=G.length>=$.opts.loopEnum,H,K=()=>H!==null&&H!==void 0?H:H=(0,VU.useFunc)(X,qU.default),B;if(z||W)B=X.let("valid"),Q.block$data(B,D);else{if(!Array.isArray(G))throw Error("ajv implementation error");let U=X.const("vSchema",J);B=(0,C6.or)(...G.map((O,M)=>A(U,M)))}Q.pass(B);function D(){X.assign(B,!1),X.forOf("v",J,(U)=>X.if(C6._`${K()}(${Y}, ${U})`,()=>X.assign(B,!0).break()))}function A(U,O){let M=G[O];return typeof M==="object"&&M!==null?C6._`${K()}(${Y}, ${U}[${O}])`:C6._`${Y} === ${M}`}}};Mz.default=NU});var Zz=Z((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});var jU=o$(),PU=a$(),bU=Yz(),EU=Gz(),IU=$z(),TU=Hz(),SU=Bz(),RU=Lz(),CU=Oz(),kU=Vz(),vU=[jU.default,PU.default,bU.default,EU.default,IU.default,TU.default,SU.default,RU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CU.default,kU.default];qz.default=vU});var XX=Z((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});wz.validateAdditionalItems=void 0;var V1=k(),QX=g(),_U={message:({params:{len:Q}})=>V1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>V1._`{limit: ${Q}}`},yU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:_U,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,QX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}Nz(Q,W)}};function Nz(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let z=Y.const("len",V1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(V1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,QX.alwaysValidSchema)($,W)){let K=Y.var("valid",V1._`${z} <= ${X.length}`);Y.if((0,V1.not)(K),()=>H(K)),Q.ok(K)}function H(K){Y.forRange("i",X.length,z,(B)=>{if(Q.subschema({keyword:J,dataProp:B,dataPropType:QX.Type.Num},K),!$.allErrors)Y.if((0,V1.not)(K),()=>Y.break())})}}wz.validateAdditionalItems=Nz;wz.default=yU});var YX=Z((Ez)=>{Object.defineProperty(Ez,"__esModule",{value:!0});Ez.validateTuple=void 0;var Pz=k(),r4=g(),uU=j0(),gU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return bz(Q,"additionalItems",X);if(Y.items=!0,(0,r4.alwaysValidSchema)(Y,X))return;Q.ok((0,uU.validateArray)(Q))}};function bz(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:z}=Q;if(B(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=r4.mergeEvaluated.items(W,Y.length,z.items);let H=W.name("valid"),K=W.const("len",Pz._`${J}.length`);Y.forEach((D,A)=>{if((0,r4.alwaysValidSchema)(z,D))return;W.if(Pz._`${K} > ${A}`,()=>Q.subschema({keyword:$,schemaProp:A,dataProp:A},H)),Q.ok(H)});function B(D){let{opts:A,errSchemaPath:U}=z,O=Y.length,M=O===D.minItems&&(O===D.maxItems||D[X]===!1);if(A.strictTuples&&!M){let q=`"${$}" is ${O}-tuple, but minItems or maxItems/${X} are not specified or different at path "${U}"`;(0,r4.checkStrictMode)(z,q,A.strictTuples)}}}Ez.validateTuple=bz;Ez.default=gU});var Sz=Z((Tz)=>{Object.defineProperty(Tz,"__esModule",{value:!0});var mU=YX(),lU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,mU.validateTuple)(Q,"items")};Tz.default=lU});var kz=Z((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});var Rz=k(),pU=g(),iU=j0(),nU=XX(),dU={message:({params:{len:Q}})=>Rz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Rz._`{limit: ${Q}}`},rU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:dU,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,pU.alwaysValidSchema)(W,X))return;if(G)(0,nU.validateAdditionalItems)(Q,G);else Q.ok((0,iU.validateArray)(Q))}};Cz.default=rU});var xz=Z((vz)=>{Object.defineProperty(vz,"__esModule",{value:!0});var P0=k(),o4=g(),tU={message:({params:{min:Q,max:X}})=>X===void 0?P0.str`must contain at least ${Q} valid item(s)`:P0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?P0._`{minContains: ${Q}}`:P0._`{minContains: ${Q}, maxContains: ${X}}`},aU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tU,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,z,{minContains:H,maxContains:K}=W;if(J.opts.next)$=H===void 0?1:H,z=K;else $=1;let B=X.const("len",P0._`${G}.length`);if(Q.setParams({min:$,max:z}),z===void 0&&$===0){(0,o4.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&$>z){(0,o4.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,o4.alwaysValidSchema)(J,Y)){let M=P0._`${B} >= ${$}`;if(z!==void 0)M=P0._`${M} && ${B} <= ${z}`;Q.pass(M);return}J.items=!0;let D=X.name("valid");if(z===void 0&&$===1)U(D,()=>X.if(D,()=>X.break()));else if($===0){if(X.let(D,!0),z!==void 0)X.if(P0._`${G}.length > 0`,A)}else X.let(D,!1),A();Q.result(D,()=>Q.reset());function A(){let M=X.name("_valid"),q=X.let("count",0);U(M,()=>X.if(M,()=>O(q)))}function U(M,q){X.forRange("i",0,B,(V)=>{Q.subschema({keyword:"contains",dataProp:V,dataPropType:o4.Type.Num,compositeRule:!0},M),q()})}function O(M){if(X.code(P0._`${M}++`),z===void 0)X.if(P0._`${M} >= ${$}`,()=>X.assign(D,!0).break());else if(X.if(P0._`${M} > ${z}`,()=>X.assign(D,!1).break()),$===1)X.assign(D,!0);else X.if(P0._`${M} >= ${$}`,()=>X.assign(D,!0))}}};vz.default=aU});var fz=Z((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});hz.validateSchemaDeps=hz.validatePropertyDeps=hz.error=void 0;var WX=k(),eU=g(),k6=j0();hz.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return WX.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>WX._`{property: ${Q},
6
+ || ${$} === "boolean" || ${G} === null`).assign(z,R._`[${G}]`)}}}function TD({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(R._`${X} !== undefined`,()=>Q.assign(R._`${X}[${Y}]`,W))}function R9(Q,X,Y,W=C1.Correct){let G=W===C1.Correct?R.operators.EQ:R.operators.NEQ,J;switch(Q){case"null":return R._`${X} ${G} null`;case"array":J=R._`Array.isArray(${X})`;break;case"object":J=R._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(R._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return R._`typeof ${X} ${G} ${Q}`}return W===C1.Correct?J:(0,R.not)(J);function $(z=R.nil){return(0,R.and)(R._`typeof ${X} == "number"`,z,Y?R._`isFinite(${X})`:R.nil)}}MJ.checkDataType=R9;function C9(Q,X,Y,W){if(Q.length===1)return R9(Q[0],X,Y,W);let G,J=(0,LJ.toHash)(Q);if(J.array&&J.object){let $=R._`typeof ${X} != "object"`;G=J.null?$:R._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=R.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,R.and)(G,R9($,X,Y,W));return G}MJ.checkDataTypes=C9;var SD={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?R._`{type: ${Q}}`:R._`{type: ${X}}`};function k9(Q){let X=RD(Q);(0,jD.reportError)(X,SD)}MJ.reportTypeError=k9;function RD(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,LJ.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var wJ=Z((ZJ)=>{Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.assignDefaults=void 0;var k1=k(),hD=g();function uD(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)qJ(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>qJ(Q,J,G.default))}ZJ.assignDefaults=uD;function qJ(Q,X,Y){let{gen:W,compositeRule:G,data:J,opts:$}=Q;if(Y===void 0)return;let z=k1._`${J}${(0,k1.getProperty)(X)}`;if(G){(0,hD.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let H=k1._`${z} === undefined`;if($.useDefaults==="empty")H=k1._`${H} || ${z} === null || ${z} === ""`;W.if(H,k1._`${z} = ${(0,k1.stringify)(Y)}`)}});var j0=Z((bJ)=>{Object.defineProperty(bJ,"__esModule",{value:!0});bJ.validateUnion=bJ.validateArray=bJ.usePattern=bJ.callValidateCode=bJ.schemaProperties=bJ.allSchemaProperties=bJ.noPropertyInData=bJ.propertyInData=bJ.isOwnProperty=bJ.hasPropFunc=bJ.reportMissingProp=bJ.checkMissingProp=bJ.checkReportMissingProp=void 0;var d=k(),v9=g(),J1=p0(),gD=g();function fD(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(_9(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:d._`${X}`},!0),Q.error()})}bJ.checkReportMissingProp=fD;function mD({gen:Q,data:X,it:{opts:Y}},W,G){return(0,d.or)(...W.map((J)=>(0,d.and)(_9(Q,X,J,Y.ownProperties),d._`${G} = ${J}`)))}bJ.checkMissingProp=mD;function lD(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}bJ.reportMissingProp=lD;function jJ(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:d._`Object.prototype.hasOwnProperty`})}bJ.hasPropFunc=jJ;function x9(Q,X,Y){return d._`${jJ(Q)}.call(${X}, ${Y})`}bJ.isOwnProperty=x9;function cD(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} !== undefined`;return W?d._`${G} && ${x9(Q,X,Y)}`:G}bJ.propertyInData=cD;function _9(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} === undefined`;return W?(0,d.or)(G,(0,d.not)(x9(Q,X,Y))):G}bJ.noPropertyInData=_9;function PJ(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}bJ.allSchemaProperties=PJ;function pD(Q,X){return PJ(X).filter((Y)=>!(0,v9.alwaysValidSchema)(Q,X[Y]))}bJ.schemaProperties=pD;function iD({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},z,H,K){let B=K?d._`${Q}, ${X}, ${W}${G}`:X,D=[[J1.default.instancePath,(0,d.strConcat)(J1.default.instancePath,J)],[J1.default.parentData,$.parentData],[J1.default.parentDataProperty,$.parentDataProperty],[J1.default.rootData,J1.default.rootData]];if($.opts.dynamicRef)D.push([J1.default.dynamicAnchors,J1.default.dynamicAnchors]);let A=d._`${B}, ${Y.object(...D)}`;return H!==d.nil?d._`${z}.call(${H}, ${A})`:d._`${z}(${A})`}bJ.callValidateCode=iD;var nD=d._`new RegExp`;function dD({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:d._`${G.code==="new RegExp"?nD:(0,gD.useFunc)(Q,G)}(${Y}, ${W})`})}bJ.usePattern=dD;function rD(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,J=X.name("valid");if(G.allErrors){let z=X.let("valid",!0);return $(()=>X.assign(z,!1)),z}return X.var(J,!0),$(()=>X.break()),J;function $(z){let H=X.const("len",d._`${Y}.length`);X.forRange("i",0,H,(K)=>{Q.subschema({keyword:W,dataProp:K,dataPropType:v9.Type.Num},J),X.if((0,d.not)(J),z)})}}bJ.validateArray=rD;function oD(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((H)=>(0,v9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((H,K)=>{let B=Q.subschema({keyword:W,schemaProp:K,compositeRule:!0},z);if(X.assign($,d._`${$} || ${z}`),!Q.mergeValidEvaluated(B,z))X.if((0,d.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}bJ.validateUnion=oD});var CJ=Z((SJ)=>{Object.defineProperty(SJ,"__esModule",{value:!0});SJ.validateKeywordUsage=SJ.validSchemaType=SJ.funcKeywordCode=SJ.macroKeywordCode=void 0;var A0=k(),U1=p0(),HA=j0(),KA=U6();function BA(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,z=X.macro.call($.self,G,J,$),H=TJ(Y,W,z);if($.opts.validateSchema!==!1)$.self.validateSchema(z,!0);let K=Y.name("valid");Q.subschema({schema:z,schemaPath:A0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},K),Q.pass(K,()=>Q.error(!0))}SJ.macroKeywordCode=BA;function DA(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:z,it:H}=Q;FA(H,X);let K=!z&&X.compile?X.compile.call(H.self,J,$,H):X.validate,B=TJ(W,G,K),D=W.let("valid");Q.block$data(D,A),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:D);function A(){if(X.errors===!1){if(M(),X.modifying)IJ(Q);q(()=>Q.error())}else{let V=X.async?U():O();if(X.modifying)IJ(Q);q(()=>AA(Q,V))}}function U(){let V=W.let("ruleErrs",null);return W.try(()=>M(A0._`await `),(T)=>W.assign(D,!1).if(A0._`${T} instanceof ${H.ValidationError}`,()=>W.assign(V,A0._`${T}.errors`),()=>W.throw(T))),V}function O(){let V=A0._`${B}.errors`;return W.assign(V,null),M(A0.nil),V}function M(V=X.async?A0._`await `:A0.nil){let T=H.opts.passContext?U1.default.this:U1.default.self,E=!(("compile"in X)&&!z||X.schema===!1);W.assign(D,A0._`${V}${(0,HA.callValidateCode)(Q,B,T,E)}`,X.modifying)}function q(V){var T;W.if((0,A0.not)((T=X.valid)!==null&&T!==void 0?T:D),V)}}SJ.funcKeywordCode=DA;function IJ(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,A0._`${W.parentData}[${W.parentDataProperty}]`))}function AA(Q,X){let{gen:Y}=Q;Y.if(A0._`Array.isArray(${X})`,()=>{Y.assign(U1.default.vErrors,A0._`${U1.default.vErrors} === null ? ${X} : ${U1.default.vErrors}.concat(${X})`).assign(U1.default.errors,A0._`${U1.default.vErrors}.length`),(0,KA.extendErrors)(Q)},()=>Q.error())}function FA({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function TJ(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,A0.stringify)(Y)})}function LA(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")}SJ.validSchemaType=LA;function UA({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((z)=>!Object.prototype.hasOwnProperty.call(Q,z)))throw Error(`parent schema must have dependencies of ${J}: ${$.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[J])){let H=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(H);else throw Error(H)}}}SJ.validateKeywordUsage=UA});var _J=Z((vJ)=>{Object.defineProperty(vJ,"__esModule",{value:!0});vJ.extendSubschemaMode=vJ.extendSubschemaData=vJ.getSubschema=void 0;var x0=k(),kJ=g();function qA(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 z=Q.schema[X];return Y===void 0?{schema:z,schemaPath:x0._`${Q.schemaPath}${(0,x0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:x0._`${Q.schemaPath}${(0,x0.getProperty)(X)}${(0,x0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,kJ.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')}vJ.getSubschema=qA;function ZA(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:z}=X;if(Y!==void 0){let{errorPath:K,dataPathArr:B,opts:D}=X,A=z.let("data",x0._`${X.data}${(0,x0.getProperty)(Y)}`,!0);H(A),Q.errorPath=x0.str`${K}${(0,kJ.getErrorPath)(Y,W,D.jsPropertySyntax)}`,Q.parentDataProperty=x0._`${Y}`,Q.dataPathArr=[...B,Q.parentDataProperty]}if(G!==void 0){let K=G instanceof x0.Name?G:z.let("data",G,!0);if(H(K),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function H(K){Q.data=K,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,K]}}vJ.extendSubschemaData=ZA;function NA(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}vJ.extendSubschemaMode=NA});var y9=Z((PP,yJ)=>{yJ.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 uJ=Z((bP,hJ)=>{var $1=hJ.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(){};C4(X,W,G,Q,"",Q)};$1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};$1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};$1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};$1.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 C4(Q,X,Y,W,G,J,$,z,H,K){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,z,H,K);for(var B in W){var D=W[B];if(Array.isArray(D)){if(B in $1.arrayKeywords)for(var A=0;A<D.length;A++)C4(Q,X,Y,D[A],G+"/"+B+"/"+A,J,G,B,W,A)}else if(B in $1.propsKeywords){if(D&&typeof D=="object")for(var U in D)C4(Q,X,Y,D[U],G+"/"+B+"/"+PA(U),J,G,B,W,U)}else if(B in $1.keywords||Q.allKeys&&!(B in $1.skipKeywords))C4(Q,X,Y,D,G+"/"+B,J,G,B,W)}Y(W,G,J,$,z,H,K)}}function PA(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var M6=Z((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});lJ.getSchemaRefs=lJ.resolveUrl=lJ.normalizeId=lJ._getFullPath=lJ.getFullPath=lJ.inlineRef=void 0;var bA=g(),EA=y9(),IA=uJ(),TA=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function SA(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!h9(Q);if(!X)return!1;return gJ(Q)<=X}lJ.inlineRef=SA;var RA=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h9(Q){for(let X in Q){if(RA.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(h9))return!0;if(typeof Y=="object"&&h9(Y))return!0}return!1}function gJ(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,TA.has(Y))continue;if(typeof Q[Y]=="object")(0,bA.eachItem)(Q[Y],(W)=>X+=gJ(W));if(X===1/0)return 1/0}return X}function fJ(Q,X="",Y){if(Y!==!1)X=v1(X);let W=Q.parse(X);return mJ(Q,W)}lJ.getFullPath=fJ;function mJ(Q,X){return Q.serialize(X).split("#")[0]+"#"}lJ._getFullPath=mJ;var CA=/#\/?$/;function v1(Q){return Q?Q.replace(CA,""):""}lJ.normalizeId=v1;function kA(Q,X,Y){return Y=v1(Y),Q.resolve(X,Y)}lJ.resolveUrl=kA;var vA=/^[a-z_][-a-z0-9._]*$/i;function xA(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=v1(Q[Y]||X),J={"":G},$=fJ(W,G,!1),z={},H=new Set;return IA(Q,{allKeys:!0},(D,A,U,O)=>{if(O===void 0)return;let M=$+A,q=J[O];if(typeof D[Y]=="string")q=V.call(this,D[Y]);T.call(this,D.$anchor),T.call(this,D.$dynamicAnchor),J[A]=q;function V(E){let v=this.opts.uriResolver.resolve;if(E=v1(q?v(q,E):E),H.has(E))throw B(E);H.add(E);let I=this.refs[E];if(typeof I=="string")I=this.refs[I];if(typeof I=="object")K(D,I.schema,E);else if(E!==v1(M))if(E[0]==="#")K(D,z[E],E),z[E]=D;else this.refs[E]=M;return E}function T(E){if(typeof E=="string"){if(!vA.test(E))throw Error(`invalid anchor "${E}"`);V.call(this,`#${E}`)}}}),z;function K(D,A,U){if(A!==void 0&&!EA(D,A))throw B(U)}function B(D){return Error(`reference "${D}" resolves to more than one schema`)}}lJ.getSchemaRefs=xA});var Z6=Z((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});G$.getData=G$.KeywordCxt=G$.validateFunctionCode=void 0;var rJ=zJ(),pJ=O6(),g9=S9(),k4=O6(),fA=wJ(),q6=CJ(),u9=_J(),P=k(),S=p0(),mA=M6(),i0=g(),V6=U6();function lA(Q){if(aJ(Q)){if(sJ(Q),tJ(Q)){iA(Q);return}}oJ(Q,()=>(0,rJ.topBoolOrEmptySchema)(Q))}G$.validateFunctionCode=lA;function oJ({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,P._`${S.default.data}, ${S.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${iJ(Y,G)}`),pA(Q,G),Q.code(J)});else Q.func(X,P._`${S.default.data}, ${cA(G)}`,W.$async,()=>Q.code(iJ(Y,G)).code(J))}function cA(Q){return P._`{${S.default.instancePath}="", ${S.default.parentData}, ${S.default.parentDataProperty}, ${S.default.rootData}=${S.default.data}${Q.dynamicRef?P._`, ${S.default.dynamicAnchors}={}`:P.nil}}={}`}function pA(Q,X){Q.if(S.default.valCxt,()=>{if(Q.var(S.default.instancePath,P._`${S.default.valCxt}.${S.default.instancePath}`),Q.var(S.default.parentData,P._`${S.default.valCxt}.${S.default.parentData}`),Q.var(S.default.parentDataProperty,P._`${S.default.valCxt}.${S.default.parentDataProperty}`),Q.var(S.default.rootData,P._`${S.default.valCxt}.${S.default.rootData}`),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`${S.default.valCxt}.${S.default.dynamicAnchors}`)},()=>{if(Q.var(S.default.instancePath,P._`""`),Q.var(S.default.parentData,P._`undefined`),Q.var(S.default.parentDataProperty,P._`undefined`),Q.var(S.default.rootData,S.default.data),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`{}`)})}function iA(Q){let{schema:X,opts:Y,gen:W}=Q;oJ(Q,()=>{if(Y.$comment&&X.$comment)Q$(Q);if(tA(Q),W.let(S.default.vErrors,null),W.let(S.default.errors,0),Y.unevaluated)nA(Q);eJ(Q),eA(Q)});return}function nA(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",P._`${Y}.evaluated`),X.if(P._`${Q.evaluated}.dynamicProps`,()=>X.assign(P._`${Q.evaluated}.props`,P._`undefined`)),X.if(P._`${Q.evaluated}.dynamicItems`,()=>X.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function iJ(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?P._`/*# sourceURL=${Y} */`:P.nil}function dA(Q,X){if(aJ(Q)){if(sJ(Q),tJ(Q)){rA(Q,X);return}}(0,rJ.boolOrEmptySchema)(Q,X)}function tJ({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 aJ(Q){return typeof Q.schema!="boolean"}function rA(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)Q$(Q);aA(Q),sA(Q);let J=W.const("_errs",S.default.errors);eJ(Q,J),W.var(X,P._`${J} === ${S.default.errors}`)}function sJ(Q){(0,i0.checkUnknownRules)(Q),oA(Q)}function eJ(Q,X){if(Q.opts.jtd)return nJ(Q,[],!1,X);let Y=(0,pJ.getSchemaTypes)(Q.schema),W=(0,pJ.coerceAndCheckDataType)(Q,Y);nJ(Q,Y,!W,X)}function oA(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,i0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function tA(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,i0.checkStrictMode)(Q,"default is ignored in the schema root")}function aA(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,mA.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function sA(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Q$({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(P._`${S.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=P.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(P._`${S.default.self}.opts.$comment(${J}, ${$}, ${z}.schema)`)}}function eA(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(P._`${S.default.errors} === 0`,()=>X.return(S.default.data),()=>X.throw(P._`new ${G}(${S.default.vErrors})`));else{if(X.assign(P._`${W}.errors`,S.default.vErrors),J.unevaluated)QF(Q);X.return(P._`${S.default.errors} === 0`)}}function QF({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof P.Name)Q.assign(P._`${X}.props`,Y);if(W instanceof P.Name)Q.assign(P._`${X}.items`,W)}function nJ(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:z,opts:H,self:K}=Q,{RULES:B}=K;if(J.$ref&&(H.ignoreKeywordsWithRef||!(0,i0.schemaHasRulesButRef)(J,B))){G.block(()=>Y$(Q,"$ref",B.all.$ref.definition));return}if(!H.jtd)XF(Q,X);G.block(()=>{for(let A of B.rules)D(A);D(B.post)});function D(A){if(!(0,g9.shouldUseGroup)(J,A))return;if(A.type){if(G.if((0,k4.checkDataType)(A.type,$,H.strictNumbers)),dJ(Q,A),X.length===1&&X[0]===A.type&&Y)G.else(),(0,k4.reportTypeError)(Q);G.endIf()}else dJ(Q,A);if(!z)G.if(P._`${S.default.errors} === ${W||0}`)}}function dJ(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,fA.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,g9.shouldUseRule)(W,J))Y$(Q,J.keyword,J.definition,X.type)})}function XF(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(YF(Q,X),!Q.opts.allowUnionTypes)WF(Q,X);GF(Q,Q.dataTypes)}function YF(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!X$(Q.dataTypes,Y))f9(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),$F(Q,X)}function WF(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))f9(Q,"use allowUnionTypes to allow union type keyword")}function GF(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,g9.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>JF(X,$)))f9(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function JF(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function X$(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function $F(Q,X){let Y=[];for(let W of Q.dataTypes)if(X$(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function f9(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,i0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class m9{constructor(Q,X,Y){if((0,q6.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,i0.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",W$(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,q6.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",S.default.errors)}result(Q,X,Y){this.failResult((0,P.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,P.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(P._`${X} !== undefined && (${(0,P.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?V6.reportExtraError:V6.reportError)(this,this.def.error,X)}$dataError(){(0,V6.reportError)(this,this.def.$dataError||V6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,V6.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=P.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=P.nil,X=P.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,P.or)(P._`${W} === undefined`,X)),Q!==P.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,P.or)(J(),$());function J(){if(Y.length){if(!(X instanceof P.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return P._`${(0,k4.checkDataTypes)(z,X,G.opts.strictNumbers,k4.DataType.Wrong)}`}return P.nil}function $(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${z}(${X})`}return P.nil}}subschema(Q,X){let Y=(0,u9.getSubschema)(this.it,Q);(0,u9.extendSubschemaData)(Y,this.it,Q),(0,u9.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return dA(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=i0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=i0.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,P.Name)),!0}}G$.KeywordCxt=m9;function Y$(Q,X,Y,W){let G=new m9(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,q6.funcKeywordCode)(G,Y);else if("macro"in Y)(0,q6.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,q6.funcKeywordCode)(G,Y)}var zF=/^\/(?:[^~]|~0|~1)*$/,HF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W$(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return S.default.rootData;if(Q[0]==="/"){if(!zF.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=S.default.rootData}else{let K=HF.exec(Q);if(!K)throw Error(`Invalid JSON-pointer: ${Q}`);let B=+K[1];if(G=K[2],G==="#"){if(B>=X)throw Error(H("property/index",B));return W[X-B]}if(B>X)throw Error(H("data",B));if(J=Y[X-B],!G)return J}let $=J,z=G.split("/");for(let K of z)if(K)J=P._`${J}${(0,P.getProperty)((0,i0.unescapeJsonPointer)(K))}`,$=P._`${$} && ${J}`;return $;function H(K,B){return`Cannot access ${K} ${B} levels up, current level is ${X}`}}G$.getData=W$});var v4=Z((z$)=>{Object.defineProperty(z$,"__esModule",{value:!0});class $$ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}z$.default=$$});var N6=Z((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});var l9=M6();class H$ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,l9.resolveUrl)(Q,X,Y),this.missingSchema=(0,l9.normalizeId)((0,l9.getFullPath)(Q,this.missingRef))}}K$.default=H$});var _4=Z((A$)=>{Object.defineProperty(A$,"__esModule",{value:!0});A$.resolveSchema=A$.getCompilingSchema=A$.resolveRef=A$.compileSchema=A$.SchemaEnv=void 0;var S0=k(),FF=v4(),O1=p0(),R0=M6(),B$=g(),LF=Z6();class w6{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,R0.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={}}}A$.SchemaEnv=w6;function p9(Q){let X=D$.call(this,Q);if(X)return X;let Y=(0,R0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new S0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),z;if(Q.$async)z=$.scopeValue("Error",{ref:FF.default,code:S0._`require("ajv/dist/runtime/validation_error").default`});let H=$.scopeName("validate");Q.validateName=H;let K={gen:$,allErrors:this.opts.allErrors,data:O1.default.data,parentData:O1.default.parentData,parentDataProperty:O1.default.parentDataProperty,dataNames:[O1.default.data],dataPathArr:[S0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,S0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:S0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:S0._`""`,opts:this.opts,self:this},B;try{this._compilations.add(Q),(0,LF.validateFunctionCode)(K),$.optimize(this.opts.code.optimize);let D=$.toString();if(B=`${$.scopeRefs(O1.default.scope)}return ${D}`,this.opts.code.process)B=this.opts.code.process(B,Q);let U=Function(`${O1.default.self}`,`${O1.default.scope}`,B)(this,this.scope.get());if(this.scope.value(H,{ref:U}),U.errors=null,U.schema=Q.schema,U.schemaEnv=Q,Q.$async)U.$async=!0;if(this.opts.code.source===!0)U.source={validateName:H,validateCode:D,scopeValues:$._values};if(this.opts.unevaluated){let{props:O,items:M}=K;if(U.evaluated={props:O instanceof S0.Name?void 0:O,items:M instanceof S0.Name?void 0:M,dynamicProps:O instanceof S0.Name,dynamicItems:M instanceof S0.Name},U.source)U.source.evaluated=(0,S0.stringify)(U.evaluated)}return Q.validate=U,Q}catch(D){if(delete Q.validate,delete Q.validateName,B)this.logger.error("Error compiling schema, function code:",B);throw D}finally{this._compilations.delete(Q)}}A$.compileSchema=p9;function UF(Q,X,Y){var W;Y=(0,R0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=VF.call(this,Q,Y);if(J===void 0){let $=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:z}=this.opts;if($)J=new w6({schema:$,schemaId:z,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=OF.call(this,J)}A$.resolveRef=UF;function OF(Q){if((0,R0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:p9.call(this,Q)}function D$(Q){for(let X of this._compilations)if(MF(X,Q))return X}A$.getCompilingSchema=D$;function MF(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function VF(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||x4.call(this,Q,X)}function x4(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,R0._getFullPath)(this.opts.uriResolver,Y),G=(0,R0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return c9.call(this,Y,Q);let J=(0,R0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let z=x4.call(this,Q,$);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return c9.call(this,Y,z)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)p9.call(this,$);if(J===(0,R0.normalizeId)(X)){let{schema:z}=$,{schemaId:H}=this.opts,K=z[H];if(K)G=(0,R0.resolveUrl)(this.opts.uriResolver,G,K);return new w6({schema:z,schemaId:H,root:Q,baseId:G})}return c9.call(this,Y,$)}A$.resolveSchema=x4;var qF=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function c9(Q,{baseId:X,schema:Y,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let z of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let H=Y[(0,B$.unescapeFragment)(z)];if(H===void 0)return;Y=H;let K=typeof Y==="object"&&Y[this.opts.schemaId];if(!qF.has(z)&&K)X=(0,R0.resolveUrl)(this.opts.uriResolver,X,K)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,B$.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,R0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=x4.call(this,W,z)}let{schemaId:$}=this.opts;if(J=J||new w6({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var L$=Z((CP,PF)=>{PF.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 n9=Z((kP,V$)=>{var bF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),O$=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i9(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 EF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function U$(Q){return Q.length=0,!0}function IF(Q,X,Y){if(Q.length){let W=i9(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function TF(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,z=IF;for(let H=0;H<Q.length;H++){let K=Q[H];if(K==="["||K==="]")continue;if(K===":"){if(J===!0)$=!0;if(!z(G,W,Y))break;if(++X>7){Y.error=!0;break}if(H>0&&Q[H-1]===":")J=!0;W.push(":");continue}else if(K==="%"){if(!z(G,W,Y))break;z=U$}else{G.push(K);continue}}if(G.length)if(z===U$)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(i9(G));return Y.address=W.join(""),Y}function M$(Q){if(SF(Q,":")<2)return{host:Q,isIPV6:!1};let X=TF(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 SF(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function RF(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("")}function CF(Q,X){let Y=X!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=Y(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=Y(Q.userinfo);if(Q.host!==void 0)Q.host=Y(Q.host);if(Q.path!==void 0)Q.path=Y(Q.path);if(Q.query!==void 0)Q.query=Y(Q.query);if(Q.fragment!==void 0)Q.fragment=Y(Q.fragment);return Q}function kF(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(!O$(Y)){let W=M$(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=Q.host}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}V$.exports={nonSimpleDomain:EF,recomposeAuthority:kF,normalizeComponentEncoding:CF,removeDotSegments:RF,isIPv4:O$,isUUID:bF,normalizeIPv6:M$,stringArrayToHexStripped:i9}});var j$=Z((vP,w$)=>{var{isUUID:vF}=n9(),xF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,_F=["http","https","ws","wss","urn","urn:uuid"];function yF(Q){return _F.indexOf(Q)!==-1}function d9(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 q$(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function Z$(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 hF(Q){return Q.secure=d9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function uF(Q){if(Q.port===(d9(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 gF(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(xF);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=r9(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 fF(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=r9(G);if(J)Q=J.serialize(Q,X);let $=Q,z=Q.nss;return $.path=`${W||X.nid}:${z}`,X.skipEscape=!0,$}function mF(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!vF(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function lF(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var N$={scheme:"http",domainHost:!0,parse:q$,serialize:Z$},cF={scheme:"https",domainHost:N$.domainHost,parse:q$,serialize:Z$},y4={scheme:"ws",domainHost:!0,parse:hF,serialize:uF},pF={scheme:"wss",domainHost:y4.domainHost,parse:y4.parse,serialize:y4.serialize},iF={scheme:"urn",parse:gF,serialize:fF,skipNormalize:!0},nF={scheme:"urn:uuid",parse:mF,serialize:lF,skipNormalize:!0},h4={http:N$,https:cF,ws:y4,wss:pF,urn:iF,"urn:uuid":nF};Object.setPrototypeOf(h4,null);function r9(Q){return Q&&(h4[Q]||h4[Q.toLowerCase()])||void 0}w$.exports={wsIsSecure:d9,SCHEMES:h4,isValidSchemeName:yF,getSchemeHandler:r9}});var E$=Z((xP,g4)=>{var{normalizeIPv6:dF,removeDotSegments:j6,recomposeAuthority:rF,normalizeComponentEncoding:u4,isIPv4:oF,nonSimpleDomain:tF}=n9(),{SCHEMES:aF,getSchemeHandler:P$}=j$();function sF(Q,X){if(typeof Q==="string")Q=_0(n0(Q,X),X);else if(typeof Q==="object")Q=n0(_0(Q,X),X);return Q}function eF(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=b$(n0(Q,W),n0(X,W),W,!0);return W.skipEscape=!0,_0(G,W)}function b$(Q,X,Y,W){let G={};if(!W)Q=n0(_0(Q,Y),Y),X=n0(_0(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=j6(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=j6(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=j6(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=j6(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 QL(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=_0(u4(n0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=_0(u4(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=_0(u4(n0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=_0(u4(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function _0(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=P$(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=escape(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=unescape(Y.path);if(W.reference!=="suffix"&&Y.scheme)G.push(Y.scheme,":");let $=rF(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 z=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))z=j6(z);if($===void 0&&z[0]==="/"&&z[1]==="/")z="/%2F"+z.slice(2);G.push(z)}if(Y.query!==void 0)G.push("?",Y.query);if(Y.fragment!==void 0)G.push("#",Y.fragment);return G.join("")}var XL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function n0(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;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let J=Q.match(XL);if(J){if(W.scheme=J[1],W.userinfo=J[3],W.host=J[4],W.port=parseInt(J[5],10),W.path=J[6]||"",W.query=J[7],W.fragment=J[8],isNaN(W.port))W.port=J[5];if(W.host)if(oF(W.host)===!1){let H=dF(W.host);W.host=H.host.toLowerCase(),G=H.isIPV6}else G=!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 $=P$(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!$||!$.unicodeSupport)){if(W.host&&(Y.domainHost||$&&$.domainHost)&&G===!1&&tF(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(z){W.error=W.error||"Host's domain name can not be converted to ASCII: "+z}}if(!$||$&&!$.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if($&&$.parse)$.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return W}var o9={SCHEMES:aF,normalize:sF,resolve:eF,resolveComponent:b$,equal:QL,serialize:_0,parse:n0};g4.exports=o9;g4.exports.default=o9;g4.exports.fastUri=o9});var S$=Z((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});var I$=E$();I$.code='require("ajv/dist/runtime/uri").default';T$.default=I$});var h$=Z((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.CodeGen=d0.Name=d0.nil=d0.stringify=d0.str=d0._=d0.KeywordCxt=void 0;var WL=Z6();Object.defineProperty(d0,"KeywordCxt",{enumerable:!0,get:function(){return WL.KeywordCxt}});var x1=k();Object.defineProperty(d0,"_",{enumerable:!0,get:function(){return x1._}});Object.defineProperty(d0,"str",{enumerable:!0,get:function(){return x1.str}});Object.defineProperty(d0,"stringify",{enumerable:!0,get:function(){return x1.stringify}});Object.defineProperty(d0,"nil",{enumerable:!0,get:function(){return x1.nil}});Object.defineProperty(d0,"Name",{enumerable:!0,get:function(){return x1.Name}});Object.defineProperty(d0,"CodeGen",{enumerable:!0,get:function(){return x1.CodeGen}});var GL=v4(),x$=N6(),JL=T9(),P6=_4(),$L=k(),b6=M6(),f4=O6(),a9=g(),R$=L$(),zL=S$(),_$=(Q,X)=>new RegExp(Q,X);_$.code="new RegExp";var HL=["removeAdditional","useDefaults","coerceTypes"],KL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),BL={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."},DL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C$=200;function AL(Q){var X,Y,W,G,J,$,z,H,K,B,D,A,U,O,M,q,V,T,E,v,I,v0,u0,JQ,$Q;let f1=Q.strict,zQ=(X=Q.code)===null||X===void 0?void 0:X.optimize,TX=zQ===!0||zQ===void 0?1:zQ||0,SX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:_$,O5=(G=Q.uriResolver)!==null&&G!==void 0?G:zL.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:f1)!==null&&$!==void 0?$:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:f1)!==null&&H!==void 0?H:!0,strictTypes:(B=(K=Q.strictTypes)!==null&&K!==void 0?K:f1)!==null&&B!==void 0?B:"log",strictTuples:(A=(D=Q.strictTuples)!==null&&D!==void 0?D:f1)!==null&&A!==void 0?A:"log",strictRequired:(O=(U=Q.strictRequired)!==null&&U!==void 0?U:f1)!==null&&O!==void 0?O:!1,code:Q.code?{...Q.code,optimize:TX,regExp:SX}:{optimize:TX,regExp:SX},loopRequired:(M=Q.loopRequired)!==null&&M!==void 0?M:C$,loopEnum:(q=Q.loopEnum)!==null&&q!==void 0?q:C$,meta:(V=Q.meta)!==null&&V!==void 0?V:!0,messages:(T=Q.messages)!==null&&T!==void 0?T:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(v=Q.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(I=Q.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(v0=Q.validateSchema)!==null&&v0!==void 0?v0:!0,validateFormats:(u0=Q.validateFormats)!==null&&u0!==void 0?u0:!0,unicodeRegExp:(JQ=Q.unicodeRegExp)!==null&&JQ!==void 0?JQ:!0,int32range:($Q=Q.int32range)!==null&&$Q!==void 0?$Q:!0,uriResolver:O5}}class m4{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...AL(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new $L.ValueScope({scope:{},prefixes:KL,es5:X,lines:Y}),this.logger=VL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,JL.getRules)(),k$.call(this,BL,Q,"NOT SUPPORTED"),k$.call(this,DL,Q,"DEPRECATED","warn"),this._metaOpts=OL.call(this),Q.formats)LL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)UL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);FL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=R$;if(Y==="id")W={...R$},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,B){await G.call(this,K.$schema);let D=this._addSchema(K,B);return D.validate||J.call(this,D)}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(B){if(!(B instanceof x$.default))throw B;return $.call(this,B),await z.call(this,B.missingSchema),J.call(this,K)}}function $({missingSchema:K,missingRef:B}){if(this.refs[K])throw Error(`AnySchema ${K} is loaded but ${B} cannot be resolved`)}async function z(K){let B=await H.call(this,K);if(!this.refs[K])await G.call(this,B.$schema);if(!this.refs[K])this.addSchema(B,K,X)}async function H(K){let B=this._loading[K];if(B)return B;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,b6.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=v$.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new P6.SchemaEnv({schema:{},schemaId:Y});if(X=P6.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=v$.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,b6.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(ZL.call(this,Y,X),!X)return(0,a9.eachItem)(Y,(G)=>t9.call(this,G)),this;wL.call(this,X);let W={...X,type:(0,f4.getJSONTypes)(X.type),schemaType:(0,f4.getJSONTypes)(X.schemaType)};return(0,a9.eachItem)(Y,W.type.length===0?(G)=>t9.call(this,G,W):(G)=>W.type.forEach((J)=>t9.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 z=Y[$];if(typeof z!="object")continue;let{$data:H}=z.definition,K=J[$];if(H&&K)J[$]=y$(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 z=this._cache.get(Q);if(z!==void 0)return z;Y=(0,b6.normalizeId)(J||Y);let H=b6.getSchemaRefs.call(this,Q,Y);if(z=new P6.SchemaEnv({schema:Q,schemaId:$,meta:X,baseId:Y,localRefs:H}),this._cache.set(z.schema,z),G&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=z}if(W)this.validateSchema(Q,!0);return z}_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 P6.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{P6.compileSchema.call(this,Q)}finally{this.opts=X}}}m4.ValidationError=GL.default;m4.MissingRefError=x$.default;d0.default=m4;function k$(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 v$(Q){return Q=(0,b6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function FL(){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 LL(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function UL(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 OL(){let Q={...this.opts};for(let X of HL)delete Q[X];return Q}var ML={log(){},warn(){},error(){}};function VL(Q){if(Q===!1)return ML;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 qL=/^[a-z_$][a-z0-9_$:-]*$/i;function ZL(Q,X){let{RULES:Y}=this;if((0,a9.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!qL.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 t9(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:H})=>H===Y);if(!$)$={type:Y,rules:[]},J.rules.push($);if(J.keywords[Q]=!0,!X)return;let z={keyword:Q,definition:{...X,type:(0,f4.getJSONTypes)(X.type),schemaType:(0,f4.getJSONTypes)(X.schemaType)}};if(X.before)NL.call(this,$,z,X.before);else $.rules.push(z);J.all[Q]=z,(W=X.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function NL(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 wL(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=y$(X);Q.validateSchema=this.compile(X,!0)}var jL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function y$(Q){return{anyOf:[Q,jL]}}});var g$=Z((u$)=>{Object.defineProperty(u$,"__esModule",{value:!0});var EL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};u$.default=EL});var i$=Z((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.callRef=c$.getValidate=void 0;var TL=N6(),f$=j0(),O0=k(),_1=p0(),m$=_4(),l4=g(),SL={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:J,validateName:$,opts:z,self:H}=W,{root:K}=J;if((Y==="#"||Y==="#/")&&G===K.baseId)return D();let B=m$.resolveRef.call(H,K,G,Y);if(B===void 0)throw new TL.default(W.opts.uriResolver,G,Y);if(B instanceof m$.SchemaEnv)return A(B);return U(B);function D(){if(J===K)return c4(Q,$,J,J.$async);let O=X.scopeValue("root",{ref:K});return c4(Q,O0._`${O}.validate`,K,K.$async)}function A(O){let M=l$(Q,O);c4(Q,M,O,O.$async)}function U(O){let M=X.scopeValue("schema",z.code.source===!0?{ref:O,code:(0,O0.stringify)(O)}:{ref:O}),q=X.name("valid"),V=Q.subschema({schema:O,dataTypes:[],schemaPath:O0.nil,topSchemaRef:M,errSchemaPath:Y},q);Q.mergeEvaluated(V),Q.ok(q)}}};function l$(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):O0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}c$.getValidate=l$;function c4(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:z,opts:H}=J,K=H.passContext?_1.default.this:O0.nil;if(W)B();else D();function B(){if(!z.$async)throw Error("async schema referenced by sync schema");let O=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,f$.callValidateCode)(Q,X,K)}`),U(X),!$)G.assign(O,!0)},(M)=>{if(G.if(O0._`!(${M} instanceof ${J.ValidationError})`,()=>G.throw(M)),A(M),!$)G.assign(O,!1)}),Q.ok(O)}function D(){Q.result((0,f$.callValidateCode)(Q,X,K),()=>U(X),()=>A(X))}function A(O){let M=O0._`${O}.errors`;G.assign(_1.default.vErrors,O0._`${_1.default.vErrors} === null ? ${M} : ${_1.default.vErrors}.concat(${M})`),G.assign(_1.default.errors,O0._`${_1.default.vErrors}.length`)}function U(O){var M;if(!J.opts.unevaluated)return;let q=(M=Y===null||Y===void 0?void 0:Y.validate)===null||M===void 0?void 0:M.evaluated;if(J.props!==!0)if(q&&!q.dynamicProps){if(q.props!==void 0)J.props=l4.mergeEvaluated.props(G,q.props,J.props)}else{let V=G.var("props",O0._`${O}.evaluated.props`);J.props=l4.mergeEvaluated.props(G,V,J.props,O0.Name)}if(J.items!==!0)if(q&&!q.dynamicItems){if(q.items!==void 0)J.items=l4.mergeEvaluated.items(G,q.items,J.items)}else{let V=G.var("items",O0._`${O}.evaluated.items`);J.items=l4.mergeEvaluated.items(G,V,J.items,O0.Name)}}}c$.callRef=c4;c$.default=SL});var d$=Z((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});var kL=g$(),vL=i$(),xL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",kL.default,vL.default];n$.default=xL});var o$=Z((r$)=>{Object.defineProperty(r$,"__esModule",{value:!0});var p4=k(),z1=p4.operators,i4={maximum:{okStr:"<=",ok:z1.LTE,fail:z1.GT},minimum:{okStr:">=",ok:z1.GTE,fail:z1.LT},exclusiveMaximum:{okStr:"<",ok:z1.LT,fail:z1.GTE},exclusiveMinimum:{okStr:">",ok:z1.GT,fail:z1.LTE}},yL={message:({keyword:Q,schemaCode:X})=>p4.str`must be ${i4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>p4._`{comparison: ${i4[Q].okStr}, limit: ${X}}`},hL={keyword:Object.keys(i4),type:"number",schemaType:"number",$data:!0,error:yL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(p4._`${Y} ${i4[X].fail} ${W} || isNaN(${Y})`)}};r$.default=hL});var a$=Z((t$)=>{Object.defineProperty(t$,"__esModule",{value:!0});var E6=k(),gL={message:({schemaCode:Q})=>E6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>E6._`{multipleOf: ${Q}}`},fL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:gL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),z=J?E6._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:E6._`${$} !== parseInt(${$})`;Q.fail$data(E6._`(${W} === 0 || (${$} = ${Y}/${W}, ${z}))`)}};t$.default=fL});var Qz=Z((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});function s$(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}e$.default=s$;s$.code='require("ajv/dist/runtime/ucs2length").default'});var Yz=Z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});var M1=k(),cL=g(),pL=Qz(),iL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return M1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>M1._`{limit: ${Q}}`},nL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:iL,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?M1.operators.GT:M1.operators.LT,$=G.opts.unicode===!1?M1._`${Y}.length`:M1._`${(0,cL.useFunc)(Q.gen,pL.default)}(${Y})`;Q.fail$data(M1._`${$} ${J} ${W}`)}};Xz.default=nL});var Gz=Z((Wz)=>{Object.defineProperty(Wz,"__esModule",{value:!0});var rL=j0(),n4=k(),oL={message:({schemaCode:Q})=>n4.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>n4._`{pattern: ${Q}}`},tL={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:oL,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:J}=Q,$=J.opts.unicodeRegExp?"u":"",z=Y?n4._`(new RegExp(${G}, ${$}))`:(0,rL.usePattern)(Q,W);Q.fail$data(n4._`!${z}.test(${X})`)}};Wz.default=tL});var $z=Z((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});var I6=k(),sL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return I6.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>I6._`{limit: ${Q}}`},eL={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:sL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?I6.operators.GT:I6.operators.LT;Q.fail$data(I6._`Object.keys(${Y}).length ${G} ${W}`)}};Jz.default=eL});var Hz=Z((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});var T6=j0(),S6=k(),XU=g(),YU={message:({params:{missingProperty:Q}})=>S6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>S6._`{missingProperty: ${Q}}`},WU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:YU,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:J,it:$}=Q,{opts:z}=$;if(!J&&Y.length===0)return;let H=Y.length>=z.loopRequired;if($.allErrors)K();else B();if(z.strictRequired){let U=Q.parentSchema.properties,{definedProperties:O}=Q.it;for(let M of Y)if((U===null||U===void 0?void 0:U[M])===void 0&&!O.has(M)){let q=$.schemaEnv.baseId+$.errSchemaPath,V=`required property "${M}" is not defined at "${q}" (strictRequired)`;(0,XU.checkStrictMode)($,V,$.opts.strictRequired)}}function K(){if(H||J)Q.block$data(S6.nil,D);else for(let U of Y)(0,T6.checkReportMissingProp)(Q,U)}function B(){let U=X.let("missing");if(H||J){let O=X.let("valid",!0);Q.block$data(O,()=>A(U,O)),Q.ok(O)}else X.if((0,T6.checkMissingProp)(Q,Y,U)),(0,T6.reportMissingProp)(Q,U),X.else()}function D(){X.forOf("prop",W,(U)=>{Q.setParams({missingProperty:U}),X.if((0,T6.noPropertyInData)(X,G,U,z.ownProperties),()=>Q.error())})}function A(U,O){Q.setParams({missingProperty:U}),X.forOf(U,W,()=>{X.assign(O,(0,T6.propertyInData)(X,G,U,z.ownProperties)),X.if((0,S6.not)(O),()=>{Q.error(),X.break()})},S6.nil)}}};zz.default=WU});var Bz=Z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var R6=k(),JU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return R6.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>R6._`{limit: ${Q}}`},$U={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:JU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?R6.operators.GT:R6.operators.LT;Q.fail$data(R6._`${Y}.length ${G} ${W}`)}};Kz.default=$U});var d4=Z((Az)=>{Object.defineProperty(Az,"__esModule",{value:!0});var Dz=y9();Dz.code='require("ajv/dist/runtime/equal").default';Az.default=Dz});var Lz=Z((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var s9=O6(),$0=k(),KU=g(),BU=d4(),DU={message:({params:{i:Q,j:X}})=>$0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>$0._`{i: ${Q}, j: ${X}}`},AU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:DU,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:J,schemaCode:$,it:z}=Q;if(!W&&!G)return;let H=X.let("valid"),K=J.items?(0,s9.getSchemaTypes)(J.items):[];Q.block$data(H,B,$0._`${$} === false`),Q.ok(H);function B(){let O=X.let("i",$0._`${Y}.length`),M=X.let("j");Q.setParams({i:O,j:M}),X.assign(H,!0),X.if($0._`${O} > 1`,()=>(D()?A:U)(O,M))}function D(){return K.length>0&&!K.some((O)=>O==="object"||O==="array")}function A(O,M){let q=X.name("item"),V=(0,s9.checkDataTypes)(K,q,z.opts.strictNumbers,s9.DataType.Wrong),T=X.const("indices",$0._`{}`);X.for($0._`;${O}--;`,()=>{if(X.let(q,$0._`${Y}[${O}]`),X.if(V,$0._`continue`),K.length>1)X.if($0._`typeof ${q} == "string"`,$0._`${q} += "_"`);X.if($0._`typeof ${T}[${q}] == "number"`,()=>{X.assign(M,$0._`${T}[${q}]`),Q.error(),X.assign(H,!1).break()}).code($0._`${T}[${q}] = ${O}`)})}function U(O,M){let q=(0,KU.useFunc)(X,BU.default),V=X.name("outer");X.label(V).for($0._`;${O}--;`,()=>X.for($0._`${M} = ${O}; ${M}--;`,()=>X.if($0._`${q}(${Y}[${O}], ${Y}[${M}])`,()=>{Q.error(),X.assign(H,!1).break(V)})))}}};Fz.default=AU});var Oz=Z((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});var e9=k(),LU=g(),UU=d4(),OU={message:"must be equal to constant",params:({schemaCode:Q})=>e9._`{allowedValue: ${Q}}`},MU={keyword:"const",$data:!0,error:OU,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(e9._`!${(0,LU.useFunc)(X,UU.default)}(${Y}, ${G})`);else Q.fail(e9._`${J} !== ${Y}`)}};Uz.default=MU});var Vz=Z((Mz)=>{Object.defineProperty(Mz,"__esModule",{value:!0});var C6=k(),qU=g(),ZU=d4(),NU={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>C6._`{allowedValues: ${Q}}`},wU={keyword:"enum",schemaType:"array",$data:!0,error:NU,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 z=G.length>=$.opts.loopEnum,H,K=()=>H!==null&&H!==void 0?H:H=(0,qU.useFunc)(X,ZU.default),B;if(z||W)B=X.let("valid"),Q.block$data(B,D);else{if(!Array.isArray(G))throw Error("ajv implementation error");let U=X.const("vSchema",J);B=(0,C6.or)(...G.map((O,M)=>A(U,M)))}Q.pass(B);function D(){X.assign(B,!1),X.forOf("v",J,(U)=>X.if(C6._`${K()}(${Y}, ${U})`,()=>X.assign(B,!0).break()))}function A(U,O){let M=G[O];return typeof M==="object"&&M!==null?C6._`${K()}(${Y}, ${U}[${O}])`:C6._`${Y} === ${M}`}}};Mz.default=wU});var Zz=Z((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});var PU=o$(),bU=a$(),EU=Yz(),IU=Gz(),TU=$z(),SU=Hz(),RU=Bz(),CU=Lz(),kU=Oz(),vU=Vz(),xU=[PU.default,bU.default,EU.default,IU.default,TU.default,SU.default,RU.default,CU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},kU.default,vU.default];qz.default=xU});var XX=Z((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});wz.validateAdditionalItems=void 0;var V1=k(),QX=g(),yU={message:({params:{len:Q}})=>V1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>V1._`{limit: ${Q}}`},hU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:yU,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,QX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}Nz(Q,W)}};function Nz(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let z=Y.const("len",V1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(V1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,QX.alwaysValidSchema)($,W)){let K=Y.var("valid",V1._`${z} <= ${X.length}`);Y.if((0,V1.not)(K),()=>H(K)),Q.ok(K)}function H(K){Y.forRange("i",X.length,z,(B)=>{if(Q.subschema({keyword:J,dataProp:B,dataPropType:QX.Type.Num},K),!$.allErrors)Y.if((0,V1.not)(K),()=>Y.break())})}}wz.validateAdditionalItems=Nz;wz.default=hU});var YX=Z((Ez)=>{Object.defineProperty(Ez,"__esModule",{value:!0});Ez.validateTuple=void 0;var Pz=k(),r4=g(),gU=j0(),fU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return bz(Q,"additionalItems",X);if(Y.items=!0,(0,r4.alwaysValidSchema)(Y,X))return;Q.ok((0,gU.validateArray)(Q))}};function bz(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:z}=Q;if(B(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=r4.mergeEvaluated.items(W,Y.length,z.items);let H=W.name("valid"),K=W.const("len",Pz._`${J}.length`);Y.forEach((D,A)=>{if((0,r4.alwaysValidSchema)(z,D))return;W.if(Pz._`${K} > ${A}`,()=>Q.subschema({keyword:$,schemaProp:A,dataProp:A},H)),Q.ok(H)});function B(D){let{opts:A,errSchemaPath:U}=z,O=Y.length,M=O===D.minItems&&(O===D.maxItems||D[X]===!1);if(A.strictTuples&&!M){let q=`"${$}" is ${O}-tuple, but minItems or maxItems/${X} are not specified or different at path "${U}"`;(0,r4.checkStrictMode)(z,q,A.strictTuples)}}}Ez.validateTuple=bz;Ez.default=fU});var Sz=Z((Tz)=>{Object.defineProperty(Tz,"__esModule",{value:!0});var lU=YX(),cU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,lU.validateTuple)(Q,"items")};Tz.default=cU});var kz=Z((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});var Rz=k(),iU=g(),nU=j0(),dU=XX(),rU={message:({params:{len:Q}})=>Rz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Rz._`{limit: ${Q}}`},oU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:rU,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,iU.alwaysValidSchema)(W,X))return;if(G)(0,dU.validateAdditionalItems)(Q,G);else Q.ok((0,nU.validateArray)(Q))}};Cz.default=oU});var xz=Z((vz)=>{Object.defineProperty(vz,"__esModule",{value:!0});var P0=k(),o4=g(),aU={message:({params:{min:Q,max:X}})=>X===void 0?P0.str`must contain at least ${Q} valid item(s)`:P0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?P0._`{minContains: ${Q}}`:P0._`{minContains: ${Q}, maxContains: ${X}}`},sU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:aU,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,z,{minContains:H,maxContains:K}=W;if(J.opts.next)$=H===void 0?1:H,z=K;else $=1;let B=X.const("len",P0._`${G}.length`);if(Q.setParams({min:$,max:z}),z===void 0&&$===0){(0,o4.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&$>z){(0,o4.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,o4.alwaysValidSchema)(J,Y)){let M=P0._`${B} >= ${$}`;if(z!==void 0)M=P0._`${M} && ${B} <= ${z}`;Q.pass(M);return}J.items=!0;let D=X.name("valid");if(z===void 0&&$===1)U(D,()=>X.if(D,()=>X.break()));else if($===0){if(X.let(D,!0),z!==void 0)X.if(P0._`${G}.length > 0`,A)}else X.let(D,!1),A();Q.result(D,()=>Q.reset());function A(){let M=X.name("_valid"),q=X.let("count",0);U(M,()=>X.if(M,()=>O(q)))}function U(M,q){X.forRange("i",0,B,(V)=>{Q.subschema({keyword:"contains",dataProp:V,dataPropType:o4.Type.Num,compositeRule:!0},M),q()})}function O(M){if(X.code(P0._`${M}++`),z===void 0)X.if(P0._`${M} >= ${$}`,()=>X.assign(D,!0).break());else if(X.if(P0._`${M} > ${z}`,()=>X.assign(D,!1).break()),$===1)X.assign(D,!0);else X.if(P0._`${M} >= ${$}`,()=>X.assign(D,!0))}}};vz.default=sU});var fz=Z((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});hz.validateSchemaDeps=hz.validatePropertyDeps=hz.error=void 0;var WX=k(),QO=g(),k6=j0();hz.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return WX.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>WX._`{property: ${Q},
7
7
  missingProperty: ${W},
8
8
  depsCount: ${X},
9
- deps: ${Y}}`};var QO={keyword:"dependencies",type:"object",schemaType:"object",error:hz.error,code(Q){let[X,Y]=XO(Q);_z(Q,X),yz(Q,Y)}};function XO({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 _z(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 z=X[$];if(z.length===0)continue;let H=(0,k6.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(H,()=>{for(let K of z)(0,k6.checkReportMissingProp)(Q,K)});else Y.if(WX._`${H} && (${(0,k6.checkMissingProp)(Q,z,J)})`),(0,k6.reportMissingProp)(Q,J),Y.else()}}hz.validatePropertyDeps=_z;function yz(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let z in X){if((0,eU.alwaysValidSchema)(J,X[z]))continue;Y.if((0,k6.propertyInData)(Y,W,z,J.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},$);Q.mergeValidEvaluated(H,$)},()=>Y.var($,!0)),Q.ok($)}}hz.validateSchemaDeps=yz;hz.default=QO});var cz=Z((lz)=>{Object.defineProperty(lz,"__esModule",{value:!0});var mz=k(),GO=g(),JO={message:"property name must be valid",params:({params:Q})=>mz._`{propertyName: ${Q.propertyName}}`},$O={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:JO,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,GO.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,mz.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};lz.default=$O});var GX=Z((pz)=>{Object.defineProperty(pz,"__esModule",{value:!0});var t4=j0(),C0=k(),HO=p0(),a4=g(),KO={message:"must NOT have additional properties",params:({params:Q})=>C0._`{additionalProperty: ${Q.additionalProperty}}`},BO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:KO,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:J,it:$}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:z,opts:H}=$;if($.props=!0,H.removeAdditional!=="all"&&(0,a4.alwaysValidSchema)($,Y))return;let K=(0,t4.allSchemaProperties)(W.properties),B=(0,t4.allSchemaProperties)(W.patternProperties);D(),Q.ok(C0._`${J} === ${HO.default.errors}`);function D(){X.forIn("key",G,(q)=>{if(!K.length&&!B.length)O(q);else X.if(A(q),()=>O(q))})}function A(q){let V;if(K.length>8){let T=(0,a4.schemaRefOrVal)($,W.properties,"properties");V=(0,t4.isOwnProperty)(X,T,q)}else if(K.length)V=(0,C0.or)(...K.map((T)=>C0._`${q} === ${T}`));else V=C0.nil;if(B.length)V=(0,C0.or)(V,...B.map((T)=>C0._`${(0,t4.usePattern)(Q,T)}.test(${q})`));return(0,C0.not)(V)}function U(q){X.code(C0._`delete ${G}[${q}]`)}function O(q){if(H.removeAdditional==="all"||H.removeAdditional&&Y===!1){U(q);return}if(Y===!1){if(Q.setParams({additionalProperty:q}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,a4.alwaysValidSchema)($,Y)){let V=X.name("valid");if(H.removeAdditional==="failing")M(q,V,!1),X.if((0,C0.not)(V),()=>{Q.reset(),U(q)});else if(M(q,V),!z)X.if((0,C0.not)(V),()=>X.break())}}function M(q,V,T){let E={keyword:"additionalProperties",dataProp:q,dataPropType:a4.Type.Str};if(T===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,V)}}};pz.default=BO});var rz=Z((dz)=>{Object.defineProperty(dz,"__esModule",{value:!0});var AO=Z6(),iz=j0(),JX=g(),nz=GX(),FO={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)nz.default.code(new AO.KeywordCxt(J,nz.default,"additionalProperties"));let $=(0,iz.allSchemaProperties)(Y);for(let D of $)J.definedProperties.add(D);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=JX.mergeEvaluated.props(X,(0,JX.toHash)($),J.props);let z=$.filter((D)=>!(0,JX.alwaysValidSchema)(J,Y[D]));if(z.length===0)return;let H=X.name("valid");for(let D of z){if(K(D))B(D);else{if(X.if((0,iz.propertyInData)(X,G,D,J.opts.ownProperties)),B(D),!J.allErrors)X.else().var(H,!0);X.endIf()}Q.it.definedProperties.add(D),Q.ok(H)}function K(D){return J.opts.useDefaults&&!J.compositeRule&&Y[D].default!==void 0}function B(D){Q.subschema({keyword:"properties",schemaProp:D,dataProp:D},H)}}};dz.default=FO});var ez=Z((sz)=>{Object.defineProperty(sz,"__esModule",{value:!0});var oz=j0(),s4=k(),tz=g(),az=g(),UO={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,z=(0,oz.allSchemaProperties)(Y),H=z.filter((M)=>(0,tz.alwaysValidSchema)(J,Y[M]));if(z.length===0||H.length===z.length&&(!J.opts.unevaluated||J.props===!0))return;let K=$.strictSchema&&!$.allowMatchingProperties&&G.properties,B=X.name("valid");if(J.props!==!0&&!(J.props instanceof s4.Name))J.props=(0,az.evaluatedPropsToName)(X,J.props);let{props:D}=J;A();function A(){for(let M of z){if(K)U(M);if(J.allErrors)O(M);else X.var(B,!0),O(M),X.if(B)}}function U(M){for(let q in K)if(new RegExp(M).test(q))(0,tz.checkStrictMode)(J,`property ${q} matches pattern ${M} (use allowMatchingProperties)`)}function O(M){X.forIn("key",W,(q)=>{X.if(s4._`${(0,oz.usePattern)(Q,M)}.test(${q})`,()=>{let V=H.includes(M);if(!V)Q.subschema({keyword:"patternProperties",schemaProp:M,dataProp:q,dataPropType:az.Type.Str},B);if(J.opts.unevaluated&&D!==!0)X.assign(s4._`${D}[${q}]`,!0);else if(!V&&!J.allErrors)X.if((0,s4.not)(B),()=>X.break())})})}}};sz.default=UO});var X7=Z((Q7)=>{Object.defineProperty(Q7,"__esModule",{value:!0});var MO=g(),VO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,MO.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"}};Q7.default=VO});var W7=Z((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});var ZO=j0(),NO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ZO.validateUnion,error:{message:"must match a schema in anyOf"}};Y7.default=NO});var J7=Z((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});var e4=k(),jO=g(),PO={message:"must match exactly one schema in oneOf",params:({params:Q})=>e4._`{passingSchemas: ${Q.passing}}`},bO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:PO,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),z=X.let("passing",null),H=X.name("_valid");Q.setParams({passing:z}),X.block(K),Q.result($,()=>Q.reset(),()=>Q.error(!0));function K(){J.forEach((B,D)=>{let A;if((0,jO.alwaysValidSchema)(G,B))X.var(H,!0);else A=Q.subschema({keyword:"oneOf",schemaProp:D,compositeRule:!0},H);if(D>0)X.if(e4._`${H} && ${$}`).assign($,!1).assign(z,e4._`[${z}, ${D}]`).else();X.if(H,()=>{if(X.assign($,!0),X.assign(z,D),A)Q.mergeEvaluated(A,e4.Name)})})}}};G7.default=bO});var z7=Z(($7)=>{Object.defineProperty($7,"__esModule",{value:!0});var IO=g(),TO={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,IO.alwaysValidSchema)(W,J))return;let z=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(z)})}};$7.default=TO});var D7=Z((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});var QQ=k(),K7=g(),RO={message:({params:Q})=>QQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>QQ._`{failingKeyword: ${Q.ifClause}}`},CO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:RO,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,K7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=H7(W,"then"),J=H7(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),z=X.name("_valid");if(H(),Q.reset(),G&&J){let B=X.let("ifClause");Q.setParams({ifClause:B}),X.if(z,K("then",B),K("else",B))}else if(G)X.if(z,K("then"));else X.if((0,QQ.not)(z),K("else"));Q.pass($,()=>Q.error(!0));function H(){let B=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(B)}function K(B,D){return()=>{let A=Q.subschema({keyword:B},z);if(X.assign($,z),Q.mergeValidEvaluated(A,$),D)X.assign(D,QQ._`${B}`);else Q.setParams({ifClause:B})}}}};function H7(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,K7.alwaysValidSchema)(Q,Y)}B7.default=CO});var F7=Z((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var vO=g(),xO={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,vO.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};A7.default=xO});var U7=Z((L7)=>{Object.defineProperty(L7,"__esModule",{value:!0});var yO=XX(),hO=Sz(),uO=YX(),gO=kz(),fO=xz(),mO=fz(),lO=cz(),cO=GX(),pO=rz(),iO=ez(),nO=X7(),dO=W7(),rO=J7(),oO=z7(),tO=D7(),aO=F7();function sO(Q=!1){let X=[nO.default,dO.default,rO.default,oO.default,tO.default,aO.default,lO.default,cO.default,mO.default,pO.default,iO.default];if(Q)X.push(hO.default,gO.default);else X.push(yO.default,uO.default);return X.push(fO.default),X}L7.default=sO});var M7=Z((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var e=k(),QM={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},XM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:QM,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:z}=Q,{opts:H,errSchemaPath:K,schemaEnv:B,self:D}=z;if(!H.validateFormats)return;if(G)A();else U();function A(){let O=Y.scopeValue("formats",{ref:D.formats,code:H.code.formats}),M=Y.const("fDef",e._`${O}[${$}]`),q=Y.let("fType"),V=Y.let("format");Y.if(e._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>Y.assign(q,e._`${M}.type || "string"`).assign(V,e._`${M}.validate`),()=>Y.assign(q,e._`"string"`).assign(V,M)),Q.fail$data((0,e.or)(T(),E()));function T(){if(H.strictSchema===!1)return e.nil;return e._`${$} && !${V}`}function E(){let v=B.$async?e._`(${M}.async ? await ${V}(${W}) : ${V}(${W}))`:e._`${V}(${W})`,I=e._`(typeof ${V} == "function" ? ${v} : ${V}.test(${W}))`;return e._`${V} && ${V} !== true && ${q} === ${X} && !${I}`}}function U(){let O=D.formats[J];if(!O){T();return}if(O===!0)return;let[M,q,V]=E(O);if(M===X)Q.pass(v());function T(){if(H.strictSchema===!1){D.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${J}" ignored in schema at path "${K}"`}}function E(I){let v0=I instanceof RegExp?(0,e.regexpCode)(I):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)(J)}`:void 0,u0=Y.scopeValue("formats",{key:J,ref:I,code:v0});if(typeof I=="object"&&!(I instanceof RegExp))return[I.type||"string",I.validate,e._`${u0}.validate`];return["string",I,u0]}function v(){if(typeof O=="object"&&!(O instanceof RegExp)&&O.async){if(!B.$async)throw Error("async format in sync schema");return e._`await ${V}(${W})`}return typeof q=="function"?e._`${V}(${W})`:e._`${V}.test(${W})`}}}};O7.default=XM});var q7=Z((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});var WM=M7(),GM=[WM.default];V7.default=GM});var w7=Z((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});Z7.contentVocabulary=Z7.metadataVocabulary=void 0;Z7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Z7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var b7=Z((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});var zM=d$(),HM=Zz(),KM=U7(),BM=q7(),j7=w7(),DM=[zM.default,HM.default,(0,KM.default)(),BM.default,j7.metadataVocabulary,j7.contentVocabulary];P7.default=DM});var S7=Z((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.DiscrError=void 0;var E7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(E7||(I7.DiscrError=E7={}))});var k7=Z((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});var y1=k(),$X=S7(),R7=_4(),FM=N6(),LM=g(),UM={message:({params:{discrError:Q,tagName:X}})=>Q===$X.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>y1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},OM={keyword:"discriminator",type:"object",schemaType:"object",error:UM,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 z=W.propertyName;if(typeof z!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!$)throw Error("discriminator: requires oneOf keyword");let H=X.let("valid",!1),K=X.const("tag",y1._`${Y}${(0,y1.getProperty)(z)}`);X.if(y1._`typeof ${K} == "string"`,()=>B(),()=>Q.error(!1,{discrError:$X.DiscrError.Tag,tag:K,tagName:z})),Q.ok(H);function B(){let U=A();X.if(!1);for(let O in U)X.elseIf(y1._`${K} === ${O}`),X.assign(H,D(U[O]));X.else(),Q.error(!1,{discrError:$X.DiscrError.Mapping,tag:K,tagName:z}),X.endIf()}function D(U){let O=X.name("valid"),M=Q.subschema({keyword:"oneOf",schemaProp:U},O);return Q.mergeEvaluated(M,y1.Name),O}function A(){var U;let O={},M=V(G),q=!0;for(let v=0;v<$.length;v++){let I=$[v];if((I===null||I===void 0?void 0:I.$ref)&&!(0,LM.schemaHasRulesButRef)(I,J.self.RULES)){let u0=I.$ref;if(I=R7.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,u0),I instanceof R7.SchemaEnv)I=I.schema;if(I===void 0)throw new FM.default(J.opts.uriResolver,J.baseId,u0)}let v0=(U=I===null||I===void 0?void 0:I.properties)===null||U===void 0?void 0:U[z];if(typeof v0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);q=q&&(M||V(I)),T(v0,v)}if(!q)throw Error(`discriminator: "${z}" must be required`);return O;function V({required:v}){return Array.isArray(v)&&v.includes(z)}function T(v,I){if(v.const)E(v.const,I);else if(v.enum)for(let v0 of v.enum)E(v0,I);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(v,I){if(typeof v!="string"||v in O)throw Error(`discriminator: "${z}" values must be unique strings`);O[v]=I}}}};C7.default=OM});var v7=Z((Ib,VM)=>{VM.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 HX=Z((M0,zX)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var qM=h$(),ZM=b7(),NM=k7(),x7=v7(),wM=["/properties"],XQ="http://json-schema.org/draft-07/schema";class v6 extends qM.default{_addVocabularies(){if(super._addVocabularies(),ZM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(NM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(x7,wM):x7;this.addMetaSchema(Q,XQ,!1),this.refs["http://json-schema.org/schema"]=XQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(XQ)?XQ:void 0)}}M0.Ajv=v6;zX.exports=M0=v6;zX.exports.Ajv=v6;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=v6;var jM=Z6();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return jM.KeywordCxt}});var h1=k();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return h1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return h1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return h1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return h1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return h1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return h1.CodeGen}});var PM=v4();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return PM.default}});var bM=N6();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return bM.default}})});var p7=Z((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.formatNames=l7.fastFormats=l7.fullFormats=void 0;function y0(Q,X){return{validate:Q,compare:X}}l7.fullFormats={date:y0(u7,AX),time:y0(BX(!0),FX),"date-time":y0(_7(!0),f7),"iso-time":y0(BX(),g7),"iso-date-time":y0(_7(),m7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vM,"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:fM,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:xM,int32:{type:"number",validate:hM},int64:{type:"number",validate:uM},float:{type:"number",validate:h7},double:{type:"number",validate:h7},password:!0,binary:!0};l7.fastFormats={...l7.fullFormats,date:y0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,AX),time:y0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FX),"date-time":y0(/^\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,f7),"iso-time":y0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,g7),"iso-date-time":y0(/^\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,m7),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};l7.formatNames=Object.keys(l7.fullFormats);function TM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var SM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,RM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function u7(Q){let X=SM.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&&TM(Y)?29:RM[W])}function AX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var KX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function BX(Q){return function(Y){let W=KX.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],z=W[4],H=W[5]==="-"?-1:1,K=+(W[6]||0),B=+(W[7]||0);if(K>23||B>59||Q&&!z)return!1;if(G<=23&&J<=59&&$<60)return!0;let D=J-B*H,A=G-K*H-(D<0?1:0);return(A===23||A===-1)&&(D===59||D===-1)&&$<61}}function FX(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 g7(Q,X){if(!(Q&&X))return;let Y=KX.exec(Q),W=KX.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 DX=/t|\s/i;function _7(Q){let X=BX(Q);return function(W){let G=W.split(DX);return G.length===2&&u7(G[0])&&X(G[1])}}function f7(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 m7(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(DX),[G,J]=X.split(DX),$=AX(Y,G);if($===void 0)return;return $||FX(W,J)}var CM=/\/|:/,kM=/^(?:[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 vM(Q){return CM.test(Q)&&kM.test(Q)}var y7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function xM(Q){return y7.lastIndex=0,y7.test(Q)}var _M=-2147483648,yM=2147483647;function hM(Q){return Number.isInteger(Q)&&Q<=yM&&Q>=_M}function uM(Q){return Number.isInteger(Q)}function h7(){return!0}var gM=/[^\\]\\Z/;function fM(Q){if(gM.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var n7=Z((i7)=>{Object.defineProperty(i7,"__esModule",{value:!0});i7.formatLimitDefinition=void 0;var lM=HX(),k0=k(),H1=k0.operators,YQ={formatMaximum:{okStr:"<=",ok:H1.LTE,fail:H1.GT},formatMinimum:{okStr:">=",ok:H1.GTE,fail:H1.LT},formatExclusiveMaximum:{okStr:"<",ok:H1.LT,fail:H1.GTE},formatExclusiveMinimum:{okStr:">",ok:H1.GT,fail:H1.LTE}},cM={message:({keyword:Q,schemaCode:X})=>k0.str`should be ${YQ[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>k0._`{comparison: ${YQ[Q].okStr}, limit: ${X}}`};i7.formatLimitDefinition={keyword:Object.keys(YQ),type:"string",schemaType:"string",$data:!0,error:cM,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:z}=J;if(!$.validateFormats)return;let H=new lM.KeywordCxt(J,z.RULES.all.format.definition,"format");if(H.$data)K();else B();function K(){let A=X.scopeValue("formats",{ref:z.formats,code:$.code.formats}),U=X.const("fmt",k0._`${A}[${H.schemaCode}]`);Q.fail$data((0,k0.or)(k0._`typeof ${U} != "object"`,k0._`${U} instanceof RegExp`,k0._`typeof ${U}.compare != "function"`,D(U)))}function B(){let A=H.schema,U=z.formats[A];if(!U||U===!0)return;if(typeof U!="object"||U instanceof RegExp||typeof U.compare!="function")throw Error(`"${G}": format "${A}" does not define "compare" function`);let O=X.scopeValue("formats",{key:A,ref:U,code:$.code.formats?k0._`${$.code.formats}${(0,k0.getProperty)(A)}`:void 0});Q.fail$data(D(O))}function D(A){return k0._`${A}.compare(${Y}, ${W}) ${YQ[G].fail} 0`}},dependencies:["format"]};var pM=(Q)=>{return Q.addKeyword(i7.formatLimitDefinition),Q};i7.default=pM});var t7=Z((x6,o7)=>{Object.defineProperty(x6,"__esModule",{value:!0});var u1=p7(),nM=n7(),OX=k(),d7=new OX.Name("fullFormats"),dM=new OX.Name("fastFormats"),MX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return r7(Q,X,u1.fullFormats,d7),Q;let[Y,W]=X.mode==="fast"?[u1.fastFormats,dM]:[u1.fullFormats,d7],G=X.formats||u1.formatNames;if(r7(Q,G,Y,W),X.keywords)(0,nM.default)(Q);return Q};MX.get=(Q,X="full")=>{let W=(X==="fast"?u1.fastFormats:u1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function r7(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=OX._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}o7.exports=x6=MX;Object.defineProperty(x6,"__esModule",{value:!0});x6.default=MX});var LV=Object.freeze({status:"aborted"});function L(Q,X,Y){function W(z,H){var K;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(K=z._zod).traits??(K.traits=new Set),z._zod.traits.add(Q),X(z,H);for(let B in $.prototype)if(!(B in z))Object.defineProperty(z,B,{value:$.prototype[B].bind(z)});z._zod.constr=$,z._zod.def=H}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function $(z){var H;let K=Y?.Parent?new J:this;W(K,z),(H=K._zod).deferred??(H.deferred=[]);for(let B of K._zod.deferred)B();return K}return Object.defineProperty($,"init",{value:W}),Object.defineProperty($,Symbol.hasInstance,{value:(z)=>{if(Y?.Parent&&z instanceof Y.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty($,"name",{value:Q}),$}var UV=Symbol("zod_brand");class g0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class m1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var h6={};function Z0(Q){if(Q)Object.assign(h6,Q);return h6}var u={};CX(u,{unwrapMessage:()=>l1,uint8ArrayToHex:()=>o5,uint8ArrayToBase64url:()=>d5,uint8ArrayToBase64:()=>uX,stringifyPrimitive:()=>m6,shallowClone:()=>vX,safeExtend:()=>m5,required:()=>p5,randomString:()=>x5,propertyKeyTypes:()=>FQ,promiseAllObject:()=>v5,primitiveTypes:()=>xX,prefixIssues:()=>m0,pick:()=>u5,partial:()=>c5,optionalKeys:()=>LQ,omit:()=>g5,objectClone:()=>R5,numKeys:()=>_5,nullish:()=>c1,normalizeParams:()=>b,mergeDefs:()=>t0,merge:()=>l5,jsonStringifyReplacer:()=>Z1,joinValues:()=>u6,issue:()=>w1,isPlainObject:()=>a0,isObject:()=>D1,hexToUint8Array:()=>r5,getSizableOrigin:()=>yX,getParsedType:()=>y5,getLengthableOrigin:()=>i1,getEnumValues:()=>BQ,getElementAtPath:()=>k5,floatSafeRemainder:()=>DQ,finalizeIssue:()=>E0,extend:()=>f5,escapeRegex:()=>f0,esc:()=>g6,defineLazy:()=>l,createTransparentProxy:()=>h5,cloneDef:()=>C5,clone:()=>b0,cleanRegex:()=>p1,cleanEnum:()=>i5,captureStackTrace:()=>f6,cached:()=>N1,base64urlToUint8Array:()=>n5,base64ToUint8Array:()=>hX,assignProp:()=>o0,assertNotEqual:()=>E5,assertNever:()=>T5,assertIs:()=>I5,assertEqual:()=>b5,assert:()=>S5,allowsEval:()=>AQ,aborted:()=>s0,NUMBER_FORMAT_RANGES:()=>UQ,Class:()=>gX,BIGINT_FORMAT_RANGES:()=>_X});function b5(Q){return Q}function E5(Q){return Q}function I5(Q){}function T5(Q){throw Error()}function S5(Q){}function BQ(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 u6(Q,X="|"){return Q.map((Y)=>m6(Y)).join(X)}function Z1(Q,X){if(typeof X==="bigint")return X.toString();return X}function N1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function c1(Q){return Q===null||Q===void 0}function p1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function DQ(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=X.toString(),G=(W.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(W)){let H=W.match(/\d?e-(\d?)/);if(H?.[1])G=Number.parseInt(H[1])}let J=Y>G?Y:G,$=Number.parseInt(Q.toFixed(J).replace(".","")),z=Number.parseInt(X.toFixed(J).replace(".",""));return $%z/10**J}var kX=Symbol("evaluating");function l(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===kX)return;if(W===void 0)W=kX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function R5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function o0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function t0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function C5(Q){return t0(Q._zod.def)}function k5(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function v5(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 x5(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function g6(Q){return JSON.stringify(Q)}var f6="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function D1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var AQ=N1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function a0(Q){if(D1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(D1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function vX(Q){if(a0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function _5(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var y5=(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}`)}},FQ=new Set(["string","number","symbol"]),xX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function f0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function b(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 h5(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 m6(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function LQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var UQ={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]},_X={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u5(Q,X){let Y=Q._zod.def,W=t0(Q._zod.def,{get shape(){let G={};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;G[J]=Y.shape[J]}return o0(this,"shape",G),G},checks:[]});return b0(Q,W)}function g5(Q,X){let Y=Q._zod.def,W=t0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;delete G[J]}return o0(this,"shape",G),G},checks:[]});return b0(Q,W)}function f5(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)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=t0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return o0(this,"shape",J),J},checks:[]});return b0(Q,G)}function m5(Q,X){if(!a0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X};return o0(this,"shape",W),W},checks:Q._zod.def.checks};return b0(Q,Y)}function l5(Q,X){let Y=t0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return o0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return b0(Q,Y)}function c5(Q,X,Y){let W=t0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in G))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$]}else for(let $ in G)J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$];return o0(this,"shape",J),J},checks:[]});return b0(X,W)}function p5(Q,X,Y){let W=t0(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 o0(this,"shape",J),J},checks:[]});return b0(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 m0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function l1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=l1(Q.inst?._zod.def?.error?.(Q))??l1(X?.error?.(Q))??l1(Y.customError?.(Q))??l1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function yX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function i1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function w1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function i5(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function hX(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 uX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function n5(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return hX(X+Y)}function d5(Q){return uX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function r5(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 o5(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class gX{constructor(...Q){}}var fX=(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,Z1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},l6=L("$ZodError",fX),OQ=L("$ZodError",fX,{Parent:Error});function mX(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 lX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map(($)=>W({issues:$}));else if(J.code==="invalid_key")W({issues:J.issues});else if(J.code==="invalid_element")W({issues:J.issues});else if(J.path.length===0)Y._errors.push(X(J));else{let $=Y,z=0;while(z<J.path.length){let H=J.path[z];if(z!==J.path.length-1)$[H]=$[H]||{_errors:[]};else $[H]=$[H]||{_errors:[]},$[H]._errors.push(X(J));$=$[H],z++}}};return W(Q),Y}var c6=(Q)=>(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!1}):{async:!1},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)throw new g0;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((H)=>E0(H,J,Z0())));throw f6(z,G?.callee),z}return $.value};var p6=(Q)=>async(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)$=await $;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((H)=>E0(H,J,Z0())));throw f6(z,G?.callee),z}return $.value};var n1=(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 g0;return J.issues.length?{success:!1,error:new(Q??l6)(J.issues.map(($)=>E0($,G,Z0())))}:{success:!0,data:J.value}},d1=n1(OQ),r1=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(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,Z0())))}:{success:!0,data:J.value}},i6=r1(OQ),cX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return c6(Q)(X,Y,G)};var pX=(Q)=>(X,Y,W)=>{return c6(Q)(X,Y,W)};var iX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return p6(Q)(X,Y,G)};var nX=(Q)=>async(X,Y,W)=>{return p6(Q)(X,Y,W)};var dX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return n1(Q)(X,Y,G)};var rX=(Q)=>(X,Y,W)=>{return n1(Q)(X,Y,W)};var oX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return r1(Q)(X,Y,G)};var tX=(Q)=>async(X,Y,W)=>{return r1(Q)(X,Y,W)};var aX=/^[cC][^\s-]{8,}$/,sX=/^[0-9a-z]+$/,eX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Q8=/^[0-9a-vA-V]{20}$/,X8=/^[A-Za-z0-9]{27}$/,Y8=/^[a-zA-Z0-9_-]{21}$/,W8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var G8=/^([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})$/,MQ=(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 J8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function $8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var z8=/^(?:(?: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])$/,H8=/^(([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}|:))$/,K8=/^((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])$/,B8=/^(([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])$/,D8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,VQ=/^[A-Za-z0-9_-]*$/,A8=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;var F8=/^\+(?:[0-9]){6,14}[0-9]$/,L8="(?:(?:\\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])))",U8=new RegExp(`^${L8}$`);function O8(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 M8(Q){return new RegExp(`^${O8(Q)}$`)}function V8(Q){let X=O8({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(`^${L8}T(?:${W})$`)}var q8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var Z8=/^-?\d+$/,N8=/^-?\d+(?:\.\d+)?/,w8=/^(?:true|false)$/i,j8=/^null$/i;var P8=/^[^A-Z]*$/,b8=/^[^a-z]*$/;var X0=L("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),E8={number:"number",bigint:"bigint",object:"date"},qQ=L("$ZodCheckLessThan",(Q,X)=>{X0.init(Q,X);let Y=E8[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:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),ZQ=L("$ZodCheckGreaterThan",(Q,X)=>{X0.init(Q,X);let Y=E8[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:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),I8=L("$ZodCheckMultipleOf",(Q,X)=>{X0.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):DQ(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})}}),T8=L("$ZodCheckNumberFormat",(Q,X)=>{X0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=UQ[X.format];Q._zod.onattach.push(($)=>{let z=$._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=J,Y)z.pattern=Z8}),Q._zod.check=($)=>{let z=$.value;if(Y){if(!Number.isInteger(z)){$.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)$.issues.push({input:z,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});else $.issues.push({input:z,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});return}}if(z<G)$.issues.push({origin:"number",input:z,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(z>J)$.issues.push({origin:"number",input:z,code:"too_big",maximum:J,inst:Q})}});var S8=L("$ZodCheckMaxLength",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),R8=L("$ZodCheckMinLength",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),C8=L("$ZodCheckLengthEquals",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G),z=J>X.length;W.issues.push({origin:$,...z?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),o1=L("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(X0.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=()=>{})}),k8=L("$ZodCheckRegex",(Q,X)=>{o1.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})}}),v8=L("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=P8),o1.init(Q,X)}),x8=L("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=b8),o1.init(Q,X)}),_8=L("$ZodCheckIncludes",(Q,X)=>{X0.init(Q,X);let Y=f0(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})}}),y8=L("$ZodCheckStartsWith",(Q,X)=>{X0.init(Q,X);let Y=new RegExp(`^${f0(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})}}),h8=L("$ZodCheckEndsWith",(Q,X)=>{X0.init(Q,X);let Y=new RegExp(`.*${f0(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 u8=L("$ZodCheckOverwrite",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class NQ{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(`
9
+ deps: ${Y}}`};var XO={keyword:"dependencies",type:"object",schemaType:"object",error:hz.error,code(Q){let[X,Y]=YO(Q);_z(Q,X),yz(Q,Y)}};function YO({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 _z(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 z=X[$];if(z.length===0)continue;let H=(0,k6.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(H,()=>{for(let K of z)(0,k6.checkReportMissingProp)(Q,K)});else Y.if(WX._`${H} && (${(0,k6.checkMissingProp)(Q,z,J)})`),(0,k6.reportMissingProp)(Q,J),Y.else()}}hz.validatePropertyDeps=_z;function yz(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let z in X){if((0,QO.alwaysValidSchema)(J,X[z]))continue;Y.if((0,k6.propertyInData)(Y,W,z,J.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},$);Q.mergeValidEvaluated(H,$)},()=>Y.var($,!0)),Q.ok($)}}hz.validateSchemaDeps=yz;hz.default=XO});var cz=Z((lz)=>{Object.defineProperty(lz,"__esModule",{value:!0});var mz=k(),JO=g(),$O={message:"property name must be valid",params:({params:Q})=>mz._`{propertyName: ${Q.propertyName}}`},zO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:$O,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,JO.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,mz.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};lz.default=zO});var GX=Z((pz)=>{Object.defineProperty(pz,"__esModule",{value:!0});var t4=j0(),C0=k(),KO=p0(),a4=g(),BO={message:"must NOT have additional properties",params:({params:Q})=>C0._`{additionalProperty: ${Q.additionalProperty}}`},DO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:BO,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:J,it:$}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:z,opts:H}=$;if($.props=!0,H.removeAdditional!=="all"&&(0,a4.alwaysValidSchema)($,Y))return;let K=(0,t4.allSchemaProperties)(W.properties),B=(0,t4.allSchemaProperties)(W.patternProperties);D(),Q.ok(C0._`${J} === ${KO.default.errors}`);function D(){X.forIn("key",G,(q)=>{if(!K.length&&!B.length)O(q);else X.if(A(q),()=>O(q))})}function A(q){let V;if(K.length>8){let T=(0,a4.schemaRefOrVal)($,W.properties,"properties");V=(0,t4.isOwnProperty)(X,T,q)}else if(K.length)V=(0,C0.or)(...K.map((T)=>C0._`${q} === ${T}`));else V=C0.nil;if(B.length)V=(0,C0.or)(V,...B.map((T)=>C0._`${(0,t4.usePattern)(Q,T)}.test(${q})`));return(0,C0.not)(V)}function U(q){X.code(C0._`delete ${G}[${q}]`)}function O(q){if(H.removeAdditional==="all"||H.removeAdditional&&Y===!1){U(q);return}if(Y===!1){if(Q.setParams({additionalProperty:q}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,a4.alwaysValidSchema)($,Y)){let V=X.name("valid");if(H.removeAdditional==="failing")M(q,V,!1),X.if((0,C0.not)(V),()=>{Q.reset(),U(q)});else if(M(q,V),!z)X.if((0,C0.not)(V),()=>X.break())}}function M(q,V,T){let E={keyword:"additionalProperties",dataProp:q,dataPropType:a4.Type.Str};if(T===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,V)}}};pz.default=DO});var rz=Z((dz)=>{Object.defineProperty(dz,"__esModule",{value:!0});var FO=Z6(),iz=j0(),JX=g(),nz=GX(),LO={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)nz.default.code(new FO.KeywordCxt(J,nz.default,"additionalProperties"));let $=(0,iz.allSchemaProperties)(Y);for(let D of $)J.definedProperties.add(D);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=JX.mergeEvaluated.props(X,(0,JX.toHash)($),J.props);let z=$.filter((D)=>!(0,JX.alwaysValidSchema)(J,Y[D]));if(z.length===0)return;let H=X.name("valid");for(let D of z){if(K(D))B(D);else{if(X.if((0,iz.propertyInData)(X,G,D,J.opts.ownProperties)),B(D),!J.allErrors)X.else().var(H,!0);X.endIf()}Q.it.definedProperties.add(D),Q.ok(H)}function K(D){return J.opts.useDefaults&&!J.compositeRule&&Y[D].default!==void 0}function B(D){Q.subschema({keyword:"properties",schemaProp:D,dataProp:D},H)}}};dz.default=LO});var ez=Z((sz)=>{Object.defineProperty(sz,"__esModule",{value:!0});var oz=j0(),s4=k(),tz=g(),az=g(),OO={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,z=(0,oz.allSchemaProperties)(Y),H=z.filter((M)=>(0,tz.alwaysValidSchema)(J,Y[M]));if(z.length===0||H.length===z.length&&(!J.opts.unevaluated||J.props===!0))return;let K=$.strictSchema&&!$.allowMatchingProperties&&G.properties,B=X.name("valid");if(J.props!==!0&&!(J.props instanceof s4.Name))J.props=(0,az.evaluatedPropsToName)(X,J.props);let{props:D}=J;A();function A(){for(let M of z){if(K)U(M);if(J.allErrors)O(M);else X.var(B,!0),O(M),X.if(B)}}function U(M){for(let q in K)if(new RegExp(M).test(q))(0,tz.checkStrictMode)(J,`property ${q} matches pattern ${M} (use allowMatchingProperties)`)}function O(M){X.forIn("key",W,(q)=>{X.if(s4._`${(0,oz.usePattern)(Q,M)}.test(${q})`,()=>{let V=H.includes(M);if(!V)Q.subschema({keyword:"patternProperties",schemaProp:M,dataProp:q,dataPropType:az.Type.Str},B);if(J.opts.unevaluated&&D!==!0)X.assign(s4._`${D}[${q}]`,!0);else if(!V&&!J.allErrors)X.if((0,s4.not)(B),()=>X.break())})})}}};sz.default=OO});var X7=Z((Q7)=>{Object.defineProperty(Q7,"__esModule",{value:!0});var VO=g(),qO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,VO.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"}};Q7.default=qO});var W7=Z((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});var NO=j0(),wO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:NO.validateUnion,error:{message:"must match a schema in anyOf"}};Y7.default=wO});var J7=Z((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});var e4=k(),PO=g(),bO={message:"must match exactly one schema in oneOf",params:({params:Q})=>e4._`{passingSchemas: ${Q.passing}}`},EO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bO,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),z=X.let("passing",null),H=X.name("_valid");Q.setParams({passing:z}),X.block(K),Q.result($,()=>Q.reset(),()=>Q.error(!0));function K(){J.forEach((B,D)=>{let A;if((0,PO.alwaysValidSchema)(G,B))X.var(H,!0);else A=Q.subschema({keyword:"oneOf",schemaProp:D,compositeRule:!0},H);if(D>0)X.if(e4._`${H} && ${$}`).assign($,!1).assign(z,e4._`[${z}, ${D}]`).else();X.if(H,()=>{if(X.assign($,!0),X.assign(z,D),A)Q.mergeEvaluated(A,e4.Name)})})}}};G7.default=EO});var z7=Z(($7)=>{Object.defineProperty($7,"__esModule",{value:!0});var TO=g(),SO={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,TO.alwaysValidSchema)(W,J))return;let z=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(z)})}};$7.default=SO});var D7=Z((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});var QQ=k(),K7=g(),CO={message:({params:Q})=>QQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>QQ._`{failingKeyword: ${Q.ifClause}}`},kO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:CO,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,K7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=H7(W,"then"),J=H7(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),z=X.name("_valid");if(H(),Q.reset(),G&&J){let B=X.let("ifClause");Q.setParams({ifClause:B}),X.if(z,K("then",B),K("else",B))}else if(G)X.if(z,K("then"));else X.if((0,QQ.not)(z),K("else"));Q.pass($,()=>Q.error(!0));function H(){let B=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(B)}function K(B,D){return()=>{let A=Q.subschema({keyword:B},z);if(X.assign($,z),Q.mergeValidEvaluated(A,$),D)X.assign(D,QQ._`${B}`);else Q.setParams({ifClause:B})}}}};function H7(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,K7.alwaysValidSchema)(Q,Y)}B7.default=kO});var F7=Z((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var xO=g(),_O={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,xO.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};A7.default=_O});var U7=Z((L7)=>{Object.defineProperty(L7,"__esModule",{value:!0});var hO=XX(),uO=Sz(),gO=YX(),fO=kz(),mO=xz(),lO=fz(),cO=cz(),pO=GX(),iO=rz(),nO=ez(),dO=X7(),rO=W7(),oO=J7(),tO=z7(),aO=D7(),sO=F7();function eO(Q=!1){let X=[dO.default,rO.default,oO.default,tO.default,aO.default,sO.default,cO.default,pO.default,lO.default,iO.default,nO.default];if(Q)X.push(uO.default,fO.default);else X.push(hO.default,gO.default);return X.push(mO.default),X}L7.default=eO});var M7=Z((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var e=k(),XM={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},YM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:XM,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:z}=Q,{opts:H,errSchemaPath:K,schemaEnv:B,self:D}=z;if(!H.validateFormats)return;if(G)A();else U();function A(){let O=Y.scopeValue("formats",{ref:D.formats,code:H.code.formats}),M=Y.const("fDef",e._`${O}[${$}]`),q=Y.let("fType"),V=Y.let("format");Y.if(e._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>Y.assign(q,e._`${M}.type || "string"`).assign(V,e._`${M}.validate`),()=>Y.assign(q,e._`"string"`).assign(V,M)),Q.fail$data((0,e.or)(T(),E()));function T(){if(H.strictSchema===!1)return e.nil;return e._`${$} && !${V}`}function E(){let v=B.$async?e._`(${M}.async ? await ${V}(${W}) : ${V}(${W}))`:e._`${V}(${W})`,I=e._`(typeof ${V} == "function" ? ${v} : ${V}.test(${W}))`;return e._`${V} && ${V} !== true && ${q} === ${X} && !${I}`}}function U(){let O=D.formats[J];if(!O){T();return}if(O===!0)return;let[M,q,V]=E(O);if(M===X)Q.pass(v());function T(){if(H.strictSchema===!1){D.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${J}" ignored in schema at path "${K}"`}}function E(I){let v0=I instanceof RegExp?(0,e.regexpCode)(I):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)(J)}`:void 0,u0=Y.scopeValue("formats",{key:J,ref:I,code:v0});if(typeof I=="object"&&!(I instanceof RegExp))return[I.type||"string",I.validate,e._`${u0}.validate`];return["string",I,u0]}function v(){if(typeof O=="object"&&!(O instanceof RegExp)&&O.async){if(!B.$async)throw Error("async format in sync schema");return e._`await ${V}(${W})`}return typeof q=="function"?e._`${V}(${W})`:e._`${V}.test(${W})`}}}};O7.default=YM});var q7=Z((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});var GM=M7(),JM=[GM.default];V7.default=JM});var w7=Z((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});Z7.contentVocabulary=Z7.metadataVocabulary=void 0;Z7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Z7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var b7=Z((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});var HM=d$(),KM=Zz(),BM=U7(),DM=q7(),j7=w7(),AM=[HM.default,KM.default,(0,BM.default)(),DM.default,j7.metadataVocabulary,j7.contentVocabulary];P7.default=AM});var S7=Z((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.DiscrError=void 0;var E7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(E7||(I7.DiscrError=E7={}))});var k7=Z((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});var y1=k(),$X=S7(),R7=_4(),LM=N6(),UM=g(),OM={message:({params:{discrError:Q,tagName:X}})=>Q===$X.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>y1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},MM={keyword:"discriminator",type:"object",schemaType:"object",error:OM,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 z=W.propertyName;if(typeof z!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!$)throw Error("discriminator: requires oneOf keyword");let H=X.let("valid",!1),K=X.const("tag",y1._`${Y}${(0,y1.getProperty)(z)}`);X.if(y1._`typeof ${K} == "string"`,()=>B(),()=>Q.error(!1,{discrError:$X.DiscrError.Tag,tag:K,tagName:z})),Q.ok(H);function B(){let U=A();X.if(!1);for(let O in U)X.elseIf(y1._`${K} === ${O}`),X.assign(H,D(U[O]));X.else(),Q.error(!1,{discrError:$X.DiscrError.Mapping,tag:K,tagName:z}),X.endIf()}function D(U){let O=X.name("valid"),M=Q.subschema({keyword:"oneOf",schemaProp:U},O);return Q.mergeEvaluated(M,y1.Name),O}function A(){var U;let O={},M=V(G),q=!0;for(let v=0;v<$.length;v++){let I=$[v];if((I===null||I===void 0?void 0:I.$ref)&&!(0,UM.schemaHasRulesButRef)(I,J.self.RULES)){let u0=I.$ref;if(I=R7.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,u0),I instanceof R7.SchemaEnv)I=I.schema;if(I===void 0)throw new LM.default(J.opts.uriResolver,J.baseId,u0)}let v0=(U=I===null||I===void 0?void 0:I.properties)===null||U===void 0?void 0:U[z];if(typeof v0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);q=q&&(M||V(I)),T(v0,v)}if(!q)throw Error(`discriminator: "${z}" must be required`);return O;function V({required:v}){return Array.isArray(v)&&v.includes(z)}function T(v,I){if(v.const)E(v.const,I);else if(v.enum)for(let v0 of v.enum)E(v0,I);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(v,I){if(typeof v!="string"||v in O)throw Error(`discriminator: "${z}" values must be unique strings`);O[v]=I}}}};C7.default=MM});var v7=Z((Tb,qM)=>{qM.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 HX=Z((M0,zX)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var ZM=h$(),NM=b7(),wM=k7(),x7=v7(),jM=["/properties"],XQ="http://json-schema.org/draft-07/schema";class v6 extends ZM.default{_addVocabularies(){if(super._addVocabularies(),NM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(wM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(x7,jM):x7;this.addMetaSchema(Q,XQ,!1),this.refs["http://json-schema.org/schema"]=XQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(XQ)?XQ:void 0)}}M0.Ajv=v6;zX.exports=M0=v6;zX.exports.Ajv=v6;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=v6;var PM=Z6();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return PM.KeywordCxt}});var h1=k();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return h1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return h1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return h1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return h1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return h1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return h1.CodeGen}});var bM=v4();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return bM.default}});var EM=N6();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return EM.default}})});var p7=Z((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.formatNames=l7.fastFormats=l7.fullFormats=void 0;function y0(Q,X){return{validate:Q,compare:X}}l7.fullFormats={date:y0(u7,AX),time:y0(BX(!0),FX),"date-time":y0(_7(!0),f7),"iso-time":y0(BX(),g7),"iso-date-time":y0(_7(),m7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xM,"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:mM,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:_M,int32:{type:"number",validate:uM},int64:{type:"number",validate:gM},float:{type:"number",validate:h7},double:{type:"number",validate:h7},password:!0,binary:!0};l7.fastFormats={...l7.fullFormats,date:y0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,AX),time:y0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FX),"date-time":y0(/^\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,f7),"iso-time":y0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,g7),"iso-date-time":y0(/^\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,m7),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};l7.formatNames=Object.keys(l7.fullFormats);function SM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var RM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,CM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function u7(Q){let X=RM.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&&SM(Y)?29:CM[W])}function AX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var KX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function BX(Q){return function(Y){let W=KX.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],z=W[4],H=W[5]==="-"?-1:1,K=+(W[6]||0),B=+(W[7]||0);if(K>23||B>59||Q&&!z)return!1;if(G<=23&&J<=59&&$<60)return!0;let D=J-B*H,A=G-K*H-(D<0?1:0);return(A===23||A===-1)&&(D===59||D===-1)&&$<61}}function FX(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 g7(Q,X){if(!(Q&&X))return;let Y=KX.exec(Q),W=KX.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 DX=/t|\s/i;function _7(Q){let X=BX(Q);return function(W){let G=W.split(DX);return G.length===2&&u7(G[0])&&X(G[1])}}function f7(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 m7(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(DX),[G,J]=X.split(DX),$=AX(Y,G);if($===void 0)return;return $||FX(W,J)}var kM=/\/|:/,vM=/^(?:[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 xM(Q){return kM.test(Q)&&vM.test(Q)}var y7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _M(Q){return y7.lastIndex=0,y7.test(Q)}var yM=-2147483648,hM=2147483647;function uM(Q){return Number.isInteger(Q)&&Q<=hM&&Q>=yM}function gM(Q){return Number.isInteger(Q)}function h7(){return!0}var fM=/[^\\]\\Z/;function mM(Q){if(fM.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var n7=Z((i7)=>{Object.defineProperty(i7,"__esModule",{value:!0});i7.formatLimitDefinition=void 0;var cM=HX(),k0=k(),H1=k0.operators,YQ={formatMaximum:{okStr:"<=",ok:H1.LTE,fail:H1.GT},formatMinimum:{okStr:">=",ok:H1.GTE,fail:H1.LT},formatExclusiveMaximum:{okStr:"<",ok:H1.LT,fail:H1.GTE},formatExclusiveMinimum:{okStr:">",ok:H1.GT,fail:H1.LTE}},pM={message:({keyword:Q,schemaCode:X})=>k0.str`should be ${YQ[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>k0._`{comparison: ${YQ[Q].okStr}, limit: ${X}}`};i7.formatLimitDefinition={keyword:Object.keys(YQ),type:"string",schemaType:"string",$data:!0,error:pM,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:z}=J;if(!$.validateFormats)return;let H=new cM.KeywordCxt(J,z.RULES.all.format.definition,"format");if(H.$data)K();else B();function K(){let A=X.scopeValue("formats",{ref:z.formats,code:$.code.formats}),U=X.const("fmt",k0._`${A}[${H.schemaCode}]`);Q.fail$data((0,k0.or)(k0._`typeof ${U} != "object"`,k0._`${U} instanceof RegExp`,k0._`typeof ${U}.compare != "function"`,D(U)))}function B(){let A=H.schema,U=z.formats[A];if(!U||U===!0)return;if(typeof U!="object"||U instanceof RegExp||typeof U.compare!="function")throw Error(`"${G}": format "${A}" does not define "compare" function`);let O=X.scopeValue("formats",{key:A,ref:U,code:$.code.formats?k0._`${$.code.formats}${(0,k0.getProperty)(A)}`:void 0});Q.fail$data(D(O))}function D(A){return k0._`${A}.compare(${Y}, ${W}) ${YQ[G].fail} 0`}},dependencies:["format"]};var iM=(Q)=>{return Q.addKeyword(i7.formatLimitDefinition),Q};i7.default=iM});var t7=Z((x6,o7)=>{Object.defineProperty(x6,"__esModule",{value:!0});var u1=p7(),dM=n7(),OX=k(),d7=new OX.Name("fullFormats"),rM=new OX.Name("fastFormats"),MX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return r7(Q,X,u1.fullFormats,d7),Q;let[Y,W]=X.mode==="fast"?[u1.fastFormats,rM]:[u1.fullFormats,d7],G=X.formats||u1.formatNames;if(r7(Q,G,Y,W),X.keywords)(0,dM.default)(Q);return Q};MX.get=(Q,X="full")=>{let W=(X==="fast"?u1.fastFormats:u1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function r7(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=OX._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}o7.exports=x6=MX;Object.defineProperty(x6,"__esModule",{value:!0});x6.default=MX});var UV=Object.freeze({status:"aborted"});function L(Q,X,Y){function W(z,H){var K;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(K=z._zod).traits??(K.traits=new Set),z._zod.traits.add(Q),X(z,H);for(let B in $.prototype)if(!(B in z))Object.defineProperty(z,B,{value:$.prototype[B].bind(z)});z._zod.constr=$,z._zod.def=H}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function $(z){var H;let K=Y?.Parent?new J:this;W(K,z),(H=K._zod).deferred??(H.deferred=[]);for(let B of K._zod.deferred)B();return K}return Object.defineProperty($,"init",{value:W}),Object.defineProperty($,Symbol.hasInstance,{value:(z)=>{if(Y?.Parent&&z instanceof Y.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty($,"name",{value:Q}),$}var OV=Symbol("zod_brand");class g0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class m1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var h6={};function Z0(Q){if(Q)Object.assign(h6,Q);return h6}var u={};CX(u,{unwrapMessage:()=>l1,uint8ArrayToHex:()=>t5,uint8ArrayToBase64url:()=>r5,uint8ArrayToBase64:()=>uX,stringifyPrimitive:()=>m6,shallowClone:()=>vX,safeExtend:()=>l5,required:()=>i5,randomString:()=>_5,propertyKeyTypes:()=>FQ,promiseAllObject:()=>x5,primitiveTypes:()=>xX,prefixIssues:()=>m0,pick:()=>g5,partial:()=>p5,optionalKeys:()=>LQ,omit:()=>f5,objectClone:()=>C5,numKeys:()=>y5,nullish:()=>c1,normalizeParams:()=>b,mergeDefs:()=>t0,merge:()=>c5,jsonStringifyReplacer:()=>Z1,joinValues:()=>u6,issue:()=>w1,isPlainObject:()=>a0,isObject:()=>D1,hexToUint8Array:()=>o5,getSizableOrigin:()=>yX,getParsedType:()=>h5,getLengthableOrigin:()=>i1,getEnumValues:()=>BQ,getElementAtPath:()=>v5,floatSafeRemainder:()=>DQ,finalizeIssue:()=>E0,extend:()=>m5,escapeRegex:()=>f0,esc:()=>g6,defineLazy:()=>l,createTransparentProxy:()=>u5,cloneDef:()=>k5,clone:()=>b0,cleanRegex:()=>p1,cleanEnum:()=>n5,captureStackTrace:()=>f6,cached:()=>N1,base64urlToUint8Array:()=>d5,base64ToUint8Array:()=>hX,assignProp:()=>o0,assertNotEqual:()=>I5,assertNever:()=>S5,assertIs:()=>T5,assertEqual:()=>E5,assert:()=>R5,allowsEval:()=>AQ,aborted:()=>s0,NUMBER_FORMAT_RANGES:()=>UQ,Class:()=>gX,BIGINT_FORMAT_RANGES:()=>_X});function E5(Q){return Q}function I5(Q){return Q}function T5(Q){}function S5(Q){throw Error()}function R5(Q){}function BQ(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 u6(Q,X="|"){return Q.map((Y)=>m6(Y)).join(X)}function Z1(Q,X){if(typeof X==="bigint")return X.toString();return X}function N1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function c1(Q){return Q===null||Q===void 0}function p1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function DQ(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=X.toString(),G=(W.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(W)){let H=W.match(/\d?e-(\d?)/);if(H?.[1])G=Number.parseInt(H[1])}let J=Y>G?Y:G,$=Number.parseInt(Q.toFixed(J).replace(".","")),z=Number.parseInt(X.toFixed(J).replace(".",""));return $%z/10**J}var kX=Symbol("evaluating");function l(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===kX)return;if(W===void 0)W=kX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function C5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function o0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function t0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function k5(Q){return t0(Q._zod.def)}function v5(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function x5(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 _5(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function g6(Q){return JSON.stringify(Q)}var f6="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function D1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var AQ=N1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function a0(Q){if(D1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(D1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function vX(Q){if(a0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function y5(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var h5=(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}`)}},FQ=new Set(["string","number","symbol"]),xX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function f0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function b(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 u5(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 m6(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function LQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var UQ={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]},_X={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function g5(Q,X){let Y=Q._zod.def,W=t0(Q._zod.def,{get shape(){let G={};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;G[J]=Y.shape[J]}return o0(this,"shape",G),G},checks:[]});return b0(Q,W)}function f5(Q,X){let Y=Q._zod.def,W=t0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;delete G[J]}return o0(this,"shape",G),G},checks:[]});return b0(Q,W)}function m5(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)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=t0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return o0(this,"shape",J),J},checks:[]});return b0(Q,G)}function l5(Q,X){if(!a0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X};return o0(this,"shape",W),W},checks:Q._zod.def.checks};return b0(Q,Y)}function c5(Q,X){let Y=t0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return o0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return b0(Q,Y)}function p5(Q,X,Y){let W=t0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in G))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$]}else for(let $ in G)J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$];return o0(this,"shape",J),J},checks:[]});return b0(X,W)}function i5(Q,X,Y){let W=t0(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 o0(this,"shape",J),J},checks:[]});return b0(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 m0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function l1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=l1(Q.inst?._zod.def?.error?.(Q))??l1(X?.error?.(Q))??l1(Y.customError?.(Q))??l1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function yX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function i1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function w1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function n5(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function hX(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 uX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function d5(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return hX(X+Y)}function r5(Q){return uX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function o5(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 t5(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class gX{constructor(...Q){}}var fX=(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,Z1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},l6=L("$ZodError",fX),OQ=L("$ZodError",fX,{Parent:Error});function mX(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 lX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map(($)=>W({issues:$}));else if(J.code==="invalid_key")W({issues:J.issues});else if(J.code==="invalid_element")W({issues:J.issues});else if(J.path.length===0)Y._errors.push(X(J));else{let $=Y,z=0;while(z<J.path.length){let H=J.path[z];if(z!==J.path.length-1)$[H]=$[H]||{_errors:[]};else $[H]=$[H]||{_errors:[]},$[H]._errors.push(X(J));$=$[H],z++}}};return W(Q),Y}var c6=(Q)=>(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!1}):{async:!1},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)throw new g0;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((H)=>E0(H,J,Z0())));throw f6(z,G?.callee),z}return $.value};var p6=(Q)=>async(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)$=await $;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((H)=>E0(H,J,Z0())));throw f6(z,G?.callee),z}return $.value};var n1=(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 g0;return J.issues.length?{success:!1,error:new(Q??l6)(J.issues.map(($)=>E0($,G,Z0())))}:{success:!0,data:J.value}},d1=n1(OQ),r1=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(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,Z0())))}:{success:!0,data:J.value}},i6=r1(OQ),cX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return c6(Q)(X,Y,G)};var pX=(Q)=>(X,Y,W)=>{return c6(Q)(X,Y,W)};var iX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return p6(Q)(X,Y,G)};var nX=(Q)=>async(X,Y,W)=>{return p6(Q)(X,Y,W)};var dX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return n1(Q)(X,Y,G)};var rX=(Q)=>(X,Y,W)=>{return n1(Q)(X,Y,W)};var oX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return r1(Q)(X,Y,G)};var tX=(Q)=>async(X,Y,W)=>{return r1(Q)(X,Y,W)};var aX=/^[cC][^\s-]{8,}$/,sX=/^[0-9a-z]+$/,eX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Q8=/^[0-9a-vA-V]{20}$/,X8=/^[A-Za-z0-9]{27}$/,Y8=/^[a-zA-Z0-9_-]{21}$/,W8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var G8=/^([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})$/,MQ=(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 J8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function $8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var z8=/^(?:(?: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])$/,H8=/^(([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}|:))$/,K8=/^((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])$/,B8=/^(([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])$/,D8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,VQ=/^[A-Za-z0-9_-]*$/,A8=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;var F8=/^\+(?:[0-9]){6,14}[0-9]$/,L8="(?:(?:\\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])))",U8=new RegExp(`^${L8}$`);function O8(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 M8(Q){return new RegExp(`^${O8(Q)}$`)}function V8(Q){let X=O8({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(`^${L8}T(?:${W})$`)}var q8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var Z8=/^-?\d+$/,N8=/^-?\d+(?:\.\d+)?/,w8=/^(?:true|false)$/i,j8=/^null$/i;var P8=/^[^A-Z]*$/,b8=/^[^a-z]*$/;var X0=L("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),E8={number:"number",bigint:"bigint",object:"date"},qQ=L("$ZodCheckLessThan",(Q,X)=>{X0.init(Q,X);let Y=E8[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:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),ZQ=L("$ZodCheckGreaterThan",(Q,X)=>{X0.init(Q,X);let Y=E8[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:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),I8=L("$ZodCheckMultipleOf",(Q,X)=>{X0.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):DQ(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})}}),T8=L("$ZodCheckNumberFormat",(Q,X)=>{X0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=UQ[X.format];Q._zod.onattach.push(($)=>{let z=$._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=J,Y)z.pattern=Z8}),Q._zod.check=($)=>{let z=$.value;if(Y){if(!Number.isInteger(z)){$.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)$.issues.push({input:z,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});else $.issues.push({input:z,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});return}}if(z<G)$.issues.push({origin:"number",input:z,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(z>J)$.issues.push({origin:"number",input:z,code:"too_big",maximum:J,inst:Q})}});var S8=L("$ZodCheckMaxLength",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),R8=L("$ZodCheckMinLength",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),C8=L("$ZodCheckLengthEquals",(Q,X)=>{var Y;X0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!c1(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 $=i1(G),z=J>X.length;W.issues.push({origin:$,...z?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),o1=L("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(X0.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=()=>{})}),k8=L("$ZodCheckRegex",(Q,X)=>{o1.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})}}),v8=L("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=P8),o1.init(Q,X)}),x8=L("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=b8),o1.init(Q,X)}),_8=L("$ZodCheckIncludes",(Q,X)=>{X0.init(Q,X);let Y=f0(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})}}),y8=L("$ZodCheckStartsWith",(Q,X)=>{X0.init(Q,X);let Y=new RegExp(`^${f0(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})}}),h8=L("$ZodCheckEndsWith",(Q,X)=>{X0.init(Q,X);let Y=new RegExp(`.*${f0(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 u8=L("$ZodCheckOverwrite",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class NQ{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let Y=Q.split(`
10
10
  `).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(`
11
- `))}}var f8={major:4,minor:1,patch:12};var i=L("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=f8;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=($,z,H)=>{let K=s0($),B;for(let D of z){if(D._zod.def.when){if(!D._zod.def.when($))continue}else if(K)continue;let A=$.issues.length,U=D._zod.check($);if(U instanceof Promise&&H?.async===!1)throw new g0;if(B||U instanceof Promise)B=(B??Promise.resolve()).then(async()=>{if(await U,$.issues.length===A)return;if(!K)K=s0($,A)});else{if($.issues.length===A)continue;if(!K)K=s0($,A)}}if(B)return B.then(()=>{return $});return $},J=($,z,H)=>{if(s0($))return $.aborted=!0,$;let K=G(z,W,H);if(K instanceof Promise){if(H.async===!1)throw new g0;return K.then((B)=>Q._zod.parse(B,H))}return Q._zod.parse(K,H)};Q._zod.run=($,z)=>{if(z.skipChecks)return Q._zod.parse($,z);if(z.direction==="backward"){let K=Q._zod.parse({value:$.value,issues:[]},{...z,skipChecks:!0});if(K instanceof Promise)return K.then((B)=>{return J(B,$,z)});return J(K,$,z)}let H=Q._zod.parse($,z);if(H instanceof Promise){if(z.async===!1)throw new g0;return H.then((K)=>G(K,W,z))}return G(H,W,z)}}Q["~standard"]={validate:(G)=>{try{let J=d1(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return i6(Q,G).then(($)=>$.success?{value:$.data}:{issues:$.error?.issues})}},vendor:"zod",version:1}}),o6=L("$ZodString",(Q,X)=>{i.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??q8(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}}),n=L("$ZodStringFormat",(Q,X)=>{o1.init(Q,X),o6.init(Q,X)}),o8=L("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=G8),n.init(Q,X)}),t8=L("$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=MQ(W))}else X.pattern??(X.pattern=MQ());n.init(Q,X)}),a8=L("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=J8),n.init(Q,X)}),s8=L("$ZodURL",(Q,X)=>{n.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value.trim(),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:A8.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})}}}),e8=L("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=$8()),n.init(Q,X)}),QY=L("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=Y8),n.init(Q,X)}),XY=L("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=aX),n.init(Q,X)}),YY=L("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=sX),n.init(Q,X)}),WY=L("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=eX),n.init(Q,X)}),GY=L("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=Q8),n.init(Q,X)}),JY=L("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=X8),n.init(Q,X)}),$Y=L("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=V8(X)),n.init(Q,X)}),zY=L("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=U8),n.init(Q,X)}),HY=L("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=M8(X)),n.init(Q,X)}),KY=L("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=W8),n.init(Q,X)}),BY=L("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=z8),n.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),DY=L("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=H8),n.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv6"}),Q._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:Q,continue:!X.abort})}}}),AY=L("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=K8),n.init(Q,X)}),FY=L("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=B8),n.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 LY(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var UY=L("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=D8),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(LY(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function e5(Q){if(!VQ.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return LY(Y)}var OY=L("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=VQ),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(e5(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),MY=L("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=F8),n.init(Q,X)});function QH(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 VY=L("$ZodJWT",(Q,X)=>{n.init(Q,X),Q._zod.check=(Y)=>{if(QH(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var jQ=L("$ZodNumber",(Q,X)=>{i.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??N8,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}}),qY=L("$ZodNumber",(Q,X)=>{T8.init(Q,X),jQ.init(Q,X)}),ZY=L("$ZodBoolean",(Q,X)=>{i.init(Q,X),Q._zod.pattern=w8,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 NY=L("$ZodNull",(Q,X)=>{i.init(Q,X),Q._zod.pattern=j8,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 wY=L("$ZodUnknown",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y)=>Y}),jY=L("$ZodNever",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function m8(Q,X,Y){if(Q.issues.length)X.issues.push(...m0(Y,Q.issues));X.value[Y]=Q.value}var PY=L("$ZodArray",(Q,X)=>{i.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 z=G[$],H=X.element._zod.run({value:z,issues:[]},W);if(H instanceof Promise)J.push(H.then((K)=>m8(K,Y,$)));else m8(H,Y,$)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function r6(Q,X,Y,W){if(Q.issues.length)X.issues.push(...m0(Y,Q.issues));if(Q.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=Q.value}function bY(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=LQ(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function EY(Q,X,Y,W,G,J){let $=[],z=G.keySet,H=G.catchall._zod,K=H.def.type;for(let B of Object.keys(X)){if(z.has(B))continue;if(K==="never"){$.push(B);continue}let D=H.run({value:X[B],issues:[]},W);if(D instanceof Promise)Q.push(D.then((A)=>r6(A,Y,B,X)));else r6(D,Y,B,X)}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 XH=L("$ZodObject",(Q,X)=>{if(i.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let z=X.shape;Object.defineProperty(X,"shape",{get:()=>{let H={...z};return Object.defineProperty(X,"shape",{value:H}),H}})}let W=N1(()=>bY(X));l(Q._zod,"propValues",()=>{let z=X.shape,H={};for(let K in z){let B=z[K]._zod;if(B.values){H[K]??(H[K]=new Set);for(let D of B.values)H[K].add(D)}}return H});let G=D1,J=X.catchall,$;Q._zod.parse=(z,H)=>{$??($=W.value);let K=z.value;if(!G(K))return z.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),z;z.value={};let B=[],D=$.shape;for(let A of $.keys){let O=D[A]._zod.run({value:K[A],issues:[]},H);if(O instanceof Promise)B.push(O.then((M)=>r6(M,z,A,K)));else r6(O,z,A,K)}if(!J)return B.length?Promise.all(B).then(()=>z):z;return EY(B,K,z,H,W.value,Q)}}),IY=L("$ZodObjectJIT",(Q,X)=>{XH.init(Q,X);let Y=Q._zod.parse,W=N1(()=>bY(X)),G=(A)=>{let U=new NQ(["shape","payload","ctx"]),O=W.value,M=(E)=>{let v=g6(E);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};U.write("const input = payload.value;");let q=Object.create(null),V=0;for(let E of O.keys)q[E]=`key_${V++}`;U.write("const newResult = {};");for(let E of O.keys){let v=q[E],I=g6(E);U.write(`const ${v} = ${M(E)};`),U.write(`
11
+ `))}}var f8={major:4,minor:1,patch:12};var i=L("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=f8;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=($,z,H)=>{let K=s0($),B;for(let D of z){if(D._zod.def.when){if(!D._zod.def.when($))continue}else if(K)continue;let A=$.issues.length,U=D._zod.check($);if(U instanceof Promise&&H?.async===!1)throw new g0;if(B||U instanceof Promise)B=(B??Promise.resolve()).then(async()=>{if(await U,$.issues.length===A)return;if(!K)K=s0($,A)});else{if($.issues.length===A)continue;if(!K)K=s0($,A)}}if(B)return B.then(()=>{return $});return $},J=($,z,H)=>{if(s0($))return $.aborted=!0,$;let K=G(z,W,H);if(K instanceof Promise){if(H.async===!1)throw new g0;return K.then((B)=>Q._zod.parse(B,H))}return Q._zod.parse(K,H)};Q._zod.run=($,z)=>{if(z.skipChecks)return Q._zod.parse($,z);if(z.direction==="backward"){let K=Q._zod.parse({value:$.value,issues:[]},{...z,skipChecks:!0});if(K instanceof Promise)return K.then((B)=>{return J(B,$,z)});return J(K,$,z)}let H=Q._zod.parse($,z);if(H instanceof Promise){if(z.async===!1)throw new g0;return H.then((K)=>G(K,W,z))}return G(H,W,z)}}Q["~standard"]={validate:(G)=>{try{let J=d1(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return i6(Q,G).then(($)=>$.success?{value:$.data}:{issues:$.error?.issues})}},vendor:"zod",version:1}}),o6=L("$ZodString",(Q,X)=>{i.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??q8(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}}),n=L("$ZodStringFormat",(Q,X)=>{o1.init(Q,X),o6.init(Q,X)}),o8=L("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=G8),n.init(Q,X)}),t8=L("$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=MQ(W))}else X.pattern??(X.pattern=MQ());n.init(Q,X)}),a8=L("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=J8),n.init(Q,X)}),s8=L("$ZodURL",(Q,X)=>{n.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value.trim(),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:A8.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})}}}),e8=L("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=$8()),n.init(Q,X)}),QY=L("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=Y8),n.init(Q,X)}),XY=L("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=aX),n.init(Q,X)}),YY=L("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=sX),n.init(Q,X)}),WY=L("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=eX),n.init(Q,X)}),GY=L("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=Q8),n.init(Q,X)}),JY=L("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=X8),n.init(Q,X)}),$Y=L("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=V8(X)),n.init(Q,X)}),zY=L("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=U8),n.init(Q,X)}),HY=L("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=M8(X)),n.init(Q,X)}),KY=L("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=W8),n.init(Q,X)}),BY=L("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=z8),n.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),DY=L("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=H8),n.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv6"}),Q._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:Q,continue:!X.abort})}}}),AY=L("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=K8),n.init(Q,X)}),FY=L("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=B8),n.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 LY(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var UY=L("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=D8),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(LY(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function QH(Q){if(!VQ.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return LY(Y)}var OY=L("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=VQ),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(QH(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),MY=L("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=F8),n.init(Q,X)});function XH(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 VY=L("$ZodJWT",(Q,X)=>{n.init(Q,X),Q._zod.check=(Y)=>{if(XH(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var jQ=L("$ZodNumber",(Q,X)=>{i.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??N8,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}}),qY=L("$ZodNumber",(Q,X)=>{T8.init(Q,X),jQ.init(Q,X)}),ZY=L("$ZodBoolean",(Q,X)=>{i.init(Q,X),Q._zod.pattern=w8,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 NY=L("$ZodNull",(Q,X)=>{i.init(Q,X),Q._zod.pattern=j8,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 wY=L("$ZodUnknown",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y)=>Y}),jY=L("$ZodNever",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function m8(Q,X,Y){if(Q.issues.length)X.issues.push(...m0(Y,Q.issues));X.value[Y]=Q.value}var PY=L("$ZodArray",(Q,X)=>{i.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 z=G[$],H=X.element._zod.run({value:z,issues:[]},W);if(H instanceof Promise)J.push(H.then((K)=>m8(K,Y,$)));else m8(H,Y,$)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function r6(Q,X,Y,W){if(Q.issues.length)X.issues.push(...m0(Y,Q.issues));if(Q.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=Q.value}function bY(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=LQ(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function EY(Q,X,Y,W,G,J){let $=[],z=G.keySet,H=G.catchall._zod,K=H.def.type;for(let B of Object.keys(X)){if(z.has(B))continue;if(K==="never"){$.push(B);continue}let D=H.run({value:X[B],issues:[]},W);if(D instanceof Promise)Q.push(D.then((A)=>r6(A,Y,B,X)));else r6(D,Y,B,X)}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 YH=L("$ZodObject",(Q,X)=>{if(i.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let z=X.shape;Object.defineProperty(X,"shape",{get:()=>{let H={...z};return Object.defineProperty(X,"shape",{value:H}),H}})}let W=N1(()=>bY(X));l(Q._zod,"propValues",()=>{let z=X.shape,H={};for(let K in z){let B=z[K]._zod;if(B.values){H[K]??(H[K]=new Set);for(let D of B.values)H[K].add(D)}}return H});let G=D1,J=X.catchall,$;Q._zod.parse=(z,H)=>{$??($=W.value);let K=z.value;if(!G(K))return z.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),z;z.value={};let B=[],D=$.shape;for(let A of $.keys){let O=D[A]._zod.run({value:K[A],issues:[]},H);if(O instanceof Promise)B.push(O.then((M)=>r6(M,z,A,K)));else r6(O,z,A,K)}if(!J)return B.length?Promise.all(B).then(()=>z):z;return EY(B,K,z,H,W.value,Q)}}),IY=L("$ZodObjectJIT",(Q,X)=>{YH.init(Q,X);let Y=Q._zod.parse,W=N1(()=>bY(X)),G=(A)=>{let U=new NQ(["shape","payload","ctx"]),O=W.value,M=(E)=>{let v=g6(E);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};U.write("const input = payload.value;");let q=Object.create(null),V=0;for(let E of O.keys)q[E]=`key_${V++}`;U.write("const newResult = {};");for(let E of O.keys){let v=q[E],I=g6(E);U.write(`const ${v} = ${M(E)};`),U.write(`
12
12
  if (${v}.issues.length) {
13
13
  payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
14
14
  ...iss,
@@ -25,10 +25,10 @@ var O5=Object.create;var{getPrototypeOf:M5,defineProperty:HQ,getOwnPropertyNames
25
25
  newResult[${I}] = ${v}.value;
26
26
  }
27
27
 
28
- `)}U.write("payload.value = newResult;"),U.write("return payload;");let T=U.compile();return(E,v)=>T(A,E,v)},J,$=D1,z=!h6.jitless,K=z&&AQ.value,B=X.catchall,D;Q._zod.parse=(A,U)=>{D??(D=W.value);let O=A.value;if(!$(O))return A.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),A;if(z&&K&&U?.async===!1&&U.jitless!==!0){if(!J)J=G(X.shape);if(A=J(A,U),!B)return A;return EY([],O,A,U,D,Q)}return Y(A,U)}});function l8(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,Z0())))}),X}var PQ=L("$ZodUnion",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),l(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),l(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),l(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>p1(J.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(Y)return W(G,J);let $=!1,z=[];for(let H of X.options){let K=H._zod.run({value:G.value,issues:[]},J);if(K instanceof Promise)z.push(K),$=!0;else{if(K.issues.length===0)return K;z.push(K)}}if(!$)return l8(z,G,Q,J);return Promise.all(z).then((H)=>{return l8(H,G,Q,J)})}}),TY=L("$ZodDiscriminatedUnion",(Q,X)=>{PQ.init(Q,X);let Y=Q._zod.parse;l(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[z,H]of Object.entries($)){if(!G[z])G[z]=new Set;for(let K of H)G[z].add(K)}}return G});let W=N1(()=>{let G=X.options,J=new Map;for(let $ of G){let z=$._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let H of z){if(J.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);J.set(H,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!D1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let z=W.value.get($?.[X.discriminator]);if(z)return z._zod.run(G,J);if(X.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:$,path:[X.discriminator],inst:Q}),G}}),SY=L("$ZodIntersection",(Q,X)=>{i.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(([H,K])=>{return c8(Y,H,K)});return c8(Y,J,$)}});function wQ(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 $=wQ(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],$=wQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function c8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(s0(Q))return Q;let W=wQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var RY=L("$ZodRecord",(Q,X)=>{i.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=[];if(X.keyType._zod.values){let $=X.keyType._zod.values;Y.value={};for(let H of $)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let K=X.valueType._zod.run({value:G[H],issues:[]},W);if(K instanceof Promise)J.push(K.then((B)=>{if(B.issues.length)Y.issues.push(...m0(H,B.issues));Y.value[H]=B.value}));else{if(K.issues.length)Y.issues.push(...m0(H,K.issues));Y.value[H]=K.value}}let z;for(let H in G)if(!$.has(H))z=z??[],z.push(H);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let $ of Reflect.ownKeys(G)){if($==="__proto__")continue;let z=X.keyType._zod.run({value:$,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((K)=>E0(K,W,Z0())),input:$,path:[$],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[$],issues:[]},W);if(H instanceof Promise)J.push(H.then((K)=>{if(K.issues.length)Y.issues.push(...m0($,K.issues));Y.value[z.value]=K.value}));else{if(H.issues.length)Y.issues.push(...m0($,H.issues));Y.value[z.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var CY=L("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=BQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>FQ.has(typeof G)).map((G)=>typeof G==="string"?f0(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}}),kY=L("$ZodLiteral",(Q,X)=>{if(i.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?f0(Y):Y?f0(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let G=Y.value;if(Q._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var vY=L("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(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});if(G instanceof Promise)throw new g0;return Y.value=G,Y}});function p8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var xY=L("$ZodOptional",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",l(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>p8(J,Y.value));return p8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),_Y=L("$ZodNullable",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)}|null)$`):void 0}),l(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)}}),yY=L("$ZodDefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",l(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)=>i8(J,X));return i8(G,X)}});function i8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var hY=L("$ZodPrefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",l(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)}}),uY=L("$ZodNonOptional",(Q,X)=>{i.init(Q,X),l(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)=>n8(J,Q));return n8(G,Q)}});function n8(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 gY=L("$ZodCatch",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(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,Z0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>E0(J,W,Z0()))},input:Y.value}),Y.issues=[];return Y}});var fY=L("$ZodPipe",(Q,X)=>{i.init(Q,X),l(Q._zod,"values",()=>X.in._zod.values),l(Q._zod,"optin",()=>X.in._zod.optin),l(Q._zod,"optout",()=>X.out._zod.optout),l(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(($)=>d6($,X.in,W));return d6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>d6(J,X.out,W));return d6(G,X.out,W)}});function d6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var mY=L("$ZodReadonly",(Q,X)=>{i.init(Q,X),l(Q._zod,"propValues",()=>X.innerType._zod.propValues),l(Q._zod,"values",()=>X.innerType._zod.values),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(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(d8);return d8(G)}});function d8(Q){return Q.value=Object.freeze(Q.value),Q}var lY=L("$ZodCustom",(Q,X)=>{X0.init(Q,X),i.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)=>r8(J,Y,W,Q));r8(G,Y,W,Q);return}});function r8(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(w1(G))}}var YH=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},WH=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return Q[W]??null}let Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${YH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${m6(W.values[0])}`;return`Invalid option: expected one of ${u6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${G}${W.minimum.toString()}`}case"invalid_format":{let G=W;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${u6(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function bQ(){return{localeError:WH()}}var SV=Symbol("ZodOutput"),RV=Symbol("ZodInput");class cY{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){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,Q)}return this}clear(){return this._map=new 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 GH(){return new cY}var t1=GH();function pY(Q,X){return new Q({type:"string",...b(X)})}function iY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function EQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(X)})}function rY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(X)})}function oY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function tY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function eY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function XW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function YW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function WW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function GW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function JW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function $W(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function zW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function HW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function KW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function BW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function DW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function AW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function FW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function LW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function UW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function OW(Q,X){return new Q({type:"number",checks:[],...b(X)})}function MW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function VW(Q,X){return new Q({type:"boolean",...b(X)})}function qW(Q,X){return new Q({type:"null",...b(X)})}function ZW(Q){return new Q({type:"unknown"})}function NW(Q,X){return new Q({type:"never",...b(X)})}function t6(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!1})}function a1(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!0})}function a6(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!1})}function s1(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!0})}function s6(Q,X){return new I8({check:"multiple_of",...b(X),value:Q})}function e6(Q,X){return new S8({check:"max_length",...b(X),maximum:Q})}function j1(Q,X){return new R8({check:"min_length",...b(X),minimum:Q})}function Q4(Q,X){return new C8({check:"length_equals",...b(X),length:Q})}function IQ(Q,X){return new k8({check:"string_format",format:"regex",...b(X),pattern:Q})}function TQ(Q){return new v8({check:"string_format",format:"lowercase",...b(Q)})}function SQ(Q){return new x8({check:"string_format",format:"uppercase",...b(Q)})}function RQ(Q,X){return new _8({check:"string_format",format:"includes",...b(X),includes:Q})}function CQ(Q,X){return new y8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function kQ(Q,X){return new h8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function A1(Q){return new u8({check:"overwrite",tx:Q})}function vQ(Q){return A1((X)=>X.normalize(Q))}function xQ(){return A1((Q)=>Q.trim())}function _Q(){return A1((Q)=>Q.toLowerCase())}function yQ(){return A1((Q)=>Q.toUpperCase())}function wW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function jW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function PW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function bW(Q){let X=JH((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(w1(W,Y.value,X._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(w1(G))}},Q(Y.value,Y)});return X}function JH(Q,X){let Y=new X0({check:"custom",...b(X)});return Y._zod.check=Q,Y}function P1(Q){return!!Q._zod}function e0(Q,X){if(P1(Q))return d1(Q,X);return Q.safeParse(X)}function X4(Q){if(!Q)return;let X;if(P1(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 EW(Q){if(P1(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 Q6={};CX(Q6,{time:()=>gQ,duration:()=>fQ,datetime:()=>hQ,date:()=>uQ,ZodISOTime:()=>SW,ZodISODuration:()=>RW,ZodISODateTime:()=>IW,ZodISODate:()=>TW});var IW=L("ZodISODateTime",(Q,X)=>{$Y.init(Q,X),r.init(Q,X)});function hQ(Q){return AW(IW,Q)}var TW=L("ZodISODate",(Q,X)=>{zY.init(Q,X),r.init(Q,X)});function uQ(Q){return FW(TW,Q)}var SW=L("ZodISOTime",(Q,X)=>{HY.init(Q,X),r.init(Q,X)});function gQ(Q){return LW(SW,Q)}var RW=L("ZodISODuration",(Q,X)=>{KY.init(Q,X),r.init(Q,X)});function fQ(Q){return UW(RW,Q)}var CW=(Q,X)=>{l6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>lX(Q,Y)},flatten:{value:(Y)=>mX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},Uq=L("ZodError",CW),V0=L("ZodError",CW,{Parent:Error});var kW=c6(V0),vW=p6(V0),xW=n1(V0),_W=r1(V0),yW=cX(V0),hW=pX(V0),uW=iX(V0),gW=nX(V0),fW=dX(V0),mW=rX(V0),lW=oX(V0),cW=tX(V0);var s=L("ZodType",(Q,X)=>{return i.init(Q,X),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone(u.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>b0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>kW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>xW(Q,Y,W),Q.parseAsync=async(Y,W)=>vW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>_W(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>yW(Q,Y,W),Q.decode=(Y,W)=>hW(Q,Y,W),Q.encodeAsync=async(Y,W)=>uW(Q,Y,W),Q.decodeAsync=async(Y,W)=>gW(Q,Y,W),Q.safeEncode=(Y,W)=>fW(Q,Y,W),Q.safeDecode=(Y,W)=>mW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>lW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>cW(Q,Y,W),Q.refine=(Y,W)=>Q.check(X3(Y,W)),Q.superRefine=(Y)=>Q.check(Y3(Y)),Q.overwrite=(Y)=>Q.check(A1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>nW(Q),Q.nullish=()=>a(nW(Q)),Q.nonoptional=(Y)=>oH(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>p([Q,Y]),Q.and=(Y)=>W4(Q,Y),Q.transform=(Y)=>lQ(Q,aW(Y)),Q.default=(Y)=>nH(Q,Y),Q.prefault=(Y)=>rH(Q,Y),Q.catch=(Y)=>aH(Q,Y),Q.pipe=(Y)=>lQ(Q,Y),Q.readonly=()=>Q3(Q),Q.describe=(Y)=>{let W=Q.clone();return t1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return t1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return t1.get(Q);let W=Q.clone();return t1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),dW=L("_ZodString",(Q,X)=>{o6.init(Q,X),s.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(IQ(...W)),Q.includes=(...W)=>Q.check(RQ(...W)),Q.startsWith=(...W)=>Q.check(CQ(...W)),Q.endsWith=(...W)=>Q.check(kQ(...W)),Q.min=(...W)=>Q.check(j1(...W)),Q.max=(...W)=>Q.check(e6(...W)),Q.length=(...W)=>Q.check(Q4(...W)),Q.nonempty=(...W)=>Q.check(j1(1,...W)),Q.lowercase=(W)=>Q.check(TQ(W)),Q.uppercase=(W)=>Q.check(SQ(W)),Q.trim=()=>Q.check(xQ()),Q.normalize=(...W)=>Q.check(vQ(...W)),Q.toLowerCase=()=>Q.check(_Q()),Q.toUpperCase=()=>Q.check(yQ())}),LH=L("ZodString",(Q,X)=>{o6.init(Q,X),dW.init(Q,X),Q.email=(Y)=>Q.check(iY(UH,Y)),Q.url=(Y)=>Q.check(tY(OH,Y)),Q.jwt=(Y)=>Q.check(DW(CH,Y)),Q.emoji=(Y)=>Q.check(aY(MH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.uuid=(Y)=>Q.check(nY(Y4,Y)),Q.uuidv4=(Y)=>Q.check(dY(Y4,Y)),Q.uuidv6=(Y)=>Q.check(rY(Y4,Y)),Q.uuidv7=(Y)=>Q.check(oY(Y4,Y)),Q.nanoid=(Y)=>Q.check(sY(VH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.cuid=(Y)=>Q.check(eY(qH,Y)),Q.cuid2=(Y)=>Q.check(QW(ZH,Y)),Q.ulid=(Y)=>Q.check(XW(NH,Y)),Q.base64=(Y)=>Q.check(HW(TH,Y)),Q.base64url=(Y)=>Q.check(KW(SH,Y)),Q.xid=(Y)=>Q.check(YW(wH,Y)),Q.ksuid=(Y)=>Q.check(WW(jH,Y)),Q.ipv4=(Y)=>Q.check(GW(PH,Y)),Q.ipv6=(Y)=>Q.check(JW(bH,Y)),Q.cidrv4=(Y)=>Q.check($W(EH,Y)),Q.cidrv6=(Y)=>Q.check(zW(IH,Y)),Q.e164=(Y)=>Q.check(BW(RH,Y)),Q.datetime=(Y)=>Q.check(hQ(Y)),Q.date=(Y)=>Q.check(uQ(Y)),Q.time=(Y)=>Q.check(gQ(Y)),Q.duration=(Y)=>Q.check(fQ(Y))});function F(Q){return pY(LH,Q)}var r=L("ZodStringFormat",(Q,X)=>{n.init(Q,X),dW.init(Q,X)}),UH=L("ZodEmail",(Q,X)=>{a8.init(Q,X),r.init(Q,X)});var pW=L("ZodGUID",(Q,X)=>{o8.init(Q,X),r.init(Q,X)});var Y4=L("ZodUUID",(Q,X)=>{t8.init(Q,X),r.init(Q,X)});var OH=L("ZodURL",(Q,X)=>{s8.init(Q,X),r.init(Q,X)});var MH=L("ZodEmoji",(Q,X)=>{e8.init(Q,X),r.init(Q,X)});var VH=L("ZodNanoID",(Q,X)=>{QY.init(Q,X),r.init(Q,X)});var qH=L("ZodCUID",(Q,X)=>{XY.init(Q,X),r.init(Q,X)});var ZH=L("ZodCUID2",(Q,X)=>{YY.init(Q,X),r.init(Q,X)});var NH=L("ZodULID",(Q,X)=>{WY.init(Q,X),r.init(Q,X)});var wH=L("ZodXID",(Q,X)=>{GY.init(Q,X),r.init(Q,X)});var jH=L("ZodKSUID",(Q,X)=>{JY.init(Q,X),r.init(Q,X)});var PH=L("ZodIPv4",(Q,X)=>{BY.init(Q,X),r.init(Q,X)});var bH=L("ZodIPv6",(Q,X)=>{DY.init(Q,X),r.init(Q,X)});var EH=L("ZodCIDRv4",(Q,X)=>{AY.init(Q,X),r.init(Q,X)});var IH=L("ZodCIDRv6",(Q,X)=>{FY.init(Q,X),r.init(Q,X)});var TH=L("ZodBase64",(Q,X)=>{UY.init(Q,X),r.init(Q,X)});var SH=L("ZodBase64URL",(Q,X)=>{OY.init(Q,X),r.init(Q,X)});var RH=L("ZodE164",(Q,X)=>{MY.init(Q,X),r.init(Q,X)});var CH=L("ZodJWT",(Q,X)=>{VY.init(Q,X),r.init(Q,X)});var rW=L("ZodNumber",(Q,X)=>{jQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(a6(W,G)),Q.gte=(W,G)=>Q.check(s1(W,G)),Q.min=(W,G)=>Q.check(s1(W,G)),Q.lt=(W,G)=>Q.check(t6(W,G)),Q.lte=(W,G)=>Q.check(a1(W,G)),Q.max=(W,G)=>Q.check(a1(W,G)),Q.int=(W)=>Q.check(iW(W)),Q.safe=(W)=>Q.check(iW(W)),Q.positive=(W)=>Q.check(a6(0,W)),Q.nonnegative=(W)=>Q.check(s1(0,W)),Q.negative=(W)=>Q.check(t6(0,W)),Q.nonpositive=(W)=>Q.check(a1(0,W)),Q.multipleOf=(W,G)=>Q.check(s6(W,G)),Q.step=(W,G)=>Q.check(s6(W,G)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function m(Q){return OW(rW,Q)}var kH=L("ZodNumberFormat",(Q,X)=>{qY.init(Q,X),rW.init(Q,X)});function iW(Q){return MW(kH,Q)}var vH=L("ZodBoolean",(Q,X)=>{ZY.init(Q,X),s.init(Q,X)});function Q0(Q){return VW(vH,Q)}var xH=L("ZodNull",(Q,X)=>{NY.init(Q,X),s.init(Q,X)});function cQ(Q){return qW(xH,Q)}var _H=L("ZodUnknown",(Q,X)=>{wY.init(Q,X),s.init(Q,X)});function o(){return ZW(_H)}var yH=L("ZodNever",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function hH(Q){return NW(yH,Q)}var uH=L("ZodArray",(Q,X)=>{PY.init(Q,X),s.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(j1(Y,W)),Q.nonempty=(Y)=>Q.check(j1(1,Y)),Q.max=(Y,W)=>Q.check(e6(Y,W)),Q.length=(Y,W)=>Q.check(Q4(Y,W)),Q.unwrap=()=>Q.element});function x(Q,X){return wW(uH,Q,X)}var oW=L("ZodObject",(Q,X)=>{IY.init(Q,X),s.init(Q,X),u.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>F0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:hH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return u.extend(Q,Y)},Q.safeExtend=(Y)=>{return u.safeExtend(Q,Y)},Q.merge=(Y)=>u.merge(Q,Y),Q.pick=(Y)=>u.pick(Q,Y),Q.omit=(Y)=>u.omit(Q,Y),Q.partial=(...Y)=>u.partial(sW,Q,Y[0]),Q.required=(...Y)=>u.required(eW,Q,Y[0])});function N(Q,X){let Y={type:"object",shape:Q??{},...u.normalizeParams(X)};return new oW(Y)}function B0(Q,X){return new oW({type:"object",shape:Q,catchall:o(),...u.normalizeParams(X)})}var tW=L("ZodUnion",(Q,X)=>{PQ.init(Q,X),s.init(Q,X),Q.options=X.options});function p(Q,X){return new tW({type:"union",options:Q,...u.normalizeParams(X)})}var gH=L("ZodDiscriminatedUnion",(Q,X)=>{tW.init(Q,X),TY.init(Q,X)});function pQ(Q,X,Y){return new gH({type:"union",options:X,discriminator:Q,...u.normalizeParams(Y)})}var fH=L("ZodIntersection",(Q,X)=>{SY.init(Q,X),s.init(Q,X)});function W4(Q,X){return new fH({type:"intersection",left:Q,right:X})}var mH=L("ZodRecord",(Q,X)=>{RY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new mH({type:"record",keyType:Q,valueType:X,...u.normalizeParams(Y)})}var mQ=L("ZodEnum",(Q,X)=>{CY.init(Q,X),s.init(Q,X),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 mQ({...X,checks:[],...u.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 mQ({...X,checks:[],...u.normalizeParams(G),entries:J})}});function F0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new mQ({type:"enum",entries:Y,...u.normalizeParams(X)})}var lH=L("ZodLiteral",(Q,X)=>{kY.init(Q,X),s.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function j(Q,X){return new lH({type:"literal",values:Array.isArray(Q)?Q:[Q],...u.normalizeParams(X)})}var cH=L("ZodTransform",(Q,X)=>{vY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(u.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(u.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function aW(Q){return new cH({type:"transform",transform:Q})}var sW=L("ZodOptional",(Q,X)=>{xY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new sW({type:"optional",innerType:Q})}var pH=L("ZodNullable",(Q,X)=>{_Y.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function nW(Q){return new pH({type:"nullable",innerType:Q})}var iH=L("ZodDefault",(Q,X)=>{yY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function nH(Q,X){return new iH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():u.shallowClone(X)}})}var dH=L("ZodPrefault",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function rH(Q,X){return new dH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():u.shallowClone(X)}})}var eW=L("ZodNonOptional",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function oH(Q,X){return new eW({type:"nonoptional",innerType:Q,...u.normalizeParams(X)})}var tH=L("ZodCatch",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function aH(Q,X){return new tH({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var sH=L("ZodPipe",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function lQ(Q,X){return new sH({type:"pipe",in:Q,out:X})}var eH=L("ZodReadonly",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function Q3(Q){return new eH({type:"readonly",innerType:Q})}var QG=L("ZodCustom",(Q,X)=>{lY.init(Q,X),s.init(Q,X)});function XG(Q,X){return jW(QG,Q??(()=>!0),X)}function X3(Q,X={}){return PW(QG,Q,X)}function Y3(Q){return bW(Q)}function iQ(Q,X){return lQ(aW(Q),X)}Z0(bQ());var nQ="2025-11-25";var YG=[nQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Q1="io.modelcontextprotocol/related-task",J4="2.0",Y0=XG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),WG=p([F(),m().int()]),GG=F(),BZ=B0({ttl:p([m(),cQ()]).optional(),pollInterval:m().optional()}),W3=N({ttl:m().optional()}),G3=N({taskId:F()}),dQ=B0({progressToken:WG.optional(),[Q1]:G3.optional()}),q0=N({_meta:dQ.optional()}),X6=q0.extend({task:W3.optional()}),JG=(Q)=>X6.safeParse(Q).success,W0=N({method:F(),params:q0.loose().optional()}),N0=N({_meta:dQ.optional()}),w0=N({method:F(),params:N0.loose().optional()}),G0=B0({_meta:dQ.optional()}),$4=p([F(),m().int()]),$G=N({jsonrpc:j(J4),id:$4,...W0.shape}).strict(),rQ=(Q)=>$G.safeParse(Q).success,zG=N({jsonrpc:j(J4),...w0.shape}).strict(),HG=(Q)=>zG.safeParse(Q).success,oQ=N({jsonrpc:j(J4),id:$4,result:G0}).strict(),Y6=(Q)=>oQ.safeParse(Q).success;var _;(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"})(_||(_={}));var tQ=N({jsonrpc:j(J4),id:$4.optional(),error:N({code:m().int(),message:F(),data:o().optional()})}).strict();var KG=(Q)=>tQ.safeParse(Q).success;var BG=p([$G,zG,oQ,tQ]),DZ=p([oQ,tQ]),z4=G0.strict(),J3=N0.extend({requestId:$4.optional(),reason:F().optional()}),H4=w0.extend({method:j("notifications/cancelled"),params:J3}),$3=N({src:F(),mimeType:F().optional(),sizes:x(F()).optional(),theme:F0(["light","dark"]).optional()}),W6=N({icons:x($3).optional()}),b1=N({name:F(),title:F().optional()}),DG=b1.extend({...b1.shape,...W6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),z3=W4(N({applyDefaults:Q0().optional()}),t(F(),o())),H3=iQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},W4(N({form:z3.optional(),url:Y0.optional()}),t(F(),o()).optional())),K3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({sampling:B0({createMessage:Y0.optional()}).optional(),elicitation:B0({create:Y0.optional()}).optional()}).optional()}),B3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({tools:B0({call:Y0.optional()}).optional()}).optional()}),D3=N({experimental:t(F(),Y0).optional(),sampling:N({context:Y0.optional(),tools:Y0.optional()}).optional(),elicitation:H3.optional(),roots:N({listChanged:Q0().optional()}).optional(),tasks:K3.optional()}),A3=q0.extend({protocolVersion:F(),capabilities:D3,clientInfo:DG}),aQ=W0.extend({method:j("initialize"),params:A3});var F3=N({experimental:t(F(),Y0).optional(),logging:Y0.optional(),completions:Y0.optional(),prompts:N({listChanged:Q0().optional()}).optional(),resources:N({subscribe:Q0().optional(),listChanged:Q0().optional()}).optional(),tools:N({listChanged:Q0().optional()}).optional(),tasks:B3.optional()}),L3=G0.extend({protocolVersion:F(),capabilities:F3,serverInfo:DG,instructions:F().optional()}),sQ=w0.extend({method:j("notifications/initialized"),params:N0.optional()});var K4=W0.extend({method:j("ping"),params:q0.optional()}),U3=N({progress:m(),total:a(m()),message:a(F())}),O3=N({...N0.shape,...U3.shape,progressToken:WG}),B4=w0.extend({method:j("notifications/progress"),params:O3}),M3=q0.extend({cursor:GG.optional()}),G6=W0.extend({params:M3.optional()}),J6=G0.extend({nextCursor:GG.optional()}),V3=F0(["working","input_required","completed","failed","cancelled"]),$6=N({taskId:F(),status:V3,ttl:p([m(),cQ()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:a(m()),statusMessage:a(F())}),E1=G0.extend({task:$6}),q3=N0.merge($6),z6=w0.extend({method:j("notifications/tasks/status"),params:q3}),D4=W0.extend({method:j("tasks/get"),params:q0.extend({taskId:F()})}),A4=G0.merge($6),F4=W0.extend({method:j("tasks/result"),params:q0.extend({taskId:F()})}),AZ=G0.loose(),L4=G6.extend({method:j("tasks/list")}),U4=J6.extend({tasks:x($6)}),O4=W0.extend({method:j("tasks/cancel"),params:q0.extend({taskId:F()})}),AG=G0.merge($6),FG=N({uri:F(),mimeType:a(F()),_meta:t(F(),o()).optional()}),LG=FG.extend({text:F()}),eQ=F().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),UG=FG.extend({blob:eQ}),H6=F0(["user","assistant"]),I1=N({audience:x(H6).optional(),priority:m().min(0).max(1).optional(),lastModified:Q6.datetime({offset:!0}).optional()}),OG=N({...b1.shape,...W6.shape,uri:F(),description:a(F()),mimeType:a(F()),annotations:I1.optional(),_meta:a(B0({}))}),Z3=N({...b1.shape,...W6.shape,uriTemplate:F(),description:a(F()),mimeType:a(F()),annotations:I1.optional(),_meta:a(B0({}))}),Q9=G6.extend({method:j("resources/list")}),N3=J6.extend({resources:x(OG)}),w3=G6.extend({method:j("resources/templates/list")}),j3=J6.extend({resourceTemplates:x(Z3)}),X9=q0.extend({uri:F()}),P3=X9,Y9=W0.extend({method:j("resources/read"),params:P3}),b3=G0.extend({contents:x(p([LG,UG]))}),E3=w0.extend({method:j("notifications/resources/list_changed"),params:N0.optional()}),I3=X9,T3=W0.extend({method:j("resources/subscribe"),params:I3}),S3=X9,R3=W0.extend({method:j("resources/unsubscribe"),params:S3}),C3=N0.extend({uri:F()}),k3=w0.extend({method:j("notifications/resources/updated"),params:C3}),v3=N({name:F(),description:a(F()),required:a(Q0())}),x3=N({...b1.shape,...W6.shape,description:a(F()),arguments:a(x(v3)),_meta:a(B0({}))}),_3=G6.extend({method:j("prompts/list")}),y3=J6.extend({prompts:x(x3)}),h3=q0.extend({name:F(),arguments:t(F(),F()).optional()}),u3=W0.extend({method:j("prompts/get"),params:h3}),W9=N({type:j("text"),text:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),G9=N({type:j("image"),data:eQ,mimeType:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),J9=N({type:j("audio"),data:eQ,mimeType:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),g3=N({type:j("tool_use"),name:F(),id:F(),input:t(F(),o()),_meta:t(F(),o()).optional()}),f3=N({type:j("resource"),resource:p([LG,UG]),annotations:I1.optional(),_meta:t(F(),o()).optional()}),m3=OG.extend({type:j("resource_link")}),$9=p([W9,G9,J9,m3,f3]),l3=N({role:H6,content:$9}),c3=G0.extend({description:F().optional(),messages:x(l3)}),p3=w0.extend({method:j("notifications/prompts/list_changed"),params:N0.optional()}),i3=N({title:F().optional(),readOnlyHint:Q0().optional(),destructiveHint:Q0().optional(),idempotentHint:Q0().optional(),openWorldHint:Q0().optional()}),n3=N({taskSupport:F0(["required","optional","forbidden"]).optional()}),MG=N({...b1.shape,...W6.shape,description:F().optional(),inputSchema:N({type:j("object"),properties:t(F(),Y0).optional(),required:x(F()).optional()}).catchall(o()),outputSchema:N({type:j("object"),properties:t(F(),Y0).optional(),required:x(F()).optional()}).catchall(o()).optional(),annotations:i3.optional(),execution:n3.optional(),_meta:t(F(),o()).optional()}),z9=G6.extend({method:j("tools/list")}),d3=J6.extend({tools:x(MG)}),M4=G0.extend({content:x($9).default([]),structuredContent:t(F(),o()).optional(),isError:Q0().optional()}),FZ=M4.or(G0.extend({toolResult:o()})),r3=X6.extend({name:F(),arguments:t(F(),o()).optional()}),K6=W0.extend({method:j("tools/call"),params:r3}),o3=w0.extend({method:j("notifications/tools/list_changed"),params:N0.optional()}),LZ=N({autoRefresh:Q0().default(!0),debounceMs:m().int().nonnegative().default(300)}),B6=F0(["debug","info","notice","warning","error","critical","alert","emergency"]),t3=q0.extend({level:B6}),H9=W0.extend({method:j("logging/setLevel"),params:t3}),a3=N0.extend({level:B6,logger:F().optional(),data:o()}),s3=w0.extend({method:j("notifications/message"),params:a3}),e3=N({name:F().optional()}),QK=N({hints:x(e3).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),XK=N({mode:F0(["auto","required","none"]).optional()}),YK=N({type:j("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:x($9).default([]),structuredContent:N({}).loose().optional(),isError:Q0().optional(),_meta:t(F(),o()).optional()}),WK=pQ("type",[W9,G9,J9]),G4=pQ("type",[W9,G9,J9,g3,YK]),GK=N({role:H6,content:p([G4,x(G4)]),_meta:t(F(),o()).optional()}),JK=X6.extend({messages:x(GK),modelPreferences:QK.optional(),systemPrompt:F().optional(),includeContext:F0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:x(F()).optional(),metadata:Y0.optional(),tools:x(MG).optional(),toolChoice:XK.optional()}),$K=W0.extend({method:j("sampling/createMessage"),params:JK}),K9=G0.extend({model:F(),stopReason:a(F0(["endTurn","stopSequence","maxTokens"]).or(F())),role:H6,content:WK}),B9=G0.extend({model:F(),stopReason:a(F0(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:H6,content:p([G4,x(G4)])}),zK=N({type:j("boolean"),title:F().optional(),description:F().optional(),default:Q0().optional()}),HK=N({type:j("string"),title:F().optional(),description:F().optional(),minLength:m().optional(),maxLength:m().optional(),format:F0(["email","uri","date","date-time"]).optional(),default:F().optional()}),KK=N({type:F0(["number","integer"]),title:F().optional(),description:F().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),BK=N({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),default:F().optional()}),DK=N({type:j("string"),title:F().optional(),description:F().optional(),oneOf:x(N({const:F(),title:F()})),default:F().optional()}),AK=N({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),enumNames:x(F()).optional(),default:F().optional()}),FK=p([BK,DK]),LK=N({type:j("array"),title:F().optional(),description:F().optional(),minItems:m().optional(),maxItems:m().optional(),items:N({type:j("string"),enum:x(F())}),default:x(F()).optional()}),UK=N({type:j("array"),title:F().optional(),description:F().optional(),minItems:m().optional(),maxItems:m().optional(),items:N({anyOf:x(N({const:F(),title:F()}))}),default:x(F()).optional()}),OK=p([LK,UK]),MK=p([AK,FK,OK]),VK=p([MK,zK,HK,KK]),qK=X6.extend({mode:j("form").optional(),message:F(),requestedSchema:N({type:j("object"),properties:t(F(),VK),required:x(F()).optional()})}),ZK=X6.extend({mode:j("url"),message:F(),elicitationId:F(),url:F().url()}),NK=p([qK,ZK]),wK=W0.extend({method:j("elicitation/create"),params:NK}),jK=N0.extend({elicitationId:F()}),PK=w0.extend({method:j("notifications/elicitation/complete"),params:jK}),V4=G0.extend({action:F0(["accept","decline","cancel"]),content:iQ((Q)=>Q===null?void 0:Q,t(F(),p([F(),m(),Q0(),x(F())])).optional())}),bK=N({type:j("ref/resource"),uri:F()});var EK=N({type:j("ref/prompt"),name:F()}),IK=q0.extend({ref:p([EK,bK]),argument:N({name:F(),value:F()}),context:N({arguments:t(F(),F()).optional()}).optional()}),TK=W0.extend({method:j("completion/complete"),params:IK});var SK=G0.extend({completion:B0({values:x(F()).max(100),total:a(m().int()),hasMore:a(Q0())})}),RK=N({uri:F().startsWith("file://"),name:F().optional(),_meta:t(F(),o()).optional()}),CK=W0.extend({method:j("roots/list"),params:q0.optional()}),D9=G0.extend({roots:x(RK)}),kK=w0.extend({method:j("notifications/roots/list_changed"),params:N0.optional()}),UZ=p([K4,aQ,TK,H9,u3,_3,Q9,w3,Y9,T3,R3,K6,z9,D4,F4,L4,O4]),OZ=p([H4,B4,sQ,kK,z6]),MZ=p([z4,K9,B9,V4,D9,A4,U4,E1]),VZ=p([K4,$K,wK,CK,D4,F4,L4,O4]),qZ=p([H4,B4,s3,k3,E3,o3,p3,z6,PK]),ZZ=p([z4,L3,SK,c3,y3,N3,j3,b3,M4,d3,A4,U4,E1]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===_.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new VG(W.elicitations,X)}return new C(Q,X,Y)}}class VG extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(_.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function X1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var vK=Symbol("Let zodToJsonSchema decide on which parser to use");var eZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function A9(Q){let Y=X4(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=EW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function F9(Q,X){let Y=e0(Q,X);if(!Y.success)throw Y.error;return Y.data}var gK=60000;class L9{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(H4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(B4,(X)=>{this._onprogress(X)}),this.setRequestHandler(K4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(D4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(F4,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 z=$.message,H=z.id,K=this._requestResolvers.get(H);if(K)if(this._requestResolvers.delete(H),$.type==="response")K(z);else{let B=z,D=new C(B.error.code,B.error.message,B.error.data);K(D)}else{let B=$.type==="response"?"Response":"Error";this._onerror(Error(`${B} handler missing for request ${H}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new C(_.InvalidParams,`Task not found: ${G}`);if(!X1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(X1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[Q1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(L4,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 C(_.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(O4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,`Task not found: ${X.params.taskId}`);if(X1(W.status))throw new C(_.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 C(_.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof C)throw W;throw new C(_.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),C.fromError(_.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){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),Y6(G)||KG(G))this._onresponse(G);else if(rQ(G))this._onrequest(G,J);else if(HG(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();let X=C.fromError(_.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?.[Q1]?.taskId;if(Y===void 0){let K={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((B)=>this._onerror(Error(`Failed to enqueue error response: ${B}`)));else W?.send(K).catch((B)=>this._onerror(Error(`Failed to send an error response: ${B}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=JG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(K)=>{let B={relatedRequestId:Q.id};if(G)B.relatedTask={taskId:G};await this.notification(K,B)},sendRequest:async(K,B,D)=>{let A={...D,relatedRequestId:Q.id};if(G&&!A.relatedTask)A.relatedTask={taskId:G};let U=A.relatedTask?.taskId??G;if(U&&z)await z.updateTaskStatus(U,"input_required");return await this.request(K,B,A)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(K)=>{if(J.signal.aborted)return;let B={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)},async(K)=>{if(J.signal.aborted)return;let B={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:_.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{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(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),Y6(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let G=!1;if(Y6(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(Y6(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,E1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(_.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},X1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new C(_.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new C(_.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((H,K)=>{let B=(V)=>{K(V)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(V){B(V);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,A={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),A.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if($)A.params={...A.params,task:$};if(z)A.params={...A.params,_meta:{...A.params?._meta||{},[Q1]:z}};let U=(V)=>{this._responseHandlers.delete(D),this._progressHandlers.delete(D),this._cleanupTimeout(D),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:D,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let T=V instanceof C?V:new C(_.RequestTimeout,String(V));K(T)};this._responseHandlers.set(D,(V)=>{if(Y?.signal?.aborted)return;if(V instanceof Error)return K(V);try{let T=e0(X,V.result);if(!T.success)K(T.error);else H(T.data)}catch(T){K(T)}}),Y?.signal?.addEventListener("abort",()=>{U(Y?.signal?.reason)});let O=Y?.timeout??gK,M=()=>U(C.fromError(_.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(D,O,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let q=z?.taskId;if(q){let V=(T)=>{let E=this._responseHandlers.get(D);if(E)E(T);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,V),this._enqueueTaskMessage(q,{type:"request",message:A,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(D),K(T)})}else this._transport.send(A,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(D),K(V)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},A4,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},U4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},AG,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||{},[Q1]: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||{},[Q1]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[Q1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=A9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=F9(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=A9(Q);this._notificationHandlers.set(Y,(W)=>{let G=F9(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"&&rQ(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new C(_.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 C(_.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new C(_.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 C(_.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 z=z6.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),X1($.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 C(_.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(X1($.status))throw new C(_.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 z=await Y.getTask(W,X);if(z){let H=z6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),X1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function qG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function ZG(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(qG($)&&qG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var a7=RX(HX(),1),s7=RX(t7(),1);function rM(){let Q=new a7.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return s7.default(Q),Q}class VX{constructor(Q){this._ajv=Q??rM()}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 qX{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}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 e7(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 Q5(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 ZX extends L9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(B6.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 VX,this.setRequestHandler(aQ,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(sQ,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(H9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=B6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new qX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ZG(this._capabilities,Q)}setRequestHandler(Q,X){let W=X4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(P1(W)){let $=W;G=$._zod?.def?.value??$.value}else{let $=W;G=$._def?.value??$.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(z,H)=>{let K=e0(K6,z);if(!K.success){let U=K.error instanceof Error?K.error.message:String(K.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${U}`)}let{params:B}=K.data,D=await Promise.resolve(X(z,H));if(B.task){let U=e0(E1,D);if(!U.success){let O=U.error instanceof Error?U.error.message:String(U.error);throw new C(_.InvalidParams,`Invalid task creation result: ${O}`)}return U.data}let A=e0(M4,D);if(!A.success){let U=A.error instanceof Error?A.error.message:String(A.error);throw new C(_.InvalidParams,`Invalid tools/call result: ${U}`)}return A.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){Q5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;e7(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:YG.includes(X)?X:nQ,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"},z4)}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((H)=>H.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]:[],z=$.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!z)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(z){let H=new Set($.filter((B)=>B.type==="tool_use").map((B)=>B.id)),K=new Set(W.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(H.size!==K.size||![...H].every((B)=>K.has(B)))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},B9,X);return this.request({method:"sampling/createMessage",params:Q},K9,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},V4,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},V4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new C(_.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(_.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},D9,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 Y5 from"node:process";class NX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
29
- `);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),oM(X)}clear(){this._buffer=void 0}}function oM(Q){return BG.parse(JSON.parse(Q))}function X5(Q){return JSON.stringify(Q)+`
30
- `}class wX{constructor(Q=Y5.stdin,X=Y5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new NX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=X5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var W5={name:"@sequenzy/mcp",version:"0.0.21",mcpName:"io.github.polnikale/sequenzy-mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/sequenzy/sequenzy.git"}};class g1 extends Error{statusCode;rawDetails;code;constructor(Q,X,Y,W){super(Q);this.statusCode=X;this.rawDetails=Y;this.code=W;this.name="McpApiError"}}function aM(Q){if(Q instanceof g1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function sM(Q){let X=aM(Q),Y=X.message.trim()||"Unknown error",W=Y.toLowerCase(),G=X.rawDetails?.trim()||Y;if(X.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===401||X.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(X.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode&&X.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function q1(Q){let X=sM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
31
- `)}var jX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],G5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function eM(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function r0(Q){let X=Q?.trim();return X?X:void 0}function K1(Q){return encodeURIComponent(Q)}function z0(Q,X){return`${Q}${X}`}function H0(Q,X=""){return`/dashboard/company/${K1(Q)}${X}`}function J5(Q,X,Y){return z0(Q,`${H0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function QV(Q,X){let Y=jX.map((W)=>[W,X?J5(Q,X,W):""]);return Object.fromEntries(Y)}function B1(Q={},X){let Y=eM(X),W=r0(Q.companyId),G={},J=QV(Y,W);if(!W)return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J};G.dashboard=z0(Y,H0(W)),G.campaigns=z0(Y,H0(W,"/campaign")),G.sequences=z0(Y,H0(W,"/sequences")),G.settings=z0(Y,H0(W,"/settings")),G.emails=z0(Y,H0(W,"/emails")),G.subscribers=z0(Y,H0(W,"/subscribers")),G.segments=z0(Y,H0(W,"/segments")),G.metrics=z0(Y,H0(W,"/metrics")),G.transactional=z0(Y,H0(W,"/transactional"));let $=r0(Q.campaignId);if($)G.campaign=z0(Y,H0(W,`/campaign/${K1($)}`));let z=r0(Q.sequenceId);if(z)G.sequence=z0(Y,H0(W,`/sequences/${K1(z)}`));let H=r0(Q.emailId)??r0(Q.templateId);if(H)G.email=z0(Y,H0(W,`/emails/${K1(H)}`)),G.template=G.email;let K=r0(Q.transactionalId);if(K)G.transactionalEmail=z0(Y,H0(W,`/transactional/${K1(K)}`));let B=r0(Q.domainId);if(B)G.domain=z0(Y,H0(W,`/settings/domain/${K1(B)}`)),G.domainVerify=`${G.domain}/verify`;let D=r0(Q.status);if(D)G.campaignList=z0(Y,H0(W,`/campaign/list/${K1(D)}`)),G.sequenceList=z0(Y,H0(W,`/sequences/list/${K1(D)}`));let A=r0(Q.settingsTab);if(A)G.settingsTab=J5(Y,W,A);return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J}}var $5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function z5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await w("GET","/api/v1/account"),W=_6()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await w("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=B1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:q1(X)}]}}}var XV={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","emailProvider","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For `event`, use `is`, `is_not`, `at_least`, or `less_than_count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Event examples: `saas.purchase:30d`, `saas.purchase:all`, or `saas.purchase:5:30d` for thresholds. Segment values are segment IDs. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1},YV={type:"object",properties:{kind:{type:"string",enum:["group"]},id:{type:"string",description:"Stable group ID. Any string works; one will be generated if omitted."},joinOperator:{type:"string",enum:["and","or"],description:"How children in this group combine."},children:{type:"array",minItems:1,items:{type:"object",description:'Either a filter leaf (`kind: "filter"`) or another group (`kind: "group"`).'}}},required:["kind","joinOperator","children"],additionalProperties:!0};function K5(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function B5(Q){if(typeof Q!=="object"||Q===null)return Q;let X=Q;if(X.kind==="filter"){let Y=K5([X]);return Array.isArray(Y)?Y[0]:X}if(X.kind!=="group")return Q;return{...X,id:typeof X.id==="string"&&X.id.trim()!==""?X.id:crypto.randomUUID(),children:Array.isArray(X.children)?X.children.map(B5):[]}}function WQ(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function WV(Q){WQ("create_campaign",Q);let X=f(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(X&&(Y||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!X&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!X&&f(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function GV(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function h0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function H5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function JV(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function $V(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],J=1,$=0,z=0,H=0;while(!0){let B=JV({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.toString()}`,void 0,X);$=D.pagination?.total??D.subscribers.length,z=D.pagination?.totalPages??1,H+=1,G.push(...D.subscribers??[]);let A=Y!==void 0&&G.length>=Y,U=D.pagination?J>=D.pagination.totalPages:(D.subscribers??[]).length<W;if(A||U)break;J+=1}let K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function PX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}function f(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function D5(Q){let X=f(Q,"companyId");if(X)return X;let Y=_6();if(Y)return Y;try{return(await w("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function GQ(Q,X){if(!h0(Q)||!X)return Q;return{...Q,url:X}}function bX(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!h0(W))return W;let G=f(W,"id");if(!G)return W;let J=B1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G}}),$=Y==="campaign"?J.urls.campaign:Y==="sequence"?J.urls.sequence:J.urls.email;return GQ(W,$)})}function zV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!h0(X))return X;let Y=f(X,"id");if(!Y)return X;let W=B1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var HV=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","create_campaign","update_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","list_templates","get_template","create_template","update_template"]);async function KV(Q,X,Y){if(!h0(Y)||!HV.has(Q))return Y;let W=h0(Y.company)?Y.company:void 0,J=f(Y,"selectedCompanyId")??f(Y,"currentCompanyId")??f(Y,"companyId")??(W?f(W,"id"):void 0)??(W?f(W,"companyId"):void 0)??await D5(X);if(!J)return Y;let $=h0(Y.campaign)?Y.campaign:void 0,z=h0(Y.sequence)?Y.sequence:void 0,H=h0(Y.template)?Y.template:void 0,K={companyId:J,campaignId:f(X,"campaignId")??f(Y,"campaignId")??($?f($,"id"):void 0),sequenceId:f(X,"sequenceId")??f(Y,"sequenceId")??(z?f(z,"id"):void 0),emailId:f(X,"templateId")??f(Y,"templateId")??(H?f(H,"id"):void 0),status:f(X,"status")},B=B1(K),D=W?B1({companyId:J}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:zV(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:bX(Y.campaigns,J,"campaign")},...Array.isArray(Y.sequences)&&{sequences:bX(Y.sequences,J,"sequence")},...Array.isArray(Y.templates)&&{templates:bX(Y.templates,J,"template")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...$&&B.urls.campaign!==void 0&&{campaign:GQ($,B.urls.campaign)},...z&&B.urls.sequence!==void 0&&{sequence:GQ(z,B.urls.sequence)},...H&&B.urls.email!==void 0&&{template:GQ(H,B.urls.email)},appUrls:B.urls}}var A5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
28
+ `)}U.write("payload.value = newResult;"),U.write("return payload;");let T=U.compile();return(E,v)=>T(A,E,v)},J,$=D1,z=!h6.jitless,K=z&&AQ.value,B=X.catchall,D;Q._zod.parse=(A,U)=>{D??(D=W.value);let O=A.value;if(!$(O))return A.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),A;if(z&&K&&U?.async===!1&&U.jitless!==!0){if(!J)J=G(X.shape);if(A=J(A,U),!B)return A;return EY([],O,A,U,D,Q)}return Y(A,U)}});function l8(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,Z0())))}),X}var PQ=L("$ZodUnion",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),l(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),l(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),l(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>p1(J.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(Y)return W(G,J);let $=!1,z=[];for(let H of X.options){let K=H._zod.run({value:G.value,issues:[]},J);if(K instanceof Promise)z.push(K),$=!0;else{if(K.issues.length===0)return K;z.push(K)}}if(!$)return l8(z,G,Q,J);return Promise.all(z).then((H)=>{return l8(H,G,Q,J)})}}),TY=L("$ZodDiscriminatedUnion",(Q,X)=>{PQ.init(Q,X);let Y=Q._zod.parse;l(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[z,H]of Object.entries($)){if(!G[z])G[z]=new Set;for(let K of H)G[z].add(K)}}return G});let W=N1(()=>{let G=X.options,J=new Map;for(let $ of G){let z=$._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let H of z){if(J.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);J.set(H,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!D1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let z=W.value.get($?.[X.discriminator]);if(z)return z._zod.run(G,J);if(X.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:$,path:[X.discriminator],inst:Q}),G}}),SY=L("$ZodIntersection",(Q,X)=>{i.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(([H,K])=>{return c8(Y,H,K)});return c8(Y,J,$)}});function wQ(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 $=wQ(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],$=wQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function c8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(s0(Q))return Q;let W=wQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var RY=L("$ZodRecord",(Q,X)=>{i.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=[];if(X.keyType._zod.values){let $=X.keyType._zod.values;Y.value={};for(let H of $)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let K=X.valueType._zod.run({value:G[H],issues:[]},W);if(K instanceof Promise)J.push(K.then((B)=>{if(B.issues.length)Y.issues.push(...m0(H,B.issues));Y.value[H]=B.value}));else{if(K.issues.length)Y.issues.push(...m0(H,K.issues));Y.value[H]=K.value}}let z;for(let H in G)if(!$.has(H))z=z??[],z.push(H);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let $ of Reflect.ownKeys(G)){if($==="__proto__")continue;let z=X.keyType._zod.run({value:$,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((K)=>E0(K,W,Z0())),input:$,path:[$],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[$],issues:[]},W);if(H instanceof Promise)J.push(H.then((K)=>{if(K.issues.length)Y.issues.push(...m0($,K.issues));Y.value[z.value]=K.value}));else{if(H.issues.length)Y.issues.push(...m0($,H.issues));Y.value[z.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var CY=L("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=BQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>FQ.has(typeof G)).map((G)=>typeof G==="string"?f0(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}}),kY=L("$ZodLiteral",(Q,X)=>{if(i.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?f0(Y):Y?f0(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let G=Y.value;if(Q._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var vY=L("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(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});if(G instanceof Promise)throw new g0;return Y.value=G,Y}});function p8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var xY=L("$ZodOptional",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",l(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>p8(J,Y.value));return p8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),_Y=L("$ZodNullable",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)}|null)$`):void 0}),l(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)}}),yY=L("$ZodDefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",l(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)=>i8(J,X));return i8(G,X)}});function i8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var hY=L("$ZodPrefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",l(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)}}),uY=L("$ZodNonOptional",(Q,X)=>{i.init(Q,X),l(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)=>n8(J,Q));return n8(G,Q)}});function n8(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 gY=L("$ZodCatch",(Q,X)=>{i.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(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,Z0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>E0(J,W,Z0()))},input:Y.value}),Y.issues=[];return Y}});var fY=L("$ZodPipe",(Q,X)=>{i.init(Q,X),l(Q._zod,"values",()=>X.in._zod.values),l(Q._zod,"optin",()=>X.in._zod.optin),l(Q._zod,"optout",()=>X.out._zod.optout),l(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(($)=>d6($,X.in,W));return d6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>d6(J,X.out,W));return d6(G,X.out,W)}});function d6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var mY=L("$ZodReadonly",(Q,X)=>{i.init(Q,X),l(Q._zod,"propValues",()=>X.innerType._zod.propValues),l(Q._zod,"values",()=>X.innerType._zod.values),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(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(d8);return d8(G)}});function d8(Q){return Q.value=Object.freeze(Q.value),Q}var lY=L("$ZodCustom",(Q,X)=>{X0.init(Q,X),i.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)=>r8(J,Y,W,Q));r8(G,Y,W,Q);return}});function r8(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(w1(G))}}var WH=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},GH=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return Q[W]??null}let Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${WH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${m6(W.values[0])}`;return`Invalid option: expected one of ${u6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${G}${W.minimum.toString()}`}case"invalid_format":{let G=W;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${u6(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function bQ(){return{localeError:GH()}}var RV=Symbol("ZodOutput"),CV=Symbol("ZodInput");class cY{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){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,Q)}return this}clear(){return this._map=new 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 JH(){return new cY}var t1=JH();function pY(Q,X){return new Q({type:"string",...b(X)})}function iY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function EQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(X)})}function rY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(X)})}function oY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function tY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function eY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function XW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function YW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function WW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function GW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function JW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function $W(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function zW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function HW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function KW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function BW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function DW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function AW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function FW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function LW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function UW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function OW(Q,X){return new Q({type:"number",checks:[],...b(X)})}function MW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function VW(Q,X){return new Q({type:"boolean",...b(X)})}function qW(Q,X){return new Q({type:"null",...b(X)})}function ZW(Q){return new Q({type:"unknown"})}function NW(Q,X){return new Q({type:"never",...b(X)})}function t6(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!1})}function a1(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!0})}function a6(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!1})}function s1(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!0})}function s6(Q,X){return new I8({check:"multiple_of",...b(X),value:Q})}function e6(Q,X){return new S8({check:"max_length",...b(X),maximum:Q})}function j1(Q,X){return new R8({check:"min_length",...b(X),minimum:Q})}function Q4(Q,X){return new C8({check:"length_equals",...b(X),length:Q})}function IQ(Q,X){return new k8({check:"string_format",format:"regex",...b(X),pattern:Q})}function TQ(Q){return new v8({check:"string_format",format:"lowercase",...b(Q)})}function SQ(Q){return new x8({check:"string_format",format:"uppercase",...b(Q)})}function RQ(Q,X){return new _8({check:"string_format",format:"includes",...b(X),includes:Q})}function CQ(Q,X){return new y8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function kQ(Q,X){return new h8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function A1(Q){return new u8({check:"overwrite",tx:Q})}function vQ(Q){return A1((X)=>X.normalize(Q))}function xQ(){return A1((Q)=>Q.trim())}function _Q(){return A1((Q)=>Q.toLowerCase())}function yQ(){return A1((Q)=>Q.toUpperCase())}function wW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function jW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function PW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function bW(Q){let X=$H((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(w1(W,Y.value,X._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(w1(G))}},Q(Y.value,Y)});return X}function $H(Q,X){let Y=new X0({check:"custom",...b(X)});return Y._zod.check=Q,Y}function P1(Q){return!!Q._zod}function e0(Q,X){if(P1(Q))return d1(Q,X);return Q.safeParse(X)}function X4(Q){if(!Q)return;let X;if(P1(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 EW(Q){if(P1(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 Q6={};CX(Q6,{time:()=>gQ,duration:()=>fQ,datetime:()=>hQ,date:()=>uQ,ZodISOTime:()=>SW,ZodISODuration:()=>RW,ZodISODateTime:()=>IW,ZodISODate:()=>TW});var IW=L("ZodISODateTime",(Q,X)=>{$Y.init(Q,X),r.init(Q,X)});function hQ(Q){return AW(IW,Q)}var TW=L("ZodISODate",(Q,X)=>{zY.init(Q,X),r.init(Q,X)});function uQ(Q){return FW(TW,Q)}var SW=L("ZodISOTime",(Q,X)=>{HY.init(Q,X),r.init(Q,X)});function gQ(Q){return LW(SW,Q)}var RW=L("ZodISODuration",(Q,X)=>{KY.init(Q,X),r.init(Q,X)});function fQ(Q){return UW(RW,Q)}var CW=(Q,X)=>{l6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>lX(Q,Y)},flatten:{value:(Y)=>mX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},Oq=L("ZodError",CW),V0=L("ZodError",CW,{Parent:Error});var kW=c6(V0),vW=p6(V0),xW=n1(V0),_W=r1(V0),yW=cX(V0),hW=pX(V0),uW=iX(V0),gW=nX(V0),fW=dX(V0),mW=rX(V0),lW=oX(V0),cW=tX(V0);var s=L("ZodType",(Q,X)=>{return i.init(Q,X),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone(u.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>b0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>kW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>xW(Q,Y,W),Q.parseAsync=async(Y,W)=>vW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>_W(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>yW(Q,Y,W),Q.decode=(Y,W)=>hW(Q,Y,W),Q.encodeAsync=async(Y,W)=>uW(Q,Y,W),Q.decodeAsync=async(Y,W)=>gW(Q,Y,W),Q.safeEncode=(Y,W)=>fW(Q,Y,W),Q.safeDecode=(Y,W)=>mW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>lW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>cW(Q,Y,W),Q.refine=(Y,W)=>Q.check(Y3(Y,W)),Q.superRefine=(Y)=>Q.check(W3(Y)),Q.overwrite=(Y)=>Q.check(A1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>nW(Q),Q.nullish=()=>a(nW(Q)),Q.nonoptional=(Y)=>tH(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>p([Q,Y]),Q.and=(Y)=>W4(Q,Y),Q.transform=(Y)=>lQ(Q,aW(Y)),Q.default=(Y)=>dH(Q,Y),Q.prefault=(Y)=>oH(Q,Y),Q.catch=(Y)=>sH(Q,Y),Q.pipe=(Y)=>lQ(Q,Y),Q.readonly=()=>X3(Q),Q.describe=(Y)=>{let W=Q.clone();return t1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return t1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return t1.get(Q);let W=Q.clone();return t1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),dW=L("_ZodString",(Q,X)=>{o6.init(Q,X),s.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(IQ(...W)),Q.includes=(...W)=>Q.check(RQ(...W)),Q.startsWith=(...W)=>Q.check(CQ(...W)),Q.endsWith=(...W)=>Q.check(kQ(...W)),Q.min=(...W)=>Q.check(j1(...W)),Q.max=(...W)=>Q.check(e6(...W)),Q.length=(...W)=>Q.check(Q4(...W)),Q.nonempty=(...W)=>Q.check(j1(1,...W)),Q.lowercase=(W)=>Q.check(TQ(W)),Q.uppercase=(W)=>Q.check(SQ(W)),Q.trim=()=>Q.check(xQ()),Q.normalize=(...W)=>Q.check(vQ(...W)),Q.toLowerCase=()=>Q.check(_Q()),Q.toUpperCase=()=>Q.check(yQ())}),UH=L("ZodString",(Q,X)=>{o6.init(Q,X),dW.init(Q,X),Q.email=(Y)=>Q.check(iY(OH,Y)),Q.url=(Y)=>Q.check(tY(MH,Y)),Q.jwt=(Y)=>Q.check(DW(kH,Y)),Q.emoji=(Y)=>Q.check(aY(VH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.uuid=(Y)=>Q.check(nY(Y4,Y)),Q.uuidv4=(Y)=>Q.check(dY(Y4,Y)),Q.uuidv6=(Y)=>Q.check(rY(Y4,Y)),Q.uuidv7=(Y)=>Q.check(oY(Y4,Y)),Q.nanoid=(Y)=>Q.check(sY(qH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.cuid=(Y)=>Q.check(eY(ZH,Y)),Q.cuid2=(Y)=>Q.check(QW(NH,Y)),Q.ulid=(Y)=>Q.check(XW(wH,Y)),Q.base64=(Y)=>Q.check(HW(SH,Y)),Q.base64url=(Y)=>Q.check(KW(RH,Y)),Q.xid=(Y)=>Q.check(YW(jH,Y)),Q.ksuid=(Y)=>Q.check(WW(PH,Y)),Q.ipv4=(Y)=>Q.check(GW(bH,Y)),Q.ipv6=(Y)=>Q.check(JW(EH,Y)),Q.cidrv4=(Y)=>Q.check($W(IH,Y)),Q.cidrv6=(Y)=>Q.check(zW(TH,Y)),Q.e164=(Y)=>Q.check(BW(CH,Y)),Q.datetime=(Y)=>Q.check(hQ(Y)),Q.date=(Y)=>Q.check(uQ(Y)),Q.time=(Y)=>Q.check(gQ(Y)),Q.duration=(Y)=>Q.check(fQ(Y))});function F(Q){return pY(UH,Q)}var r=L("ZodStringFormat",(Q,X)=>{n.init(Q,X),dW.init(Q,X)}),OH=L("ZodEmail",(Q,X)=>{a8.init(Q,X),r.init(Q,X)});var pW=L("ZodGUID",(Q,X)=>{o8.init(Q,X),r.init(Q,X)});var Y4=L("ZodUUID",(Q,X)=>{t8.init(Q,X),r.init(Q,X)});var MH=L("ZodURL",(Q,X)=>{s8.init(Q,X),r.init(Q,X)});var VH=L("ZodEmoji",(Q,X)=>{e8.init(Q,X),r.init(Q,X)});var qH=L("ZodNanoID",(Q,X)=>{QY.init(Q,X),r.init(Q,X)});var ZH=L("ZodCUID",(Q,X)=>{XY.init(Q,X),r.init(Q,X)});var NH=L("ZodCUID2",(Q,X)=>{YY.init(Q,X),r.init(Q,X)});var wH=L("ZodULID",(Q,X)=>{WY.init(Q,X),r.init(Q,X)});var jH=L("ZodXID",(Q,X)=>{GY.init(Q,X),r.init(Q,X)});var PH=L("ZodKSUID",(Q,X)=>{JY.init(Q,X),r.init(Q,X)});var bH=L("ZodIPv4",(Q,X)=>{BY.init(Q,X),r.init(Q,X)});var EH=L("ZodIPv6",(Q,X)=>{DY.init(Q,X),r.init(Q,X)});var IH=L("ZodCIDRv4",(Q,X)=>{AY.init(Q,X),r.init(Q,X)});var TH=L("ZodCIDRv6",(Q,X)=>{FY.init(Q,X),r.init(Q,X)});var SH=L("ZodBase64",(Q,X)=>{UY.init(Q,X),r.init(Q,X)});var RH=L("ZodBase64URL",(Q,X)=>{OY.init(Q,X),r.init(Q,X)});var CH=L("ZodE164",(Q,X)=>{MY.init(Q,X),r.init(Q,X)});var kH=L("ZodJWT",(Q,X)=>{VY.init(Q,X),r.init(Q,X)});var rW=L("ZodNumber",(Q,X)=>{jQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(a6(W,G)),Q.gte=(W,G)=>Q.check(s1(W,G)),Q.min=(W,G)=>Q.check(s1(W,G)),Q.lt=(W,G)=>Q.check(t6(W,G)),Q.lte=(W,G)=>Q.check(a1(W,G)),Q.max=(W,G)=>Q.check(a1(W,G)),Q.int=(W)=>Q.check(iW(W)),Q.safe=(W)=>Q.check(iW(W)),Q.positive=(W)=>Q.check(a6(0,W)),Q.nonnegative=(W)=>Q.check(s1(0,W)),Q.negative=(W)=>Q.check(t6(0,W)),Q.nonpositive=(W)=>Q.check(a1(0,W)),Q.multipleOf=(W,G)=>Q.check(s6(W,G)),Q.step=(W,G)=>Q.check(s6(W,G)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function m(Q){return OW(rW,Q)}var vH=L("ZodNumberFormat",(Q,X)=>{qY.init(Q,X),rW.init(Q,X)});function iW(Q){return MW(vH,Q)}var xH=L("ZodBoolean",(Q,X)=>{ZY.init(Q,X),s.init(Q,X)});function Q0(Q){return VW(xH,Q)}var _H=L("ZodNull",(Q,X)=>{NY.init(Q,X),s.init(Q,X)});function cQ(Q){return qW(_H,Q)}var yH=L("ZodUnknown",(Q,X)=>{wY.init(Q,X),s.init(Q,X)});function o(){return ZW(yH)}var hH=L("ZodNever",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function uH(Q){return NW(hH,Q)}var gH=L("ZodArray",(Q,X)=>{PY.init(Q,X),s.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(j1(Y,W)),Q.nonempty=(Y)=>Q.check(j1(1,Y)),Q.max=(Y,W)=>Q.check(e6(Y,W)),Q.length=(Y,W)=>Q.check(Q4(Y,W)),Q.unwrap=()=>Q.element});function x(Q,X){return wW(gH,Q,X)}var oW=L("ZodObject",(Q,X)=>{IY.init(Q,X),s.init(Q,X),u.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>F0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:uH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return u.extend(Q,Y)},Q.safeExtend=(Y)=>{return u.safeExtend(Q,Y)},Q.merge=(Y)=>u.merge(Q,Y),Q.pick=(Y)=>u.pick(Q,Y),Q.omit=(Y)=>u.omit(Q,Y),Q.partial=(...Y)=>u.partial(sW,Q,Y[0]),Q.required=(...Y)=>u.required(eW,Q,Y[0])});function N(Q,X){let Y={type:"object",shape:Q??{},...u.normalizeParams(X)};return new oW(Y)}function B0(Q,X){return new oW({type:"object",shape:Q,catchall:o(),...u.normalizeParams(X)})}var tW=L("ZodUnion",(Q,X)=>{PQ.init(Q,X),s.init(Q,X),Q.options=X.options});function p(Q,X){return new tW({type:"union",options:Q,...u.normalizeParams(X)})}var fH=L("ZodDiscriminatedUnion",(Q,X)=>{tW.init(Q,X),TY.init(Q,X)});function pQ(Q,X,Y){return new fH({type:"union",options:X,discriminator:Q,...u.normalizeParams(Y)})}var mH=L("ZodIntersection",(Q,X)=>{SY.init(Q,X),s.init(Q,X)});function W4(Q,X){return new mH({type:"intersection",left:Q,right:X})}var lH=L("ZodRecord",(Q,X)=>{RY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new lH({type:"record",keyType:Q,valueType:X,...u.normalizeParams(Y)})}var mQ=L("ZodEnum",(Q,X)=>{CY.init(Q,X),s.init(Q,X),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 mQ({...X,checks:[],...u.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 mQ({...X,checks:[],...u.normalizeParams(G),entries:J})}});function F0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new mQ({type:"enum",entries:Y,...u.normalizeParams(X)})}var cH=L("ZodLiteral",(Q,X)=>{kY.init(Q,X),s.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function j(Q,X){return new cH({type:"literal",values:Array.isArray(Q)?Q:[Q],...u.normalizeParams(X)})}var pH=L("ZodTransform",(Q,X)=>{vY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(u.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(u.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function aW(Q){return new pH({type:"transform",transform:Q})}var sW=L("ZodOptional",(Q,X)=>{xY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new sW({type:"optional",innerType:Q})}var iH=L("ZodNullable",(Q,X)=>{_Y.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function nW(Q){return new iH({type:"nullable",innerType:Q})}var nH=L("ZodDefault",(Q,X)=>{yY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function dH(Q,X){return new nH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():u.shallowClone(X)}})}var rH=L("ZodPrefault",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function oH(Q,X){return new rH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():u.shallowClone(X)}})}var eW=L("ZodNonOptional",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function tH(Q,X){return new eW({type:"nonoptional",innerType:Q,...u.normalizeParams(X)})}var aH=L("ZodCatch",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function sH(Q,X){return new aH({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var eH=L("ZodPipe",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function lQ(Q,X){return new eH({type:"pipe",in:Q,out:X})}var Q3=L("ZodReadonly",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function X3(Q){return new Q3({type:"readonly",innerType:Q})}var QG=L("ZodCustom",(Q,X)=>{lY.init(Q,X),s.init(Q,X)});function XG(Q,X){return jW(QG,Q??(()=>!0),X)}function Y3(Q,X={}){return PW(QG,Q,X)}function W3(Q){return bW(Q)}function iQ(Q,X){return lQ(aW(Q),X)}Z0(bQ());var nQ="2025-11-25";var YG=[nQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Q1="io.modelcontextprotocol/related-task",J4="2.0",Y0=XG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),WG=p([F(),m().int()]),GG=F(),DZ=B0({ttl:p([m(),cQ()]).optional(),pollInterval:m().optional()}),G3=N({ttl:m().optional()}),J3=N({taskId:F()}),dQ=B0({progressToken:WG.optional(),[Q1]:J3.optional()}),q0=N({_meta:dQ.optional()}),X6=q0.extend({task:G3.optional()}),JG=(Q)=>X6.safeParse(Q).success,W0=N({method:F(),params:q0.loose().optional()}),N0=N({_meta:dQ.optional()}),w0=N({method:F(),params:N0.loose().optional()}),G0=B0({_meta:dQ.optional()}),$4=p([F(),m().int()]),$G=N({jsonrpc:j(J4),id:$4,...W0.shape}).strict(),rQ=(Q)=>$G.safeParse(Q).success,zG=N({jsonrpc:j(J4),...w0.shape}).strict(),HG=(Q)=>zG.safeParse(Q).success,oQ=N({jsonrpc:j(J4),id:$4,result:G0}).strict(),Y6=(Q)=>oQ.safeParse(Q).success;var _;(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"})(_||(_={}));var tQ=N({jsonrpc:j(J4),id:$4.optional(),error:N({code:m().int(),message:F(),data:o().optional()})}).strict();var KG=(Q)=>tQ.safeParse(Q).success;var BG=p([$G,zG,oQ,tQ]),AZ=p([oQ,tQ]),z4=G0.strict(),$3=N0.extend({requestId:$4.optional(),reason:F().optional()}),H4=w0.extend({method:j("notifications/cancelled"),params:$3}),z3=N({src:F(),mimeType:F().optional(),sizes:x(F()).optional(),theme:F0(["light","dark"]).optional()}),W6=N({icons:x(z3).optional()}),b1=N({name:F(),title:F().optional()}),DG=b1.extend({...b1.shape,...W6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),H3=W4(N({applyDefaults:Q0().optional()}),t(F(),o())),K3=iQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},W4(N({form:H3.optional(),url:Y0.optional()}),t(F(),o()).optional())),B3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({sampling:B0({createMessage:Y0.optional()}).optional(),elicitation:B0({create:Y0.optional()}).optional()}).optional()}),D3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({tools:B0({call:Y0.optional()}).optional()}).optional()}),A3=N({experimental:t(F(),Y0).optional(),sampling:N({context:Y0.optional(),tools:Y0.optional()}).optional(),elicitation:K3.optional(),roots:N({listChanged:Q0().optional()}).optional(),tasks:B3.optional()}),F3=q0.extend({protocolVersion:F(),capabilities:A3,clientInfo:DG}),aQ=W0.extend({method:j("initialize"),params:F3});var L3=N({experimental:t(F(),Y0).optional(),logging:Y0.optional(),completions:Y0.optional(),prompts:N({listChanged:Q0().optional()}).optional(),resources:N({subscribe:Q0().optional(),listChanged:Q0().optional()}).optional(),tools:N({listChanged:Q0().optional()}).optional(),tasks:D3.optional()}),U3=G0.extend({protocolVersion:F(),capabilities:L3,serverInfo:DG,instructions:F().optional()}),sQ=w0.extend({method:j("notifications/initialized"),params:N0.optional()});var K4=W0.extend({method:j("ping"),params:q0.optional()}),O3=N({progress:m(),total:a(m()),message:a(F())}),M3=N({...N0.shape,...O3.shape,progressToken:WG}),B4=w0.extend({method:j("notifications/progress"),params:M3}),V3=q0.extend({cursor:GG.optional()}),G6=W0.extend({params:V3.optional()}),J6=G0.extend({nextCursor:GG.optional()}),q3=F0(["working","input_required","completed","failed","cancelled"]),$6=N({taskId:F(),status:q3,ttl:p([m(),cQ()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:a(m()),statusMessage:a(F())}),E1=G0.extend({task:$6}),Z3=N0.merge($6),z6=w0.extend({method:j("notifications/tasks/status"),params:Z3}),D4=W0.extend({method:j("tasks/get"),params:q0.extend({taskId:F()})}),A4=G0.merge($6),F4=W0.extend({method:j("tasks/result"),params:q0.extend({taskId:F()})}),FZ=G0.loose(),L4=G6.extend({method:j("tasks/list")}),U4=J6.extend({tasks:x($6)}),O4=W0.extend({method:j("tasks/cancel"),params:q0.extend({taskId:F()})}),AG=G0.merge($6),FG=N({uri:F(),mimeType:a(F()),_meta:t(F(),o()).optional()}),LG=FG.extend({text:F()}),eQ=F().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),UG=FG.extend({blob:eQ}),H6=F0(["user","assistant"]),I1=N({audience:x(H6).optional(),priority:m().min(0).max(1).optional(),lastModified:Q6.datetime({offset:!0}).optional()}),OG=N({...b1.shape,...W6.shape,uri:F(),description:a(F()),mimeType:a(F()),annotations:I1.optional(),_meta:a(B0({}))}),N3=N({...b1.shape,...W6.shape,uriTemplate:F(),description:a(F()),mimeType:a(F()),annotations:I1.optional(),_meta:a(B0({}))}),Q9=G6.extend({method:j("resources/list")}),w3=J6.extend({resources:x(OG)}),j3=G6.extend({method:j("resources/templates/list")}),P3=J6.extend({resourceTemplates:x(N3)}),X9=q0.extend({uri:F()}),b3=X9,Y9=W0.extend({method:j("resources/read"),params:b3}),E3=G0.extend({contents:x(p([LG,UG]))}),I3=w0.extend({method:j("notifications/resources/list_changed"),params:N0.optional()}),T3=X9,S3=W0.extend({method:j("resources/subscribe"),params:T3}),R3=X9,C3=W0.extend({method:j("resources/unsubscribe"),params:R3}),k3=N0.extend({uri:F()}),v3=w0.extend({method:j("notifications/resources/updated"),params:k3}),x3=N({name:F(),description:a(F()),required:a(Q0())}),_3=N({...b1.shape,...W6.shape,description:a(F()),arguments:a(x(x3)),_meta:a(B0({}))}),y3=G6.extend({method:j("prompts/list")}),h3=J6.extend({prompts:x(_3)}),u3=q0.extend({name:F(),arguments:t(F(),F()).optional()}),g3=W0.extend({method:j("prompts/get"),params:u3}),W9=N({type:j("text"),text:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),G9=N({type:j("image"),data:eQ,mimeType:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),J9=N({type:j("audio"),data:eQ,mimeType:F(),annotations:I1.optional(),_meta:t(F(),o()).optional()}),f3=N({type:j("tool_use"),name:F(),id:F(),input:t(F(),o()),_meta:t(F(),o()).optional()}),m3=N({type:j("resource"),resource:p([LG,UG]),annotations:I1.optional(),_meta:t(F(),o()).optional()}),l3=OG.extend({type:j("resource_link")}),$9=p([W9,G9,J9,l3,m3]),c3=N({role:H6,content:$9}),p3=G0.extend({description:F().optional(),messages:x(c3)}),i3=w0.extend({method:j("notifications/prompts/list_changed"),params:N0.optional()}),n3=N({title:F().optional(),readOnlyHint:Q0().optional(),destructiveHint:Q0().optional(),idempotentHint:Q0().optional(),openWorldHint:Q0().optional()}),d3=N({taskSupport:F0(["required","optional","forbidden"]).optional()}),MG=N({...b1.shape,...W6.shape,description:F().optional(),inputSchema:N({type:j("object"),properties:t(F(),Y0).optional(),required:x(F()).optional()}).catchall(o()),outputSchema:N({type:j("object"),properties:t(F(),Y0).optional(),required:x(F()).optional()}).catchall(o()).optional(),annotations:n3.optional(),execution:d3.optional(),_meta:t(F(),o()).optional()}),z9=G6.extend({method:j("tools/list")}),r3=J6.extend({tools:x(MG)}),M4=G0.extend({content:x($9).default([]),structuredContent:t(F(),o()).optional(),isError:Q0().optional()}),LZ=M4.or(G0.extend({toolResult:o()})),o3=X6.extend({name:F(),arguments:t(F(),o()).optional()}),K6=W0.extend({method:j("tools/call"),params:o3}),t3=w0.extend({method:j("notifications/tools/list_changed"),params:N0.optional()}),UZ=N({autoRefresh:Q0().default(!0),debounceMs:m().int().nonnegative().default(300)}),B6=F0(["debug","info","notice","warning","error","critical","alert","emergency"]),a3=q0.extend({level:B6}),H9=W0.extend({method:j("logging/setLevel"),params:a3}),s3=N0.extend({level:B6,logger:F().optional(),data:o()}),e3=w0.extend({method:j("notifications/message"),params:s3}),QK=N({name:F().optional()}),XK=N({hints:x(QK).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),YK=N({mode:F0(["auto","required","none"]).optional()}),WK=N({type:j("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:x($9).default([]),structuredContent:N({}).loose().optional(),isError:Q0().optional(),_meta:t(F(),o()).optional()}),GK=pQ("type",[W9,G9,J9]),G4=pQ("type",[W9,G9,J9,f3,WK]),JK=N({role:H6,content:p([G4,x(G4)]),_meta:t(F(),o()).optional()}),$K=X6.extend({messages:x(JK),modelPreferences:XK.optional(),systemPrompt:F().optional(),includeContext:F0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:x(F()).optional(),metadata:Y0.optional(),tools:x(MG).optional(),toolChoice:YK.optional()}),zK=W0.extend({method:j("sampling/createMessage"),params:$K}),K9=G0.extend({model:F(),stopReason:a(F0(["endTurn","stopSequence","maxTokens"]).or(F())),role:H6,content:GK}),B9=G0.extend({model:F(),stopReason:a(F0(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:H6,content:p([G4,x(G4)])}),HK=N({type:j("boolean"),title:F().optional(),description:F().optional(),default:Q0().optional()}),KK=N({type:j("string"),title:F().optional(),description:F().optional(),minLength:m().optional(),maxLength:m().optional(),format:F0(["email","uri","date","date-time"]).optional(),default:F().optional()}),BK=N({type:F0(["number","integer"]),title:F().optional(),description:F().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),DK=N({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),default:F().optional()}),AK=N({type:j("string"),title:F().optional(),description:F().optional(),oneOf:x(N({const:F(),title:F()})),default:F().optional()}),FK=N({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),enumNames:x(F()).optional(),default:F().optional()}),LK=p([DK,AK]),UK=N({type:j("array"),title:F().optional(),description:F().optional(),minItems:m().optional(),maxItems:m().optional(),items:N({type:j("string"),enum:x(F())}),default:x(F()).optional()}),OK=N({type:j("array"),title:F().optional(),description:F().optional(),minItems:m().optional(),maxItems:m().optional(),items:N({anyOf:x(N({const:F(),title:F()}))}),default:x(F()).optional()}),MK=p([UK,OK]),VK=p([FK,LK,MK]),qK=p([VK,HK,KK,BK]),ZK=X6.extend({mode:j("form").optional(),message:F(),requestedSchema:N({type:j("object"),properties:t(F(),qK),required:x(F()).optional()})}),NK=X6.extend({mode:j("url"),message:F(),elicitationId:F(),url:F().url()}),wK=p([ZK,NK]),jK=W0.extend({method:j("elicitation/create"),params:wK}),PK=N0.extend({elicitationId:F()}),bK=w0.extend({method:j("notifications/elicitation/complete"),params:PK}),V4=G0.extend({action:F0(["accept","decline","cancel"]),content:iQ((Q)=>Q===null?void 0:Q,t(F(),p([F(),m(),Q0(),x(F())])).optional())}),EK=N({type:j("ref/resource"),uri:F()});var IK=N({type:j("ref/prompt"),name:F()}),TK=q0.extend({ref:p([IK,EK]),argument:N({name:F(),value:F()}),context:N({arguments:t(F(),F()).optional()}).optional()}),SK=W0.extend({method:j("completion/complete"),params:TK});var RK=G0.extend({completion:B0({values:x(F()).max(100),total:a(m().int()),hasMore:a(Q0())})}),CK=N({uri:F().startsWith("file://"),name:F().optional(),_meta:t(F(),o()).optional()}),kK=W0.extend({method:j("roots/list"),params:q0.optional()}),D9=G0.extend({roots:x(CK)}),vK=w0.extend({method:j("notifications/roots/list_changed"),params:N0.optional()}),OZ=p([K4,aQ,SK,H9,g3,y3,Q9,j3,Y9,S3,C3,K6,z9,D4,F4,L4,O4]),MZ=p([H4,B4,sQ,vK,z6]),VZ=p([z4,K9,B9,V4,D9,A4,U4,E1]),qZ=p([K4,zK,jK,kK,D4,F4,L4,O4]),ZZ=p([H4,B4,e3,v3,I3,t3,i3,z6,bK]),NZ=p([z4,U3,RK,p3,h3,w3,P3,E3,M4,r3,A4,U4,E1]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===_.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new VG(W.elicitations,X)}return new C(Q,X,Y)}}class VG extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(_.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function X1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var xK=Symbol("Let zodToJsonSchema decide on which parser to use");var QN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function A9(Q){let Y=X4(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=EW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function F9(Q,X){let Y=e0(Q,X);if(!Y.success)throw Y.error;return Y.data}var fK=60000;class L9{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(H4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(B4,(X)=>{this._onprogress(X)}),this.setRequestHandler(K4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(D4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(F4,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 z=$.message,H=z.id,K=this._requestResolvers.get(H);if(K)if(this._requestResolvers.delete(H),$.type==="response")K(z);else{let B=z,D=new C(B.error.code,B.error.message,B.error.data);K(D)}else{let B=$.type==="response"?"Response":"Error";this._onerror(Error(`${B} handler missing for request ${H}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new C(_.InvalidParams,`Task not found: ${G}`);if(!X1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(X1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[Q1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(L4,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 C(_.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(O4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,`Task not found: ${X.params.taskId}`);if(X1(W.status))throw new C(_.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 C(_.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof C)throw W;throw new C(_.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),C.fromError(_.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){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),Y6(G)||KG(G))this._onresponse(G);else if(rQ(G))this._onrequest(G,J);else if(HG(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();let X=C.fromError(_.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?.[Q1]?.taskId;if(Y===void 0){let K={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((B)=>this._onerror(Error(`Failed to enqueue error response: ${B}`)));else W?.send(K).catch((B)=>this._onerror(Error(`Failed to send an error response: ${B}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=JG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(K)=>{let B={relatedRequestId:Q.id};if(G)B.relatedTask={taskId:G};await this.notification(K,B)},sendRequest:async(K,B,D)=>{let A={...D,relatedRequestId:Q.id};if(G&&!A.relatedTask)A.relatedTask={taskId:G};let U=A.relatedTask?.taskId??G;if(U&&z)await z.updateTaskStatus(U,"input_required");return await this.request(K,B,A)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(K)=>{if(J.signal.aborted)return;let B={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)},async(K)=>{if(J.signal.aborted)return;let B={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:_.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{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(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),Y6(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let G=!1;if(Y6(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(Y6(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,E1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(_.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},X1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new C(_.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new C(_.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((H,K)=>{let B=(V)=>{K(V)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(V){B(V);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,A={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),A.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if($)A.params={...A.params,task:$};if(z)A.params={...A.params,_meta:{...A.params?._meta||{},[Q1]:z}};let U=(V)=>{this._responseHandlers.delete(D),this._progressHandlers.delete(D),this._cleanupTimeout(D),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:D,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let T=V instanceof C?V:new C(_.RequestTimeout,String(V));K(T)};this._responseHandlers.set(D,(V)=>{if(Y?.signal?.aborted)return;if(V instanceof Error)return K(V);try{let T=e0(X,V.result);if(!T.success)K(T.error);else H(T.data)}catch(T){K(T)}}),Y?.signal?.addEventListener("abort",()=>{U(Y?.signal?.reason)});let O=Y?.timeout??fK,M=()=>U(C.fromError(_.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(D,O,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let q=z?.taskId;if(q){let V=(T)=>{let E=this._responseHandlers.get(D);if(E)E(T);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,V),this._enqueueTaskMessage(q,{type:"request",message:A,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(D),K(T)})}else this._transport.send(A,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(D),K(V)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},A4,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},U4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},AG,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||{},[Q1]: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||{},[Q1]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[Q1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=A9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=F9(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=A9(Q);this._notificationHandlers.set(Y,(W)=>{let G=F9(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"&&rQ(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new C(_.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 C(_.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new C(_.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 C(_.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 z=z6.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),X1($.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 C(_.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(X1($.status))throw new C(_.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 z=await Y.getTask(W,X);if(z){let H=z6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),X1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function qG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function ZG(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(qG($)&&qG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var a7=RX(HX(),1),s7=RX(t7(),1);function oM(){let Q=new a7.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return s7.default(Q),Q}class VX{constructor(Q){this._ajv=Q??oM()}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 qX{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}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 e7(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 Q5(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 ZX extends L9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(B6.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 VX,this.setRequestHandler(aQ,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(sQ,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(H9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=B6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new qX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ZG(this._capabilities,Q)}setRequestHandler(Q,X){let W=X4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(P1(W)){let $=W;G=$._zod?.def?.value??$.value}else{let $=W;G=$._def?.value??$.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(z,H)=>{let K=e0(K6,z);if(!K.success){let U=K.error instanceof Error?K.error.message:String(K.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${U}`)}let{params:B}=K.data,D=await Promise.resolve(X(z,H));if(B.task){let U=e0(E1,D);if(!U.success){let O=U.error instanceof Error?U.error.message:String(U.error);throw new C(_.InvalidParams,`Invalid task creation result: ${O}`)}return U.data}let A=e0(M4,D);if(!A.success){let U=A.error instanceof Error?A.error.message:String(A.error);throw new C(_.InvalidParams,`Invalid tools/call result: ${U}`)}return A.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){Q5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;e7(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:YG.includes(X)?X:nQ,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"},z4)}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((H)=>H.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]:[],z=$.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!z)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(z){let H=new Set($.filter((B)=>B.type==="tool_use").map((B)=>B.id)),K=new Set(W.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(H.size!==K.size||![...H].every((B)=>K.has(B)))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},B9,X);return this.request({method:"sampling/createMessage",params:Q},K9,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},V4,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},V4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new C(_.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(_.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},D9,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 Y5 from"node:process";class NX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
29
+ `);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),tM(X)}clear(){this._buffer=void 0}}function tM(Q){return BG.parse(JSON.parse(Q))}function X5(Q){return JSON.stringify(Q)+`
30
+ `}class wX{constructor(Q=Y5.stdin,X=Y5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new NX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=X5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var W5={name:"@sequenzy/mcp",version:"0.0.23",mcpName:"io.github.polnikale/sequenzy-mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/sequenzy/sequenzy.git"}};class g1 extends Error{statusCode;rawDetails;code;constructor(Q,X,Y,W){super(Q);this.statusCode=X;this.rawDetails=Y;this.code=W;this.name="McpApiError"}}function sM(Q){if(Q instanceof g1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function eM(Q){let X=sM(Q),Y=X.message.trim()||"Unknown error",W=Y.toLowerCase(),G=X.rawDetails?.trim()||Y;if(X.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===401||X.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(X.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode&&X.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function q1(Q){let X=eM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
31
+ `)}var jX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],G5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function QV(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function r0(Q){let X=Q?.trim();return X?X:void 0}function K1(Q){return encodeURIComponent(Q)}function z0(Q,X){return`${Q}${X}`}function H0(Q,X=""){return`/dashboard/company/${K1(Q)}${X}`}function J5(Q,X,Y){return z0(Q,`${H0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function XV(Q,X){let Y=jX.map((W)=>[W,X?J5(Q,X,W):""]);return Object.fromEntries(Y)}function B1(Q={},X){let Y=QV(X),W=r0(Q.companyId),G={},J=XV(Y,W);if(!W)return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J};G.dashboard=z0(Y,H0(W)),G.campaigns=z0(Y,H0(W,"/campaign")),G.sequences=z0(Y,H0(W,"/sequences")),G.settings=z0(Y,H0(W,"/settings")),G.emails=z0(Y,H0(W,"/emails")),G.subscribers=z0(Y,H0(W,"/subscribers")),G.segments=z0(Y,H0(W,"/segments")),G.metrics=z0(Y,H0(W,"/metrics")),G.transactional=z0(Y,H0(W,"/transactional"));let $=r0(Q.campaignId);if($)G.campaign=z0(Y,H0(W,`/campaign/${K1($)}`));let z=r0(Q.sequenceId);if(z)G.sequence=z0(Y,H0(W,`/sequences/${K1(z)}`));let H=r0(Q.emailId)??r0(Q.templateId);if(H)G.email=z0(Y,H0(W,`/emails/${K1(H)}`)),G.template=G.email;let K=r0(Q.transactionalId);if(K)G.transactionalEmail=z0(Y,H0(W,`/transactional/${K1(K)}`));let B=r0(Q.domainId);if(B)G.domain=z0(Y,H0(W,`/settings/domain/${K1(B)}`)),G.domainVerify=`${G.domain}/verify`;let D=r0(Q.status);if(D)G.campaignList=z0(Y,H0(W,`/campaign/list/${K1(D)}`)),G.sequenceList=z0(Y,H0(W,`/sequences/list/${K1(D)}`));let A=r0(Q.settingsTab);if(A)G.settingsTab=J5(Y,W,A);return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J}}var $5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function z5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await w("GET","/api/v1/account"),W=_6()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await w("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=B1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:q1(X)}]}}}var YV={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","emailProvider","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For `event`, use `is`, `is_not`, `at_least`, or `less_than_count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Event examples: `saas.purchase:30d`, `saas.purchase:all`, or `saas.purchase:5:30d` for thresholds. Segment values are segment IDs. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1},WV={type:"object",properties:{kind:{type:"string",enum:["group"]},id:{type:"string",description:"Stable group ID. Any string works; one will be generated if omitted."},joinOperator:{type:"string",enum:["and","or"],description:"How children in this group combine."},children:{type:"array",minItems:1,items:{type:"object",description:'Either a filter leaf (`kind: "filter"`) or another group (`kind: "group"`).'}}},required:["kind","joinOperator","children"],additionalProperties:!0};function B5(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function D5(Q){if(typeof Q!=="object"||Q===null)return Q;let X=Q;if(X.kind==="filter"){let Y=B5([X]);return Array.isArray(Y)?Y[0]:X}if(X.kind!=="group")return Q;return{...X,id:typeof X.id==="string"&&X.id.trim()!==""?X.id:crypto.randomUUID(),children:Array.isArray(X.children)?X.children.map(D5):[]}}function WQ(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function GV(Q){WQ("create_campaign",Q);let X=f(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(X&&(Y||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!X&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!X&&f(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}var H5={type:"object",description:"A step to create inside a branch path. Use type:'delay' for a standalone delay, type:'email' for an email, or type:'create_discount' for a discount action.",properties:{type:{type:"string",enum:["email","delay","create_discount","discount","webhook"],description:"Branch path step type. Omit for email steps; use delay for standalone waits."},nodeType:{type:"string",enum:["logic_delay","action_email","action_create_discount","action_add_tag","action_remove_tag","action_add_to_list","action_remove_from_list","action_update_attributes","logic_wait_for_event","action_webhook"],description:"Advanced branch path node type. Prefer type unless creating a non-email action."},config:{type:"object",description:"Config for advanced nodeType steps such as tag/list/webhook/wait-for-event actions.",additionalProperties:!0},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks for email steps.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps."},delay:{type:"object",description:"Delay before this step, or the delay duration when type is delay.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},delayMs:{type:"number",description:"Delay in milliseconds. Useful for standalone type:'delay' steps."},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Same shape as create_sequence steps.",additionalProperties:!0},label:{type:"string",description:"Node label for discount or advanced node steps."},provider:{type:"string",enum:["stripe","shopify"]},discountType:{type:"string",enum:["percent","amount"]},percentOff:{type:"number"},amountOff:{type:"number"},currency:{type:"string"},duration:{type:"string",enum:["once","forever","repeating"]},durationInMonths:{type:"number"},appliesToAllPlans:{type:"boolean"},planIds:{type:"array",items:{type:"string"}},codePrefix:{type:"string"},maxRedemptions:{type:"number"},lockToSubscriber:{type:"boolean"},expiresAt:{type:"string"},expiresInHours:{type:"number"}},additionalProperties:!1};function JV(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function h0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function K5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function $V(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function zV(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],J=1,$=0,z=0,H=0;while(!0){let B=$V({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.toString()}`,void 0,X);$=D.pagination?.total??D.subscribers.length,z=D.pagination?.totalPages??1,H+=1,G.push(...D.subscribers??[]);let A=Y!==void 0&&G.length>=Y,U=D.pagination?J>=D.pagination.totalPages:(D.subscribers??[]).length<W;if(A||U)break;J+=1}let K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function PX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}function f(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function A5(Q){let X=f(Q,"companyId");if(X)return X;let Y=_6();if(Y)return Y;try{return(await w("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function GQ(Q,X){if(!h0(Q)||!X)return Q;return{...Q,url:X}}function bX(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!h0(W))return W;let G=f(W,"id");if(!G)return W;let J=B1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G}}),$=Y==="campaign"?J.urls.campaign:Y==="sequence"?J.urls.sequence:J.urls.email;return GQ(W,$)})}function HV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!h0(X))return X;let Y=f(X,"id");if(!Y)return X;let W=B1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var KV=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","create_campaign","update_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","list_templates","get_template","create_template","update_template"]);async function BV(Q,X,Y){if(!h0(Y)||!KV.has(Q))return Y;let W=h0(Y.company)?Y.company:void 0,J=f(Y,"selectedCompanyId")??f(Y,"currentCompanyId")??f(Y,"companyId")??(W?f(W,"id"):void 0)??(W?f(W,"companyId"):void 0)??await A5(X);if(!J)return Y;let $=h0(Y.campaign)?Y.campaign:void 0,z=h0(Y.sequence)?Y.sequence:void 0,H=h0(Y.template)?Y.template:void 0,K={companyId:J,campaignId:f(X,"campaignId")??f(Y,"campaignId")??($?f($,"id"):void 0),sequenceId:f(X,"sequenceId")??f(Y,"sequenceId")??(z?f(z,"id"):void 0),emailId:f(X,"templateId")??f(Y,"templateId")??(H?f(H,"id"):void 0),status:f(X,"status")},B=B1(K),D=W?B1({companyId:J}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:HV(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:bX(Y.campaigns,J,"campaign")},...Array.isArray(Y.sequences)&&{sequences:bX(Y.sequences,J,"sequence")},...Array.isArray(Y.templates)&&{templates:bX(Y.templates,J,"template")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...$&&B.urls.campaign!==void 0&&{campaign:GQ($,B.urls.campaign)},...z&&B.urls.sequence!==void 0&&{sequence:GQ(z,B.urls.sequence)},...H&&B.urls.email!==void 0&&{template:GQ(H,B.urls.email)},appUrls:B.urls}}var F5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
32
32
  1. Call select_company first to choose which company to work with, OR
33
33
  2. Pass companyId explicitly in each tool call
34
34
 
@@ -45,7 +45,7 @@ Use cases:
45
45
  - 'subscribe_form': Adding subscribers from signup forms
46
46
  - 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
47
47
 
48
- Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Use `filters` plus `filterJoinOperator` for flat legacy rules, or `root` for nested AND/OR groups such as `{ "kind": "group", "joinOperator": "and", "children": [{ "kind": "filter", "field": "attribute", "operator": "gte", "value": "mrr:50" }, { "kind": "group", "joinOperator": "or", "children": [{ "kind": "filter", "field": "tag", "operator": "contains", "value": "vip" }, { "kind": "filter", "field": "event", "operator": "is_not", "value": "saas.purchase:30d" }] }] }`. Supports `event` and `segment` fields, Stripe product purchase filters, and campaign-specific engagement filters.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:XV,minItems:1,description:'Array of segment filters. Example custom attribute empty check: [{"id":"filter-1","field":"attribute","operator":"is_empty","value":"last_logged_in:"}]. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'},root:{...YV,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"],anyOf:[{required:["filters"]},{required:["root"]}]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},prompt:{type:"string",description:"Generate campaign blocks from a prompt. Mutually exclusive with `html`, `blocks`, and `templateId`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Provide either a goal for AI generation or explicit steps. Explicit steps can include email content and create_discount actions; emails after a discount action can use merge tags such as {{discount.code}} and {{discount.percentOff}}. For AI-generated sequences, the tool polls until emails are generated (typically 30-60 seconds).
48
+ Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Use `filters` plus `filterJoinOperator` for flat legacy rules, or `root` for nested AND/OR groups such as `{ "kind": "group", "joinOperator": "and", "children": [{ "kind": "filter", "field": "attribute", "operator": "gte", "value": "mrr:50" }, { "kind": "group", "joinOperator": "or", "children": [{ "kind": "filter", "field": "tag", "operator": "contains", "value": "vip" }, { "kind": "filter", "field": "event", "operator": "is_not", "value": "saas.purchase:30d" }] }] }`. Supports `event` and `segment` fields, Stripe product purchase filters, and campaign-specific engagement filters.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:YV,minItems:1,description:'Array of segment filters. Example custom attribute empty check: [{"id":"filter-1","field":"attribute","operator":"is_empty","value":"last_logged_in:"}]. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'},root:{...WV,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"],anyOf:[{required:["filters"]},{required:["root"]}]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},prompt:{type:"string",description:"Generate campaign blocks from a prompt. Mutually exclusive with `html`, `blocks`, and `templateId`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Provide either a goal for AI generation or explicit steps. Explicit steps can include email content and create_discount actions; emails after a discount action can use merge tags such as {{discount.code}} and {{discount.percentOff}}. For AI-generated sequences, the tool polls until emails are generated (typically 30-60 seconds).
49
49
 
50
50
  IMPORTANT GUIDELINES:
51
51
 
@@ -141,6 +141,7 @@ Only offer manual tracking if the user explicitly asks for it.
141
141
 
142
142
  DISCOUNT ACTION STEPS:
143
143
  - Use explicit steps with { "type": "create_discount", "discount": { "discountType": "percent", "percentOff": 20, "duration": "once", "appliesToAllPlans": true, "maxRedemptions": 1, "codePrefix": "SAVE" } }.
144
+ - Optionally add "lockToSubscriber": true for Stripe discounts only when the subscriber is expected to have a matching Stripe customer.
144
145
  - Discount actions currently require Stripe; connect Stripe before enabling the sequence.
145
146
  - Put the discount action before the email that references it with {{discount.code}}.
146
147
 
@@ -173,4 +174,4 @@ BUILT-IN EVENTS (auto-fired by payment integrations):
173
174
 
174
175
  OTHER BUILT-IN EVENTS:
175
176
  - email.opened, email.clicked, email.replied, email.bounced, email.unsubscribed
176
- - contact.subscribed, contact.unsubscribed`,inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the sequence in. If not provided, uses the currently selected company."},name:{type:"string",description:"Sequence name (e.g., 'User Onboarding', 'Welcome Series')"},trigger:{type:"string",enum:["contact_added","tag_added","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), 'event_received' (when custom event fires), 'inactivity' (when subscriber hasn't performed an event for X days), 'frequency' (when subscriber performs event X times in Y days)"},listId:{type:"string",description:"List ID to trigger on (for contact_added trigger). If not provided, triggers on any list."},tagName:{type:"string",description:"Tag name to trigger on (required for tag_added trigger)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},eventName:{type:"string",description:"Event name to trigger on (required for event_received, inactivity, and frequency triggers)"},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},minCount:{type:"number",description:"Minimum event count (required for frequency trigger, must be >= 1)"},timeWindowDays:{type:"number",description:"Time window in days for frequency trigger (required for frequency trigger, must be >= 1)"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks. Provide blocks or html for email steps.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"},name:{type:"string",description:"Sequence name"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{anyOf:[{type:"string"},{type:"null"}],description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Set to null through the API to clear it; omit to leave unchanged."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."}},required:["conditionType"]}}},required:["afterNodeId","branches"]},emails:{type:"array",description:"Updated sequence emails. If you omit emailId/nodeId, items are matched by existing step order.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step"}}}},steps:{type:"array",description:"Alias for emails. Supports the same fields and matching rules.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step"}}}}},required:["sequenceId"]}},{name:"enable_sequence",description:"Enable/activate a sequence. IMPORTANT: Only call this when the user EXPLICITLY asks to enable or activate a sequence. Never enable sequences automatically after creation - the user must review the content first.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"disable_sequence",description:"Disable/pause a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"delete_sequence",description:"Delete a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"send_email",description:"Send a transactional email to a single recipient",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},to:{type:"string",description:"Recipient email address"},subject:{type:"string",description:"Email subject (required if not using templateId)"},html:{type:"string",description:"Email HTML content (required if not using templateId)"},templateId:{type:"string",description:"Template ID to use (alternative to html)"},variables:{type:"object",description:"Variables for template personalization"}},required:["to"]}},{name:"get_stats",description:"Get overview statistics for a time period",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},period:{type:"string",description:"Time period: 7d, 30d, or 90d (default: 7d)"}}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including per-step failed subscribers and failure reasons",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"get_subscriber_activity",description:"Get recent activity, email stats, and current sequence enrollments for a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"generate_email",description:"Generate email blocks from a prompt",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},prompt:{type:"string",description:"Description of the email to generate"},style:{type:"string",description:"Style: minimal, branded, promotional"},tone:{type:"string",description:"Tone: professional, casual, friendly"}},required:["prompt"]}},{name:"generate_sequence",description:"[DEPRECATED - Use create_sequence instead] Generate a multi-email sequence from a goal. Note: create_sequence now handles AI generation automatically.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},goal:{type:"string",description:"Goal of the sequence (e.g., 'onboard new SaaS trial users')"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},durationDays:{type:"number",description:"Total duration in days (default: 14)"}},required:["goal"]}},{name:"generate_subject_lines",description:"Generate A/B test subject line variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},topic:{type:"string",description:"Topic or context for the subject lines"},count:{type:"number",description:"Number of variants to generate (default: 5)"}},required:["topic"]}}];async function F5(Q,X){try{let Y;switch(Q){case"get_account":{let G=await w("GET","/api/v1/account"),J=_6();Y={...G,selectedCompanyId:J??G.currentCompanyId};break}case"select_company":{let G=X.companyId,J=await w("GET","/api/v1/account"),$=J.companies?.find((z)=>z.id===G);if(!$)throw Error(`Company not found. Available companies: ${J.companies?.map((z)=>`${z.name} (${z.id})`).join(", ")??"none"}`);EX(G),Y={success:!0,message:`Switched to company: ${$.name}`,companyId:$.id,companyName:$.name};break}case"get_app_urls":{let G=await D5(X);Y={...B1({companyId:G,campaignId:f(X,"campaignId"),sequenceId:f(X,"sequenceId"),emailId:f(X,"emailId")??f(X,"templateId"),transactionalId:f(X,"transactionalId"),domainId:f(X,"domainId"),status:f(X,"status"),settingsTab:f(X,"settingsTab")}),...G===void 0&&{note:"No company ID is selected. Call get_account, select_company, or pass companyId to get concrete dashboard URLs."}};break}case"create_company":{let G=await w("POST","/api/v1/companies",{name:X.name,domain:X.domain});if(!G.success)throw Error("Failed to create company");let J=G.company.id,$=6,z=0,H=G.company.status;while(H==="processing"&&z<$){await new Promise((D)=>setTimeout(D,20000)),z++;let B=await w("GET",`/api/v1/companies/${J}`);if(B.success)H=B.company.status}EX(J);let K=await w("GET",`/api/v1/companies/${J}`);Y={success:!0,company:K.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${K.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=X.companyId;Y=await w("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=X.companyId;Y=await w("POST","/api/v1/api-keys",{name:X.name},G);break}case"list_websites":{let G=X.companyId;Y=await w("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=X.companyId;Y=await w("POST","/api/v1/websites",{domain:X.domain},G);break}case"check_website":{let G=X.companyId;Y=await w("GET",`/api/v1/websites/${X.domain}`,void 0,G);break}case"get_integration_guide":Y=await w("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let G=X.companyId;Y=await w("POST","/api/v1/subscribers",{email:X.email,customAttributes:X.attributes,tags:X.tags,lists:X.listIds},G);break}case"update_subscriber":{let G=X.companyId,J=await PX(String(X.email),G),$=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((D)=>typeof D==="string"):[],z=Array.isArray(X.addTags)?X.addTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(H5):[],H=new Set(Array.isArray(X.removeTags)?X.removeTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(H5):[]),K=$.filter((D)=>!H.has(D));for(let D of z)if(!K.includes(D))K.push(D);let B={};if(h0(X.attributes))B.customAttributes={...h0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...X.attributes};if(X.addTags||X.removeTags)B.tags=K;Y=await w("PATCH",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,B,G);break}case"remove_subscriber":{let G=X.companyId;if(X.hardDelete===!0)Y=await w("DELETE",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,void 0,G);else Y=await w("PATCH",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=X.companyId;Y=await PX(String(X.email),G);break}case"search_subscribers":{let G=X.companyId;Y=await $V(X,G);break}case"list_tags":{let G=X.companyId;Y=await w("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=X.companyId;Y=await w("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=X.companyId;Y=await w("POST","/api/v1/lists",X,G);break}case"list_segments":{let G=X.companyId;Y=await w("GET","/api/v1/segments",void 0,G);break}case"create_segment":{let G=X.companyId;Y=await w("POST","/api/v1/segments",{...X,...X.filters!==void 0?{filters:K5(X.filters)}:{},...X.root!==void 0?{root:B5(X.root)}:{}},G);break}case"get_segment_count":{let G=X.companyId;Y=await w("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,G);break}case"list_templates":{let G=X.companyId;Y=await w("GET","/api/v1/templates",void 0,G);break}case"get_template":{let G=X.companyId;Y=await w("GET",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"create_template":{let G=X.companyId;WQ("create_template",X,{requireContent:!0}),Y=await w("POST","/api/v1/templates",X,G);break}case"update_template":{let G=X.companyId,J=new Set(["companyId","templateId","name","subject","html","blocks"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, and \`blocks\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(WQ("update_template",X),X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, or `blocks` when calling `update_template`.");Y=await w("PUT",`/api/v1/templates/${X.templateId}`,X,G);break}case"delete_template":{let G=X.companyId;Y=await w("DELETE",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"list_campaigns":{let G=X.companyId,J=new URLSearchParams;if(X.status)J.set("status",String(X.status));Y=await w("GET",`/api/v1/campaigns?${J}`,void 0,G);break}case"get_campaign":{let G=X.companyId;Y=await w("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,G);break}case"create_campaign":{let G=X.companyId;WV(X);let J=f(X,"prompt");if(J!==void 0){let $=await w("POST","/api/v1/generate/email",{prompt:J,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G),z=f(X,"subject")??(typeof $.subject==="string"&&$.subject.trim()!==""?$.subject.trim():void 0);if(!z)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray($.blocks)&&$.blocks.length>0?$.blocks:void 0,K=typeof $.html==="string"&&$.html.trim()!==""?$.html:void 0;if(H===void 0&&K===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");Y=await w("POST","/api/v1/campaigns",{name:X.name,subject:z,...H!==void 0?{blocks:H}:{html:K},...X.segmentId!==void 0&&{segmentId:X.segmentId}},G);break}Y=await w("POST","/api/v1/campaigns",X,G);break}case"update_campaign":{let G=X.companyId,J=new Set(["companyId","campaignId","name","subject","html","blocks","replyTo","replyProfileId"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, \`replyTo\`, and \`replyProfileId\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(WQ("update_campaign",X),X.replyTo!==void 0&&X.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0&&X.replyTo===void 0&&X.replyProfileId===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, `replyTo`, or `replyProfileId` when calling `update_campaign`.");Y=await w("PUT",`/api/v1/campaigns/${X.campaignId}`,X,G);break}case"send_test_email":{let G=X.companyId;Y=await w("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},G);break}case"list_sequences":{let G=X.companyId;Y=await w("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=X.companyId;Y=await w("GET",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"create_sequence":{let G=X.companyId,J=Array.isArray(X.steps)&&X.steps.length>0,$=await w("POST","/api/v1/sequences",X,G);if(!$.success){Y=$;break}let z=$.sequence.id;if(J){let A=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(A.success)Y={success:!0,sequence:A.sequence,message:`Sequence "${A.sequence.name}" created with explicit steps. Review it before enabling.`};else Y=A;break}let H=6,K=0,B="pending";while(B!=="complete"&&K<H){await new Promise((U)=>setTimeout(U,20000)),K++;let A=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(A.success)B=A.sequence.enrichmentStatus}let D=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(D.success)Y={success:!0,sequence:D.sequence,message:D.sequence.enrichmentStatus==="complete"?`Sequence "${D.sequence.name}" created with ${D.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${D.sequence.name}" created. Email enrichment is still in progress (${D.sequence.enrichedCount}/${D.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=D;break}case"update_sequence":{let G=X.companyId;Y=await w("PUT",`/api/v1/sequences/${X.sequenceId}`,X,G);break}case"enable_sequence":{let G=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,G);break}case"delete_sequence":{let G=X.companyId;Y=await w("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"send_email":{let G=X.companyId;Y=await w("POST","/api/v1/transactional/send",X,G);break}case"get_stats":{let G=X.companyId,J=X.period??"7d";Y=await w("GET",`/api/v1/metrics?period=${J}`,void 0,G);break}case"get_campaign_stats":{let G=X.companyId;Y=await w("GET",`/api/v1/metrics/campaigns/${X.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=X.companyId;Y=await w("GET",`/api/v1/metrics/sequences/${X.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=X.companyId,J=await PX(String(X.email),G);Y={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=X.companyId;Y=await w("POST","/api/v1/generate/email",X,G);break}case"generate_sequence":{let G=X.companyId;Y=await w("POST","/api/v1/generate/sequence",X,G);break}case"generate_subject_lines":{let G=X.companyId;Y=await w("POST","/api/v1/generate/subjects",X,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=GV(Y);if(W)throw W;return Y=await KV(Q,X,Y),{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{isError:!0,content:[{type:"text",text:q1(Y)}]}}}var BV=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",L5=process.env.SEQUENZY_API_KEY,IX=null;if(!L5)console.error(q1(new g1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1);function _6(){return IX}function EX(Q){IX=Q}var y6=new ZX({name:"sequenzy",version:W5.version},{capabilities:{tools:{},resources:{}}});function DV(Q){if(!Q.trim())return{message:"Request failed"};try{let X=JSON.parse(Q);if(typeof X==="string")return{message:X};if(typeof X.error==="string")return{message:X.error,code:X.code};if(X.error&&typeof X.error==="object")return{message:X.error.message??X.message??Q,code:X.error.code??X.code};return{message:X.message??Q,code:X.code}}catch{return{message:Q}}}async function w(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${L5}`},J=W??IX;if(J)G["x-company-id"]=J;let $;try{$=await fetch(`${BV}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0})}catch(z){throw new g1(z instanceof Error?z.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!$.ok){let z=await $.text(),H=DV(z);throw new g1(H.message,$.status,z,H.code)}return $.json()}y6.setRequestHandler(z9,async()=>{return{tools:A5}});y6.setRequestHandler(K6,async(Q)=>{let{name:X,arguments:Y}=Q.params;return F5(X,Y??{})});y6.setRequestHandler(Q9,async()=>{return{resources:$5}});y6.setRequestHandler(Y9,async(Q)=>{let{uri:X}=Q.params;return z5(X)});async function AV(){let Q=new wX;await y6.connect(Q),console.error("Sequenzy MCP server running on stdio")}AV().catch((Q)=>{console.error(q1(Q)),process.exit(1)});export{EX as setSelectedCompanyId,_6 as getSelectedCompanyId,w as apiRequest};
177
+ - contact.subscribed, contact.unsubscribed`,inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the sequence in. If not provided, uses the currently selected company."},name:{type:"string",description:"Sequence name (e.g., 'User Onboarding', 'Welcome Series')"},trigger:{type:"string",enum:["contact_added","tag_added","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), 'event_received' (when custom event fires), 'inactivity' (when subscriber hasn't performed an event for X days), 'frequency' (when subscriber performs event X times in Y days)"},listId:{type:"string",description:"List ID to trigger on (for contact_added trigger). If not provided, triggers on any list."},tagName:{type:"string",description:"Tag name to trigger on (required for tag_added trigger)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},eventName:{type:"string",description:"Event name to trigger on (required for event_received, inactivity, and frequency triggers)"},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},minCount:{type:"number",description:"Minimum event count (required for frequency trigger, must be >= 1)"},timeWindowDays:{type:"number",description:"Time window in days for frequency trigger (required for frequency trigger, must be >= 1)"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks. Provide blocks or html for email steps.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Stripe-only. Restrict each generated promotion code to the matched subscriber's Stripe customer."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Legacy top-level Stripe-only flag. Prefer discount.lockToSubscriber."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment. When inserting an if/else branch, include steps for every branch arm and elseSteps so the branch is usable immediately.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"},name:{type:"string",description:"Sequence name"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{anyOf:[{type:"string"},{type:"null"}],description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Set to null through the API to clear it; omit to leave unchanged."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId. Each branch condition should include steps, and elseSteps is required unless allowEmptyPaths is true.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."},steps:{type:"array",description:"Steps to create inside this branch path. Required by default so the branch is not an empty placeholder.",items:H5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:H5},allowEmptyPaths:{type:"boolean",description:"Set true only when intentionally creating empty UI placeholders. Normal API/MCP use should omit this and provide branch steps plus elseSteps."}},required:["afterNodeId","branches"]},emails:{type:"array",description:"Updated sequence emails. If you omit emailId/nodeId, items are matched by existing step order.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step"}}}},steps:{type:"array",description:"Alias for emails. Supports the same fields and matching rules.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step"}}}}},required:["sequenceId"]}},{name:"enable_sequence",description:"Enable/activate a sequence. IMPORTANT: Only call this when the user EXPLICITLY asks to enable or activate a sequence. Never enable sequences automatically after creation - the user must review the content first.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"disable_sequence",description:"Disable/pause a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"delete_sequence",description:"Delete a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"send_email",description:"Send a transactional email to a single recipient",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},to:{type:"string",description:"Recipient email address"},subject:{type:"string",description:"Email subject (required if not using templateId)"},html:{type:"string",description:"Email HTML content (required if not using templateId)"},templateId:{type:"string",description:"Template ID to use (alternative to html)"},variables:{type:"object",description:"Variables for template personalization"}},required:["to"]}},{name:"get_stats",description:"Get overview statistics for a time period",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},period:{type:"string",description:"Time period: 7d, 30d, or 90d (default: 7d)"}}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including per-step failed subscribers and failure reasons",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"get_subscriber_activity",description:"Get recent activity, email stats, and current sequence enrollments for a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"generate_email",description:"Generate email blocks from a prompt",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},prompt:{type:"string",description:"Description of the email to generate"},style:{type:"string",description:"Style: minimal, branded, promotional"},tone:{type:"string",description:"Tone: professional, casual, friendly"}},required:["prompt"]}},{name:"generate_sequence",description:"[DEPRECATED - Use create_sequence instead] Generate a multi-email sequence from a goal. Note: create_sequence now handles AI generation automatically.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},goal:{type:"string",description:"Goal of the sequence (e.g., 'onboard new SaaS trial users')"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},durationDays:{type:"number",description:"Total duration in days (default: 14)"}},required:["goal"]}},{name:"generate_subject_lines",description:"Generate A/B test subject line variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},topic:{type:"string",description:"Topic or context for the subject lines"},count:{type:"number",description:"Number of variants to generate (default: 5)"}},required:["topic"]}}];async function L5(Q,X){try{let Y;switch(Q){case"get_account":{let G=await w("GET","/api/v1/account"),J=_6();Y={...G,selectedCompanyId:J??G.currentCompanyId};break}case"select_company":{let G=X.companyId,J=await w("GET","/api/v1/account"),$=J.companies?.find((z)=>z.id===G);if(!$)throw Error(`Company not found. Available companies: ${J.companies?.map((z)=>`${z.name} (${z.id})`).join(", ")??"none"}`);EX(G),Y={success:!0,message:`Switched to company: ${$.name}`,companyId:$.id,companyName:$.name};break}case"get_app_urls":{let G=await A5(X);Y={...B1({companyId:G,campaignId:f(X,"campaignId"),sequenceId:f(X,"sequenceId"),emailId:f(X,"emailId")??f(X,"templateId"),transactionalId:f(X,"transactionalId"),domainId:f(X,"domainId"),status:f(X,"status"),settingsTab:f(X,"settingsTab")}),...G===void 0&&{note:"No company ID is selected. Call get_account, select_company, or pass companyId to get concrete dashboard URLs."}};break}case"create_company":{let G=await w("POST","/api/v1/companies",{name:X.name,domain:X.domain});if(!G.success)throw Error("Failed to create company");let J=G.company.id,$=6,z=0,H=G.company.status;while(H==="processing"&&z<$){await new Promise((D)=>setTimeout(D,20000)),z++;let B=await w("GET",`/api/v1/companies/${J}`);if(B.success)H=B.company.status}EX(J);let K=await w("GET",`/api/v1/companies/${J}`);Y={success:!0,company:K.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${K.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=X.companyId;Y=await w("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=X.companyId;Y=await w("POST","/api/v1/api-keys",{name:X.name},G);break}case"list_websites":{let G=X.companyId;Y=await w("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=X.companyId;Y=await w("POST","/api/v1/websites",{domain:X.domain},G);break}case"check_website":{let G=X.companyId;Y=await w("GET",`/api/v1/websites/${X.domain}`,void 0,G);break}case"get_integration_guide":Y=await w("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let G=X.companyId;Y=await w("POST","/api/v1/subscribers",{email:X.email,customAttributes:X.attributes,tags:X.tags,lists:X.listIds},G);break}case"update_subscriber":{let G=X.companyId,J=await PX(String(X.email),G),$=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((D)=>typeof D==="string"):[],z=Array.isArray(X.addTags)?X.addTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(K5):[],H=new Set(Array.isArray(X.removeTags)?X.removeTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(K5):[]),K=$.filter((D)=>!H.has(D));for(let D of z)if(!K.includes(D))K.push(D);let B={};if(h0(X.attributes))B.customAttributes={...h0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...X.attributes};if(X.addTags||X.removeTags)B.tags=K;Y=await w("PATCH",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,B,G);break}case"remove_subscriber":{let G=X.companyId;if(X.hardDelete===!0)Y=await w("DELETE",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,void 0,G);else Y=await w("PATCH",`/api/v1/subscribers/${encodeURIComponent(String(X.email))}`,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=X.companyId;Y=await PX(String(X.email),G);break}case"search_subscribers":{let G=X.companyId;Y=await zV(X,G);break}case"list_tags":{let G=X.companyId;Y=await w("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=X.companyId;Y=await w("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=X.companyId;Y=await w("POST","/api/v1/lists",X,G);break}case"list_segments":{let G=X.companyId;Y=await w("GET","/api/v1/segments",void 0,G);break}case"create_segment":{let G=X.companyId;Y=await w("POST","/api/v1/segments",{...X,...X.filters!==void 0?{filters:B5(X.filters)}:{},...X.root!==void 0?{root:D5(X.root)}:{}},G);break}case"get_segment_count":{let G=X.companyId;Y=await w("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,G);break}case"list_templates":{let G=X.companyId;Y=await w("GET","/api/v1/templates",void 0,G);break}case"get_template":{let G=X.companyId;Y=await w("GET",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"create_template":{let G=X.companyId;WQ("create_template",X,{requireContent:!0}),Y=await w("POST","/api/v1/templates",X,G);break}case"update_template":{let G=X.companyId,J=new Set(["companyId","templateId","name","subject","html","blocks"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, and \`blocks\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(WQ("update_template",X),X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, or `blocks` when calling `update_template`.");Y=await w("PUT",`/api/v1/templates/${X.templateId}`,X,G);break}case"delete_template":{let G=X.companyId;Y=await w("DELETE",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"list_campaigns":{let G=X.companyId,J=new URLSearchParams;if(X.status)J.set("status",String(X.status));Y=await w("GET",`/api/v1/campaigns?${J}`,void 0,G);break}case"get_campaign":{let G=X.companyId;Y=await w("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,G);break}case"create_campaign":{let G=X.companyId;GV(X);let J=f(X,"prompt");if(J!==void 0){let $=await w("POST","/api/v1/generate/email",{prompt:J,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G),z=f(X,"subject")??(typeof $.subject==="string"&&$.subject.trim()!==""?$.subject.trim():void 0);if(!z)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray($.blocks)&&$.blocks.length>0?$.blocks:void 0,K=typeof $.html==="string"&&$.html.trim()!==""?$.html:void 0;if(H===void 0&&K===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");Y=await w("POST","/api/v1/campaigns",{name:X.name,subject:z,...H!==void 0?{blocks:H}:{html:K},...X.segmentId!==void 0&&{segmentId:X.segmentId}},G);break}Y=await w("POST","/api/v1/campaigns",X,G);break}case"update_campaign":{let G=X.companyId,J=new Set(["companyId","campaignId","name","subject","html","blocks","replyTo","replyProfileId"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, \`replyTo\`, and \`replyProfileId\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(WQ("update_campaign",X),X.replyTo!==void 0&&X.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0&&X.replyTo===void 0&&X.replyProfileId===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, `replyTo`, or `replyProfileId` when calling `update_campaign`.");Y=await w("PUT",`/api/v1/campaigns/${X.campaignId}`,X,G);break}case"send_test_email":{let G=X.companyId;Y=await w("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},G);break}case"list_sequences":{let G=X.companyId;Y=await w("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=X.companyId;Y=await w("GET",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"create_sequence":{let G=X.companyId,J=Array.isArray(X.steps)&&X.steps.length>0,$=await w("POST","/api/v1/sequences",X,G);if(!$.success){Y=$;break}let z=$.sequence.id;if(J){let A=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(A.success)Y={success:!0,sequence:A.sequence,message:`Sequence "${A.sequence.name}" created with explicit steps. Review it before enabling.`};else Y=A;break}let H=6,K=0,B="pending";while(B!=="complete"&&K<H){await new Promise((U)=>setTimeout(U,20000)),K++;let A=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(A.success)B=A.sequence.enrichmentStatus}let D=await w("GET",`/api/v1/sequences/${z}`,void 0,G);if(D.success)Y={success:!0,sequence:D.sequence,message:D.sequence.enrichmentStatus==="complete"?`Sequence "${D.sequence.name}" created with ${D.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${D.sequence.name}" created. Email enrichment is still in progress (${D.sequence.enrichedCount}/${D.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=D;break}case"update_sequence":{let G=X.companyId;Y=await w("PUT",`/api/v1/sequences/${X.sequenceId}`,X,G);break}case"enable_sequence":{let G=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,G);break}case"delete_sequence":{let G=X.companyId;Y=await w("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"send_email":{let G=X.companyId;Y=await w("POST","/api/v1/transactional/send",X,G);break}case"get_stats":{let G=X.companyId,J=X.period??"7d";Y=await w("GET",`/api/v1/metrics?period=${J}`,void 0,G);break}case"get_campaign_stats":{let G=X.companyId;Y=await w("GET",`/api/v1/metrics/campaigns/${X.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=X.companyId;Y=await w("GET",`/api/v1/metrics/sequences/${X.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=X.companyId,J=await PX(String(X.email),G);Y={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=X.companyId;Y=await w("POST","/api/v1/generate/email",X,G);break}case"generate_sequence":{let G=X.companyId;Y=await w("POST","/api/v1/generate/sequence",X,G);break}case"generate_subject_lines":{let G=X.companyId;Y=await w("POST","/api/v1/generate/subjects",X,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=JV(Y);if(W)throw W;return Y=await BV(Q,X,Y),{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{isError:!0,content:[{type:"text",text:q1(Y)}]}}}var DV=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",U5=process.env.SEQUENZY_API_KEY,IX=null;if(!U5)console.error(q1(new g1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1);function _6(){return IX}function EX(Q){IX=Q}var y6=new ZX({name:"sequenzy",version:W5.version},{capabilities:{tools:{},resources:{}}});function AV(Q){if(!Q.trim())return{message:"Request failed"};try{let X=JSON.parse(Q);if(typeof X==="string")return{message:X};if(typeof X.error==="string")return{message:X.error,code:X.code};if(X.error&&typeof X.error==="object")return{message:X.error.message??X.message??Q,code:X.error.code??X.code};return{message:X.message??Q,code:X.code}}catch{return{message:Q}}}async function w(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${U5}`},J=W??IX;if(J)G["x-company-id"]=J;let $;try{$=await fetch(`${DV}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0})}catch(z){throw new g1(z instanceof Error?z.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!$.ok){let z=await $.text(),H=AV(z);throw new g1(H.message,$.status,z,H.code)}return $.json()}y6.setRequestHandler(z9,async()=>{return{tools:F5}});y6.setRequestHandler(K6,async(Q)=>{let{name:X,arguments:Y}=Q.params;return L5(X,Y??{})});y6.setRequestHandler(Q9,async()=>{return{resources:$5}});y6.setRequestHandler(Y9,async(Q)=>{let{uri:X}=Q.params;return z5(X)});async function FV(){let Q=new wX;await y6.connect(Q),console.error("Sequenzy MCP server running on stdio")}FV().catch((Q)=>{console.error(q1(Q)),process.exit(1)});export{EX as setSelectedCompanyId,_6 as getSelectedCompanyId,w as apiRequest};