@sequenzy/mcp 0.0.34 → 0.0.36
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 +18 -18
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Z5=Object.create;var{getPrototypeOf:N5,defineProperty:UQ,getOwnPropertyNames:w5}=Object;var b5=Object.prototype.hasOwnProperty;function j5(Q){return this[Q]}var P5,I5,vX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?P5??=new WeakMap:I5??=new WeakMap,J=G.get(Q);if(J)return J}Y=Q!=null?Z5(N5(Q)):{};let $=X||!Q||!Q.__esModule?UQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let z of w5(Q))if(!b5.call($,z))UQ($,z,{get:j5.bind(Q,z),enumerable:!0});if(W)G.set(Q,$);return $};var N=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var E5=(Q)=>Q;function T5(Q,X){this[Q]=E5.bind(null,X)}var xX=(Q,X)=>{for(var Y in X)UQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:T5.bind(X,Y)})};var q6=N((IG)=>{Object.defineProperty(IG,"__esModule",{value:!0});IG.regexpCode=IG.getEsmExportName=IG.getProperty=IG.safeStringify=IG.stringify=IG.strConcat=IG.addCodeArg=IG.str=IG._=IG.nil=IG._Code=IG.Name=IG.IDENTIFIER=IG._CodeOrName=void 0;class w4{}IG._CodeOrName=w4;IG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class T1 extends w4{constructor(Q){super();if(!IG.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}}}IG.Name=T1;class T0 extends w4{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},{})}}IG._Code=T0;IG.nil=new T0("");function jG(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)V9(Y,X[W]),Y.push(Q[++W]);return new T0(Y)}IG._=jG;var M9=new T0("+");function PG(Q,...X){let Y=[F6(Q[0])],W=0;while(W<X.length)Y.push(M9),V9(Y,X[W]),Y.push(M9,F6(Q[++W]));return pA(Y),new T0(Y)}IG.str=PG;function V9(Q,X){if(X instanceof T0)Q.push(...X._items);else if(X instanceof T1)Q.push(X);else Q.push(nA(X))}IG.addCodeArg=V9;function pA(Q){let X=1;while(X<Q.length-1){if(Q[X]===M9){let Y=iA(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function iA(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 rA(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:PG`${Q}${X}`}IG.strConcat=rA;function nA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:F6(Array.isArray(Q)?Q.join(","):Q)}function dA(Q){return new T0(F6(Q))}IG.stringify=dA;function F6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}IG.safeStringify=F6;function oA(Q){return typeof Q=="string"&&IG.IDENTIFIER.test(Q)?new T0(`.${Q}`):jG`[${Q}]`}IG.getProperty=oA;function tA(Q){if(typeof Q=="string"&&IG.IDENTIFIER.test(Q))return new T0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}IG.getEsmExportName=tA;function aA(Q){return new T0(Q.toString())}IG.regexpCode=aA});var b9=N((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.ValueScope=RG.ValueScopeName=RG.Scope=RG.varKinds=RG.UsedValueState=void 0;var L0=q6();class TG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var j4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(j4||(RG.UsedValueState=j4={}));RG.varKinds={const:new L0.Name("const"),let:new L0.Name("let"),var:new L0.Name("var")};class N9{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}}}RG.Scope=N9;class w9 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}]`}}RG.ValueScopeName=w9;var KK=L0._`\n`;class SG extends N9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?KK:L0.nil}}get(){return this._scope}name(Q){return new w9(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 A=$.get(J);if(A)return A}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,j4.Started);let A=X(H);if(A){let K=this.opts.es5?RG.varKinds.var:RG.varKinds.const;G=L0._`${G}${K} ${H} = ${A};${this.opts._n}`}else if(A=W===null||W===void 0?void 0:W(H))G=L0._`${G}${A}${this.opts._n}`;else throw new TG(H);z.set(H,j4.Completed)})}return G}}RG.ValueScope=SG});var v=N((F0)=>{Object.defineProperty(F0,"__esModule",{value:!0});F0.or=F0.and=F0.not=F0.CodeGen=F0.operators=F0.varKinds=F0.ValueScopeName=F0.ValueScope=F0.Scope=F0.Name=F0.regexpCode=F0.stringify=F0.getProperty=F0.nil=F0.strConcat=F0.str=F0._=void 0;var g=q6(),S0=b9(),W1=q6();Object.defineProperty(F0,"_",{enumerable:!0,get:function(){return W1._}});Object.defineProperty(F0,"str",{enumerable:!0,get:function(){return W1.str}});Object.defineProperty(F0,"strConcat",{enumerable:!0,get:function(){return W1.strConcat}});Object.defineProperty(F0,"nil",{enumerable:!0,get:function(){return W1.nil}});Object.defineProperty(F0,"getProperty",{enumerable:!0,get:function(){return W1.getProperty}});Object.defineProperty(F0,"stringify",{enumerable:!0,get:function(){return W1.stringify}});Object.defineProperty(F0,"regexpCode",{enumerable:!0,get:function(){return W1.regexpCode}});Object.defineProperty(F0,"Name",{enumerable:!0,get:function(){return W1.Name}});var R4=b9();Object.defineProperty(F0,"Scope",{enumerable:!0,get:function(){return R4.Scope}});Object.defineProperty(F0,"ValueScope",{enumerable:!0,get:function(){return R4.ValueScope}});Object.defineProperty(F0,"ValueScopeName",{enumerable:!0,get:function(){return R4.ValueScopeName}});Object.defineProperty(F0,"varKinds",{enumerable:!0,get:function(){return R4.varKinds}});F0.operators={GT:new g._Code(">"),GTE:new g._Code(">="),LT:new g._Code("<"),LTE:new g._Code("<="),EQ:new g._Code("==="),NEQ:new g._Code("!=="),NOT:new g._Code("!"),OR:new g._Code("||"),AND:new g._Code("&&"),ADD:new g._Code("+")};class G1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class kG extends G1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?S0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${Y} ${this.name}${W};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=R1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof g._CodeOrName?this.rhs.names:{}}}class I9 extends G1{constructor(Q,X,Y){super();this.lhs=Q,this.rhs=X,this.sideEffects=Y}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof g.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=R1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof g.Name?{}:{...this.lhs.names};return S4(Q,this.rhs)}}class vG extends I9{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class xG extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class _G extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class yG extends G1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class gG extends G1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,X){return this.code=R1(this.code,Q,X),this}get names(){return this.code instanceof g._CodeOrName?this.code.names:{}}}class C4 extends G1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,Y)=>X+Y.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let Y=Q[X].optimizeNodes();if(Array.isArray(Y))Q.splice(X,1,...Y);else if(Y)Q[X]=Y;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:Y}=this,W=Y.length;while(W--){let G=Y[W];if(G.optimizeNames(Q,X))continue;LK(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>D1(Q,X.names),{})}}class J1 extends C4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class uG extends C4{}class O6 extends J1{}O6.kind="else";class p0 extends J1{constructor(Q,X){super(X);this.condition=Q}render(Q){let X=`if(${this.condition})`+super.render(Q);if(this.else)X+="else "+this.else.render(Q);return X}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let X=this.else;if(X){let Y=X.optimizeNodes();X=this.else=Array.isArray(Y)?new O6(Y):Y}if(X){if(Q===!1)return X instanceof p0?X:X.nodes;if(this.nodes.length)return this;return new p0(cG(Q),X instanceof p0?[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(S4(Q,this.condition),this.else)D1(Q,this.else.names);return Q}}p0.kind="if";class S1 extends J1{}S1.kind="for";class hG 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 D1(super.names,this.iteration.names)}}class fG 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?S0.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=S4(super.names,this.from);return S4(Q,this.to)}}class j9 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 D1(super.names,this.iterable.names)}}class P4 extends J1{constructor(Q,X,Y){super();this.name=Q,this.args=X,this.async=Y}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}P4.kind="func";class I4 extends C4{render(Q){return"return "+super.render(Q)}}I4.kind="return";class lG extends J1{render(Q){let X="try"+super.render(Q);if(this.catch)X+=this.catch.render(Q);if(this.finally)X+=this.finally.render(Q);return X}optimizeNodes(){var Q,X;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(Q,X){var Y,W;return super.optimizeNames(Q,X),(Y=this.catch)===null||Y===void 0||Y.optimizeNames(Q,X),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)D1(Q,this.catch.names);if(this.finally)D1(Q,this.finally.names);return Q}}class E4 extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}E4.kind="catch";class T4 extends J1{render(Q){return"finally"+super.render(Q)}}T4.kind="finally";class mG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
|
|
3
|
-
`:""},this._extScope=Q,this._scope=new S0.Scope({parent:Q}),this._nodes=[new uG]}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 kG(Q,G,Y)),G}const(Q,X,Y){return this._def(S0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(S0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(S0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new I9(Q,X,Y))}add(Q,X){return this._leafNode(new vG(Q,F0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==g.nil)this._leafNode(new gG(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,g.addCodeArg)(X,W)}return X.push("}"),new g._Code(X)}if(Q,X,Y){if(this._blockNode(new p0(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 p0(Q))}else(){return this._elseNode(new O6)}endIf(){return this._endBlockNode(p0,O6)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new hG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?S0.varKinds.var:S0.varKinds.let){let J=this._scope.toName(Q);return this._for(new fG(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=S0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof g.Name?X:this.var("_arr",X);return this.forRange("_i",0,g._`${J}.length`,($)=>{this.var(G,g._`${J}[${$}]`),Y(G)})}return this._for(new j9("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?S0.varKinds.var:S0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,g._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new j9("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(S1)}label(Q){return this._leafNode(new xG(Q))}break(Q){return this._leafNode(new _G(Q))}return(Q){let X=new I4;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(I4)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new lG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new E4(G),X(G)}if(Y)this._currNode=W.finally=new T4,this.code(Y);return this._endBlockNode(E4,T4)}throw(Q){return this._leafNode(new yG(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=g.nil,Y,W){if(this._blockNode(new P4(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(P4)}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 p0))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}}F0.CodeGen=mG;function D1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function S4(Q,X){return X instanceof g._CodeOrName?D1(Q,X.names):Q}function R1(Q,X,Y){if(Q instanceof g.Name)return W(Q);if(!G(Q))return Q;return new g._Code(Q._items.reduce((J,$)=>{if($ instanceof g.Name)$=W($);if($ instanceof g._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 g._Code&&J._items.some(($)=>$ instanceof g.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function LK(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function cG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:g._`!${P9(Q)}`}F0.not=cG;var FK=pG(F0.operators.AND);function qK(...Q){return Q.reduce(FK)}F0.and=qK;var OK=pG(F0.operators.OR);function MK(...Q){return Q.reduce(OK)}F0.or=MK;function pG(Q){return(X,Y)=>X===g.nil?Y:Y===g.nil?X:g._`${P9(X)} ${Q} ${P9(Y)}`}function P9(Q){return Q instanceof g.Name?Q:g._`(${Q})`}});var f=N((eG)=>{Object.defineProperty(eG,"__esModule",{value:!0});eG.checkStrictMode=eG.getErrorPath=eG.Type=eG.useFunc=eG.setEvaluated=eG.evaluatedPropsToName=eG.mergeEvaluated=eG.eachItem=eG.unescapeJsonPointer=eG.escapeJsonPointer=eG.escapeFragment=eG.unescapeFragment=eG.schemaRefOrVal=eG.schemaHasRulesButRef=eG.schemaHasRules=eG.checkUnknownRules=eG.alwaysValidSchema=eG.toHash=void 0;var c=v(),wK=q6();function bK(Q){let X={};for(let Y of Q)X[Y]=!0;return X}eG.toHash=bK;function jK(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return dG(Q,X),!oG(X,Q.self.RULES.all)}eG.alwaysValidSchema=jK;function dG(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])sG(Q,`unknown keyword: "${J}"`)}eG.checkUnknownRules=dG;function oG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}eG.schemaHasRules=oG;function PK(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}eG.schemaHasRulesButRef=PK;function IK({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)}`}eG.schemaRefOrVal=IK;function EK(Q){return tG(decodeURIComponent(Q))}eG.unescapeFragment=EK;function TK(Q){return encodeURIComponent(T9(Q))}eG.escapeFragment=TK;function T9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}eG.escapeJsonPointer=T9;function tG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}eG.unescapeJsonPointer=tG;function SK(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}eG.eachItem=SK;function rG({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}}eG.mergeEvaluated={props:rG({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} || {}`),S9(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:aG}),items:rG({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 aG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",c._`{}`);if(X!==void 0)S9(Q,Y,X);return Y}eG.evaluatedPropsToName=aG;function S9(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(c._`${X}${(0,c.getProperty)(W)}`,!0))}eG.setEvaluated=S9;var nG={};function RK(Q,X){return Q.scopeValue("func",{ref:X,code:nG[X.code]||(nG[X.code]=new wK._Code(X.code))})}eG.useFunc=RK;var E9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(E9||(eG.Type=E9={}));function CK(Q,X,Y){if(Q instanceof c.Name){let W=X===E9.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():"/"+T9(Q)}eG.getErrorPath=CK;function sG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}eG.checkStrictMode=sG});var i0=N((XJ)=>{Object.defineProperty(XJ,"__esModule",{value:!0});var A0=v(),oK={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};XJ.default=oK});var M6=N((JJ)=>{Object.defineProperty(JJ,"__esModule",{value:!0});JJ.extendErrors=JJ.resetErrorsCount=JJ.reportExtraError=JJ.reportError=JJ.keyword$DataError=JJ.keywordError=void 0;var u=v(),v4=f(),U0=i0();JJ.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};JJ.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?u.str`"${Q}" keyword must be ${X} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function aK(Q,X=JJ.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:z}=G,H=GJ(Q,X,Y);if(W!==null&&W!==void 0?W:$||z)YJ(J,H);else WJ(G,u._`[${H}]`)}JJ.reportError=aK;function sK(Q,X=JJ.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,z=GJ(Q,X,Y);if(YJ(G,z),!(J||$))WJ(W,U0.default.vErrors)}JJ.reportExtraError=sK;function eK(Q,X){Q.assign(U0.default.errors,X),Q.if(u._`${U0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(u._`${U0.default.vErrors}.length`,X),()=>Q.assign(U0.default.vErrors,null)))}JJ.resetErrorsCount=eK;function QU({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,U0.default.errors,(z)=>{if(Q.const($,u._`${U0.default.vErrors}[${z}]`),Q.if(u._`${$}.instancePath === undefined`,()=>Q.assign(u._`${$}.instancePath`,(0,u.strConcat)(U0.default.instancePath,J.errorPath))),Q.assign(u._`${$}.schemaPath`,u.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(u._`${$}.schema`,Y),Q.assign(u._`${$}.data`,W)})}JJ.extendErrors=QU;function YJ(Q,X){let Y=Q.const("err",X);Q.if(u._`${U0.default.vErrors} === null`,()=>Q.assign(U0.default.vErrors,u._`[${Y}]`),u._`${U0.default.vErrors}.push(${Y})`),Q.code(u._`${U0.default.errors}++`)}function WJ(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(u._`new ${Q.ValidationError}(${X})`);else Y.assign(u._`${W}.errors`,X),Y.return(!1)}var L1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function GJ(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return XU(Q,X,Y)}function XU(Q,X,Y={}){let{gen:W,it:G}=Q,J=[YU(G,Y),WU(Q,Y)];return GU(Q,X,J),W.object(...J)}function YU({errorPath:Q},{instancePath:X}){let Y=X?u.str`${Q}${(0,v4.getErrorPath)(X,v4.Type.Str)}`:Q;return[U0.default.instancePath,(0,u.strConcat)(U0.default.instancePath,Y)]}function WU({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:u.str`${X}/${Q}`;if(Y)G=u.str`${G}${(0,v4.getErrorPath)(Y,v4.Type.Str)}`;return[L1.schemaPath,G]}function GU(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:z}=Q,{opts:H,propertyName:A,topSchemaRef:K,schemaPath:U}=z;if(W.push([L1.keyword,G],[L1.params,typeof X=="function"?X(Q):X||u._`{}`]),H.messages)W.push([L1.message,typeof Y=="function"?Y(Q):Y]);if(H.verbose)W.push([L1.schema,$],[L1.parentSchema,u._`${K}${U}`],[U0.default.data,J]);if(A)W.push([L1.propertyName,A])}});var KJ=N((HJ)=>{Object.defineProperty(HJ,"__esModule",{value:!0});HJ.boolOrEmptySchema=HJ.topBoolOrEmptySchema=void 0;var AU=M6(),KU=v(),UU=i0(),BU={message:"boolean schema is false"};function DU(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)zJ(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(UU.default.data);else X.assign(KU._`${W}.errors`,null),X.return(!0)}HJ.topBoolOrEmptySchema=DU;function LU(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),zJ(Q);else Y.var(X,!0)}HJ.boolOrEmptySchema=LU;function zJ(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,AU.reportError)(G,BU,void 0,X)}});var C9=N((UJ)=>{Object.defineProperty(UJ,"__esModule",{value:!0});UJ.getRules=UJ.isJSONType=void 0;var qU=["string","number","integer","boolean","null","object","array"],OU=new Set(qU);function MU(Q){return typeof Q=="string"&&OU.has(Q)}UJ.isJSONType=MU;function VU(){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:{}}}UJ.getRules=VU});var k9=N((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});FJ.shouldUseRule=FJ.shouldUseGroup=FJ.schemaHasRulesForType=void 0;function NU({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&DJ(Q,W)}FJ.schemaHasRulesForType=NU;function DJ(Q,X){return X.rules.some((Y)=>LJ(Q,Y))}FJ.shouldUseGroup=DJ;function LJ(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))}FJ.shouldUseRule=LJ});var V6=N((ZJ)=>{Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.reportTypeError=ZJ.checkDataTypes=ZJ.checkDataType=ZJ.coerceAndCheckDataType=ZJ.getJSONTypes=ZJ.getSchemaTypes=ZJ.DataType=void 0;var jU=C9(),PU=k9(),IU=M6(),C=v(),OJ=f(),C1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(C1||(ZJ.DataType=C1={}));function EU(Q){let X=MJ(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}ZJ.getSchemaTypes=EU;function MJ(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(jU.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}ZJ.getJSONTypes=MJ;function TU(Q,X){let{gen:Y,data:W,opts:G}=Q,J=SU(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,PU.schemaHasRulesForType)(Q,X[0]));if($){let z=x9(X,W,G.strictNumbers,C1.Wrong);Y.if(z,()=>{if(J.length)RU(Q,X,J);else _9(Q)})}return $}ZJ.coerceAndCheckDataType=TU;var VJ=new Set(["string","number","integer","boolean","null"]);function SU(Q,X){return X?Q.filter((Y)=>VJ.has(Y)||X==="array"&&Y==="array"):[]}function RU(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",C._`typeof ${G}`),z=W.let("coerced",C._`undefined`);if(J.coerceTypes==="array")W.if(C._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign($,C._`typeof ${G}`).if(x9(X,G,J.strictNumbers),()=>W.assign(z,G)));W.if(C._`${z} !== undefined`);for(let A of Y)if(VJ.has(A)||A==="array"&&J.coerceTypes==="array")H(A);W.else(),_9(Q),W.endIf(),W.if(C._`${z} !== undefined`,()=>{W.assign(G,z),CU(Q,z)});function H(A){switch(A){case"string":W.elseIf(C._`${$} == "number" || ${$} == "boolean"`).assign(z,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign(z,C._`""`);return;case"number":W.elseIf(C._`${$} == "boolean" || ${G} === null
|
|
4
|
-
|| (${
|
|
5
|
-
|| (${
|
|
6
|
-
|| ${$} === "boolean" || ${G} === null`).assign(z,C._`[${G}]`)}}}function CU({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(C._`${X} !== undefined`,()=>Q.assign(C._`${X}[${Y}]`,W))}function v9(Q,X,Y,W=C1.Correct){let G=W===C1.Correct?C.operators.EQ:C.operators.NEQ,J;switch(Q){case"null":return C._`${X} ${G} null`;case"array":J=C._`Array.isArray(${X})`;break;case"object":J=C._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(C._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return C._`typeof ${X} ${G} ${Q}`}return W===C1.Correct?J:(0,C.not)(J);function $(z=C.nil){return(0,C.and)(C._`typeof ${X} == "number"`,z,Y?C._`isFinite(${X})`:C.nil)}}ZJ.checkDataType=v9;function x9(Q,X,Y,W){if(Q.length===1)return v9(Q[0],X,Y,W);let G,J=(0,OJ.toHash)(Q);if(J.array&&J.object){let $=C._`typeof ${X} != "object"`;G=J.null?$:C._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=C.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,C.and)(G,v9($,X,Y,W));return G}ZJ.checkDataTypes=x9;var kU={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${X}}`};function _9(Q){let X=vU(Q);(0,IU.reportError)(X,kU)}ZJ.reportTypeError=_9;function vU(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,OJ.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var PJ=N((bJ)=>{Object.defineProperty(bJ,"__esModule",{value:!0});bJ.assignDefaults=void 0;var k1=v(),fU=f();function lU(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)wJ(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>wJ(Q,J,G.default))}bJ.assignDefaults=lU;function wJ(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,fU.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=N((TJ)=>{Object.defineProperty(TJ,"__esModule",{value:!0});TJ.validateUnion=TJ.validateArray=TJ.usePattern=TJ.callValidateCode=TJ.schemaProperties=TJ.allSchemaProperties=TJ.noPropertyInData=TJ.propertyInData=TJ.isOwnProperty=TJ.hasPropFunc=TJ.reportMissingProp=TJ.checkMissingProp=TJ.checkReportMissingProp=void 0;var n=v(),y9=f(),$1=i0(),mU=f();function cU(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(u9(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:n._`${X}`},!0),Q.error()})}TJ.checkReportMissingProp=cU;function pU({gen:Q,data:X,it:{opts:Y}},W,G){return(0,n.or)(...W.map((J)=>(0,n.and)(u9(Q,X,J,Y.ownProperties),n._`${G} = ${J}`)))}TJ.checkMissingProp=pU;function iU(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}TJ.reportMissingProp=iU;function IJ(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}TJ.hasPropFunc=IJ;function g9(Q,X,Y){return n._`${IJ(Q)}.call(${X}, ${Y})`}TJ.isOwnProperty=g9;function rU(Q,X,Y,W){let G=n._`${X}${(0,n.getProperty)(Y)} !== undefined`;return W?n._`${G} && ${g9(Q,X,Y)}`:G}TJ.propertyInData=rU;function u9(Q,X,Y,W){let G=n._`${X}${(0,n.getProperty)(Y)} === undefined`;return W?(0,n.or)(G,(0,n.not)(g9(Q,X,Y))):G}TJ.noPropertyInData=u9;function EJ(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}TJ.allSchemaProperties=EJ;function nU(Q,X){return EJ(X).filter((Y)=>!(0,y9.alwaysValidSchema)(Q,X[Y]))}TJ.schemaProperties=nU;function dU({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},z,H,A){let K=A?n._`${Q}, ${X}, ${W}${G}`:X,U=[[$1.default.instancePath,(0,n.strConcat)($1.default.instancePath,J)],[$1.default.parentData,$.parentData],[$1.default.parentDataProperty,$.parentDataProperty],[$1.default.rootData,$1.default.rootData]];if($.opts.dynamicRef)U.push([$1.default.dynamicAnchors,$1.default.dynamicAnchors]);let B=n._`${K}, ${Y.object(...U)}`;return H!==n.nil?n._`${z}.call(${H}, ${B})`:n._`${z}(${B})`}TJ.callValidateCode=dU;var oU=n._`new RegExp`;function tU({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:n._`${G.code==="new RegExp"?oU:(0,mU.useFunc)(Q,G)}(${Y}, ${W})`})}TJ.usePattern=tU;function aU(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",n._`${Y}.length`);X.forRange("i",0,H,(A)=>{Q.subschema({keyword:W,dataProp:A,dataPropType:y9.Type.Num},J),X.if((0,n.not)(J),z)})}}TJ.validateArray=aU;function sU(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,y9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((H,A)=>{let K=Q.subschema({keyword:W,schemaProp:A,compositeRule:!0},z);if(X.assign($,n._`${$} || ${z}`),!Q.mergeValidEvaluated(K,z))X.if((0,n.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}TJ.validateUnion=sU});var xJ=N((kJ)=>{Object.defineProperty(kJ,"__esModule",{value:!0});kJ.validateKeywordUsage=kJ.validSchemaType=kJ.funcKeywordCode=kJ.macroKeywordCode=void 0;var B0=v(),F1=i0(),UB=j0(),BB=M6();function DB(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,z=X.macro.call($.self,G,J,$),H=CJ(Y,W,z);if($.opts.validateSchema!==!1)$.self.validateSchema(z,!0);let A=Y.name("valid");Q.subschema({schema:z,schemaPath:B0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},A),Q.pass(A,()=>Q.error(!0))}kJ.macroKeywordCode=DB;function LB(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:z,it:H}=Q;qB(H,X);let A=!z&&X.compile?X.compile.call(H.self,J,$,H):X.validate,K=CJ(W,G,A),U=W.let("valid");Q.block$data(U,B),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:U);function B(){if(X.errors===!1){if(O(),X.modifying)RJ(Q);V(()=>Q.error())}else{let M=X.async?L():q();if(X.modifying)RJ(Q);V(()=>FB(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(B0._`await `),(T)=>W.assign(U,!1).if(B0._`${T} instanceof ${H.ValidationError}`,()=>W.assign(M,B0._`${T}.errors`),()=>W.throw(T))),M}function q(){let M=B0._`${K}.errors`;return W.assign(M,null),O(B0.nil),M}function O(M=X.async?B0._`await `:B0.nil){let T=H.opts.passContext?F1.default.this:F1.default.self,I=!(("compile"in X)&&!z||X.schema===!1);W.assign(U,B0._`${M}${(0,UB.callValidateCode)(Q,K,T,I)}`,X.modifying)}function V(M){var T;W.if((0,B0.not)((T=X.valid)!==null&&T!==void 0?T:U),M)}}kJ.funcKeywordCode=LB;function RJ(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,B0._`${W.parentData}[${W.parentDataProperty}]`))}function FB(Q,X){let{gen:Y}=Q;Y.if(B0._`Array.isArray(${X})`,()=>{Y.assign(F1.default.vErrors,B0._`${F1.default.vErrors} === null ? ${X} : ${F1.default.vErrors}.concat(${X})`).assign(F1.default.errors,B0._`${F1.default.vErrors}.length`),(0,BB.extendErrors)(Q)},()=>Q.error())}function qB({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function CJ(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,B0.stringify)(Y)})}function OB(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")}kJ.validSchemaType=OB;function MB({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)}}}kJ.validateKeywordUsage=MB});var uJ=N((yJ)=>{Object.defineProperty(yJ,"__esModule",{value:!0});yJ.extendSubschemaMode=yJ.extendSubschemaData=yJ.getSubschema=void 0;var _0=v(),_J=f();function wB(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:_0._`${Q.schemaPath}${(0,_0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:_0._`${Q.schemaPath}${(0,_0.getProperty)(X)}${(0,_0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,_J.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')}yJ.getSubschema=wB;function bB(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:A,dataPathArr:K,opts:U}=X,B=z.let("data",_0._`${X.data}${(0,_0.getProperty)(Y)}`,!0);H(B),Q.errorPath=_0.str`${A}${(0,_J.getErrorPath)(Y,W,U.jsPropertySyntax)}`,Q.parentDataProperty=_0._`${Y}`,Q.dataPathArr=[...K,Q.parentDataProperty]}if(G!==void 0){let A=G instanceof _0.Name?G:z.let("data",G,!0);if(H(A),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function H(A){Q.data=A,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,A]}}yJ.extendSubschemaData=bB;function jB(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}yJ.extendSubschemaMode=jB});var h9=N((kj,hJ)=>{hJ.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 lJ=N((vj,fJ)=>{var z1=fJ.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(){};x4(X,W,G,Q,"",Q)};z1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};z1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};z1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};z1.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 x4(Q,X,Y,W,G,J,$,z,H,A){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,z,H,A);for(var K in W){var U=W[K];if(Array.isArray(U)){if(K in z1.arrayKeywords)for(var B=0;B<U.length;B++)x4(Q,X,Y,U[B],G+"/"+K+"/"+B,J,G,K,W,B)}else if(K in z1.propsKeywords){if(U&&typeof U=="object")for(var L in U)x4(Q,X,Y,U[L],G+"/"+K+"/"+EB(L),J,G,K,W,L)}else if(K in z1.keywords||Q.allKeys&&!(K in z1.skipKeywords))x4(Q,X,Y,U,G+"/"+K,J,G,K,W)}Y(W,G,J,$,z,H,A)}}function EB(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var Z6=N((iJ)=>{Object.defineProperty(iJ,"__esModule",{value:!0});iJ.getSchemaRefs=iJ.resolveUrl=iJ.normalizeId=iJ._getFullPath=iJ.getFullPath=iJ.inlineRef=void 0;var TB=f(),SB=h9(),RB=lJ(),CB=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function kB(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!f9(Q);if(!X)return!1;return mJ(Q)<=X}iJ.inlineRef=kB;var vB=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function f9(Q){for(let X in Q){if(vB.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(f9))return!0;if(typeof Y=="object"&&f9(Y))return!0}return!1}function mJ(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,CB.has(Y))continue;if(typeof Q[Y]=="object")(0,TB.eachItem)(Q[Y],(W)=>X+=mJ(W));if(X===1/0)return 1/0}return X}function cJ(Q,X="",Y){if(Y!==!1)X=v1(X);let W=Q.parse(X);return pJ(Q,W)}iJ.getFullPath=cJ;function pJ(Q,X){return Q.serialize(X).split("#")[0]+"#"}iJ._getFullPath=pJ;var xB=/#\/?$/;function v1(Q){return Q?Q.replace(xB,""):""}iJ.normalizeId=v1;function _B(Q,X,Y){return Y=v1(Y),Q.resolve(X,Y)}iJ.resolveUrl=_B;var yB=/^[a-z_][-a-z0-9._]*$/i;function gB(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=v1(Q[Y]||X),J={"":G},$=cJ(W,G,!1),z={},H=new Set;return RB(Q,{allKeys:!0},(U,B,L,q)=>{if(q===void 0)return;let O=$+B,V=J[q];if(typeof U[Y]=="string")V=M.call(this,U[Y]);T.call(this,U.$anchor),T.call(this,U.$dynamicAnchor),J[B]=V;function M(I){let x=this.opts.uriResolver.resolve;if(I=v1(V?x(V,I):I),H.has(I))throw K(I);H.add(I);let E=this.refs[I];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")A(U,E.schema,I);else if(I!==v1(O))if(I[0]==="#")A(U,z[I],I),z[I]=U;else this.refs[I]=O;return I}function T(I){if(typeof I=="string"){if(!yB.test(I))throw Error(`invalid anchor "${I}"`);M.call(this,`#${I}`)}}}),z;function A(U,B,L){if(B!==void 0&&!SB(U,B))throw K(L)}function K(U){return Error(`reference "${U}" resolves to more than one schema`)}}iJ.getSchemaRefs=gB});var b6=N((z$)=>{Object.defineProperty(z$,"__esModule",{value:!0});z$.getData=z$.KeywordCxt=z$.validateFunctionCode=void 0;var aJ=KJ(),nJ=V6(),m9=k9(),_4=V6(),cB=PJ(),w6=xJ(),l9=uJ(),j=v(),R=i0(),pB=Z6(),r0=f(),N6=M6();function iB(Q){if(Q$(Q)){if(X$(Q),eJ(Q)){dB(Q);return}}sJ(Q,()=>(0,aJ.topBoolOrEmptySchema)(Q))}z$.validateFunctionCode=iB;function sJ({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,j._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(j._`"use strict"; ${dJ(Y,G)}`),nB(Q,G),Q.code(J)});else Q.func(X,j._`${R.default.data}, ${rB(G)}`,W.$async,()=>Q.code(dJ(Y,G)).code(J))}function rB(Q){return j._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?j._`, ${R.default.dynamicAnchors}={}`:j.nil}}={}`}function nB(Q,X){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,j._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,j._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,j._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,j._`${R.default.valCxt}.${R.default.rootData}`),X.dynamicRef)Q.var(R.default.dynamicAnchors,j._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,j._`""`),Q.var(R.default.parentData,j._`undefined`),Q.var(R.default.parentDataProperty,j._`undefined`),Q.var(R.default.rootData,R.default.data),X.dynamicRef)Q.var(R.default.dynamicAnchors,j._`{}`)})}function dB(Q){let{schema:X,opts:Y,gen:W}=Q;sJ(Q,()=>{if(Y.$comment&&X.$comment)W$(Q);if(eB(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),Y.unevaluated)oB(Q);Y$(Q),YD(Q)});return}function oB(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",j._`${Y}.evaluated`),X.if(j._`${Q.evaluated}.dynamicProps`,()=>X.assign(j._`${Q.evaluated}.props`,j._`undefined`)),X.if(j._`${Q.evaluated}.dynamicItems`,()=>X.assign(j._`${Q.evaluated}.items`,j._`undefined`))}function dJ(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?j._`/*# sourceURL=${Y} */`:j.nil}function tB(Q,X){if(Q$(Q)){if(X$(Q),eJ(Q)){aB(Q,X);return}}(0,aJ.boolOrEmptySchema)(Q,X)}function eJ({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 Q$(Q){return typeof Q.schema!="boolean"}function aB(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)W$(Q);QD(Q),XD(Q);let J=W.const("_errs",R.default.errors);Y$(Q,J),W.var(X,j._`${J} === ${R.default.errors}`)}function X$(Q){(0,r0.checkUnknownRules)(Q),sB(Q)}function Y$(Q,X){if(Q.opts.jtd)return oJ(Q,[],!1,X);let Y=(0,nJ.getSchemaTypes)(Q.schema),W=(0,nJ.coerceAndCheckDataType)(Q,Y);oJ(Q,Y,!W,X)}function sB(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,r0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function eB(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,r0.checkStrictMode)(Q,"default is ignored in the schema root")}function QD(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,pB.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function XD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function W$({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(j._`${R.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=j.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(j._`${R.default.self}.opts.$comment(${J}, ${$}, ${z}.schema)`)}}function YD(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(j._`${R.default.errors} === 0`,()=>X.return(R.default.data),()=>X.throw(j._`new ${G}(${R.default.vErrors})`));else{if(X.assign(j._`${W}.errors`,R.default.vErrors),J.unevaluated)WD(Q);X.return(j._`${R.default.errors} === 0`)}}function WD({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof j.Name)Q.assign(j._`${X}.props`,Y);if(W instanceof j.Name)Q.assign(j._`${X}.items`,W)}function oJ(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:z,opts:H,self:A}=Q,{RULES:K}=A;if(J.$ref&&(H.ignoreKeywordsWithRef||!(0,r0.schemaHasRulesButRef)(J,K))){G.block(()=>J$(Q,"$ref",K.all.$ref.definition));return}if(!H.jtd)GD(Q,X);G.block(()=>{for(let B of K.rules)U(B);U(K.post)});function U(B){if(!(0,m9.shouldUseGroup)(J,B))return;if(B.type){if(G.if((0,_4.checkDataType)(B.type,$,H.strictNumbers)),tJ(Q,B),X.length===1&&X[0]===B.type&&Y)G.else(),(0,_4.reportTypeError)(Q);G.endIf()}else tJ(Q,B);if(!z)G.if(j._`${R.default.errors} === ${W||0}`)}}function tJ(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,cB.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,m9.shouldUseRule)(W,J))J$(Q,J.keyword,J.definition,X.type)})}function GD(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(JD(Q,X),!Q.opts.allowUnionTypes)$D(Q,X);zD(Q,Q.dataTypes)}function JD(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!G$(Q.dataTypes,Y))c9(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),AD(Q,X)}function $D(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))c9(Q,"use allowUnionTypes to allow union type keyword")}function zD(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,m9.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>HD(X,$)))c9(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function HD(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function G$(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function AD(Q,X){let Y=[];for(let W of Q.dataTypes)if(G$(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function c9(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,r0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class p9{constructor(Q,X,Y){if((0,w6.validateKeywordUsage)(Q,X,Y),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=Y,this.data=Q.data,this.schema=Q.schema[Y],this.$data=X.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,r0.schemaRefOrVal)(Q,this.schema,Y,this.$data),this.schemaType=X.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=X,this.$data)this.schemaCode=Q.gen.const("vSchema",$$(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,w6.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",R.default.errors)}result(Q,X,Y){this.failResult((0,j.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,j.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(j._`${X} !== undefined && (${(0,j.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?N6.reportExtraError:N6.reportError)(this,this.def.error,X)}$dataError(){(0,N6.reportError)(this,this.def.$dataError||N6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,N6.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=j.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=j.nil,X=j.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,j.or)(j._`${W} === undefined`,X)),Q!==j.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==j.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,j.or)(J(),$());function J(){if(Y.length){if(!(X instanceof j.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return j._`${(0,_4.checkDataTypes)(z,X,G.opts.strictNumbers,_4.DataType.Wrong)}`}return j.nil}function $(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return j._`!${z}(${X})`}return j.nil}}subschema(Q,X){let Y=(0,l9.getSubschema)(this.it,Q);(0,l9.extendSubschemaData)(Y,this.it,Q),(0,l9.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return tB(W,X),W}mergeEvaluated(Q,X){let{it:Y,gen:W}=this;if(!Y.opts.unevaluated)return;if(Y.props!==!0&&Q.props!==void 0)Y.props=r0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=r0.mergeEvaluated.items(W,Q.items,Y.items,X)}mergeValidEvaluated(Q,X){let{it:Y,gen:W}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return W.if(X,()=>this.mergeEvaluated(Q,j.Name)),!0}}z$.KeywordCxt=p9;function J$(Q,X,Y,W){let G=new p9(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,w6.funcKeywordCode)(G,Y);else if("macro"in Y)(0,w6.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,w6.funcKeywordCode)(G,Y)}var KD=/^\/(?:[^~]|~0|~1)*$/,UD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $$(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!KD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=R.default.rootData}else{let A=UD.exec(Q);if(!A)throw Error(`Invalid JSON-pointer: ${Q}`);let K=+A[1];if(G=A[2],G==="#"){if(K>=X)throw Error(H("property/index",K));return W[X-K]}if(K>X)throw Error(H("data",K));if(J=Y[X-K],!G)return J}let $=J,z=G.split("/");for(let A of z)if(A)J=j._`${J}${(0,j.getProperty)((0,r0.unescapeJsonPointer)(A))}`,$=j._`${$} && ${J}`;return $;function H(A,K){return`Cannot access ${A} ${K} levels up, current level is ${X}`}}z$.getData=$$});var y4=N((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});class A$ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}K$.default=A$});var j6=N((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});var i9=Z6();class U$ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,i9.resolveUrl)(Q,X,Y),this.missingSchema=(0,i9.normalizeId)((0,i9.getFullPath)(Q,this.missingRef))}}B$.default=U$});var u4=N((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});F$.resolveSchema=F$.getCompilingSchema=F$.resolveRef=F$.compileSchema=F$.SchemaEnv=void 0;var R0=v(),qD=y4(),q1=i0(),C0=Z6(),D$=f(),OD=b6();class P6{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,C0.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={}}}F$.SchemaEnv=P6;function n9(Q){let X=L$.call(this,Q);if(X)return X;let Y=(0,C0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new R0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),z;if(Q.$async)z=$.scopeValue("Error",{ref:qD.default,code:R0._`require("ajv/dist/runtime/validation_error").default`});let H=$.scopeName("validate");Q.validateName=H;let A={gen:$,allErrors:this.opts.allErrors,data:q1.default.data,parentData:q1.default.parentData,parentDataProperty:q1.default.parentDataProperty,dataNames:[q1.default.data],dataPathArr:[R0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,R0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:R0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:R0._`""`,opts:this.opts,self:this},K;try{this._compilations.add(Q),(0,OD.validateFunctionCode)(A),$.optimize(this.opts.code.optimize);let U=$.toString();if(K=`${$.scopeRefs(q1.default.scope)}return ${U}`,this.opts.code.process)K=this.opts.code.process(K,Q);let L=Function(`${q1.default.self}`,`${q1.default.scope}`,K)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:U,scopeValues:$._values};if(this.opts.unevaluated){let{props:q,items:O}=A;if(L.evaluated={props:q instanceof R0.Name?void 0:q,items:O instanceof R0.Name?void 0:O,dynamicProps:q instanceof R0.Name,dynamicItems:O instanceof R0.Name},L.source)L.source.evaluated=(0,R0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(U){if(delete Q.validate,delete Q.validateName,K)this.logger.error("Error compiling schema, function code:",K);throw U}finally{this._compilations.delete(Q)}}F$.compileSchema=n9;function MD(Q,X,Y){var W;Y=(0,C0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=ND.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 P6({schema:$,schemaId:z,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=VD.call(this,J)}F$.resolveRef=MD;function VD(Q){if((0,C0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:n9.call(this,Q)}function L$(Q){for(let X of this._compilations)if(ZD(X,Q))return X}F$.getCompilingSchema=L$;function ZD(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function ND(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||g4.call(this,Q,X)}function g4(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,C0._getFullPath)(this.opts.uriResolver,Y),G=(0,C0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return r9.call(this,Y,Q);let J=(0,C0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let z=g4.call(this,Q,$);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return r9.call(this,Y,z)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)n9.call(this,$);if(J===(0,C0.normalizeId)(X)){let{schema:z}=$,{schemaId:H}=this.opts,A=z[H];if(A)G=(0,C0.resolveUrl)(this.opts.uriResolver,G,A);return new P6({schema:z,schemaId:H,root:Q,baseId:G})}return r9.call(this,Y,$)}F$.resolveSchema=g4;var wD=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function r9(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,D$.unescapeFragment)(z)];if(H===void 0)return;Y=H;let A=typeof Y==="object"&&Y[this.opts.schemaId];if(!wD.has(z)&&A)X=(0,C0.resolveUrl)(this.opts.uriResolver,X,A)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,D$.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,C0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=g4.call(this,W,z)}let{schemaId:$}=this.opts;if(J=J||new P6({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var O$=N((hj,ED)=>{ED.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 o9=N((fj,N$)=>{var TD=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),V$=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 d9(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 SD=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function M$(Q){return Q.length=0,!0}function RD(Q,X,Y){if(Q.length){let W=d9(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function CD(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,z=RD;for(let H=0;H<Q.length;H++){let A=Q[H];if(A==="["||A==="]")continue;if(A===":"){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(A==="%"){if(!z(G,W,Y))break;z=M$}else{G.push(A);continue}}if(G.length)if(z===M$)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(d9(G));return Y.address=W.join(""),Y}function Z$(Q){if(kD(Q,":")<2)return{host:Q,isIPV6:!1};let X=CD(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 kD(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function vD(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 xD(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 _D(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(!V$(Y)){let W=Z$(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}N$.exports={nonSimpleDomain:SD,recomposeAuthority:_D,normalizeComponentEncoding:xD,removeDotSegments:vD,isIPv4:V$,isUUID:TD,normalizeIPv6:Z$,stringArrayToHexStripped:d9}});var I$=N((lj,P$)=>{var{isUUID:yD}=o9(),gD=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,uD=["http","https","ws","wss","urn","urn:uuid"];function hD(Q){return uD.indexOf(Q)!==-1}function t9(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 w$(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function b$(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 fD(Q){return Q.secure=t9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function lD(Q){if(Q.port===(t9(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 mD(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(gD);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=a9(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 cD(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=a9(G);if(J)Q=J.serialize(Q,X);let $=Q,z=Q.nss;return $.path=`${W||X.nid}:${z}`,X.skipEscape=!0,$}function pD(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!yD(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function iD(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var j$={scheme:"http",domainHost:!0,parse:w$,serialize:b$},rD={scheme:"https",domainHost:j$.domainHost,parse:w$,serialize:b$},h4={scheme:"ws",domainHost:!0,parse:fD,serialize:lD},nD={scheme:"wss",domainHost:h4.domainHost,parse:h4.parse,serialize:h4.serialize},dD={scheme:"urn",parse:mD,serialize:cD,skipNormalize:!0},oD={scheme:"urn:uuid",parse:pD,serialize:iD,skipNormalize:!0},f4={http:j$,https:rD,ws:h4,wss:nD,urn:dD,"urn:uuid":oD};Object.setPrototypeOf(f4,null);function a9(Q){return Q&&(f4[Q]||f4[Q.toLowerCase()])||void 0}P$.exports={wsIsSecure:t9,SCHEMES:f4,isValidSchemeName:hD,getSchemeHandler:a9}});var S$=N((mj,m4)=>{var{normalizeIPv6:tD,removeDotSegments:I6,recomposeAuthority:aD,normalizeComponentEncoding:l4,isIPv4:sD,nonSimpleDomain:eD}=o9(),{SCHEMES:QL,getSchemeHandler:E$}=I$();function XL(Q,X){if(typeof Q==="string")Q=y0(n0(Q,X),X);else if(typeof Q==="object")Q=n0(y0(Q,X),X);return Q}function YL(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=T$(n0(Q,W),n0(X,W),W,!0);return W.skipEscape=!0,y0(G,W)}function T$(Q,X,Y,W){let G={};if(!W)Q=n0(y0(Q,Y),Y),X=n0(y0(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=I6(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=I6(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=I6(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=I6(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 WL(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=y0(l4(n0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=y0(l4(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=y0(l4(n0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=y0(l4(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function y0(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=E$(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 $=aD(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=I6(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 GL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(GL);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(sD(W.host)===!1){let H=tD(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 $=E$(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!$||!$.unicodeSupport)){if(W.host&&(Y.domainHost||$&&$.domainHost)&&G===!1&&eD(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 s9={SCHEMES:QL,normalize:XL,resolve:YL,resolveComponent:T$,equal:WL,serialize:y0,parse:n0};m4.exports=s9;m4.exports.default=s9;m4.exports.fastUri=s9});var k$=N((C$)=>{Object.defineProperty(C$,"__esModule",{value:!0});var R$=S$();R$.code='require("ajv/dist/runtime/uri").default';C$.default=R$});var f$=N((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.CodeGen=d0.Name=d0.nil=d0.stringify=d0.str=d0._=d0.KeywordCxt=void 0;var $L=b6();Object.defineProperty(d0,"KeywordCxt",{enumerable:!0,get:function(){return $L.KeywordCxt}});var x1=v();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 zL=y4(),g$=j6(),HL=C9(),E6=u4(),AL=v(),T6=Z6(),c4=V6(),QX=f(),v$=O$(),KL=k$(),u$=(Q,X)=>new RegExp(Q,X);u$.code="new RegExp";var UL=["removeAdditional","useDefaults","coerceTypes"],BL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),DL={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."},LL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},x$=200;function FL(Q){var X,Y,W,G,J,$,z,H,A,K,U,B,L,q,O,V,M,T,I,x,E,x0,h0,HQ,AQ;let c1=Q.strict,KQ=(X=Q.code)===null||X===void 0?void 0:X.optimize,CX=KQ===!0||KQ===void 0?1:KQ||0,kX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:u$,V5=(G=Q.uriResolver)!==null&&G!==void 0?G:KL.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:c1)!==null&&$!==void 0?$:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:c1)!==null&&H!==void 0?H:!0,strictTypes:(K=(A=Q.strictTypes)!==null&&A!==void 0?A:c1)!==null&&K!==void 0?K:"log",strictTuples:(B=(U=Q.strictTuples)!==null&&U!==void 0?U:c1)!==null&&B!==void 0?B:"log",strictRequired:(q=(L=Q.strictRequired)!==null&&L!==void 0?L:c1)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:CX,regExp:kX}:{optimize:CX,regExp:kX},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:x$,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:x$,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(T=Q.messages)!==null&&T!==void 0?T:!0,inlineRefs:(I=Q.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(E=Q.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(x0=Q.validateSchema)!==null&&x0!==void 0?x0:!0,validateFormats:(h0=Q.validateFormats)!==null&&h0!==void 0?h0:!0,unicodeRegExp:(HQ=Q.unicodeRegExp)!==null&&HQ!==void 0?HQ:!0,int32range:(AQ=Q.int32range)!==null&&AQ!==void 0?AQ:!0,uriResolver:V5}}class p4{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...FL(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new AL.ValueScope({scope:{},prefixes:BL,es5:X,lines:Y}),this.logger=NL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,HL.getRules)(),_$.call(this,DL,Q,"NOT SUPPORTED"),_$.call(this,LL,Q,"DEPRECATED","warn"),this._metaOpts=VL.call(this),Q.formats)OL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)ML.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);qL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=v$;if(Y==="id")W={...v$},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(A,K){await G.call(this,A.$schema);let U=this._addSchema(A,K);return U.validate||J.call(this,U)}async function G(A){if(A&&!this.getSchema(A))await W.call(this,{$ref:A},!0)}async function J(A){try{return this._compileSchemaEnv(A)}catch(K){if(!(K instanceof g$.default))throw K;return $.call(this,K),await z.call(this,K.missingSchema),J.call(this,A)}}function $({missingSchema:A,missingRef:K}){if(this.refs[A])throw Error(`AnySchema ${A} is loaded but ${K} cannot be resolved`)}async function z(A){let K=await H.call(this,A);if(!this.refs[A])await G.call(this,K.$schema);if(!this.refs[A])this.addSchema(K,A,X)}async function H(A){let K=this._loading[A];if(K)return K;try{return await(this._loading[A]=Y(A))}finally{delete this._loading[A]}}}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,T6.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=y$.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new E6.SchemaEnv({schema:{},schemaId:Y});if(X=E6.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=y$.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,T6.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(bL.call(this,Y,X),!X)return(0,QX.eachItem)(Y,(G)=>e9.call(this,G)),this;PL.call(this,X);let W={...X,type:(0,c4.getJSONTypes)(X.type),schemaType:(0,c4.getJSONTypes)(X.schemaType)};return(0,QX.eachItem)(Y,W.type.length===0?(G)=>e9.call(this,G,W):(G)=>W.type.forEach((J)=>e9.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,A=J[$];if(H&&A)J[$]=h$(A)}}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,T6.normalizeId)(J||Y);let H=T6.getSchemaRefs.call(this,Q,Y);if(z=new E6.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 E6.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{E6.compileSchema.call(this,Q)}finally{this.opts=X}}}p4.ValidationError=zL.default;p4.MissingRefError=g$.default;d0.default=p4;function _$(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 y$(Q){return Q=(0,T6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function qL(){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 OL(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function ML(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 VL(){let Q={...this.opts};for(let X of UL)delete Q[X];return Q}var ZL={log(){},warn(){},error(){}};function NL(Q){if(Q===!1)return ZL;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 wL=/^[a-z_$][a-z0-9_$:-]*$/i;function bL(Q,X){let{RULES:Y}=this;if((0,QX.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!wL.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 e9(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,c4.getJSONTypes)(X.type),schemaType:(0,c4.getJSONTypes)(X.schemaType)}};if(X.before)jL.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 jL(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 PL(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=h$(X);Q.validateSchema=this.compile(X,!0)}var IL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function h$(Q){return{anyOf:[Q,IL]}}});var m$=N((l$)=>{Object.defineProperty(l$,"__esModule",{value:!0});var SL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};l$.default=SL});var d$=N((r$)=>{Object.defineProperty(r$,"__esModule",{value:!0});r$.callRef=r$.getValidate=void 0;var CL=j6(),c$=j0(),q0=v(),_1=i0(),p$=u4(),i4=f(),kL={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:A}=J;if((Y==="#"||Y==="#/")&&G===A.baseId)return U();let K=p$.resolveRef.call(H,A,G,Y);if(K===void 0)throw new CL.default(W.opts.uriResolver,G,Y);if(K instanceof p$.SchemaEnv)return B(K);return L(K);function U(){if(J===A)return r4(Q,$,J,J.$async);let q=X.scopeValue("root",{ref:A});return r4(Q,q0._`${q}.validate`,A,A.$async)}function B(q){let O=i$(Q,q);r4(Q,O,q,q.$async)}function L(q){let O=X.scopeValue("schema",z.code.source===!0?{ref:q,code:(0,q0.stringify)(q)}:{ref:q}),V=X.name("valid"),M=Q.subschema({schema:q,dataTypes:[],schemaPath:q0.nil,topSchemaRef:O,errSchemaPath:Y},V);Q.mergeEvaluated(M),Q.ok(V)}}};function i$(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):q0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}r$.getValidate=i$;function r4(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:z,opts:H}=J,A=H.passContext?_1.default.this:q0.nil;if(W)K();else U();function K(){if(!z.$async)throw Error("async schema referenced by sync schema");let q=G.let("valid");G.try(()=>{if(G.code(q0._`await ${(0,c$.callValidateCode)(Q,X,A)}`),L(X),!$)G.assign(q,!0)},(O)=>{if(G.if(q0._`!(${O} instanceof ${J.ValidationError})`,()=>G.throw(O)),B(O),!$)G.assign(q,!1)}),Q.ok(q)}function U(){Q.result((0,c$.callValidateCode)(Q,X,A),()=>L(X),()=>B(X))}function B(q){let O=q0._`${q}.errors`;G.assign(_1.default.vErrors,q0._`${_1.default.vErrors} === null ? ${O} : ${_1.default.vErrors}.concat(${O})`),G.assign(_1.default.errors,q0._`${_1.default.vErrors}.length`)}function L(q){var O;if(!J.opts.unevaluated)return;let V=(O=Y===null||Y===void 0?void 0:Y.validate)===null||O===void 0?void 0:O.evaluated;if(J.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)J.props=i4.mergeEvaluated.props(G,V.props,J.props)}else{let M=G.var("props",q0._`${q}.evaluated.props`);J.props=i4.mergeEvaluated.props(G,M,J.props,q0.Name)}if(J.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)J.items=i4.mergeEvaluated.items(G,V.items,J.items)}else{let M=G.var("items",q0._`${q}.evaluated.items`);J.items=i4.mergeEvaluated.items(G,M,J.items,q0.Name)}}}r$.callRef=r4;r$.default=kL});var t$=N((o$)=>{Object.defineProperty(o$,"__esModule",{value:!0});var _L=m$(),yL=d$(),gL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_L.default,yL.default];o$.default=gL});var s$=N((a$)=>{Object.defineProperty(a$,"__esModule",{value:!0});var n4=v(),H1=n4.operators,d4={maximum:{okStr:"<=",ok:H1.LTE,fail:H1.GT},minimum:{okStr:">=",ok:H1.GTE,fail:H1.LT},exclusiveMaximum:{okStr:"<",ok:H1.LT,fail:H1.GTE},exclusiveMinimum:{okStr:">",ok:H1.GT,fail:H1.LTE}},hL={message:({keyword:Q,schemaCode:X})=>n4.str`must be ${d4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>n4._`{comparison: ${d4[Q].okStr}, limit: ${X}}`},fL={keyword:Object.keys(d4),type:"number",schemaType:"number",$data:!0,error:hL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(n4._`${Y} ${d4[X].fail} ${W} || isNaN(${Y})`)}};a$.default=fL});var Qz=N((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});var S6=v(),mL={message:({schemaCode:Q})=>S6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>S6._`{multipleOf: ${Q}}`},cL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:mL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),z=J?S6._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:S6._`${$} !== parseInt(${$})`;Q.fail$data(S6._`(${W} === 0 || (${$} = ${Y}/${W}, ${z}))`)}};e$.default=cL});var Wz=N((Yz)=>{Object.defineProperty(Yz,"__esModule",{value:!0});function Xz(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}Yz.default=Xz;Xz.code='require("ajv/dist/runtime/ucs2length").default'});var Jz=N((Gz)=>{Object.defineProperty(Gz,"__esModule",{value:!0});var O1=v(),rL=f(),nL=Wz(),dL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return O1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>O1._`{limit: ${Q}}`},oL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:dL,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?O1.operators.GT:O1.operators.LT,$=G.opts.unicode===!1?O1._`${Y}.length`:O1._`${(0,rL.useFunc)(Q.gen,nL.default)}(${Y})`;Q.fail$data(O1._`${$} ${J} ${W}`)}};Gz.default=oL});var zz=N(($z)=>{Object.defineProperty($z,"__esModule",{value:!0});var aL=j0(),o4=v(),sL={message:({schemaCode:Q})=>o4.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>o4._`{pattern: ${Q}}`},eL={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sL,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:J}=Q,$=J.opts.unicodeRegExp?"u":"",z=Y?o4._`(new RegExp(${G}, ${$}))`:(0,aL.usePattern)(Q,W);Q.fail$data(o4._`!${z}.test(${X})`)}};$z.default=eL});var Az=N((Hz)=>{Object.defineProperty(Hz,"__esModule",{value:!0});var R6=v(),XF={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return R6.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>R6._`{limit: ${Q}}`},YF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:XF,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?R6.operators.GT:R6.operators.LT;Q.fail$data(R6._`Object.keys(${Y}).length ${G} ${W}`)}};Hz.default=YF});var Uz=N((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var C6=j0(),k6=v(),GF=f(),JF={message:({params:{missingProperty:Q}})=>k6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>k6._`{missingProperty: ${Q}}`},$F={keyword:"required",type:"object",schemaType:"array",$data:!0,error:JF,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)A();else K();if(z.strictRequired){let L=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let O of Y)if((L===null||L===void 0?void 0:L[O])===void 0&&!q.has(O)){let V=$.schemaEnv.baseId+$.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,GF.checkStrictMode)($,M,$.opts.strictRequired)}}function A(){if(H||J)Q.block$data(k6.nil,U);else for(let L of Y)(0,C6.checkReportMissingProp)(Q,L)}function K(){let L=X.let("missing");if(H||J){let q=X.let("valid",!0);Q.block$data(q,()=>B(L,q)),Q.ok(q)}else X.if((0,C6.checkMissingProp)(Q,Y,L)),(0,C6.reportMissingProp)(Q,L),X.else()}function U(){X.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),X.if((0,C6.noPropertyInData)(X,G,L,z.ownProperties),()=>Q.error())})}function B(L,q){Q.setParams({missingProperty:L}),X.forOf(L,W,()=>{X.assign(q,(0,C6.propertyInData)(X,G,L,z.ownProperties)),X.if((0,k6.not)(q),()=>{Q.error(),X.break()})},k6.nil)}}};Kz.default=$F});var Dz=N((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});var v6=v(),HF={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return v6.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>v6._`{limit: ${Q}}`},AF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:HF,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?v6.operators.GT:v6.operators.LT;Q.fail$data(v6._`${Y}.length ${G} ${W}`)}};Bz.default=AF});var t4=N((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var Lz=h9();Lz.code='require("ajv/dist/runtime/equal").default';Fz.default=Lz});var Oz=N((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});var XX=V6(),H0=v(),BF=f(),DF=t4(),LF={message:({params:{i:Q,j:X}})=>H0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>H0._`{i: ${Q}, j: ${X}}`},FF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:LF,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"),A=J.items?(0,XX.getSchemaTypes)(J.items):[];Q.block$data(H,K,H0._`${$} === false`),Q.ok(H);function K(){let q=X.let("i",H0._`${Y}.length`),O=X.let("j");Q.setParams({i:q,j:O}),X.assign(H,!0),X.if(H0._`${q} > 1`,()=>(U()?B:L)(q,O))}function U(){return A.length>0&&!A.some((q)=>q==="object"||q==="array")}function B(q,O){let V=X.name("item"),M=(0,XX.checkDataTypes)(A,V,z.opts.strictNumbers,XX.DataType.Wrong),T=X.const("indices",H0._`{}`);X.for(H0._`;${q}--;`,()=>{if(X.let(V,H0._`${Y}[${q}]`),X.if(M,H0._`continue`),A.length>1)X.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);X.if(H0._`typeof ${T}[${V}] == "number"`,()=>{X.assign(O,H0._`${T}[${V}]`),Q.error(),X.assign(H,!1).break()}).code(H0._`${T}[${V}] = ${q}`)})}function L(q,O){let V=(0,BF.useFunc)(X,DF.default),M=X.name("outer");X.label(M).for(H0._`;${q}--;`,()=>X.for(H0._`${O} = ${q}; ${O}--;`,()=>X.if(H0._`${V}(${Y}[${q}], ${Y}[${O}])`,()=>{Q.error(),X.assign(H,!1).break(M)})))}}};qz.default=FF});var Vz=N((Mz)=>{Object.defineProperty(Mz,"__esModule",{value:!0});var YX=v(),OF=f(),MF=t4(),VF={message:"must be equal to constant",params:({schemaCode:Q})=>YX._`{allowedValue: ${Q}}`},ZF={keyword:"const",$data:!0,error:VF,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(YX._`!${(0,OF.useFunc)(X,MF.default)}(${Y}, ${G})`);else Q.fail(YX._`${J} !== ${Y}`)}};Mz.default=ZF});var Nz=N((Zz)=>{Object.defineProperty(Zz,"__esModule",{value:!0});var x6=v(),wF=f(),bF=t4(),jF={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>x6._`{allowedValues: ${Q}}`},PF={keyword:"enum",schemaType:"array",$data:!0,error:jF,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,A=()=>H!==null&&H!==void 0?H:H=(0,wF.useFunc)(X,bF.default),K;if(z||W)K=X.let("valid"),Q.block$data(K,U);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=X.const("vSchema",J);K=(0,x6.or)(...G.map((q,O)=>B(L,O)))}Q.pass(K);function U(){X.assign(K,!1),X.forOf("v",J,(L)=>X.if(x6._`${A()}(${Y}, ${L})`,()=>X.assign(K,!0).break()))}function B(L,q){let O=G[q];return typeof O==="object"&&O!==null?x6._`${A()}(${Y}, ${L}[${q}])`:x6._`${Y} === ${O}`}}};Zz.default=PF});var bz=N((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});var EF=s$(),TF=Qz(),SF=Jz(),RF=zz(),CF=Az(),kF=Uz(),vF=Dz(),xF=Oz(),_F=Vz(),yF=Nz(),gF=[EF.default,TF.default,SF.default,RF.default,CF.default,kF.default,vF.default,xF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},_F.default,yF.default];wz.default=gF});var GX=N((Pz)=>{Object.defineProperty(Pz,"__esModule",{value:!0});Pz.validateAdditionalItems=void 0;var M1=v(),WX=f(),hF={message:({params:{len:Q}})=>M1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>M1._`{limit: ${Q}}`},fF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hF,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,WX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}jz(Q,W)}};function jz(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let z=Y.const("len",M1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(M1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,WX.alwaysValidSchema)($,W)){let A=Y.var("valid",M1._`${z} <= ${X.length}`);Y.if((0,M1.not)(A),()=>H(A)),Q.ok(A)}function H(A){Y.forRange("i",X.length,z,(K)=>{if(Q.subschema({keyword:J,dataProp:K,dataPropType:WX.Type.Num},A),!$.allErrors)Y.if((0,M1.not)(A),()=>Y.break())})}}Pz.validateAdditionalItems=jz;Pz.default=fF});var JX=N((Sz)=>{Object.defineProperty(Sz,"__esModule",{value:!0});Sz.validateTuple=void 0;var Ez=v(),a4=f(),mF=j0(),cF={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return Tz(Q,"additionalItems",X);if(Y.items=!0,(0,a4.alwaysValidSchema)(Y,X))return;Q.ok((0,mF.validateArray)(Q))}};function Tz(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:z}=Q;if(K(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=a4.mergeEvaluated.items(W,Y.length,z.items);let H=W.name("valid"),A=W.const("len",Ez._`${J}.length`);Y.forEach((U,B)=>{if((0,a4.alwaysValidSchema)(z,U))return;W.if(Ez._`${A} > ${B}`,()=>Q.subschema({keyword:$,schemaProp:B,dataProp:B},H)),Q.ok(H)});function K(U){let{opts:B,errSchemaPath:L}=z,q=Y.length,O=q===U.minItems&&(q===U.maxItems||U[X]===!1);if(B.strictTuples&&!O){let V=`"${$}" is ${q}-tuple, but minItems or maxItems/${X} are not specified or different at path "${L}"`;(0,a4.checkStrictMode)(z,V,B.strictTuples)}}}Sz.validateTuple=Tz;Sz.default=cF});var kz=N((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});var iF=JX(),rF={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,iF.validateTuple)(Q,"items")};Cz.default=rF});var _z=N((xz)=>{Object.defineProperty(xz,"__esModule",{value:!0});var vz=v(),dF=f(),oF=j0(),tF=GX(),aF={message:({params:{len:Q}})=>vz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>vz._`{limit: ${Q}}`},sF={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:aF,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,dF.alwaysValidSchema)(W,X))return;if(G)(0,tF.validateAdditionalItems)(Q,G);else Q.ok((0,oF.validateArray)(Q))}};xz.default=sF});var gz=N((yz)=>{Object.defineProperty(yz,"__esModule",{value:!0});var P0=v(),s4=f(),Qq={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}}`},Xq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Qq,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,z,{minContains:H,maxContains:A}=W;if(J.opts.next)$=H===void 0?1:H,z=A;else $=1;let K=X.const("len",P0._`${G}.length`);if(Q.setParams({min:$,max:z}),z===void 0&&$===0){(0,s4.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&$>z){(0,s4.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,s4.alwaysValidSchema)(J,Y)){let O=P0._`${K} >= ${$}`;if(z!==void 0)O=P0._`${O} && ${K} <= ${z}`;Q.pass(O);return}J.items=!0;let U=X.name("valid");if(z===void 0&&$===1)L(U,()=>X.if(U,()=>X.break()));else if($===0){if(X.let(U,!0),z!==void 0)X.if(P0._`${G}.length > 0`,B)}else X.let(U,!1),B();Q.result(U,()=>Q.reset());function B(){let O=X.name("_valid"),V=X.let("count",0);L(O,()=>X.if(O,()=>q(V)))}function L(O,V){X.forRange("i",0,K,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:s4.Type.Num,compositeRule:!0},O),V()})}function q(O){if(X.code(P0._`${O}++`),z===void 0)X.if(P0._`${O} >= ${$}`,()=>X.assign(U,!0).break());else if(X.if(P0._`${O} > ${z}`,()=>X.assign(U,!1).break()),$===1)X.assign(U,!0);else X.if(P0._`${O} >= ${$}`,()=>X.assign(U,!0))}}};yz.default=Xq});var cz=N((fz)=>{Object.defineProperty(fz,"__esModule",{value:!0});fz.validateSchemaDeps=fz.validatePropertyDeps=fz.error=void 0;var $X=v(),Wq=f(),_6=j0();fz.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return $X.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>$X._`{property: ${Q},
|
|
2
|
+
var N5=Object.create;var{getPrototypeOf:w5,defineProperty:UQ,getOwnPropertyNames:b5}=Object;var j5=Object.prototype.hasOwnProperty;function P5(Q){return this[Q]}var I5,E5,vX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?I5??=new WeakMap:E5??=new WeakMap,$=G.get(Q);if($)return $}Y=Q!=null?N5(w5(Q)):{};let J=X||!Q||!Q.__esModule?UQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let z of b5(Q))if(!j5.call(J,z))UQ(J,z,{get:P5.bind(Q,z),enumerable:!0});if(W)G.set(Q,J);return J};var N=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var T5=(Q)=>Q;function S5(Q,X){this[Q]=T5.bind(null,X)}var xX=(Q,X)=>{for(var Y in X)UQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:S5.bind(X,Y)})};var F6=N((IG)=>{Object.defineProperty(IG,"__esModule",{value:!0});IG.regexpCode=IG.getEsmExportName=IG.getProperty=IG.safeStringify=IG.stringify=IG.strConcat=IG.addCodeArg=IG.str=IG._=IG.nil=IG._Code=IG.Name=IG.IDENTIFIER=IG._CodeOrName=void 0;class w4{}IG._CodeOrName=w4;IG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class S1 extends w4{constructor(Q){super();if(!IG.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}}}IG.Name=S1;class T0 extends w4{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 S1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}IG._Code=T0;IG.nil=new T0("");function jG(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)V9(Y,X[W]),Y.push(Q[++W]);return new T0(Y)}IG._=jG;var M9=new T0("+");function PG(Q,...X){let Y=[L6(Q[0])],W=0;while(W<X.length)Y.push(M9),V9(Y,X[W]),Y.push(M9,L6(Q[++W]));return iA(Y),new T0(Y)}IG.str=PG;function V9(Q,X){if(X instanceof T0)Q.push(...X._items);else if(X instanceof S1)Q.push(X);else Q.push(dA(X))}IG.addCodeArg=V9;function iA(Q){let X=1;while(X<Q.length-1){if(Q[X]===M9){let Y=nA(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function nA(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof S1||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 S1))return`"${Q}${X.slice(1)}`;return}function rA(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:PG`${Q}${X}`}IG.strConcat=rA;function dA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:L6(Array.isArray(Q)?Q.join(","):Q)}function oA(Q){return new T0(L6(Q))}IG.stringify=oA;function L6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}IG.safeStringify=L6;function tA(Q){return typeof Q=="string"&&IG.IDENTIFIER.test(Q)?new T0(`.${Q}`):jG`[${Q}]`}IG.getProperty=tA;function aA(Q){if(typeof Q=="string"&&IG.IDENTIFIER.test(Q))return new T0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}IG.getEsmExportName=aA;function sA(Q){return new T0(Q.toString())}IG.regexpCode=sA});var b9=N((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.ValueScope=RG.ValueScopeName=RG.Scope=RG.varKinds=RG.UsedValueState=void 0;var F0=F6();class TG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var j4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(j4||(RG.UsedValueState=j4={}));RG.varKinds={const:new F0.Name("const"),let:new F0.Name("let"),var:new F0.Name("var")};class N9{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof F0.Name?Q:this.name(Q)}name(Q){return new F0.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}}}RG.Scope=N9;class w9 extends F0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=F0._`.${new F0.Name(X)}[${Y}]`}}RG.ValueScopeName=w9;var UK=F0._`\n`;class SG extends N9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?UK:F0.nil}}get(){return this._scope}name(Q){return new w9(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,$=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,J=this._values[G];if(J){let A=J.get($);if(A)return A}else J=this._values[G]=new Map;J.set($,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 F0._`${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=F0.nil;for(let $ in Q){let J=Q[$];if(!J)continue;let z=Y[$]=Y[$]||new Map;J.forEach((H)=>{if(z.has(H))return;z.set(H,j4.Started);let A=X(H);if(A){let K=this.opts.es5?RG.varKinds.var:RG.varKinds.const;G=F0._`${G}${K} ${H} = ${A};${this.opts._n}`}else if(A=W===null||W===void 0?void 0:W(H))G=F0._`${G}${A}${this.opts._n}`;else throw new TG(H);z.set(H,j4.Completed)})}return G}}RG.ValueScope=SG});var v=N((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.or=q0.and=q0.not=q0.CodeGen=q0.operators=q0.varKinds=q0.ValueScopeName=q0.ValueScope=q0.Scope=q0.Name=q0.regexpCode=q0.stringify=q0.getProperty=q0.nil=q0.strConcat=q0.str=q0._=void 0;var g=F6(),S0=b9(),W1=F6();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return W1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return W1.str}});Object.defineProperty(q0,"strConcat",{enumerable:!0,get:function(){return W1.strConcat}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return W1.nil}});Object.defineProperty(q0,"getProperty",{enumerable:!0,get:function(){return W1.getProperty}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return W1.stringify}});Object.defineProperty(q0,"regexpCode",{enumerable:!0,get:function(){return W1.regexpCode}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return W1.Name}});var R4=b9();Object.defineProperty(q0,"Scope",{enumerable:!0,get:function(){return R4.Scope}});Object.defineProperty(q0,"ValueScope",{enumerable:!0,get:function(){return R4.ValueScope}});Object.defineProperty(q0,"ValueScopeName",{enumerable:!0,get:function(){return R4.ValueScopeName}});Object.defineProperty(q0,"varKinds",{enumerable:!0,get:function(){return R4.varKinds}});q0.operators={GT:new g._Code(">"),GTE:new g._Code(">="),LT:new g._Code("<"),LTE:new g._Code("<="),EQ:new g._Code("==="),NEQ:new g._Code("!=="),NOT:new g._Code("!"),OR:new g._Code("||"),AND:new g._Code("&&"),ADD:new g._Code("+")};class G1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class kG extends G1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?S0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${Y} ${this.name}${W};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=C1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof g._CodeOrName?this.rhs.names:{}}}class I9 extends G1{constructor(Q,X,Y){super();this.lhs=Q,this.rhs=X,this.sideEffects=Y}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof g.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=C1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof g.Name?{}:{...this.lhs.names};return S4(Q,this.rhs)}}class vG extends I9{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class xG extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class _G extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class yG extends G1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class gG extends G1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,X){return this.code=C1(this.code,Q,X),this}get names(){return this.code instanceof g._CodeOrName?this.code.names:{}}}class C4 extends G1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,Y)=>X+Y.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let Y=Q[X].optimizeNodes();if(Array.isArray(Y))Q.splice(X,1,...Y);else if(Y)Q[X]=Y;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:Y}=this,W=Y.length;while(W--){let G=Y[W];if(G.optimizeNames(Q,X))continue;FK(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>D1(Q,X.names),{})}}class $1 extends C4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class uG extends C4{}class q6 extends $1{}q6.kind="else";class p0 extends $1{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 q6(Y):Y}if(X){if(Q===!1)return X instanceof p0?X:X.nodes;if(this.nodes.length)return this;return new p0(cG(Q),X instanceof p0?[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=C1(this.condition,Q,X),this}get names(){let Q=super.names;if(S4(Q,this.condition),this.else)D1(Q,this.else.names);return Q}}p0.kind="if";class R1 extends $1{}R1.kind="for";class hG extends R1{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=C1(this.iteration,Q,X),this}get names(){return D1(super.names,this.iteration.names)}}class fG extends R1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?S0.varKinds.var:this.varKind,{name:Y,from:W,to:G}=this;return`for(${X} ${Y}=${W}; ${Y}<${G}; ${Y}++)`+super.render(Q)}get names(){let Q=S4(super.names,this.from);return S4(Q,this.to)}}class j9 extends R1{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=C1(this.iterable,Q,X),this}get names(){return D1(super.names,this.iterable.names)}}class P4 extends $1{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)}}P4.kind="func";class I4 extends C4{render(Q){return"return "+super.render(Q)}}I4.kind="return";class lG extends $1{render(Q){let X="try"+super.render(Q);if(this.catch)X+=this.catch.render(Q);if(this.finally)X+=this.finally.render(Q);return X}optimizeNodes(){var Q,X;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(Q,X){var Y,W;return super.optimizeNames(Q,X),(Y=this.catch)===null||Y===void 0||Y.optimizeNames(Q,X),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)D1(Q,this.catch.names);if(this.finally)D1(Q,this.finally.names);return Q}}class E4 extends $1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}E4.kind="catch";class T4 extends $1{render(Q){return"finally"+super.render(Q)}}T4.kind="finally";class mG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
|
|
3
|
+
`:""},this._extScope=Q,this._scope=new S0.Scope({parent:Q}),this._nodes=[new uG]}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 kG(Q,G,Y)),G}const(Q,X,Y){return this._def(S0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(S0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(S0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new I9(Q,X,Y))}add(Q,X){return this._leafNode(new vG(Q,q0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==g.nil)this._leafNode(new gG(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,g.addCodeArg)(X,W)}return X.push("}"),new g._Code(X)}if(Q,X,Y){if(this._blockNode(new p0(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 p0(Q))}else(){return this._elseNode(new q6)}endIf(){return this._endBlockNode(p0,q6)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new hG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?S0.varKinds.var:S0.varKinds.let){let $=this._scope.toName(Q);return this._for(new fG(G,$,X,Y),()=>W($))}forOf(Q,X,Y,W=S0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let $=X instanceof g.Name?X:this.var("_arr",X);return this.forRange("_i",0,g._`${$}.length`,(J)=>{this.var(G,g._`${$}[${J}]`),Y(G)})}return this._for(new j9("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?S0.varKinds.var:S0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,g._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new j9("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(R1)}label(Q){return this._leafNode(new xG(Q))}break(Q){return this._leafNode(new _G(Q))}return(Q){let X=new I4;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(I4)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new lG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new E4(G),X(G)}if(Y)this._currNode=W.finally=new T4,this.code(Y);return this._endBlockNode(E4,T4)}throw(Q){return this._leafNode(new yG(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=g.nil,Y,W){if(this._blockNode(new P4(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(P4)}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 p0))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}}q0.CodeGen=mG;function D1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function S4(Q,X){return X instanceof g._CodeOrName?D1(Q,X.names):Q}function C1(Q,X,Y){if(Q instanceof g.Name)return W(Q);if(!G(Q))return Q;return new g._Code(Q._items.reduce(($,J)=>{if(J instanceof g.Name)J=W(J);if(J instanceof g._Code)$.push(...J._items);else $.push(J);return $},[]));function W($){let J=Y[$.str];if(J===void 0||X[$.str]!==1)return $;return delete X[$.str],J}function G($){return $ instanceof g._Code&&$._items.some((J)=>J instanceof g.Name&&X[J.str]===1&&Y[J.str]!==void 0)}}function FK(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function cG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:g._`!${P9(Q)}`}q0.not=cG;var qK=pG(q0.operators.AND);function OK(...Q){return Q.reduce(qK)}q0.and=OK;var MK=pG(q0.operators.OR);function VK(...Q){return Q.reduce(MK)}q0.or=VK;function pG(Q){return(X,Y)=>X===g.nil?Y:Y===g.nil?X:g._`${P9(X)} ${Q} ${P9(Y)}`}function P9(Q){return Q instanceof g.Name?Q:g._`(${Q})`}});var f=N((eG)=>{Object.defineProperty(eG,"__esModule",{value:!0});eG.checkStrictMode=eG.getErrorPath=eG.Type=eG.useFunc=eG.setEvaluated=eG.evaluatedPropsToName=eG.mergeEvaluated=eG.eachItem=eG.unescapeJsonPointer=eG.escapeJsonPointer=eG.escapeFragment=eG.unescapeFragment=eG.schemaRefOrVal=eG.schemaHasRulesButRef=eG.schemaHasRules=eG.checkUnknownRules=eG.alwaysValidSchema=eG.toHash=void 0;var c=v(),bK=F6();function jK(Q){let X={};for(let Y of Q)X[Y]=!0;return X}eG.toHash=jK;function PK(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return dG(Q,X),!oG(X,Q.self.RULES.all)}eG.alwaysValidSchema=PK;function dG(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 $ in X)if(!G[$])sG(Q,`unknown keyword: "${$}"`)}eG.checkUnknownRules=dG;function oG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}eG.schemaHasRules=oG;function IK(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}eG.schemaHasRulesButRef=IK;function EK({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)}`}eG.schemaRefOrVal=EK;function TK(Q){return tG(decodeURIComponent(Q))}eG.unescapeFragment=TK;function SK(Q){return encodeURIComponent(T9(Q))}eG.escapeFragment=SK;function T9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}eG.escapeJsonPointer=T9;function tG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}eG.unescapeJsonPointer=tG;function RK(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}eG.eachItem=RK;function nG({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,$,J,z)=>{let H=J===void 0?$:J instanceof c.Name?($ instanceof c.Name?Q(G,$,J):X(G,$,J),J):$ instanceof c.Name?(X(G,J,$),$):Y($,J);return z===c.Name&&!(H instanceof c.Name)?W(G,H):H}}eG.mergeEvaluated={props:nG({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} || {}`),S9(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:aG}),items:nG({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 aG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",c._`{}`);if(X!==void 0)S9(Q,Y,X);return Y}eG.evaluatedPropsToName=aG;function S9(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(c._`${X}${(0,c.getProperty)(W)}`,!0))}eG.setEvaluated=S9;var rG={};function CK(Q,X){return Q.scopeValue("func",{ref:X,code:rG[X.code]||(rG[X.code]=new bK._Code(X.code))})}eG.useFunc=CK;var E9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(E9||(eG.Type=E9={}));function kK(Q,X,Y){if(Q instanceof c.Name){let W=X===E9.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():"/"+T9(Q)}eG.getErrorPath=kK;function sG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}eG.checkStrictMode=sG});var i0=N((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});var A0=v(),tK={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};X$.default=tK});var O6=N(($$)=>{Object.defineProperty($$,"__esModule",{value:!0});$$.extendErrors=$$.resetErrorsCount=$$.reportExtraError=$$.reportError=$$.keyword$DataError=$$.keywordError=void 0;var u=v(),v4=f(),U0=i0();$$.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};$$.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?u.str`"${Q}" keyword must be ${X} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function sK(Q,X=$$.keywordError,Y,W){let{it:G}=Q,{gen:$,compositeRule:J,allErrors:z}=G,H=G$(Q,X,Y);if(W!==null&&W!==void 0?W:J||z)Y$($,H);else W$(G,u._`[${H}]`)}$$.reportError=sK;function eK(Q,X=$$.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:$,allErrors:J}=W,z=G$(Q,X,Y);if(Y$(G,z),!($||J))W$(W,U0.default.vErrors)}$$.reportExtraError=eK;function QU(Q,X){Q.assign(U0.default.errors,X),Q.if(u._`${U0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(u._`${U0.default.vErrors}.length`,X),()=>Q.assign(U0.default.vErrors,null)))}$$.resetErrorsCount=QU;function XU({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:G,it:$}){if(G===void 0)throw Error("ajv implementation error");let J=Q.name("err");Q.forRange("i",G,U0.default.errors,(z)=>{if(Q.const(J,u._`${U0.default.vErrors}[${z}]`),Q.if(u._`${J}.instancePath === undefined`,()=>Q.assign(u._`${J}.instancePath`,(0,u.strConcat)(U0.default.instancePath,$.errorPath))),Q.assign(u._`${J}.schemaPath`,u.str`${$.errSchemaPath}/${X}`),$.opts.verbose)Q.assign(u._`${J}.schema`,Y),Q.assign(u._`${J}.data`,W)})}$$.extendErrors=XU;function Y$(Q,X){let Y=Q.const("err",X);Q.if(u._`${U0.default.vErrors} === null`,()=>Q.assign(U0.default.vErrors,u._`[${Y}]`),u._`${U0.default.vErrors}.push(${Y})`),Q.code(u._`${U0.default.errors}++`)}function W$(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(u._`new ${Q.ValidationError}(${X})`);else Y.assign(u._`${W}.errors`,X),Y.return(!1)}var L1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function G$(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return YU(Q,X,Y)}function YU(Q,X,Y={}){let{gen:W,it:G}=Q,$=[WU(G,Y),GU(Q,Y)];return $U(Q,X,$),W.object(...$)}function WU({errorPath:Q},{instancePath:X}){let Y=X?u.str`${Q}${(0,v4.getErrorPath)(X,v4.Type.Str)}`:Q;return[U0.default.instancePath,(0,u.strConcat)(U0.default.instancePath,Y)]}function GU({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:u.str`${X}/${Q}`;if(Y)G=u.str`${G}${(0,v4.getErrorPath)(Y,v4.Type.Str)}`;return[L1.schemaPath,G]}function $U(Q,{params:X,message:Y},W){let{keyword:G,data:$,schemaValue:J,it:z}=Q,{opts:H,propertyName:A,topSchemaRef:K,schemaPath:U}=z;if(W.push([L1.keyword,G],[L1.params,typeof X=="function"?X(Q):X||u._`{}`]),H.messages)W.push([L1.message,typeof Y=="function"?Y(Q):Y]);if(H.verbose)W.push([L1.schema,J],[L1.parentSchema,u._`${K}${U}`],[U0.default.data,$]);if(A)W.push([L1.propertyName,A])}});var K$=N((H$)=>{Object.defineProperty(H$,"__esModule",{value:!0});H$.boolOrEmptySchema=H$.topBoolOrEmptySchema=void 0;var KU=O6(),UU=v(),BU=i0(),DU={message:"boolean schema is false"};function LU(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)z$(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(BU.default.data);else X.assign(UU._`${W}.errors`,null),X.return(!0)}H$.topBoolOrEmptySchema=LU;function FU(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),z$(Q);else Y.var(X,!0)}H$.boolOrEmptySchema=FU;function z$(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,KU.reportError)(G,DU,void 0,X)}});var C9=N((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.getRules=U$.isJSONType=void 0;var OU=["string","number","integer","boolean","null","object","array"],MU=new Set(OU);function VU(Q){return typeof Q=="string"&&MU.has(Q)}U$.isJSONType=VU;function ZU(){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:{}}}U$.getRules=ZU});var k9=N((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});F$.shouldUseRule=F$.shouldUseGroup=F$.schemaHasRulesForType=void 0;function wU({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&D$(Q,W)}F$.schemaHasRulesForType=wU;function D$(Q,X){return X.rules.some((Y)=>L$(Q,Y))}F$.shouldUseGroup=D$;function L$(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))}F$.shouldUseRule=L$});var M6=N((Z$)=>{Object.defineProperty(Z$,"__esModule",{value:!0});Z$.reportTypeError=Z$.checkDataTypes=Z$.checkDataType=Z$.coerceAndCheckDataType=Z$.getJSONTypes=Z$.getSchemaTypes=Z$.DataType=void 0;var PU=C9(),IU=k9(),EU=O6(),C=v(),O$=f(),k1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(k1||(Z$.DataType=k1={}));function TU(Q){let X=M$(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}Z$.getSchemaTypes=TU;function M$(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(PU.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}Z$.getJSONTypes=M$;function SU(Q,X){let{gen:Y,data:W,opts:G}=Q,$=RU(X,G.coerceTypes),J=X.length>0&&!($.length===0&&X.length===1&&(0,IU.schemaHasRulesForType)(Q,X[0]));if(J){let z=x9(X,W,G.strictNumbers,k1.Wrong);Y.if(z,()=>{if($.length)CU(Q,X,$);else _9(Q)})}return J}Z$.coerceAndCheckDataType=SU;var V$=new Set(["string","number","integer","boolean","null"]);function RU(Q,X){return X?Q.filter((Y)=>V$.has(Y)||X==="array"&&Y==="array"):[]}function CU(Q,X,Y){let{gen:W,data:G,opts:$}=Q,J=W.let("dataType",C._`typeof ${G}`),z=W.let("coerced",C._`undefined`);if($.coerceTypes==="array")W.if(C._`${J} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign(J,C._`typeof ${G}`).if(x9(X,G,$.strictNumbers),()=>W.assign(z,G)));W.if(C._`${z} !== undefined`);for(let A of Y)if(V$.has(A)||A==="array"&&$.coerceTypes==="array")H(A);W.else(),_9(Q),W.endIf(),W.if(C._`${z} !== undefined`,()=>{W.assign(G,z),kU(Q,z)});function H(A){switch(A){case"string":W.elseIf(C._`${J} == "number" || ${J} == "boolean"`).assign(z,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign(z,C._`""`);return;case"number":W.elseIf(C._`${J} == "boolean" || ${G} === null
|
|
4
|
+
|| (${J} == "string" && ${G} && ${G} == +${G})`).assign(z,C._`+${G}`);return;case"integer":W.elseIf(C._`${J} === "boolean" || ${G} === null
|
|
5
|
+
|| (${J} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(z,C._`+${G}`);return;case"boolean":W.elseIf(C._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(z,!1).elseIf(C._`${G} === "true" || ${G} === 1`).assign(z,!0);return;case"null":W.elseIf(C._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(z,null);return;case"array":W.elseIf(C._`${J} === "string" || ${J} === "number"
|
|
6
|
+
|| ${J} === "boolean" || ${G} === null`).assign(z,C._`[${G}]`)}}}function kU({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(C._`${X} !== undefined`,()=>Q.assign(C._`${X}[${Y}]`,W))}function v9(Q,X,Y,W=k1.Correct){let G=W===k1.Correct?C.operators.EQ:C.operators.NEQ,$;switch(Q){case"null":return C._`${X} ${G} null`;case"array":$=C._`Array.isArray(${X})`;break;case"object":$=C._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":$=J(C._`!(${X} % 1) && !isNaN(${X})`);break;case"number":$=J();break;default:return C._`typeof ${X} ${G} ${Q}`}return W===k1.Correct?$:(0,C.not)($);function J(z=C.nil){return(0,C.and)(C._`typeof ${X} == "number"`,z,Y?C._`isFinite(${X})`:C.nil)}}Z$.checkDataType=v9;function x9(Q,X,Y,W){if(Q.length===1)return v9(Q[0],X,Y,W);let G,$=(0,O$.toHash)(Q);if($.array&&$.object){let J=C._`typeof ${X} != "object"`;G=$.null?J:C._`!${X} || ${J}`,delete $.null,delete $.array,delete $.object}else G=C.nil;if($.number)delete $.integer;for(let J in $)G=(0,C.and)(G,v9(J,X,Y,W));return G}Z$.checkDataTypes=x9;var vU={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${X}}`};function _9(Q){let X=xU(Q);(0,EU.reportError)(X,vU)}Z$.reportTypeError=_9;function xU(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,O$.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var P$=N((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});b$.assignDefaults=void 0;var v1=v(),lU=f();function mU(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)w$(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,$)=>w$(Q,$,G.default))}b$.assignDefaults=mU;function w$(Q,X,Y){let{gen:W,compositeRule:G,data:$,opts:J}=Q;if(Y===void 0)return;let z=v1._`${$}${(0,v1.getProperty)(X)}`;if(G){(0,lU.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let H=v1._`${z} === undefined`;if(J.useDefaults==="empty")H=v1._`${H} || ${z} === null || ${z} === ""`;W.if(H,v1._`${z} = ${(0,v1.stringify)(Y)}`)}});var j0=N((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});T$.validateUnion=T$.validateArray=T$.usePattern=T$.callValidateCode=T$.schemaProperties=T$.allSchemaProperties=T$.noPropertyInData=T$.propertyInData=T$.isOwnProperty=T$.hasPropFunc=T$.reportMissingProp=T$.checkMissingProp=T$.checkReportMissingProp=void 0;var r=v(),y9=f(),J1=i0(),cU=f();function pU(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(u9(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:r._`${X}`},!0),Q.error()})}T$.checkReportMissingProp=pU;function iU({gen:Q,data:X,it:{opts:Y}},W,G){return(0,r.or)(...W.map(($)=>(0,r.and)(u9(Q,X,$,Y.ownProperties),r._`${G} = ${$}`)))}T$.checkMissingProp=iU;function nU(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}T$.reportMissingProp=nU;function I$(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}T$.hasPropFunc=I$;function g9(Q,X,Y){return r._`${I$(Q)}.call(${X}, ${Y})`}T$.isOwnProperty=g9;function rU(Q,X,Y,W){let G=r._`${X}${(0,r.getProperty)(Y)} !== undefined`;return W?r._`${G} && ${g9(Q,X,Y)}`:G}T$.propertyInData=rU;function u9(Q,X,Y,W){let G=r._`${X}${(0,r.getProperty)(Y)} === undefined`;return W?(0,r.or)(G,(0,r.not)(g9(Q,X,Y))):G}T$.noPropertyInData=u9;function E$(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}T$.allSchemaProperties=E$;function dU(Q,X){return E$(X).filter((Y)=>!(0,y9.alwaysValidSchema)(Q,X[Y]))}T$.schemaProperties=dU;function oU({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:$},it:J},z,H,A){let K=A?r._`${Q}, ${X}, ${W}${G}`:X,U=[[J1.default.instancePath,(0,r.strConcat)(J1.default.instancePath,$)],[J1.default.parentData,J.parentData],[J1.default.parentDataProperty,J.parentDataProperty],[J1.default.rootData,J1.default.rootData]];if(J.opts.dynamicRef)U.push([J1.default.dynamicAnchors,J1.default.dynamicAnchors]);let B=r._`${K}, ${Y.object(...U)}`;return H!==r.nil?r._`${z}.call(${H}, ${B})`:r._`${z}(${B})`}T$.callValidateCode=oU;var tU=r._`new RegExp`;function aU({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:G}=X.code,$=G(Y,W);return Q.scopeValue("pattern",{key:$.toString(),ref:$,code:r._`${G.code==="new RegExp"?tU:(0,cU.useFunc)(Q,G)}(${Y}, ${W})`})}T$.usePattern=aU;function sU(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,$=X.name("valid");if(G.allErrors){let z=X.let("valid",!0);return J(()=>X.assign(z,!1)),z}return X.var($,!0),J(()=>X.break()),$;function J(z){let H=X.const("len",r._`${Y}.length`);X.forRange("i",0,H,(A)=>{Q.subschema({keyword:W,dataProp:A,dataPropType:y9.Type.Num},$),X.if((0,r.not)($),z)})}}T$.validateArray=sU;function eU(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,y9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let J=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((H,A)=>{let K=Q.subschema({keyword:W,schemaProp:A,compositeRule:!0},z);if(X.assign(J,r._`${J} || ${z}`),!Q.mergeValidEvaluated(K,z))X.if((0,r.not)(J))})),Q.result(J,()=>Q.reset(),()=>Q.error(!0))}T$.validateUnion=eU});var x$=N((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});k$.validateKeywordUsage=k$.validSchemaType=k$.funcKeywordCode=k$.macroKeywordCode=void 0;var B0=v(),F1=i0(),BB=j0(),DB=O6();function LB(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:$,it:J}=Q,z=X.macro.call(J.self,G,$,J),H=C$(Y,W,z);if(J.opts.validateSchema!==!1)J.self.validateSchema(z,!0);let A=Y.name("valid");Q.subschema({schema:z,schemaPath:B0.nil,errSchemaPath:`${J.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},A),Q.pass(A,()=>Q.error(!0))}k$.macroKeywordCode=LB;function FB(Q,X){var Y;let{gen:W,keyword:G,schema:$,parentSchema:J,$data:z,it:H}=Q;OB(H,X);let A=!z&&X.compile?X.compile.call(H.self,$,J,H):X.validate,K=C$(W,G,A),U=W.let("valid");Q.block$data(U,B),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:U);function B(){if(X.errors===!1){if(O(),X.modifying)R$(Q);V(()=>Q.error())}else{let M=X.async?L():q();if(X.modifying)R$(Q);V(()=>qB(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(B0._`await `),(S)=>W.assign(U,!1).if(B0._`${S} instanceof ${H.ValidationError}`,()=>W.assign(M,B0._`${S}.errors`),()=>W.throw(S))),M}function q(){let M=B0._`${K}.errors`;return W.assign(M,null),O(B0.nil),M}function O(M=X.async?B0._`await `:B0.nil){let S=H.opts.passContext?F1.default.this:F1.default.self,E=!(("compile"in X)&&!z||X.schema===!1);W.assign(U,B0._`${M}${(0,BB.callValidateCode)(Q,K,S,E)}`,X.modifying)}function V(M){var S;W.if((0,B0.not)((S=X.valid)!==null&&S!==void 0?S:U),M)}}k$.funcKeywordCode=FB;function R$(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,B0._`${W.parentData}[${W.parentDataProperty}]`))}function qB(Q,X){let{gen:Y}=Q;Y.if(B0._`Array.isArray(${X})`,()=>{Y.assign(F1.default.vErrors,B0._`${F1.default.vErrors} === null ? ${X} : ${F1.default.vErrors}.concat(${X})`).assign(F1.default.errors,B0._`${F1.default.vErrors}.length`),(0,DB.extendErrors)(Q)},()=>Q.error())}function OB({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function C$(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,B0.stringify)(Y)})}function MB(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")}k$.validSchemaType=MB;function VB({schema:Q,opts:X,self:Y,errSchemaPath:W},G,$){if(Array.isArray(G.keyword)?!G.keyword.includes($):G.keyword!==$)throw Error("ajv implementation error");let J=G.dependencies;if(J===null||J===void 0?void 0:J.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[$])){let H=`keyword "${$}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(H);else throw Error(H)}}}k$.validateKeywordUsage=VB});var u$=N((y$)=>{Object.defineProperty(y$,"__esModule",{value:!0});y$.extendSubschemaMode=y$.extendSubschemaData=y$.getSubschema=void 0;var _0=v(),_$=f();function bB(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:G,errSchemaPath:$,topSchemaRef:J}){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:_0._`${Q.schemaPath}${(0,_0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:_0._`${Q.schemaPath}${(0,_0.getProperty)(X)}${(0,_0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,_$.escapeFragment)(Y)}`}}if(W!==void 0){if(G===void 0||$===void 0||J===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:J,errSchemaPath:$}}throw Error('either "keyword" or "schema" must be passed')}y$.getSubschema=bB;function jB(Q,X,{dataProp:Y,dataPropType:W,data:G,dataTypes:$,propertyName:J}){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:A,dataPathArr:K,opts:U}=X,B=z.let("data",_0._`${X.data}${(0,_0.getProperty)(Y)}`,!0);H(B),Q.errorPath=_0.str`${A}${(0,_$.getErrorPath)(Y,W,U.jsPropertySyntax)}`,Q.parentDataProperty=_0._`${Y}`,Q.dataPathArr=[...K,Q.parentDataProperty]}if(G!==void 0){let A=G instanceof _0.Name?G:z.let("data",G,!0);if(H(A),J!==void 0)Q.propertyName=J}if($)Q.dataTypes=$;function H(A){Q.data=A,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,A]}}y$.extendSubschemaData=jB;function PB(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:G,allErrors:$}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if($!==void 0)Q.allErrors=$;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}y$.extendSubschemaMode=PB});var h9=N((xj,h$)=>{h$.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,$;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($=Object.keys(X),W=$.length,W!==Object.keys(Y).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,$[G]))return!1;for(G=W;G--!==0;){var J=$[G];if(!Q(X[J],Y[J]))return!1}return!0}return X!==X&&Y!==Y}});var l$=N((_j,f$)=>{var z1=f$.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(){};x4(X,W,G,Q,"",Q)};z1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};z1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};z1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};z1.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 x4(Q,X,Y,W,G,$,J,z,H,A){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,$,J,z,H,A);for(var K in W){var U=W[K];if(Array.isArray(U)){if(K in z1.arrayKeywords)for(var B=0;B<U.length;B++)x4(Q,X,Y,U[B],G+"/"+K+"/"+B,$,G,K,W,B)}else if(K in z1.propsKeywords){if(U&&typeof U=="object")for(var L in U)x4(Q,X,Y,U[L],G+"/"+K+"/"+TB(L),$,G,K,W,L)}else if(K in z1.keywords||Q.allKeys&&!(K in z1.skipKeywords))x4(Q,X,Y,U,G+"/"+K,$,G,K,W)}Y(W,G,$,J,z,H,A)}}function TB(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var V6=N((i$)=>{Object.defineProperty(i$,"__esModule",{value:!0});i$.getSchemaRefs=i$.resolveUrl=i$.normalizeId=i$._getFullPath=i$.getFullPath=i$.inlineRef=void 0;var SB=f(),RB=h9(),CB=l$(),kB=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vB(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!f9(Q);if(!X)return!1;return m$(Q)<=X}i$.inlineRef=vB;var xB=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function f9(Q){for(let X in Q){if(xB.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(f9))return!0;if(typeof Y=="object"&&f9(Y))return!0}return!1}function m$(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,kB.has(Y))continue;if(typeof Q[Y]=="object")(0,SB.eachItem)(Q[Y],(W)=>X+=m$(W));if(X===1/0)return 1/0}return X}function c$(Q,X="",Y){if(Y!==!1)X=x1(X);let W=Q.parse(X);return p$(Q,W)}i$.getFullPath=c$;function p$(Q,X){return Q.serialize(X).split("#")[0]+"#"}i$._getFullPath=p$;var _B=/#\/?$/;function x1(Q){return Q?Q.replace(_B,""):""}i$.normalizeId=x1;function yB(Q,X,Y){return Y=x1(Y),Q.resolve(X,Y)}i$.resolveUrl=yB;var gB=/^[a-z_][-a-z0-9._]*$/i;function uB(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=x1(Q[Y]||X),$={"":G},J=c$(W,G,!1),z={},H=new Set;return CB(Q,{allKeys:!0},(U,B,L,q)=>{if(q===void 0)return;let O=J+B,V=$[q];if(typeof U[Y]=="string")V=M.call(this,U[Y]);S.call(this,U.$anchor),S.call(this,U.$dynamicAnchor),$[B]=V;function M(E){let x=this.opts.uriResolver.resolve;if(E=x1(V?x(V,E):E),H.has(E))throw K(E);H.add(E);let T=this.refs[E];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")A(U,T.schema,E);else if(E!==x1(O))if(E[0]==="#")A(U,z[E],E),z[E]=U;else this.refs[E]=O;return E}function S(E){if(typeof E=="string"){if(!gB.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),z;function A(U,B,L){if(B!==void 0&&!RB(U,B))throw K(L)}function K(U){return Error(`reference "${U}" resolves to more than one schema`)}}i$.getSchemaRefs=uB});var w6=N((zJ)=>{Object.defineProperty(zJ,"__esModule",{value:!0});zJ.getData=zJ.KeywordCxt=zJ.validateFunctionCode=void 0;var a$=K$(),r$=M6(),m9=k9(),_4=M6(),pB=P$(),N6=x$(),l9=u$(),j=v(),R=i0(),iB=V6(),n0=f(),Z6=O6();function nB(Q){if(QJ(Q)){if(XJ(Q),e$(Q)){oB(Q);return}}s$(Q,()=>(0,a$.topBoolOrEmptySchema)(Q))}zJ.validateFunctionCode=nB;function s$({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},$){if(G.code.es5)Q.func(X,j._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(j._`"use strict"; ${d$(Y,G)}`),dB(Q,G),Q.code($)});else Q.func(X,j._`${R.default.data}, ${rB(G)}`,W.$async,()=>Q.code(d$(Y,G)).code($))}function rB(Q){return j._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?j._`, ${R.default.dynamicAnchors}={}`:j.nil}}={}`}function dB(Q,X){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,j._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,j._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,j._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,j._`${R.default.valCxt}.${R.default.rootData}`),X.dynamicRef)Q.var(R.default.dynamicAnchors,j._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,j._`""`),Q.var(R.default.parentData,j._`undefined`),Q.var(R.default.parentDataProperty,j._`undefined`),Q.var(R.default.rootData,R.default.data),X.dynamicRef)Q.var(R.default.dynamicAnchors,j._`{}`)})}function oB(Q){let{schema:X,opts:Y,gen:W}=Q;s$(Q,()=>{if(Y.$comment&&X.$comment)WJ(Q);if(QD(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),Y.unevaluated)tB(Q);YJ(Q),WD(Q)});return}function tB(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",j._`${Y}.evaluated`),X.if(j._`${Q.evaluated}.dynamicProps`,()=>X.assign(j._`${Q.evaluated}.props`,j._`undefined`)),X.if(j._`${Q.evaluated}.dynamicItems`,()=>X.assign(j._`${Q.evaluated}.items`,j._`undefined`))}function d$(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?j._`/*# sourceURL=${Y} */`:j.nil}function aB(Q,X){if(QJ(Q)){if(XJ(Q),e$(Q)){sB(Q,X);return}}(0,a$.boolOrEmptySchema)(Q,X)}function e$({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 QJ(Q){return typeof Q.schema!="boolean"}function sB(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)WJ(Q);XD(Q),YD(Q);let $=W.const("_errs",R.default.errors);YJ(Q,$),W.var(X,j._`${$} === ${R.default.errors}`)}function XJ(Q){(0,n0.checkUnknownRules)(Q),eB(Q)}function YJ(Q,X){if(Q.opts.jtd)return o$(Q,[],!1,X);let Y=(0,r$.getSchemaTypes)(Q.schema),W=(0,r$.coerceAndCheckDataType)(Q,Y);o$(Q,Y,!W,X)}function eB(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,n0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function QD(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,n0.checkStrictMode)(Q,"default is ignored in the schema root")}function XD(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,iB.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function YD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function WJ({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let $=Y.$comment;if(G.$comment===!0)Q.code(j._`${R.default.self}.logger.log(${$})`);else if(typeof G.$comment=="function"){let J=j.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(j._`${R.default.self}.opts.$comment(${$}, ${J}, ${z}.schema)`)}}function WD(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:$}=Q;if(Y.$async)X.if(j._`${R.default.errors} === 0`,()=>X.return(R.default.data),()=>X.throw(j._`new ${G}(${R.default.vErrors})`));else{if(X.assign(j._`${W}.errors`,R.default.vErrors),$.unevaluated)GD(Q);X.return(j._`${R.default.errors} === 0`)}}function GD({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof j.Name)Q.assign(j._`${X}.props`,Y);if(W instanceof j.Name)Q.assign(j._`${X}.items`,W)}function o$(Q,X,Y,W){let{gen:G,schema:$,data:J,allErrors:z,opts:H,self:A}=Q,{RULES:K}=A;if($.$ref&&(H.ignoreKeywordsWithRef||!(0,n0.schemaHasRulesButRef)($,K))){G.block(()=>$J(Q,"$ref",K.all.$ref.definition));return}if(!H.jtd)$D(Q,X);G.block(()=>{for(let B of K.rules)U(B);U(K.post)});function U(B){if(!(0,m9.shouldUseGroup)($,B))return;if(B.type){if(G.if((0,_4.checkDataType)(B.type,J,H.strictNumbers)),t$(Q,B),X.length===1&&X[0]===B.type&&Y)G.else(),(0,_4.reportTypeError)(Q);G.endIf()}else t$(Q,B);if(!z)G.if(j._`${R.default.errors} === ${W||0}`)}}function t$(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,pB.assignDefaults)(Q,X.type);Y.block(()=>{for(let $ of X.rules)if((0,m9.shouldUseRule)(W,$))$J(Q,$.keyword,$.definition,X.type)})}function $D(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(JD(Q,X),!Q.opts.allowUnionTypes)zD(Q,X);HD(Q,Q.dataTypes)}function JD(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!GJ(Q.dataTypes,Y))c9(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),KD(Q,X)}function zD(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))c9(Q,"use allowUnionTypes to allow union type keyword")}function HD(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,m9.shouldUseRule)(Q.schema,G)){let{type:$}=G.definition;if($.length&&!$.some((J)=>AD(X,J)))c9(Q,`missing type "${$.join(",")}" for keyword "${W}"`)}}}function AD(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function GJ(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function KD(Q,X){let Y=[];for(let W of Q.dataTypes)if(GJ(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function c9(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,n0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class p9{constructor(Q,X,Y){if((0,N6.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,n0.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",JJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,N6.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",R.default.errors)}result(Q,X,Y){this.failResult((0,j.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,j.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(j._`${X} !== undefined && (${(0,j.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?Z6.reportExtraError:Z6.reportError)(this,this.def.error,X)}$dataError(){(0,Z6.reportError)(this,this.def.$dataError||Z6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Z6.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=j.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=j.nil,X=j.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:$}=this;if(Y.if((0,j.or)(j._`${W} === undefined`,X)),Q!==j.nil)Y.assign(Q,!0);if(G.length||$.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==j.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,j.or)($(),J());function $(){if(Y.length){if(!(X instanceof j.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return j._`${(0,_4.checkDataTypes)(z,X,G.opts.strictNumbers,_4.DataType.Wrong)}`}return j.nil}function J(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return j._`!${z}(${X})`}return j.nil}}subschema(Q,X){let Y=(0,l9.getSubschema)(this.it,Q);(0,l9.extendSubschemaData)(Y,this.it,Q),(0,l9.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return aB(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=n0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=n0.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,j.Name)),!0}}zJ.KeywordCxt=p9;function $J(Q,X,Y,W){let G=new p9(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,N6.funcKeywordCode)(G,Y);else if("macro"in Y)(0,N6.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,N6.funcKeywordCode)(G,Y)}var UD=/^\/(?:[^~]|~0|~1)*$/,BD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function JJ(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,$;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!UD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,$=R.default.rootData}else{let A=BD.exec(Q);if(!A)throw Error(`Invalid JSON-pointer: ${Q}`);let K=+A[1];if(G=A[2],G==="#"){if(K>=X)throw Error(H("property/index",K));return W[X-K]}if(K>X)throw Error(H("data",K));if($=Y[X-K],!G)return $}let J=$,z=G.split("/");for(let A of z)if(A)$=j._`${$}${(0,j.getProperty)((0,n0.unescapeJsonPointer)(A))}`,J=j._`${J} && ${$}`;return J;function H(A,K){return`Cannot access ${A} ${K} levels up, current level is ${X}`}}zJ.getData=JJ});var y4=N((KJ)=>{Object.defineProperty(KJ,"__esModule",{value:!0});class AJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}KJ.default=AJ});var b6=N((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});var i9=V6();class UJ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,i9.resolveUrl)(Q,X,Y),this.missingSchema=(0,i9.normalizeId)((0,i9.getFullPath)(Q,this.missingRef))}}BJ.default=UJ});var u4=N((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});FJ.resolveSchema=FJ.getCompilingSchema=FJ.resolveRef=FJ.compileSchema=FJ.SchemaEnv=void 0;var R0=v(),OD=y4(),q1=i0(),C0=V6(),DJ=f(),MD=w6();class j6{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,C0.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={}}}FJ.SchemaEnv=j6;function r9(Q){let X=LJ.call(this,Q);if(X)return X;let Y=(0,C0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:$}=this.opts,J=new R0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:$}),z;if(Q.$async)z=J.scopeValue("Error",{ref:OD.default,code:R0._`require("ajv/dist/runtime/validation_error").default`});let H=J.scopeName("validate");Q.validateName=H;let A={gen:J,allErrors:this.opts.allErrors,data:q1.default.data,parentData:q1.default.parentData,parentDataProperty:q1.default.parentDataProperty,dataNames:[q1.default.data],dataPathArr:[R0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:J.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,R0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:R0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:R0._`""`,opts:this.opts,self:this},K;try{this._compilations.add(Q),(0,MD.validateFunctionCode)(A),J.optimize(this.opts.code.optimize);let U=J.toString();if(K=`${J.scopeRefs(q1.default.scope)}return ${U}`,this.opts.code.process)K=this.opts.code.process(K,Q);let L=Function(`${q1.default.self}`,`${q1.default.scope}`,K)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:U,scopeValues:J._values};if(this.opts.unevaluated){let{props:q,items:O}=A;if(L.evaluated={props:q instanceof R0.Name?void 0:q,items:O instanceof R0.Name?void 0:O,dynamicProps:q instanceof R0.Name,dynamicItems:O instanceof R0.Name},L.source)L.source.evaluated=(0,R0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(U){if(delete Q.validate,delete Q.validateName,K)this.logger.error("Error compiling schema, function code:",K);throw U}finally{this._compilations.delete(Q)}}FJ.compileSchema=r9;function VD(Q,X,Y){var W;Y=(0,C0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let $=wD.call(this,Q,Y);if($===void 0){let J=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:z}=this.opts;if(J)$=new j6({schema:J,schemaId:z,root:Q,baseId:X})}if($===void 0)return;return Q.refs[Y]=ZD.call(this,$)}FJ.resolveRef=VD;function ZD(Q){if((0,C0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:r9.call(this,Q)}function LJ(Q){for(let X of this._compilations)if(ND(X,Q))return X}FJ.getCompilingSchema=LJ;function ND(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function wD(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||g4.call(this,Q,X)}function g4(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,C0._getFullPath)(this.opts.uriResolver,Y),G=(0,C0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return n9.call(this,Y,Q);let $=(0,C0.normalizeId)(W),J=this.refs[$]||this.schemas[$];if(typeof J=="string"){let z=g4.call(this,Q,J);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return n9.call(this,Y,z)}if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;if(!J.validate)r9.call(this,J);if($===(0,C0.normalizeId)(X)){let{schema:z}=J,{schemaId:H}=this.opts,A=z[H];if(A)G=(0,C0.resolveUrl)(this.opts.uriResolver,G,A);return new j6({schema:z,schemaId:H,root:Q,baseId:G})}return n9.call(this,Y,J)}FJ.resolveSchema=g4;var bD=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function n9(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,DJ.unescapeFragment)(z)];if(H===void 0)return;Y=H;let A=typeof Y==="object"&&Y[this.opts.schemaId];if(!bD.has(z)&&A)X=(0,C0.resolveUrl)(this.opts.uriResolver,X,A)}let $;if(typeof Y!="boolean"&&Y.$ref&&!(0,DJ.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,C0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);$=g4.call(this,W,z)}let{schemaId:J}=this.opts;if($=$||new j6({schema:Y,schemaId:J,root:W,baseId:X}),$.schema!==$.root.schema)return $;return}});var OJ=N((lj,TD)=>{TD.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 o9=N((mj,NJ)=>{var SD=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),VJ=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 d9(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 RD=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function MJ(Q){return Q.length=0,!0}function CD(Q,X,Y){if(Q.length){let W=d9(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function kD(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],$=!1,J=!1,z=CD;for(let H=0;H<Q.length;H++){let A=Q[H];if(A==="["||A==="]")continue;if(A===":"){if($===!0)J=!0;if(!z(G,W,Y))break;if(++X>7){Y.error=!0;break}if(H>0&&Q[H-1]===":")$=!0;W.push(":");continue}else if(A==="%"){if(!z(G,W,Y))break;z=MJ}else{G.push(A);continue}}if(G.length)if(z===MJ)Y.zone=G.join("");else if(J)W.push(G.join(""));else W.push(d9(G));return Y.address=W.join(""),Y}function ZJ(Q){if(vD(Q,":")<2)return{host:Q,isIPV6:!1};let X=kD(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 vD(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function xD(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 _D(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 yD(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(!VJ(Y)){let W=ZJ(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}NJ.exports={nonSimpleDomain:RD,recomposeAuthority:yD,normalizeComponentEncoding:_D,removeDotSegments:xD,isIPv4:VJ,isUUID:SD,normalizeIPv6:ZJ,stringArrayToHexStripped:d9}});var IJ=N((cj,PJ)=>{var{isUUID:gD}=o9(),uD=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hD=["http","https","ws","wss","urn","urn:uuid"];function fD(Q){return hD.indexOf(Q)!==-1}function t9(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 wJ(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function bJ(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 lD(Q){return Q.secure=t9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function mD(Q){if(Q.port===(t9(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 cD(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(uD);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}`,$=a9(G);if(Q.path=void 0,$)Q=$.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function pD(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}`,$=a9(G);if($)Q=$.serialize(Q,X);let J=Q,z=Q.nss;return J.path=`${W||X.nid}:${z}`,X.skipEscape=!0,J}function iD(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!gD(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function nD(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var jJ={scheme:"http",domainHost:!0,parse:wJ,serialize:bJ},rD={scheme:"https",domainHost:jJ.domainHost,parse:wJ,serialize:bJ},h4={scheme:"ws",domainHost:!0,parse:lD,serialize:mD},dD={scheme:"wss",domainHost:h4.domainHost,parse:h4.parse,serialize:h4.serialize},oD={scheme:"urn",parse:cD,serialize:pD,skipNormalize:!0},tD={scheme:"urn:uuid",parse:iD,serialize:nD,skipNormalize:!0},f4={http:jJ,https:rD,ws:h4,wss:dD,urn:oD,"urn:uuid":tD};Object.setPrototypeOf(f4,null);function a9(Q){return Q&&(f4[Q]||f4[Q.toLowerCase()])||void 0}PJ.exports={wsIsSecure:t9,SCHEMES:f4,isValidSchemeName:fD,getSchemeHandler:a9}});var SJ=N((pj,m4)=>{var{normalizeIPv6:aD,removeDotSegments:P6,recomposeAuthority:sD,normalizeComponentEncoding:l4,isIPv4:eD,nonSimpleDomain:QL}=o9(),{SCHEMES:XL,getSchemeHandler:EJ}=IJ();function YL(Q,X){if(typeof Q==="string")Q=y0(r0(Q,X),X);else if(typeof Q==="object")Q=r0(y0(Q,X),X);return Q}function WL(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=TJ(r0(Q,W),r0(X,W),W,!0);return W.skipEscape=!0,y0(G,W)}function TJ(Q,X,Y,W){let G={};if(!W)Q=r0(y0(Q,Y),Y),X=r0(y0(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=P6(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=P6(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=P6(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=P6(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 GL(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=y0(l4(r0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=y0(l4(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=y0(l4(r0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=y0(l4(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function y0(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=[],$=EJ(W.scheme||Y.scheme);if($&&$.serialize)$.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 J=sD(Y);if(J!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(J),Y.path&&Y.path[0]!=="/")G.push("/")}if(Y.path!==void 0){let z=Y.path;if(!W.absolutePath&&(!$||!$.absolutePath))z=P6(z);if(J===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 $L=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function r0(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 $=Q.match($L);if($){if(W.scheme=$[1],W.userinfo=$[3],W.host=$[4],W.port=parseInt($[5],10),W.path=$[6]||"",W.query=$[7],W.fragment=$[8],isNaN(W.port))W.port=$[5];if(W.host)if(eD(W.host)===!1){let H=aD(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 J=EJ(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!J||!J.unicodeSupport)){if(W.host&&(Y.domainHost||J&&J.domainHost)&&G===!1&&QL(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(!J||J&&!J.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(J&&J.parse)J.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return W}var s9={SCHEMES:XL,normalize:YL,resolve:WL,resolveComponent:TJ,equal:GL,serialize:y0,parse:r0};m4.exports=s9;m4.exports.default=s9;m4.exports.fastUri=s9});var kJ=N((CJ)=>{Object.defineProperty(CJ,"__esModule",{value:!0});var RJ=SJ();RJ.code='require("ajv/dist/runtime/uri").default';CJ.default=RJ});var fJ=N((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.CodeGen=d0.Name=d0.nil=d0.stringify=d0.str=d0._=d0.KeywordCxt=void 0;var zL=w6();Object.defineProperty(d0,"KeywordCxt",{enumerable:!0,get:function(){return zL.KeywordCxt}});var _1=v();Object.defineProperty(d0,"_",{enumerable:!0,get:function(){return _1._}});Object.defineProperty(d0,"str",{enumerable:!0,get:function(){return _1.str}});Object.defineProperty(d0,"stringify",{enumerable:!0,get:function(){return _1.stringify}});Object.defineProperty(d0,"nil",{enumerable:!0,get:function(){return _1.nil}});Object.defineProperty(d0,"Name",{enumerable:!0,get:function(){return _1.Name}});Object.defineProperty(d0,"CodeGen",{enumerable:!0,get:function(){return _1.CodeGen}});var HL=y4(),gJ=b6(),AL=C9(),I6=u4(),KL=v(),E6=V6(),c4=M6(),QX=f(),vJ=OJ(),UL=kJ(),uJ=(Q,X)=>new RegExp(Q,X);uJ.code="new RegExp";var BL=["removeAdditional","useDefaults","coerceTypes"],DL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),LL={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."},FL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},xJ=200;function qL(Q){var X,Y,W,G,$,J,z,H,A,K,U,B,L,q,O,V,M,S,E,x,T,x0,h0,HQ,AQ;let m1=Q.strict,KQ=(X=Q.code)===null||X===void 0?void 0:X.optimize,CX=KQ===!0||KQ===void 0?1:KQ||0,kX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:uJ,Z5=(G=Q.uriResolver)!==null&&G!==void 0?G:UL.default;return{strictSchema:(J=($=Q.strictSchema)!==null&&$!==void 0?$:m1)!==null&&J!==void 0?J:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:m1)!==null&&H!==void 0?H:!0,strictTypes:(K=(A=Q.strictTypes)!==null&&A!==void 0?A:m1)!==null&&K!==void 0?K:"log",strictTuples:(B=(U=Q.strictTuples)!==null&&U!==void 0?U:m1)!==null&&B!==void 0?B:"log",strictRequired:(q=(L=Q.strictRequired)!==null&&L!==void 0?L:m1)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:CX,regExp:kX}:{optimize:CX,regExp:kX},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:xJ,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:xJ,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(S=Q.messages)!==null&&S!==void 0?S:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(T=Q.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(x0=Q.validateSchema)!==null&&x0!==void 0?x0:!0,validateFormats:(h0=Q.validateFormats)!==null&&h0!==void 0?h0:!0,unicodeRegExp:(HQ=Q.unicodeRegExp)!==null&&HQ!==void 0?HQ:!0,int32range:(AQ=Q.int32range)!==null&&AQ!==void 0?AQ:!0,uriResolver:Z5}}class p4{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...qL(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new KL.ValueScope({scope:{},prefixes:DL,es5:X,lines:Y}),this.logger=wL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,AL.getRules)(),_J.call(this,LL,Q,"NOT SUPPORTED"),_J.call(this,FL,Q,"DEPRECATED","warn"),this._metaOpts=ZL.call(this),Q.formats)ML.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)VL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);OL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=vJ;if(Y==="id")W={...vJ},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(A,K){await G.call(this,A.$schema);let U=this._addSchema(A,K);return U.validate||$.call(this,U)}async function G(A){if(A&&!this.getSchema(A))await W.call(this,{$ref:A},!0)}async function $(A){try{return this._compileSchemaEnv(A)}catch(K){if(!(K instanceof gJ.default))throw K;return J.call(this,K),await z.call(this,K.missingSchema),$.call(this,A)}}function J({missingSchema:A,missingRef:K}){if(this.refs[A])throw Error(`AnySchema ${A} is loaded but ${K} cannot be resolved`)}async function z(A){let K=await H.call(this,A);if(!this.refs[A])await G.call(this,K.$schema);if(!this.refs[A])this.addSchema(K,A,X)}async function H(A){let K=this._loading[A];if(K)return K;try{return await(this._loading[A]=Y(A))}finally{delete this._loading[A]}}}addSchema(Q,X,Y,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let $ of Q)this.addSchema($,void 0,Y,W);return this}let G;if(typeof Q==="object"){let{schemaId:$}=this.opts;if(G=Q[$],G!==void 0&&typeof G!="string")throw Error(`schema ${$} must be string`)}return X=(0,E6.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=yJ.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new I6.SchemaEnv({schema:{},schemaId:Y});if(X=I6.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=yJ.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,E6.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(jL.call(this,Y,X),!X)return(0,QX.eachItem)(Y,(G)=>e9.call(this,G)),this;IL.call(this,X);let W={...X,type:(0,c4.getJSONTypes)(X.type),schemaType:(0,c4.getJSONTypes)(X.schemaType)};return(0,QX.eachItem)(Y,W.type.length===0?(G)=>e9.call(this,G,W):(G)=>W.type.forEach(($)=>e9.call(this,G,W,$))),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),$=Q;for(let J of G)$=$[J];for(let J in Y){let z=Y[J];if(typeof z!="object")continue;let{$data:H}=z.definition,A=$[J];if(H&&A)$[J]=hJ(A)}}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 $,{schemaId:J}=this.opts;if(typeof Q=="object")$=Q[J];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,E6.normalizeId)($||Y);let H=E6.getSchemaRefs.call(this,Q,Y);if(z=new I6.SchemaEnv({schema:Q,schemaId:J,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 I6.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{I6.compileSchema.call(this,Q)}finally{this.opts=X}}}p4.ValidationError=HL.default;p4.MissingRefError=gJ.default;d0.default=p4;function _J(Q,X,Y,W="error"){for(let G in Q){let $=G;if($ in X)this.logger[W](`${Y}: option ${G}. ${Q[$]}`)}}function yJ(Q){return Q=(0,E6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function OL(){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 ML(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function VL(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 ZL(){let Q={...this.opts};for(let X of BL)delete Q[X];return Q}var NL={log(){},warn(){},error(){}};function wL(Q){if(Q===!1)return NL;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 bL=/^[a-z_$][a-z0-9_$:-]*$/i;function jL(Q,X){let{RULES:Y}=this;if((0,QX.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!bL.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 e9(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:$}=this,J=G?$.post:$.rules.find(({type:H})=>H===Y);if(!J)J={type:Y,rules:[]},$.rules.push(J);if($.keywords[Q]=!0,!X)return;let z={keyword:Q,definition:{...X,type:(0,c4.getJSONTypes)(X.type),schemaType:(0,c4.getJSONTypes)(X.schemaType)}};if(X.before)PL.call(this,J,z,X.before);else J.rules.push(z);$.all[Q]=z,(W=X.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function PL(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 IL(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=hJ(X);Q.validateSchema=this.compile(X,!0)}var EL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function hJ(Q){return{anyOf:[Q,EL]}}});var mJ=N((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});var RL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};lJ.default=RL});var dJ=N((nJ)=>{Object.defineProperty(nJ,"__esModule",{value:!0});nJ.callRef=nJ.getValidate=void 0;var kL=b6(),cJ=j0(),O0=v(),y1=i0(),pJ=u4(),i4=f(),vL={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:$,validateName:J,opts:z,self:H}=W,{root:A}=$;if((Y==="#"||Y==="#/")&&G===A.baseId)return U();let K=pJ.resolveRef.call(H,A,G,Y);if(K===void 0)throw new kL.default(W.opts.uriResolver,G,Y);if(K instanceof pJ.SchemaEnv)return B(K);return L(K);function U(){if($===A)return n4(Q,J,$,$.$async);let q=X.scopeValue("root",{ref:A});return n4(Q,O0._`${q}.validate`,A,A.$async)}function B(q){let O=iJ(Q,q);n4(Q,O,q,q.$async)}function L(q){let O=X.scopeValue("schema",z.code.source===!0?{ref:q,code:(0,O0.stringify)(q)}:{ref:q}),V=X.name("valid"),M=Q.subschema({schema:q,dataTypes:[],schemaPath:O0.nil,topSchemaRef:O,errSchemaPath:Y},V);Q.mergeEvaluated(M),Q.ok(V)}}};function iJ(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):O0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}nJ.getValidate=iJ;function n4(Q,X,Y,W){let{gen:G,it:$}=Q,{allErrors:J,schemaEnv:z,opts:H}=$,A=H.passContext?y1.default.this:O0.nil;if(W)K();else U();function K(){if(!z.$async)throw Error("async schema referenced by sync schema");let q=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,cJ.callValidateCode)(Q,X,A)}`),L(X),!J)G.assign(q,!0)},(O)=>{if(G.if(O0._`!(${O} instanceof ${$.ValidationError})`,()=>G.throw(O)),B(O),!J)G.assign(q,!1)}),Q.ok(q)}function U(){Q.result((0,cJ.callValidateCode)(Q,X,A),()=>L(X),()=>B(X))}function B(q){let O=O0._`${q}.errors`;G.assign(y1.default.vErrors,O0._`${y1.default.vErrors} === null ? ${O} : ${y1.default.vErrors}.concat(${O})`),G.assign(y1.default.errors,O0._`${y1.default.vErrors}.length`)}function L(q){var O;if(!$.opts.unevaluated)return;let V=(O=Y===null||Y===void 0?void 0:Y.validate)===null||O===void 0?void 0:O.evaluated;if($.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)$.props=i4.mergeEvaluated.props(G,V.props,$.props)}else{let M=G.var("props",O0._`${q}.evaluated.props`);$.props=i4.mergeEvaluated.props(G,M,$.props,O0.Name)}if($.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)$.items=i4.mergeEvaluated.items(G,V.items,$.items)}else{let M=G.var("items",O0._`${q}.evaluated.items`);$.items=i4.mergeEvaluated.items(G,M,$.items,O0.Name)}}}nJ.callRef=n4;nJ.default=vL});var tJ=N((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});var yL=mJ(),gL=dJ(),uL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yL.default,gL.default];oJ.default=uL});var sJ=N((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});var r4=v(),H1=r4.operators,d4={maximum:{okStr:"<=",ok:H1.LTE,fail:H1.GT},minimum:{okStr:">=",ok:H1.GTE,fail:H1.LT},exclusiveMaximum:{okStr:"<",ok:H1.LT,fail:H1.GTE},exclusiveMinimum:{okStr:">",ok:H1.GT,fail:H1.LTE}},fL={message:({keyword:Q,schemaCode:X})=>r4.str`must be ${d4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>r4._`{comparison: ${d4[Q].okStr}, limit: ${X}}`},lL={keyword:Object.keys(d4),type:"number",schemaType:"number",$data:!0,error:fL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(r4._`${Y} ${d4[X].fail} ${W} || isNaN(${Y})`)}};aJ.default=lL});var Qz=N((eJ)=>{Object.defineProperty(eJ,"__esModule",{value:!0});var T6=v(),cL={message:({schemaCode:Q})=>T6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>T6._`{multipleOf: ${Q}}`},pL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:cL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,$=G.opts.multipleOfPrecision,J=X.let("res"),z=$?T6._`Math.abs(Math.round(${J}) - ${J}) > 1e-${$}`:T6._`${J} !== parseInt(${J})`;Q.fail$data(T6._`(${W} === 0 || (${J} = ${Y}/${W}, ${z}))`)}};eJ.default=pL});var Wz=N((Yz)=>{Object.defineProperty(Yz,"__esModule",{value:!0});function Xz(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}Yz.default=Xz;Xz.code='require("ajv/dist/runtime/ucs2length").default'});var $z=N((Gz)=>{Object.defineProperty(Gz,"__esModule",{value:!0});var O1=v(),rL=f(),dL=Wz(),oL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return O1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>O1._`{limit: ${Q}}`},tL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:oL,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,$=X==="maxLength"?O1.operators.GT:O1.operators.LT,J=G.opts.unicode===!1?O1._`${Y}.length`:O1._`${(0,rL.useFunc)(Q.gen,dL.default)}(${Y})`;Q.fail$data(O1._`${J} ${$} ${W}`)}};Gz.default=tL});var zz=N((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});var sL=j0(),o4=v(),eL={message:({schemaCode:Q})=>o4.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>o4._`{pattern: ${Q}}`},QF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:eL,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:$}=Q,J=$.opts.unicodeRegExp?"u":"",z=Y?o4._`(new RegExp(${G}, ${J}))`:(0,sL.usePattern)(Q,W);Q.fail$data(o4._`!${z}.test(${X})`)}};Jz.default=QF});var Az=N((Hz)=>{Object.defineProperty(Hz,"__esModule",{value:!0});var S6=v(),YF={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return S6.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>S6._`{limit: ${Q}}`},WF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:YF,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?S6.operators.GT:S6.operators.LT;Q.fail$data(S6._`Object.keys(${Y}).length ${G} ${W}`)}};Hz.default=WF});var Uz=N((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var R6=j0(),C6=v(),$F=f(),JF={message:({params:{missingProperty:Q}})=>C6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>C6._`{missingProperty: ${Q}}`},zF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:JF,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:$,it:J}=Q,{opts:z}=J;if(!$&&Y.length===0)return;let H=Y.length>=z.loopRequired;if(J.allErrors)A();else K();if(z.strictRequired){let L=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let O of Y)if((L===null||L===void 0?void 0:L[O])===void 0&&!q.has(O)){let V=J.schemaEnv.baseId+J.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,$F.checkStrictMode)(J,M,J.opts.strictRequired)}}function A(){if(H||$)Q.block$data(C6.nil,U);else for(let L of Y)(0,R6.checkReportMissingProp)(Q,L)}function K(){let L=X.let("missing");if(H||$){let q=X.let("valid",!0);Q.block$data(q,()=>B(L,q)),Q.ok(q)}else X.if((0,R6.checkMissingProp)(Q,Y,L)),(0,R6.reportMissingProp)(Q,L),X.else()}function U(){X.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),X.if((0,R6.noPropertyInData)(X,G,L,z.ownProperties),()=>Q.error())})}function B(L,q){Q.setParams({missingProperty:L}),X.forOf(L,W,()=>{X.assign(q,(0,R6.propertyInData)(X,G,L,z.ownProperties)),X.if((0,C6.not)(q),()=>{Q.error(),X.break()})},C6.nil)}}};Kz.default=zF});var Dz=N((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});var k6=v(),AF={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return k6.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>k6._`{limit: ${Q}}`},KF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:AF,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?k6.operators.GT:k6.operators.LT;Q.fail$data(k6._`${Y}.length ${G} ${W}`)}};Bz.default=KF});var t4=N((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var Lz=h9();Lz.code='require("ajv/dist/runtime/equal").default';Fz.default=Lz});var Oz=N((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});var XX=M6(),H0=v(),DF=f(),LF=t4(),FF={message:({params:{i:Q,j:X}})=>H0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>H0._`{i: ${Q}, j: ${X}}`},qF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:FF,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:$,schemaCode:J,it:z}=Q;if(!W&&!G)return;let H=X.let("valid"),A=$.items?(0,XX.getSchemaTypes)($.items):[];Q.block$data(H,K,H0._`${J} === false`),Q.ok(H);function K(){let q=X.let("i",H0._`${Y}.length`),O=X.let("j");Q.setParams({i:q,j:O}),X.assign(H,!0),X.if(H0._`${q} > 1`,()=>(U()?B:L)(q,O))}function U(){return A.length>0&&!A.some((q)=>q==="object"||q==="array")}function B(q,O){let V=X.name("item"),M=(0,XX.checkDataTypes)(A,V,z.opts.strictNumbers,XX.DataType.Wrong),S=X.const("indices",H0._`{}`);X.for(H0._`;${q}--;`,()=>{if(X.let(V,H0._`${Y}[${q}]`),X.if(M,H0._`continue`),A.length>1)X.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);X.if(H0._`typeof ${S}[${V}] == "number"`,()=>{X.assign(O,H0._`${S}[${V}]`),Q.error(),X.assign(H,!1).break()}).code(H0._`${S}[${V}] = ${q}`)})}function L(q,O){let V=(0,DF.useFunc)(X,LF.default),M=X.name("outer");X.label(M).for(H0._`;${q}--;`,()=>X.for(H0._`${O} = ${q}; ${O}--;`,()=>X.if(H0._`${V}(${Y}[${q}], ${Y}[${O}])`,()=>{Q.error(),X.assign(H,!1).break(M)})))}}};qz.default=qF});var Vz=N((Mz)=>{Object.defineProperty(Mz,"__esModule",{value:!0});var YX=v(),MF=f(),VF=t4(),ZF={message:"must be equal to constant",params:({schemaCode:Q})=>YX._`{allowedValue: ${Q}}`},NF={keyword:"const",$data:!0,error:ZF,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:$}=Q;if(W||$&&typeof $=="object")Q.fail$data(YX._`!${(0,MF.useFunc)(X,VF.default)}(${Y}, ${G})`);else Q.fail(YX._`${$} !== ${Y}`)}};Mz.default=NF});var Nz=N((Zz)=>{Object.defineProperty(Zz,"__esModule",{value:!0});var v6=v(),bF=f(),jF=t4(),PF={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>v6._`{allowedValues: ${Q}}`},IF={keyword:"enum",schemaType:"array",$data:!0,error:PF,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:$,it:J}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let z=G.length>=J.opts.loopEnum,H,A=()=>H!==null&&H!==void 0?H:H=(0,bF.useFunc)(X,jF.default),K;if(z||W)K=X.let("valid"),Q.block$data(K,U);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=X.const("vSchema",$);K=(0,v6.or)(...G.map((q,O)=>B(L,O)))}Q.pass(K);function U(){X.assign(K,!1),X.forOf("v",$,(L)=>X.if(v6._`${A()}(${Y}, ${L})`,()=>X.assign(K,!0).break()))}function B(L,q){let O=G[q];return typeof O==="object"&&O!==null?v6._`${A()}(${Y}, ${L}[${q}])`:v6._`${Y} === ${O}`}}};Zz.default=IF});var bz=N((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});var TF=sJ(),SF=Qz(),RF=$z(),CF=zz(),kF=Az(),vF=Uz(),xF=Dz(),_F=Oz(),yF=Vz(),gF=Nz(),uF=[TF.default,SF.default,RF.default,CF.default,kF.default,vF.default,xF.default,_F.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},yF.default,gF.default];wz.default=uF});var GX=N((Pz)=>{Object.defineProperty(Pz,"__esModule",{value:!0});Pz.validateAdditionalItems=void 0;var M1=v(),WX=f(),fF={message:({params:{len:Q}})=>M1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>M1._`{limit: ${Q}}`},lF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:fF,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,WX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}jz(Q,W)}};function jz(Q,X){let{gen:Y,schema:W,data:G,keyword:$,it:J}=Q;J.items=!0;let z=Y.const("len",M1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(M1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,WX.alwaysValidSchema)(J,W)){let A=Y.var("valid",M1._`${z} <= ${X.length}`);Y.if((0,M1.not)(A),()=>H(A)),Q.ok(A)}function H(A){Y.forRange("i",X.length,z,(K)=>{if(Q.subschema({keyword:$,dataProp:K,dataPropType:WX.Type.Num},A),!J.allErrors)Y.if((0,M1.not)(A),()=>Y.break())})}}Pz.validateAdditionalItems=jz;Pz.default=lF});var $X=N((Sz)=>{Object.defineProperty(Sz,"__esModule",{value:!0});Sz.validateTuple=void 0;var Ez=v(),a4=f(),cF=j0(),pF={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return Tz(Q,"additionalItems",X);if(Y.items=!0,(0,a4.alwaysValidSchema)(Y,X))return;Q.ok((0,cF.validateArray)(Q))}};function Tz(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:$,keyword:J,it:z}=Q;if(K(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=a4.mergeEvaluated.items(W,Y.length,z.items);let H=W.name("valid"),A=W.const("len",Ez._`${$}.length`);Y.forEach((U,B)=>{if((0,a4.alwaysValidSchema)(z,U))return;W.if(Ez._`${A} > ${B}`,()=>Q.subschema({keyword:J,schemaProp:B,dataProp:B},H)),Q.ok(H)});function K(U){let{opts:B,errSchemaPath:L}=z,q=Y.length,O=q===U.minItems&&(q===U.maxItems||U[X]===!1);if(B.strictTuples&&!O){let V=`"${J}" is ${q}-tuple, but minItems or maxItems/${X} are not specified or different at path "${L}"`;(0,a4.checkStrictMode)(z,V,B.strictTuples)}}}Sz.validateTuple=Tz;Sz.default=pF});var kz=N((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});var nF=$X(),rF={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,nF.validateTuple)(Q,"items")};Cz.default=rF});var _z=N((xz)=>{Object.defineProperty(xz,"__esModule",{value:!0});var vz=v(),oF=f(),tF=j0(),aF=GX(),sF={message:({params:{len:Q}})=>vz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>vz._`{limit: ${Q}}`},eF={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:sF,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,oF.alwaysValidSchema)(W,X))return;if(G)(0,aF.validateAdditionalItems)(Q,G);else Q.ok((0,tF.validateArray)(Q))}};xz.default=eF});var gz=N((yz)=>{Object.defineProperty(yz,"__esModule",{value:!0});var P0=v(),s4=f(),Xq={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}}`},Yq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Xq,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:$}=Q,J,z,{minContains:H,maxContains:A}=W;if($.opts.next)J=H===void 0?1:H,z=A;else J=1;let K=X.const("len",P0._`${G}.length`);if(Q.setParams({min:J,max:z}),z===void 0&&J===0){(0,s4.checkStrictMode)($,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&J>z){(0,s4.checkStrictMode)($,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,s4.alwaysValidSchema)($,Y)){let O=P0._`${K} >= ${J}`;if(z!==void 0)O=P0._`${O} && ${K} <= ${z}`;Q.pass(O);return}$.items=!0;let U=X.name("valid");if(z===void 0&&J===1)L(U,()=>X.if(U,()=>X.break()));else if(J===0){if(X.let(U,!0),z!==void 0)X.if(P0._`${G}.length > 0`,B)}else X.let(U,!1),B();Q.result(U,()=>Q.reset());function B(){let O=X.name("_valid"),V=X.let("count",0);L(O,()=>X.if(O,()=>q(V)))}function L(O,V){X.forRange("i",0,K,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:s4.Type.Num,compositeRule:!0},O),V()})}function q(O){if(X.code(P0._`${O}++`),z===void 0)X.if(P0._`${O} >= ${J}`,()=>X.assign(U,!0).break());else if(X.if(P0._`${O} > ${z}`,()=>X.assign(U,!1).break()),J===1)X.assign(U,!0);else X.if(P0._`${O} >= ${J}`,()=>X.assign(U,!0))}}};yz.default=Yq});var cz=N((fz)=>{Object.defineProperty(fz,"__esModule",{value:!0});fz.validateSchemaDeps=fz.validatePropertyDeps=fz.error=void 0;var JX=v(),Gq=f(),x6=j0();fz.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return JX.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>JX._`{property: ${Q},
|
|
7
7
|
missingProperty: ${W},
|
|
8
8
|
depsCount: ${X},
|
|
9
|
-
deps: ${Y}}`};var Gq={keyword:"dependencies",type:"object",schemaType:"object",error:fz.error,code(Q){let[X,Y]=Jq(Q);uz(Q,X),hz(Q,Y)}};function Jq({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 uz(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,_6.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(H,()=>{for(let A of z)(0,_6.checkReportMissingProp)(Q,A)});else Y.if($X._`${H} && (${(0,_6.checkMissingProp)(Q,z,J)})`),(0,_6.reportMissingProp)(Q,J),Y.else()}}fz.validatePropertyDeps=uz;function hz(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let z in X){if((0,Wq.alwaysValidSchema)(J,X[z]))continue;Y.if((0,_6.propertyInData)(Y,W,z,J.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},$);Q.mergeValidEvaluated(H,$)},()=>Y.var($,!0)),Q.ok($)}}fz.validateSchemaDeps=hz;fz.default=Gq});var rz=N((iz)=>{Object.defineProperty(iz,"__esModule",{value:!0});var pz=v(),Hq=f(),Aq={message:"property name must be valid",params:({params:Q})=>pz._`{propertyName: ${Q.propertyName}}`},Kq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Aq,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,Hq.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,pz.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};iz.default=Kq});var zX=N((nz)=>{Object.defineProperty(nz,"__esModule",{value:!0});var e4=j0(),k0=v(),Bq=i0(),QQ=f(),Dq={message:"must NOT have additional properties",params:({params:Q})=>k0._`{additionalProperty: ${Q.additionalProperty}}`},Lq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Dq,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,QQ.alwaysValidSchema)($,Y))return;let A=(0,e4.allSchemaProperties)(W.properties),K=(0,e4.allSchemaProperties)(W.patternProperties);U(),Q.ok(k0._`${J} === ${Bq.default.errors}`);function U(){X.forIn("key",G,(V)=>{if(!A.length&&!K.length)q(V);else X.if(B(V),()=>q(V))})}function B(V){let M;if(A.length>8){let T=(0,QQ.schemaRefOrVal)($,W.properties,"properties");M=(0,e4.isOwnProperty)(X,T,V)}else if(A.length)M=(0,k0.or)(...A.map((T)=>k0._`${V} === ${T}`));else M=k0.nil;if(K.length)M=(0,k0.or)(M,...K.map((T)=>k0._`${(0,e4.usePattern)(Q,T)}.test(${V})`));return(0,k0.not)(M)}function L(V){X.code(k0._`delete ${G}[${V}]`)}function q(V){if(H.removeAdditional==="all"||H.removeAdditional&&Y===!1){L(V);return}if(Y===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,QQ.alwaysValidSchema)($,Y)){let M=X.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),X.if((0,k0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!z)X.if((0,k0.not)(M),()=>X.break())}}function O(V,M,T){let I={keyword:"additionalProperties",dataProp:V,dataPropType:QQ.Type.Str};if(T===!1)Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(I,M)}}};nz.default=Lq});var az=N((tz)=>{Object.defineProperty(tz,"__esModule",{value:!0});var qq=b6(),dz=j0(),HX=f(),oz=zX(),Oq={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)oz.default.code(new qq.KeywordCxt(J,oz.default,"additionalProperties"));let $=(0,dz.allSchemaProperties)(Y);for(let U of $)J.definedProperties.add(U);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=HX.mergeEvaluated.props(X,(0,HX.toHash)($),J.props);let z=$.filter((U)=>!(0,HX.alwaysValidSchema)(J,Y[U]));if(z.length===0)return;let H=X.name("valid");for(let U of z){if(A(U))K(U);else{if(X.if((0,dz.propertyInData)(X,G,U,J.opts.ownProperties)),K(U),!J.allErrors)X.else().var(H,!0);X.endIf()}Q.it.definedProperties.add(U),Q.ok(H)}function A(U){return J.opts.useDefaults&&!J.compositeRule&&Y[U].default!==void 0}function K(U){Q.subschema({keyword:"properties",schemaProp:U,dataProp:U},H)}}};tz.default=Oq});var Y7=N((X7)=>{Object.defineProperty(X7,"__esModule",{value:!0});var sz=j0(),XQ=v(),ez=f(),Q7=f(),Vq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,z=(0,sz.allSchemaProperties)(Y),H=z.filter((O)=>(0,ez.alwaysValidSchema)(J,Y[O]));if(z.length===0||H.length===z.length&&(!J.opts.unevaluated||J.props===!0))return;let A=$.strictSchema&&!$.allowMatchingProperties&&G.properties,K=X.name("valid");if(J.props!==!0&&!(J.props instanceof XQ.Name))J.props=(0,Q7.evaluatedPropsToName)(X,J.props);let{props:U}=J;B();function B(){for(let O of z){if(A)L(O);if(J.allErrors)q(O);else X.var(K,!0),q(O),X.if(K)}}function L(O){for(let V in A)if(new RegExp(O).test(V))(0,ez.checkStrictMode)(J,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function q(O){X.forIn("key",W,(V)=>{X.if(XQ._`${(0,sz.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:Q7.Type.Str},K);if(J.opts.unevaluated&&U!==!0)X.assign(XQ._`${U}[${V}]`,!0);else if(!M&&!J.allErrors)X.if((0,XQ.not)(K),()=>X.break())})})}}};X7.default=Vq});var G7=N((W7)=>{Object.defineProperty(W7,"__esModule",{value:!0});var Nq=f(),wq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,Nq.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"}};W7.default=wq});var $7=N((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});var jq=j0(),Pq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:jq.validateUnion,error:{message:"must match a schema in anyOf"}};J7.default=Pq});var H7=N((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});var YQ=v(),Eq=f(),Tq={message:"must match exactly one schema in oneOf",params:({params:Q})=>YQ._`{passingSchemas: ${Q.passing}}`},Sq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Tq,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(A),Q.result($,()=>Q.reset(),()=>Q.error(!0));function A(){J.forEach((K,U)=>{let B;if((0,Eq.alwaysValidSchema)(G,K))X.var(H,!0);else B=Q.subschema({keyword:"oneOf",schemaProp:U,compositeRule:!0},H);if(U>0)X.if(YQ._`${H} && ${$}`).assign($,!1).assign(z,YQ._`[${z}, ${U}]`).else();X.if(H,()=>{if(X.assign($,!0),X.assign(z,U),B)Q.mergeEvaluated(B,YQ.Name)})})}}};z7.default=Sq});var K7=N((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var Cq=f(),kq={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,Cq.alwaysValidSchema)(W,J))return;let z=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(z)})}};A7.default=kq});var L7=N((D7)=>{Object.defineProperty(D7,"__esModule",{value:!0});var WQ=v(),B7=f(),xq={message:({params:Q})=>WQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>WQ._`{failingKeyword: ${Q.ifClause}}`},_q={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xq,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,B7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=U7(W,"then"),J=U7(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),z=X.name("_valid");if(H(),Q.reset(),G&&J){let K=X.let("ifClause");Q.setParams({ifClause:K}),X.if(z,A("then",K),A("else",K))}else if(G)X.if(z,A("then"));else X.if((0,WQ.not)(z),A("else"));Q.pass($,()=>Q.error(!0));function H(){let K=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(K)}function A(K,U){return()=>{let B=Q.subschema({keyword:K},z);if(X.assign($,z),Q.mergeValidEvaluated(B,$),U)X.assign(U,WQ._`${K}`);else Q.setParams({ifClause:K})}}}};function U7(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,B7.alwaysValidSchema)(Q,Y)}D7.default=_q});var q7=N((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});var gq=f(),uq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,gq.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};F7.default=uq});var M7=N((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var fq=GX(),lq=kz(),mq=JX(),cq=_z(),pq=gz(),iq=cz(),rq=rz(),nq=zX(),dq=az(),oq=Y7(),tq=G7(),aq=$7(),sq=H7(),eq=K7(),QO=L7(),XO=q7();function YO(Q=!1){let X=[tq.default,aq.default,sq.default,eq.default,QO.default,XO.default,rq.default,nq.default,iq.default,dq.default,oq.default];if(Q)X.push(lq.default,cq.default);else X.push(fq.default,mq.default);return X.push(pq.default),X}O7.default=YO});var Z7=N((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});var e=v(),GO={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},JO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:GO,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:z}=Q,{opts:H,errSchemaPath:A,schemaEnv:K,self:U}=z;if(!H.validateFormats)return;if(G)B();else L();function B(){let q=Y.scopeValue("formats",{ref:U.formats,code:H.code.formats}),O=Y.const("fDef",e._`${q}[${$}]`),V=Y.let("fType"),M=Y.let("format");Y.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>Y.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>Y.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(T(),I()));function T(){if(H.strictSchema===!1)return e.nil;return e._`${$} && !${M}`}function I(){let x=K.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,E=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${X} && !${E}`}}function L(){let q=U.formats[J];if(!q){T();return}if(q===!0)return;let[O,V,M]=I(q);if(O===X)Q.pass(x());function T(){if(H.strictSchema===!1){U.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${J}" ignored in schema at path "${A}"`}}function I(E){let x0=E instanceof RegExp?(0,e.regexpCode)(E):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)(J)}`:void 0,h0=Y.scopeValue("formats",{key:J,ref:E,code:x0});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,e._`${h0}.validate`];return["string",E,h0]}function x(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!K.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};V7.default=JO});var w7=N((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});var zO=Z7(),HO=[zO.default];N7.default=HO});var P7=N((b7)=>{Object.defineProperty(b7,"__esModule",{value:!0});b7.contentVocabulary=b7.metadataVocabulary=void 0;b7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];b7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var T7=N((E7)=>{Object.defineProperty(E7,"__esModule",{value:!0});var UO=t$(),BO=bz(),DO=M7(),LO=w7(),I7=P7(),FO=[UO.default,BO.default,(0,DO.default)(),LO.default,I7.metadataVocabulary,I7.contentVocabulary];E7.default=FO});var k7=N((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});R7.DiscrError=void 0;var S7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(S7||(R7.DiscrError=S7={}))});var _7=N((x7)=>{Object.defineProperty(x7,"__esModule",{value:!0});var y1=v(),AX=k7(),v7=u4(),OO=j6(),MO=f(),VO={message:({params:{discrError:Q,tagName:X}})=>Q===AX.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}}`},ZO={keyword:"discriminator",type:"object",schemaType:"object",error:VO,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),A=X.const("tag",y1._`${Y}${(0,y1.getProperty)(z)}`);X.if(y1._`typeof ${A} == "string"`,()=>K(),()=>Q.error(!1,{discrError:AX.DiscrError.Tag,tag:A,tagName:z})),Q.ok(H);function K(){let L=B();X.if(!1);for(let q in L)X.elseIf(y1._`${A} === ${q}`),X.assign(H,U(L[q]));X.else(),Q.error(!1,{discrError:AX.DiscrError.Mapping,tag:A,tagName:z}),X.endIf()}function U(L){let q=X.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},q);return Q.mergeEvaluated(O,y1.Name),q}function B(){var L;let q={},O=M(G),V=!0;for(let x=0;x<$.length;x++){let E=$[x];if((E===null||E===void 0?void 0:E.$ref)&&!(0,MO.schemaHasRulesButRef)(E,J.self.RULES)){let h0=E.$ref;if(E=v7.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,h0),E instanceof v7.SchemaEnv)E=E.schema;if(E===void 0)throw new OO.default(J.opts.uriResolver,J.baseId,h0)}let x0=(L=E===null||E===void 0?void 0:E.properties)===null||L===void 0?void 0:L[z];if(typeof x0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);V=V&&(O||M(E)),T(x0,x)}if(!V)throw Error(`discriminator: "${z}" must be required`);return q;function M({required:x}){return Array.isArray(x)&&x.includes(z)}function T(x,E){if(x.const)I(x.const,E);else if(x.enum)for(let x0 of x.enum)I(x0,E);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function I(x,E){if(typeof x!="string"||x in q)throw Error(`discriminator: "${z}" values must be unique strings`);q[x]=E}}}};x7.default=ZO});var y7=N((yP,wO)=>{wO.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 UX=N((O0,KX)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.MissingRefError=O0.ValidationError=O0.CodeGen=O0.Name=O0.nil=O0.stringify=O0.str=O0._=O0.KeywordCxt=O0.Ajv=void 0;var bO=f$(),jO=T7(),PO=_7(),g7=y7(),IO=["/properties"],GQ="http://json-schema.org/draft-07/schema";class y6 extends bO.default{_addVocabularies(){if(super._addVocabularies(),jO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(PO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(g7,IO):g7;this.addMetaSchema(Q,GQ,!1),this.refs["http://json-schema.org/schema"]=GQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(GQ)?GQ:void 0)}}O0.Ajv=y6;KX.exports=O0=y6;KX.exports.Ajv=y6;Object.defineProperty(O0,"__esModule",{value:!0});O0.default=y6;var EO=b6();Object.defineProperty(O0,"KeywordCxt",{enumerable:!0,get:function(){return EO.KeywordCxt}});var g1=v();Object.defineProperty(O0,"_",{enumerable:!0,get:function(){return g1._}});Object.defineProperty(O0,"str",{enumerable:!0,get:function(){return g1.str}});Object.defineProperty(O0,"stringify",{enumerable:!0,get:function(){return g1.stringify}});Object.defineProperty(O0,"nil",{enumerable:!0,get:function(){return g1.nil}});Object.defineProperty(O0,"Name",{enumerable:!0,get:function(){return g1.Name}});Object.defineProperty(O0,"CodeGen",{enumerable:!0,get:function(){return g1.CodeGen}});var TO=y4();Object.defineProperty(O0,"ValidationError",{enumerable:!0,get:function(){return TO.default}});var SO=j6();Object.defineProperty(O0,"MissingRefError",{enumerable:!0,get:function(){return SO.default}})});var n7=N((i7)=>{Object.defineProperty(i7,"__esModule",{value:!0});i7.formatNames=i7.fastFormats=i7.fullFormats=void 0;function g0(Q,X){return{validate:Q,compare:X}}i7.fullFormats={date:g0(l7,FX),time:g0(DX(!0),qX),"date-time":g0(u7(!0),c7),"iso-time":g0(DX(),m7),"iso-date-time":g0(u7(),p7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:gO,"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:pO,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:uO,int32:{type:"number",validate:lO},int64:{type:"number",validate:mO},float:{type:"number",validate:f7},double:{type:"number",validate:f7},password:!0,binary:!0};i7.fastFormats={...i7.fullFormats,date:g0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,FX),time:g0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qX),"date-time":g0(/^\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,c7),"iso-time":g0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m7),"iso-date-time":g0(/^\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,p7),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};i7.formatNames=Object.keys(i7.fullFormats);function kO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var vO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,xO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function l7(Q){let X=vO.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&&kO(Y)?29:xO[W])}function FX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var BX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function DX(Q){return function(Y){let W=BX.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],z=W[4],H=W[5]==="-"?-1:1,A=+(W[6]||0),K=+(W[7]||0);if(A>23||K>59||Q&&!z)return!1;if(G<=23&&J<=59&&$<60)return!0;let U=J-K*H,B=G-A*H-(U<0?1:0);return(B===23||B===-1)&&(U===59||U===-1)&&$<61}}function qX(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 m7(Q,X){if(!(Q&&X))return;let Y=BX.exec(Q),W=BX.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 LX=/t|\s/i;function u7(Q){let X=DX(Q);return function(W){let G=W.split(LX);return G.length===2&&l7(G[0])&&X(G[1])}}function c7(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 p7(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(LX),[G,J]=X.split(LX),$=FX(Y,G);if($===void 0)return;return $||qX(W,J)}var _O=/\/|:/,yO=/^(?:[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 gO(Q){return _O.test(Q)&&yO.test(Q)}var h7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function uO(Q){return h7.lastIndex=0,h7.test(Q)}var hO=-2147483648,fO=2147483647;function lO(Q){return Number.isInteger(Q)&&Q<=fO&&Q>=hO}function mO(Q){return Number.isInteger(Q)}function f7(){return!0}var cO=/[^\\]\\Z/;function pO(Q){if(cO.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var o7=N((d7)=>{Object.defineProperty(d7,"__esModule",{value:!0});d7.formatLimitDefinition=void 0;var rO=UX(),v0=v(),A1=v0.operators,JQ={formatMaximum:{okStr:"<=",ok:A1.LTE,fail:A1.GT},formatMinimum:{okStr:">=",ok:A1.GTE,fail:A1.LT},formatExclusiveMaximum:{okStr:"<",ok:A1.LT,fail:A1.GTE},formatExclusiveMinimum:{okStr:">",ok:A1.GT,fail:A1.LTE}},nO={message:({keyword:Q,schemaCode:X})=>v0.str`should be ${JQ[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>v0._`{comparison: ${JQ[Q].okStr}, limit: ${X}}`};d7.formatLimitDefinition={keyword:Object.keys(JQ),type:"string",schemaType:"string",$data:!0,error:nO,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:z}=J;if(!$.validateFormats)return;let H=new rO.KeywordCxt(J,z.RULES.all.format.definition,"format");if(H.$data)A();else K();function A(){let B=X.scopeValue("formats",{ref:z.formats,code:$.code.formats}),L=X.const("fmt",v0._`${B}[${H.schemaCode}]`);Q.fail$data((0,v0.or)(v0._`typeof ${L} != "object"`,v0._`${L} instanceof RegExp`,v0._`typeof ${L}.compare != "function"`,U(L)))}function K(){let B=H.schema,L=z.formats[B];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${B}" does not define "compare" function`);let q=X.scopeValue("formats",{key:B,ref:L,code:$.code.formats?v0._`${$.code.formats}${(0,v0.getProperty)(B)}`:void 0});Q.fail$data(U(q))}function U(B){return v0._`${B}.compare(${Y}, ${W}) ${JQ[G].fail} 0`}},dependencies:["format"]};var dO=(Q)=>{return Q.addKeyword(d7.formatLimitDefinition),Q};d7.default=dO});var e7=N((g6,s7)=>{Object.defineProperty(g6,"__esModule",{value:!0});var u1=n7(),tO=o7(),VX=v(),t7=new VX.Name("fullFormats"),aO=new VX.Name("fastFormats"),ZX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return a7(Q,X,u1.fullFormats,t7),Q;let[Y,W]=X.mode==="fast"?[u1.fastFormats,aO]:[u1.fullFormats,t7],G=X.formats||u1.formatNames;if(a7(Q,G,Y,W),X.keywords)(0,tO.default)(Q);return Q};ZX.get=(Q,X="full")=>{let W=(X==="fast"?u1.fastFormats:u1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function a7(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=VX._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}s7.exports=g6=ZX;Object.defineProperty(g6,"__esModule",{value:!0});g6.default=ZX});var bM=Object.freeze({status:"aborted"});function F(Q,X,Y){function W(z,H){var A;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(A=z._zod).traits??(A.traits=new Set),z._zod.traits.add(Q),X(z,H);for(let K in $.prototype)if(!(K in z))Object.defineProperty(z,K,{value:$.prototype[K].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 A=Y?.Parent?new J:this;W(A,z),(H=A._zod).deferred??(H.deferred=[]);for(let K of A._zod.deferred)K();return A}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 jM=Symbol("zod_brand");class f0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class p1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var f6={};function N0(Q){if(Q)Object.assign(f6,Q);return f6}var h={};xX(h,{unwrapMessage:()=>i1,uint8ArrayToHex:()=>e5,uint8ArrayToBase64url:()=>a5,uint8ArrayToBase64:()=>lX,stringifyPrimitive:()=>p6,shallowClone:()=>yX,safeExtend:()=>i5,required:()=>d5,randomString:()=>u5,propertyKeyTypes:()=>qQ,promiseAllObject:()=>g5,primitiveTypes:()=>gX,prefixIssues:()=>m0,pick:()=>m5,partial:()=>n5,optionalKeys:()=>OQ,omit:()=>c5,objectClone:()=>x5,numKeys:()=>h5,nullish:()=>r1,normalizeParams:()=>P,mergeDefs:()=>a0,merge:()=>r5,jsonStringifyReplacer:()=>Z1,joinValues:()=>l6,issue:()=>w1,isPlainObject:()=>s0,isObject:()=>U1,hexToUint8Array:()=>s5,getSizableOrigin:()=>hX,getParsedType:()=>f5,getLengthableOrigin:()=>d1,getEnumValues:()=>DQ,getElementAtPath:()=>y5,floatSafeRemainder:()=>LQ,finalizeIssue:()=>E0,extend:()=>p5,escapeRegex:()=>l0,esc:()=>m6,defineLazy:()=>m,createTransparentProxy:()=>l5,cloneDef:()=>_5,clone:()=>I0,cleanRegex:()=>n1,cleanEnum:()=>o5,captureStackTrace:()=>c6,cached:()=>N1,base64urlToUint8Array:()=>t5,base64ToUint8Array:()=>fX,assignProp:()=>t0,assertNotEqual:()=>R5,assertNever:()=>k5,assertIs:()=>C5,assertEqual:()=>S5,assert:()=>v5,allowsEval:()=>FQ,aborted:()=>e0,NUMBER_FORMAT_RANGES:()=>MQ,Class:()=>mX,BIGINT_FORMAT_RANGES:()=>uX});function S5(Q){return Q}function R5(Q){return Q}function C5(Q){}function k5(Q){throw Error()}function v5(Q){}function DQ(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 l6(Q,X="|"){return Q.map((Y)=>p6(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 r1(Q){return Q===null||Q===void 0}function n1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function LQ(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 _X=Symbol("evaluating");function m(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===_X)return;if(W===void 0)W=_X,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function x5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function t0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function a0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function _5(Q){return a0(Q._zod.def)}function y5(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function g5(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 u5(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function m6(Q){return JSON.stringify(Q)}var c6="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function U1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var FQ=N1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function s0(Q){if(U1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(U1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function yX(Q){if(s0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function h5(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var f5=(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}`)}},qQ=new Set(["string","number","symbol"]),gX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function l0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function P(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 l5(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 p6(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function OQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var MQ={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]},uX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function m5(Q,X){let Y=Q._zod.def,W=a0(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 t0(this,"shape",G),G},checks:[]});return I0(Q,W)}function c5(Q,X){let Y=Q._zod.def,W=a0(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 t0(this,"shape",G),G},checks:[]});return I0(Q,W)}function p5(Q,X){if(!s0(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=a0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return t0(this,"shape",J),J},checks:[]});return I0(Q,G)}function i5(Q,X){if(!s0(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 t0(this,"shape",W),W},checks:Q._zod.def.checks};return I0(Q,Y)}function r5(Q,X){let Y=a0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return t0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return I0(Q,Y)}function n5(Q,X,Y){let W=a0(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 t0(this,"shape",J),J},checks:[]});return I0(X,W)}function d5(Q,X,Y){let W=a0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in J))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=new Q({type:"nonoptional",innerType:G[$]})}else for(let $ in G)J[$]=new Q({type:"nonoptional",innerType:G[$]});return t0(this,"shape",J),J},checks:[]});return I0(X,W)}function e0(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 i1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=i1(Q.inst?._zod.def?.error?.(Q))??i1(X?.error?.(Q))??i1(Y.customError?.(Q))??i1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function hX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function d1(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 o5(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function fX(Q){let X=atob(Q),Y=new Uint8Array(X.length);for(let W=0;W<X.length;W++)Y[W]=X.charCodeAt(W);return Y}function lX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function t5(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return fX(X+Y)}function a5(Q){return lX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function s5(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 e5(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class mX{constructor(...Q){}}var cX=(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})},i6=F("$ZodError",cX),VQ=F("$ZodError",cX,{Parent:Error});function pX(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 iX(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 r6=(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 f0;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((H)=>E0(H,J,N0())));throw c6(z,G?.callee),z}return $.value};var n6=(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,N0())));throw c6(z,G?.callee),z}return $.value};var o1=(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 f0;return J.issues.length?{success:!1,error:new(Q??i6)(J.issues.map(($)=>E0($,G,N0())))}:{success:!0,data:J.value}},t1=o1(VQ),a1=(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,N0())))}:{success:!0,data:J.value}},d6=a1(VQ),rX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return r6(Q)(X,Y,G)};var nX=(Q)=>(X,Y,W)=>{return r6(Q)(X,Y,W)};var dX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return n6(Q)(X,Y,G)};var oX=(Q)=>async(X,Y,W)=>{return n6(Q)(X,Y,W)};var tX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return o1(Q)(X,Y,G)};var aX=(Q)=>(X,Y,W)=>{return o1(Q)(X,Y,W)};var sX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return a1(Q)(X,Y,G)};var eX=(Q)=>async(X,Y,W)=>{return a1(Q)(X,Y,W)};var Q8=/^[cC][^\s-]{8,}$/,X8=/^[0-9a-z]+$/,Y8=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,W8=/^[0-9a-vA-V]{20}$/,G8=/^[A-Za-z0-9]{27}$/,J8=/^[a-zA-Z0-9_-]{21}$/,$8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var z8=/^([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})$/,ZQ=(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 H8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function A8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var 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])$/,U8=/^(([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}|:))$/,B8=/^((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])$/,D8=/^(([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])$/,L8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,NQ=/^[A-Za-z0-9_-]*$/,F8=/^(?=.{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 q8=/^\+(?:[0-9]){6,14}[0-9]$/,O8="(?:(?:\\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])))",M8=new RegExp(`^${O8}$`);function V8(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 Z8(Q){return new RegExp(`^${V8(Q)}$`)}function N8(Q){let X=V8({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(`^${O8}T(?:${W})$`)}var w8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var b8=/^-?\d+$/,j8=/^-?\d+(?:\.\d+)?/,P8=/^(?:true|false)$/i,I8=/^null$/i;var E8=/^[^A-Z]*$/,T8=/^[^a-z]*$/;var W0=F("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),S8={number:"number",bigint:"bigint",object:"date"},wQ=F("$ZodCheckLessThan",(Q,X)=>{W0.init(Q,X);let Y=S8[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})}}),bQ=F("$ZodCheckGreaterThan",(Q,X)=>{W0.init(Q,X);let Y=S8[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})}}),R8=F("$ZodCheckMultipleOf",(Q,X)=>{W0.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):LQ(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})}}),C8=F("$ZodCheckNumberFormat",(Q,X)=>{W0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=MQ[X.format];Q._zod.onattach.push(($)=>{let z=$._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=J,Y)z.pattern=b8}),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 k8=F("$ZodCheckMaxLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!r1(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 $=d1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),v8=F("$ZodCheckMinLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!r1(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 $=d1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),x8=F("$ZodCheckLengthEquals",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!r1(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 $=d1(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})}}),s1=F("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(W0.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=()=>{})}),_8=F("$ZodCheckRegex",(Q,X)=>{s1.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})}}),y8=F("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=E8),s1.init(Q,X)}),g8=F("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=T8),s1.init(Q,X)}),u8=F("$ZodCheckIncludes",(Q,X)=>{W0.init(Q,X);let Y=l0(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})}}),h8=F("$ZodCheckStartsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`^${l0(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})}}),f8=F("$ZodCheckEndsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`.*${l0(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 l8=F("$ZodCheckOverwrite",(Q,X)=>{W0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class jQ{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let Y=Q.split(`
|
|
10
|
-
`).filter((
|
|
11
|
-
`))}}var c8={major:4,minor:1,patch:12};var i=F("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=c8;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let
|
|
9
|
+
deps: ${Y}}`};var $q={keyword:"dependencies",type:"object",schemaType:"object",error:fz.error,code(Q){let[X,Y]=Jq(Q);uz(Q,X),hz(Q,Y)}};function Jq({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 uz(Q,X=Q.schema){let{gen:Y,data:W,it:G}=Q;if(Object.keys(X).length===0)return;let $=Y.let("missing");for(let J in X){let z=X[J];if(z.length===0)continue;let H=(0,x6.propertyInData)(Y,W,J,G.opts.ownProperties);if(Q.setParams({property:J,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(H,()=>{for(let A of z)(0,x6.checkReportMissingProp)(Q,A)});else Y.if(JX._`${H} && (${(0,x6.checkMissingProp)(Q,z,$)})`),(0,x6.reportMissingProp)(Q,$),Y.else()}}fz.validatePropertyDeps=uz;function hz(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:$}=Q,J=Y.name("valid");for(let z in X){if((0,Gq.alwaysValidSchema)($,X[z]))continue;Y.if((0,x6.propertyInData)(Y,W,z,$.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},J);Q.mergeValidEvaluated(H,J)},()=>Y.var(J,!0)),Q.ok(J)}}fz.validateSchemaDeps=hz;fz.default=$q});var nz=N((iz)=>{Object.defineProperty(iz,"__esModule",{value:!0});var pz=v(),Aq=f(),Kq={message:"property name must be valid",params:({params:Q})=>pz._`{propertyName: ${Q.propertyName}}`},Uq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Kq,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,Aq.alwaysValidSchema)(G,Y))return;let $=X.name("valid");X.forIn("key",W,(J)=>{Q.setParams({propertyName:J}),Q.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},$),X.if((0,pz.not)($),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok($)}};iz.default=Uq});var zX=N((rz)=>{Object.defineProperty(rz,"__esModule",{value:!0});var e4=j0(),k0=v(),Dq=i0(),QQ=f(),Lq={message:"must NOT have additional properties",params:({params:Q})=>k0._`{additionalProperty: ${Q.additionalProperty}}`},Fq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lq,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:$,it:J}=Q;if(!$)throw Error("ajv implementation error");let{allErrors:z,opts:H}=J;if(J.props=!0,H.removeAdditional!=="all"&&(0,QQ.alwaysValidSchema)(J,Y))return;let A=(0,e4.allSchemaProperties)(W.properties),K=(0,e4.allSchemaProperties)(W.patternProperties);U(),Q.ok(k0._`${$} === ${Dq.default.errors}`);function U(){X.forIn("key",G,(V)=>{if(!A.length&&!K.length)q(V);else X.if(B(V),()=>q(V))})}function B(V){let M;if(A.length>8){let S=(0,QQ.schemaRefOrVal)(J,W.properties,"properties");M=(0,e4.isOwnProperty)(X,S,V)}else if(A.length)M=(0,k0.or)(...A.map((S)=>k0._`${V} === ${S}`));else M=k0.nil;if(K.length)M=(0,k0.or)(M,...K.map((S)=>k0._`${(0,e4.usePattern)(Q,S)}.test(${V})`));return(0,k0.not)(M)}function L(V){X.code(k0._`delete ${G}[${V}]`)}function q(V){if(H.removeAdditional==="all"||H.removeAdditional&&Y===!1){L(V);return}if(Y===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,QQ.alwaysValidSchema)(J,Y)){let M=X.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),X.if((0,k0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!z)X.if((0,k0.not)(M),()=>X.break())}}function O(V,M,S){let E={keyword:"additionalProperties",dataProp:V,dataPropType:QQ.Type.Str};if(S===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};rz.default=Fq});var az=N((tz)=>{Object.defineProperty(tz,"__esModule",{value:!0});var Oq=w6(),dz=j0(),HX=f(),oz=zX(),Mq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:$}=Q;if($.opts.removeAdditional==="all"&&W.additionalProperties===void 0)oz.default.code(new Oq.KeywordCxt($,oz.default,"additionalProperties"));let J=(0,dz.allSchemaProperties)(Y);for(let U of J)$.definedProperties.add(U);if($.opts.unevaluated&&J.length&&$.props!==!0)$.props=HX.mergeEvaluated.props(X,(0,HX.toHash)(J),$.props);let z=J.filter((U)=>!(0,HX.alwaysValidSchema)($,Y[U]));if(z.length===0)return;let H=X.name("valid");for(let U of z){if(A(U))K(U);else{if(X.if((0,dz.propertyInData)(X,G,U,$.opts.ownProperties)),K(U),!$.allErrors)X.else().var(H,!0);X.endIf()}Q.it.definedProperties.add(U),Q.ok(H)}function A(U){return $.opts.useDefaults&&!$.compositeRule&&Y[U].default!==void 0}function K(U){Q.subschema({keyword:"properties",schemaProp:U,dataProp:U},H)}}};tz.default=Mq});var Y7=N((X7)=>{Object.defineProperty(X7,"__esModule",{value:!0});var sz=j0(),XQ=v(),ez=f(),Q7=f(),Zq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:$}=Q,{opts:J}=$,z=(0,sz.allSchemaProperties)(Y),H=z.filter((O)=>(0,ez.alwaysValidSchema)($,Y[O]));if(z.length===0||H.length===z.length&&(!$.opts.unevaluated||$.props===!0))return;let A=J.strictSchema&&!J.allowMatchingProperties&&G.properties,K=X.name("valid");if($.props!==!0&&!($.props instanceof XQ.Name))$.props=(0,Q7.evaluatedPropsToName)(X,$.props);let{props:U}=$;B();function B(){for(let O of z){if(A)L(O);if($.allErrors)q(O);else X.var(K,!0),q(O),X.if(K)}}function L(O){for(let V in A)if(new RegExp(O).test(V))(0,ez.checkStrictMode)($,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function q(O){X.forIn("key",W,(V)=>{X.if(XQ._`${(0,sz.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:Q7.Type.Str},K);if($.opts.unevaluated&&U!==!0)X.assign(XQ._`${U}[${V}]`,!0);else if(!M&&!$.allErrors)X.if((0,XQ.not)(K),()=>X.break())})})}}};X7.default=Zq});var G7=N((W7)=>{Object.defineProperty(W7,"__esModule",{value:!0});var wq=f(),bq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,wq.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"}};W7.default=bq});var J7=N(($7)=>{Object.defineProperty($7,"__esModule",{value:!0});var Pq=j0(),Iq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pq.validateUnion,error:{message:"must match a schema in anyOf"}};$7.default=Iq});var H7=N((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});var YQ=v(),Tq=f(),Sq={message:"must match exactly one schema in oneOf",params:({params:Q})=>YQ._`{passingSchemas: ${Q.passing}}`},Rq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Sq,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 $=Y,J=X.let("valid",!1),z=X.let("passing",null),H=X.name("_valid");Q.setParams({passing:z}),X.block(A),Q.result(J,()=>Q.reset(),()=>Q.error(!0));function A(){$.forEach((K,U)=>{let B;if((0,Tq.alwaysValidSchema)(G,K))X.var(H,!0);else B=Q.subschema({keyword:"oneOf",schemaProp:U,compositeRule:!0},H);if(U>0)X.if(YQ._`${H} && ${J}`).assign(J,!1).assign(z,YQ._`[${z}, ${U}]`).else();X.if(H,()=>{if(X.assign(J,!0),X.assign(z,U),B)Q.mergeEvaluated(B,YQ.Name)})})}}};z7.default=Rq});var K7=N((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var kq=f(),vq={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,kq.alwaysValidSchema)(W,$))return;let z=Q.subschema({keyword:"allOf",schemaProp:J},G);Q.ok(G),Q.mergeEvaluated(z)})}};A7.default=vq});var L7=N((D7)=>{Object.defineProperty(D7,"__esModule",{value:!0});var WQ=v(),B7=f(),_q={message:({params:Q})=>WQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>WQ._`{failingKeyword: ${Q.ifClause}}`},yq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_q,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,B7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=U7(W,"then"),$=U7(W,"else");if(!G&&!$)return;let J=X.let("valid",!0),z=X.name("_valid");if(H(),Q.reset(),G&&$){let K=X.let("ifClause");Q.setParams({ifClause:K}),X.if(z,A("then",K),A("else",K))}else if(G)X.if(z,A("then"));else X.if((0,WQ.not)(z),A("else"));Q.pass(J,()=>Q.error(!0));function H(){let K=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(K)}function A(K,U){return()=>{let B=Q.subschema({keyword:K},z);if(X.assign(J,z),Q.mergeValidEvaluated(B,J),U)X.assign(U,WQ._`${K}`);else Q.setParams({ifClause:K})}}}};function U7(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,B7.alwaysValidSchema)(Q,Y)}D7.default=yq});var q7=N((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});var uq=f(),hq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,uq.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};F7.default=hq});var M7=N((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var lq=GX(),mq=kz(),cq=$X(),pq=_z(),iq=gz(),nq=cz(),rq=nz(),dq=zX(),oq=az(),tq=Y7(),aq=G7(),sq=J7(),eq=H7(),QO=K7(),XO=L7(),YO=q7();function WO(Q=!1){let X=[aq.default,sq.default,eq.default,QO.default,XO.default,YO.default,rq.default,dq.default,nq.default,oq.default,tq.default];if(Q)X.push(mq.default,pq.default);else X.push(lq.default,cq.default);return X.push(iq.default),X}O7.default=WO});var Z7=N((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});var e=v(),$O={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},JO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$O,code(Q,X){let{gen:Y,data:W,$data:G,schema:$,schemaCode:J,it:z}=Q,{opts:H,errSchemaPath:A,schemaEnv:K,self:U}=z;if(!H.validateFormats)return;if(G)B();else L();function B(){let q=Y.scopeValue("formats",{ref:U.formats,code:H.code.formats}),O=Y.const("fDef",e._`${q}[${J}]`),V=Y.let("fType"),M=Y.let("format");Y.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>Y.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>Y.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(S(),E()));function S(){if(H.strictSchema===!1)return e.nil;return e._`${J} && !${M}`}function E(){let x=K.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,T=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${X} && !${T}`}}function L(){let q=U.formats[$];if(!q){S();return}if(q===!0)return;let[O,V,M]=E(q);if(O===X)Q.pass(x());function S(){if(H.strictSchema===!1){U.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${$}" ignored in schema at path "${A}"`}}function E(T){let x0=T instanceof RegExp?(0,e.regexpCode)(T):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)($)}`:void 0,h0=Y.scopeValue("formats",{key:$,ref:T,code:x0});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,e._`${h0}.validate`];return["string",T,h0]}function x(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!K.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};V7.default=JO});var w7=N((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});var HO=Z7(),AO=[HO.default];N7.default=AO});var P7=N((b7)=>{Object.defineProperty(b7,"__esModule",{value:!0});b7.contentVocabulary=b7.metadataVocabulary=void 0;b7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];b7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var T7=N((E7)=>{Object.defineProperty(E7,"__esModule",{value:!0});var BO=tJ(),DO=bz(),LO=M7(),FO=w7(),I7=P7(),qO=[BO.default,DO.default,(0,LO.default)(),FO.default,I7.metadataVocabulary,I7.contentVocabulary];E7.default=qO});var k7=N((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});R7.DiscrError=void 0;var S7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(S7||(R7.DiscrError=S7={}))});var _7=N((x7)=>{Object.defineProperty(x7,"__esModule",{value:!0});var g1=v(),AX=k7(),v7=u4(),MO=b6(),VO=f(),ZO={message:({params:{discrError:Q,tagName:X}})=>Q===AX.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>g1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},NO={keyword:"discriminator",type:"object",schemaType:"object",error:ZO,code(Q){let{gen:X,data:Y,schema:W,parentSchema:G,it:$}=Q,{oneOf:J}=G;if(!$.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(!J)throw Error("discriminator: requires oneOf keyword");let H=X.let("valid",!1),A=X.const("tag",g1._`${Y}${(0,g1.getProperty)(z)}`);X.if(g1._`typeof ${A} == "string"`,()=>K(),()=>Q.error(!1,{discrError:AX.DiscrError.Tag,tag:A,tagName:z})),Q.ok(H);function K(){let L=B();X.if(!1);for(let q in L)X.elseIf(g1._`${A} === ${q}`),X.assign(H,U(L[q]));X.else(),Q.error(!1,{discrError:AX.DiscrError.Mapping,tag:A,tagName:z}),X.endIf()}function U(L){let q=X.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},q);return Q.mergeEvaluated(O,g1.Name),q}function B(){var L;let q={},O=M(G),V=!0;for(let x=0;x<J.length;x++){let T=J[x];if((T===null||T===void 0?void 0:T.$ref)&&!(0,VO.schemaHasRulesButRef)(T,$.self.RULES)){let h0=T.$ref;if(T=v7.resolveRef.call($.self,$.schemaEnv.root,$.baseId,h0),T instanceof v7.SchemaEnv)T=T.schema;if(T===void 0)throw new MO.default($.opts.uriResolver,$.baseId,h0)}let x0=(L=T===null||T===void 0?void 0:T.properties)===null||L===void 0?void 0:L[z];if(typeof x0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);V=V&&(O||M(T)),S(x0,x)}if(!V)throw Error(`discriminator: "${z}" must be required`);return q;function M({required:x}){return Array.isArray(x)&&x.includes(z)}function S(x,T){if(x.const)E(x.const,T);else if(x.enum)for(let x0 of x.enum)E(x0,T);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(x,T){if(typeof x!="string"||x in q)throw Error(`discriminator: "${z}" values must be unique strings`);q[x]=T}}}};x7.default=NO});var y7=N((uP,bO)=>{bO.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 UX=N((M0,KX)=>{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 jO=fJ(),PO=T7(),IO=_7(),g7=y7(),EO=["/properties"],GQ="http://json-schema.org/draft-07/schema";class _6 extends jO.default{_addVocabularies(){if(super._addVocabularies(),PO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(IO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(g7,EO):g7;this.addMetaSchema(Q,GQ,!1),this.refs["http://json-schema.org/schema"]=GQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(GQ)?GQ:void 0)}}M0.Ajv=_6;KX.exports=M0=_6;KX.exports.Ajv=_6;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=_6;var TO=w6();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return TO.KeywordCxt}});var u1=v();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return u1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return u1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return u1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return u1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return u1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return u1.CodeGen}});var SO=y4();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return SO.default}});var RO=b6();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return RO.default}})});var r7=N((i7)=>{Object.defineProperty(i7,"__esModule",{value:!0});i7.formatNames=i7.fastFormats=i7.fullFormats=void 0;function g0(Q,X){return{validate:Q,compare:X}}i7.fullFormats={date:g0(l7,FX),time:g0(DX(!0),qX),"date-time":g0(u7(!0),c7),"iso-time":g0(DX(),m7),"iso-date-time":g0(u7(),p7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uO,"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:iO,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:hO,int32:{type:"number",validate:mO},int64:{type:"number",validate:cO},float:{type:"number",validate:f7},double:{type:"number",validate:f7},password:!0,binary:!0};i7.fastFormats={...i7.fullFormats,date:g0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,FX),time:g0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qX),"date-time":g0(/^\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,c7),"iso-time":g0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m7),"iso-date-time":g0(/^\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,p7),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};i7.formatNames=Object.keys(i7.fullFormats);function vO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var xO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_O=[0,31,28,31,30,31,30,31,31,30,31,30,31];function l7(Q){let X=xO.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&&vO(Y)?29:_O[W])}function FX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var BX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function DX(Q){return function(Y){let W=BX.exec(Y);if(!W)return!1;let G=+W[1],$=+W[2],J=+W[3],z=W[4],H=W[5]==="-"?-1:1,A=+(W[6]||0),K=+(W[7]||0);if(A>23||K>59||Q&&!z)return!1;if(G<=23&&$<=59&&J<60)return!0;let U=$-K*H,B=G-A*H-(U<0?1:0);return(B===23||B===-1)&&(U===59||U===-1)&&J<61}}function qX(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 m7(Q,X){if(!(Q&&X))return;let Y=BX.exec(Q),W=BX.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 LX=/t|\s/i;function u7(Q){let X=DX(Q);return function(W){let G=W.split(LX);return G.length===2&&l7(G[0])&&X(G[1])}}function c7(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 p7(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(LX),[G,$]=X.split(LX),J=FX(Y,G);if(J===void 0)return;return J||qX(W,$)}var yO=/\/|:/,gO=/^(?:[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 uO(Q){return yO.test(Q)&&gO.test(Q)}var h7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function hO(Q){return h7.lastIndex=0,h7.test(Q)}var fO=-2147483648,lO=2147483647;function mO(Q){return Number.isInteger(Q)&&Q<=lO&&Q>=fO}function cO(Q){return Number.isInteger(Q)}function f7(){return!0}var pO=/[^\\]\\Z/;function iO(Q){if(pO.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var o7=N((d7)=>{Object.defineProperty(d7,"__esModule",{value:!0});d7.formatLimitDefinition=void 0;var rO=UX(),v0=v(),A1=v0.operators,$Q={formatMaximum:{okStr:"<=",ok:A1.LTE,fail:A1.GT},formatMinimum:{okStr:">=",ok:A1.GTE,fail:A1.LT},formatExclusiveMaximum:{okStr:"<",ok:A1.LT,fail:A1.GTE},formatExclusiveMinimum:{okStr:">",ok:A1.GT,fail:A1.LTE}},dO={message:({keyword:Q,schemaCode:X})=>v0.str`should be ${$Q[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>v0._`{comparison: ${$Q[Q].okStr}, limit: ${X}}`};d7.formatLimitDefinition={keyword:Object.keys($Q),type:"string",schemaType:"string",$data:!0,error:dO,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:$}=Q,{opts:J,self:z}=$;if(!J.validateFormats)return;let H=new rO.KeywordCxt($,z.RULES.all.format.definition,"format");if(H.$data)A();else K();function A(){let B=X.scopeValue("formats",{ref:z.formats,code:J.code.formats}),L=X.const("fmt",v0._`${B}[${H.schemaCode}]`);Q.fail$data((0,v0.or)(v0._`typeof ${L} != "object"`,v0._`${L} instanceof RegExp`,v0._`typeof ${L}.compare != "function"`,U(L)))}function K(){let B=H.schema,L=z.formats[B];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${B}" does not define "compare" function`);let q=X.scopeValue("formats",{key:B,ref:L,code:J.code.formats?v0._`${J.code.formats}${(0,v0.getProperty)(B)}`:void 0});Q.fail$data(U(q))}function U(B){return v0._`${B}.compare(${Y}, ${W}) ${$Q[G].fail} 0`}},dependencies:["format"]};var oO=(Q)=>{return Q.addKeyword(d7.formatLimitDefinition),Q};d7.default=oO});var e7=N((y6,s7)=>{Object.defineProperty(y6,"__esModule",{value:!0});var h1=r7(),aO=o7(),VX=v(),t7=new VX.Name("fullFormats"),sO=new VX.Name("fastFormats"),ZX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return a7(Q,X,h1.fullFormats,t7),Q;let[Y,W]=X.mode==="fast"?[h1.fastFormats,sO]:[h1.fullFormats,t7],G=X.formats||h1.formatNames;if(a7(Q,G,Y,W),X.keywords)(0,aO.default)(Q);return Q};ZX.get=(Q,X="full")=>{let W=(X==="fast"?h1.fastFormats:h1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function a7(Q,X,Y,W){var G,$;(G=($=Q.opts.code).formats)!==null&&G!==void 0||($.formats=VX._`require("ajv-formats/dist/formats").${W}`);for(let J of X)Q.addFormat(J,Y[J])}s7.exports=y6=ZX;Object.defineProperty(y6,"__esModule",{value:!0});y6.default=ZX});var PM=Object.freeze({status:"aborted"});function F(Q,X,Y){function W(z,H){var A;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(A=z._zod).traits??(A.traits=new Set),z._zod.traits.add(Q),X(z,H);for(let K in J.prototype)if(!(K in z))Object.defineProperty(z,K,{value:J.prototype[K].bind(z)});z._zod.constr=J,z._zod.def=H}let G=Y?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:Q});function J(z){var H;let A=Y?.Parent?new $:this;W(A,z),(H=A._zod).deferred??(H.deferred=[]);for(let K of A._zod.deferred)K();return A}return Object.defineProperty(J,"init",{value:W}),Object.defineProperty(J,Symbol.hasInstance,{value:(z)=>{if(Y?.Parent&&z instanceof Y.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var IM=Symbol("zod_brand");class f0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class c1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var f6={};function N0(Q){if(Q)Object.assign(f6,Q);return f6}var h={};xX(h,{unwrapMessage:()=>p1,uint8ArrayToHex:()=>QH,uint8ArrayToBase64url:()=>s5,uint8ArrayToBase64:()=>lX,stringifyPrimitive:()=>p6,shallowClone:()=>yX,safeExtend:()=>n5,required:()=>o5,randomString:()=>h5,propertyKeyTypes:()=>qQ,promiseAllObject:()=>u5,primitiveTypes:()=>gX,prefixIssues:()=>m0,pick:()=>c5,partial:()=>d5,optionalKeys:()=>OQ,omit:()=>p5,objectClone:()=>_5,numKeys:()=>f5,nullish:()=>i1,normalizeParams:()=>I,mergeDefs:()=>a0,merge:()=>r5,jsonStringifyReplacer:()=>N1,joinValues:()=>l6,issue:()=>b1,isPlainObject:()=>s0,isObject:()=>U1,hexToUint8Array:()=>e5,getSizableOrigin:()=>hX,getParsedType:()=>l5,getLengthableOrigin:()=>r1,getEnumValues:()=>DQ,getElementAtPath:()=>g5,floatSafeRemainder:()=>LQ,finalizeIssue:()=>E0,extend:()=>i5,escapeRegex:()=>l0,esc:()=>m6,defineLazy:()=>m,createTransparentProxy:()=>m5,cloneDef:()=>y5,clone:()=>I0,cleanRegex:()=>n1,cleanEnum:()=>t5,captureStackTrace:()=>c6,cached:()=>w1,base64urlToUint8Array:()=>a5,base64ToUint8Array:()=>fX,assignProp:()=>t0,assertNotEqual:()=>C5,assertNever:()=>v5,assertIs:()=>k5,assertEqual:()=>R5,assert:()=>x5,allowsEval:()=>FQ,aborted:()=>e0,NUMBER_FORMAT_RANGES:()=>MQ,Class:()=>mX,BIGINT_FORMAT_RANGES:()=>uX});function R5(Q){return Q}function C5(Q){return Q}function k5(Q){}function v5(Q){throw Error()}function x5(Q){}function DQ(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 l6(Q,X="|"){return Q.map((Y)=>p6(Y)).join(X)}function N1(Q,X){if(typeof X==="bigint")return X.toString();return X}function w1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function i1(Q){return Q===null||Q===void 0}function n1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function LQ(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 $=Y>G?Y:G,J=Number.parseInt(Q.toFixed($).replace(".","")),z=Number.parseInt(X.toFixed($).replace(".",""));return J%z/10**$}var _X=Symbol("evaluating");function m(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===_X)return;if(W===void 0)W=_X,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function _5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function t0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function a0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function y5(Q){return a0(Q._zod.def)}function g5(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function u5(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let G={};for(let $=0;$<X.length;$++)G[X[$]]=W[$];return G})}function h5(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function m6(Q){return JSON.stringify(Q)}var c6="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function U1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var FQ=w1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function s0(Q){if(U1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(U1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function yX(Q){if(s0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function f5(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var l5=(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}`)}},qQ=new Set(["string","number","symbol"]),gX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function l0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function I(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 m5(Q){let X;return new Proxy({},{get(Y,W,G){return X??(X=Q()),Reflect.get(X,W,G)},set(Y,W,G,$){return X??(X=Q()),Reflect.set(X,W,G,$)},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 p6(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function OQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var MQ={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]},uX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function c5(Q,X){let Y=Q._zod.def,W=a0(Q._zod.def,{get shape(){let G={};for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;G[$]=Y.shape[$]}return t0(this,"shape",G),G},checks:[]});return I0(Q,W)}function p5(Q,X){let Y=Q._zod.def,W=a0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;delete G[$]}return t0(this,"shape",G),G},checks:[]});return I0(Q,W)}function i5(Q,X){if(!s0(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=a0(Q._zod.def,{get shape(){let $={...Q._zod.def.shape,...X};return t0(this,"shape",$),$},checks:[]});return I0(Q,G)}function n5(Q,X){if(!s0(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 t0(this,"shape",W),W},checks:Q._zod.def.checks};return I0(Q,Y)}function r5(Q,X){let Y=a0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return t0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return I0(Q,Y)}function d5(Q,X,Y){let W=a0(X._zod.def,{get shape(){let G=X._zod.def.shape,$={...G};if(Y)for(let J in Y){if(!(J in G))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J]}else for(let J in G)$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J];return t0(this,"shape",$),$},checks:[]});return I0(X,W)}function o5(Q,X,Y){let W=a0(X._zod.def,{get shape(){let G=X._zod.def.shape,$={...G};if(Y)for(let J in Y){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=new Q({type:"nonoptional",innerType:G[J]})}else for(let J in G)$[J]=new Q({type:"nonoptional",innerType:G[J]});return t0(this,"shape",$),$},checks:[]});return I0(X,W)}function e0(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 p1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=p1(Q.inst?._zod.def?.error?.(Q))??p1(X?.error?.(Q))??p1(Y.customError?.(Q))??p1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function hX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function r1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function b1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function t5(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function fX(Q){let X=atob(Q),Y=new Uint8Array(X.length);for(let W=0;W<X.length;W++)Y[W]=X.charCodeAt(W);return Y}function lX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function a5(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return fX(X+Y)}function s5(Q){return lX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function e5(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 QH(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class mX{constructor(...Q){}}var cX=(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,N1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},i6=F("$ZodError",cX),VQ=F("$ZodError",cX,{Parent:Error});function pX(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 iX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G)=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((J)=>W({issues:J}));else if($.code==="invalid_key")W({issues:$.issues});else if($.code==="invalid_element")W({issues:$.issues});else if($.path.length===0)Y._errors.push(X($));else{let J=Y,z=0;while(z<$.path.length){let H=$.path[z];if(z!==$.path.length-1)J[H]=J[H]||{_errors:[]};else J[H]=J[H]||{_errors:[]},J[H]._errors.push(X($));J=J[H],z++}}};return W(Q),Y}var n6=(Q)=>(X,Y,W,G)=>{let $=W?Object.assign(W,{async:!1}):{async:!1},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)throw new f0;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>E0(H,$,N0())));throw c6(z,G?.callee),z}return J.value};var r6=(Q)=>async(X,Y,W,G)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)J=await J;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>E0(H,$,N0())));throw c6(z,G?.callee),z}return J.value};var d1=(Q)=>(X,Y,W)=>{let G=W?{...W,async:!1}:{async:!1},$=X._zod.run({value:Y,issues:[]},G);if($ instanceof Promise)throw new f0;return $.issues.length?{success:!1,error:new(Q??i6)($.issues.map((J)=>E0(J,G,N0())))}:{success:!0,data:$.value}},o1=d1(VQ),t1=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},$=X._zod.run({value:Y,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new Q($.issues.map((J)=>E0(J,G,N0())))}:{success:!0,data:$.value}},d6=t1(VQ),nX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return n6(Q)(X,Y,G)};var rX=(Q)=>(X,Y,W)=>{return n6(Q)(X,Y,W)};var dX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return r6(Q)(X,Y,G)};var oX=(Q)=>async(X,Y,W)=>{return r6(Q)(X,Y,W)};var tX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return d1(Q)(X,Y,G)};var aX=(Q)=>(X,Y,W)=>{return d1(Q)(X,Y,W)};var sX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return t1(Q)(X,Y,G)};var eX=(Q)=>async(X,Y,W)=>{return t1(Q)(X,Y,W)};var Q8=/^[cC][^\s-]{8,}$/,X8=/^[0-9a-z]+$/,Y8=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,W8=/^[0-9a-vA-V]{20}$/,G8=/^[A-Za-z0-9]{27}$/,$8=/^[a-zA-Z0-9_-]{21}$/,J8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var z8=/^([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})$/,ZQ=(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 H8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function A8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var 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])$/,U8=/^(([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}|:))$/,B8=/^((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])$/,D8=/^(([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])$/,L8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,NQ=/^[A-Za-z0-9_-]*$/,F8=/^(?=.{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 q8=/^\+(?:[0-9]){6,14}[0-9]$/,O8="(?:(?:\\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])))",M8=new RegExp(`^${O8}$`);function V8(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 Z8(Q){return new RegExp(`^${V8(Q)}$`)}function N8(Q){let X=V8({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(`^${O8}T(?:${W})$`)}var w8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var b8=/^-?\d+$/,j8=/^-?\d+(?:\.\d+)?/,P8=/^(?:true|false)$/i,I8=/^null$/i;var E8=/^[^A-Z]*$/,T8=/^[^a-z]*$/;var W0=F("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),S8={number:"number",bigint:"bigint",object:"date"},wQ=F("$ZodCheckLessThan",(Q,X)=>{W0.init(Q,X);let Y=S8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<$)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})}}),bQ=F("$ZodCheckGreaterThan",(Q,X)=>{W0.init(Q,X);let Y=S8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>$)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})}}),R8=F("$ZodCheckMultipleOf",(Q,X)=>{W0.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):LQ(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})}}),C8=F("$ZodCheckNumberFormat",(Q,X)=>{W0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,$]=MQ[X.format];Q._zod.onattach.push((J)=>{let z=J._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=$,Y)z.pattern=b8}),Q._zod.check=(J)=>{let z=J.value;if(Y){if(!Number.isInteger(z)){J.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)J.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 J.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)J.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:$,inst:Q})}});var k8=F("$ZodCheckMaxLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!i1(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 J=r1(G);W.issues.push({origin:J,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),v8=F("$ZodCheckMinLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!i1(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 J=r1(G);W.issues.push({origin:J,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),x8=F("$ZodCheckLengthEquals",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!i1(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,$=G.length;if($===X.length)return;let J=r1(G),z=$>X.length;W.issues.push({origin:J,...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})}}),a1=F("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(W0.init(Q,X),Q._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=X.format,X.pattern)$.patterns??($.patterns=new Set),$.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=()=>{})}),_8=F("$ZodCheckRegex",(Q,X)=>{a1.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})}}),y8=F("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=E8),a1.init(Q,X)}),g8=F("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=T8),a1.init(Q,X)}),u8=F("$ZodCheckIncludes",(Q,X)=>{W0.init(Q,X);let Y=l0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push((G)=>{let $=G._zod.bag;$.patterns??($.patterns=new Set),$.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})}}),h8=F("$ZodCheckStartsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`^${l0(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})}}),f8=F("$ZodCheckEndsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`.*${l0(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 l8=F("$ZodCheckOverwrite",(Q,X)=>{W0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class jQ{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let Y=Q.split(`
|
|
10
|
+
`).filter(($)=>$),W=Math.min(...Y.map(($)=>$.length-$.trimStart().length)),G=Y.map(($)=>$.slice(W)).map(($)=>" ".repeat(this.indent*2)+$);for(let $ of G)this.content.push($)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,W.join(`
|
|
11
|
+
`))}}var c8={major:4,minor:1,patch:12};var i=F("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=c8;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let $ of G._zod.onattach)$(Q);if(W.length===0)(Y=Q._zod).deferred??(Y.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=(J,z,H)=>{let A=e0(J),K;for(let U of z){if(U._zod.def.when){if(!U._zod.def.when(J))continue}else if(A)continue;let B=J.issues.length,L=U._zod.check(J);if(L instanceof Promise&&H?.async===!1)throw new f0;if(K||L instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await L,J.issues.length===B)return;if(!A)A=e0(J,B)});else{if(J.issues.length===B)continue;if(!A)A=e0(J,B)}}if(K)return K.then(()=>{return J});return J},$=(J,z,H)=>{if(e0(J))return J.aborted=!0,J;let A=G(z,W,H);if(A instanceof Promise){if(H.async===!1)throw new f0;return A.then((K)=>Q._zod.parse(K,H))}return Q._zod.parse(A,H)};Q._zod.run=(J,z)=>{if(z.skipChecks)return Q._zod.parse(J,z);if(z.direction==="backward"){let A=Q._zod.parse({value:J.value,issues:[]},{...z,skipChecks:!0});if(A instanceof Promise)return A.then((K)=>{return $(K,J,z)});return $(A,J,z)}let H=Q._zod.parse(J,z);if(H instanceof Promise){if(z.async===!1)throw new f0;return H.then((A)=>G(A,W,z))}return G(H,W,z)}}Q["~standard"]={validate:(G)=>{try{let $=o1(Q,G);return $.success?{value:$.data}:{issues:$.error?.issues}}catch($){return d6(Q,G).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}}),s6=F("$ZodString",(Q,X)=>{i.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??w8(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=F("$ZodStringFormat",(Q,X)=>{a1.init(Q,X),s6.init(Q,X)}),s8=F("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=z8),n.init(Q,X)}),e8=F("$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=ZQ(W))}else X.pattern??(X.pattern=ZQ());n.init(Q,X)}),QY=F("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=H8),n.init(Q,X)}),XY=F("$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:F8.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})}}}),YY=F("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=A8()),n.init(Q,X)}),WY=F("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=$8),n.init(Q,X)}),GY=F("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=Q8),n.init(Q,X)}),$Y=F("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=X8),n.init(Q,X)}),JY=F("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=Y8),n.init(Q,X)}),zY=F("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=W8),n.init(Q,X)}),HY=F("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=G8),n.init(Q,X)}),AY=F("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=N8(X)),n.init(Q,X)}),KY=F("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=M8),n.init(Q,X)}),UY=F("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=Z8(X)),n.init(Q,X)}),BY=F("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=J8),n.init(Q,X)}),DY=F("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=K8),n.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),LY=F("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=U8),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})}}}),FY=F("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=B8),n.init(Q,X)}),qY=F("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=D8),n.init(Q,X),Q._zod.check=(Y)=>{let W=Y.value.split("/");try{if(W.length!==2)throw Error();let[G,$]=W;if(!$)throw Error();let J=Number($);if(`${J}`!==$)throw Error();if(J<0||J>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 OY(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var MY=F("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=L8),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(OY(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function GH(Q){if(!NQ.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return OY(Y)}var VY=F("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=NQ),n.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(GH(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),ZY=F("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=q8),n.init(Q,X)});function $H(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 NY=F("$ZodJWT",(Q,X)=>{n.init(Q,X),Q._zod.check=(Y)=>{if($H(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var IQ=F("$ZodNumber",(Q,X)=>{i.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??j8,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(J){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let $=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,...$?{received:$}:{}}),Y}}),wY=F("$ZodNumber",(Q,X)=>{C8.init(Q,X),IQ.init(Q,X)}),bY=F("$ZodBoolean",(Q,X)=>{i.init(Q,X),Q._zod.pattern=P8,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch($){}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 jY=F("$ZodNull",(Q,X)=>{i.init(Q,X),Q._zod.pattern=I8,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 PY=F("$ZodUnknown",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y)=>Y}),IY=F("$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 p8(Q,X,Y){if(Q.issues.length)X.issues.push(...m0(Y,Q.issues));X.value[Y]=Q.value}var EY=F("$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 $=[];for(let J=0;J<G.length;J++){let z=G[J],H=X.element._zod.run({value:z,issues:[]},W);if(H instanceof Promise)$.push(H.then((A)=>p8(A,Y,J)));else p8(H,Y,J)}if($.length)return Promise.all($).then(()=>Y);return Y}});function a6(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 TY(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=OQ(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function SY(Q,X,Y,W,G,$){let J=[],z=G.keySet,H=G.catchall._zod,A=H.def.type;for(let K of Object.keys(X)){if(z.has(K))continue;if(A==="never"){J.push(K);continue}let U=H.run({value:X[K],issues:[]},W);if(U instanceof Promise)Q.push(U.then((B)=>a6(B,Y,K,X)));else a6(U,Y,K,X)}if(J.length)Y.issues.push({code:"unrecognized_keys",keys:J,input:X,inst:$});if(!Q.length)return Y;return Promise.all(Q).then(()=>{return Y})}var JH=F("$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=w1(()=>TY(X));m(Q._zod,"propValues",()=>{let z=X.shape,H={};for(let A in z){let K=z[A]._zod;if(K.values){H[A]??(H[A]=new Set);for(let U of K.values)H[A].add(U)}}return H});let G=U1,$=X.catchall,J;Q._zod.parse=(z,H)=>{J??(J=W.value);let A=z.value;if(!G(A))return z.issues.push({expected:"object",code:"invalid_type",input:A,inst:Q}),z;z.value={};let K=[],U=J.shape;for(let B of J.keys){let q=U[B]._zod.run({value:A[B],issues:[]},H);if(q instanceof Promise)K.push(q.then((O)=>a6(O,z,B,A)));else a6(q,z,B,A)}if(!$)return K.length?Promise.all(K).then(()=>z):z;return SY(K,A,z,H,W.value,Q)}}),RY=F("$ZodObjectJIT",(Q,X)=>{JH.init(Q,X);let Y=Q._zod.parse,W=w1(()=>TY(X)),G=(B)=>{let L=new jQ(["shape","payload","ctx"]),q=W.value,O=(E)=>{let x=m6(E);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};L.write("const input = payload.value;");let V=Object.create(null),M=0;for(let E of q.keys)V[E]=`key_${M++}`;L.write("const newResult = {};");for(let E of q.keys){let x=V[E],T=m6(E);L.write(`const ${x} = ${O(E)};`),L.write(`
|
|
12
12
|
if (${x}.issues.length) {
|
|
13
13
|
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
14
14
|
...iss,
|
|
15
|
-
path: iss.path ? [${
|
|
15
|
+
path: iss.path ? [${T}, ...iss.path] : [${T}]
|
|
16
16
|
})));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
if (${x}.value === undefined) {
|
|
21
|
-
if (${
|
|
22
|
-
newResult[${
|
|
21
|
+
if (${T} in input) {
|
|
22
|
+
newResult[${T}] = undefined;
|
|
23
23
|
}
|
|
24
24
|
} else {
|
|
25
|
-
newResult[${
|
|
25
|
+
newResult[${T}] = ${x}.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}L.write("payload.value = newResult;"),L.write("return payload;");let T=L.compile();return(I,x)=>T(B,I,x)},J,$=U1,z=!f6.jitless,A=z&&FQ.value,K=X.catchall,U;Q._zod.parse=(B,L)=>{U??(U=W.value);let q=B.value;if(!$(q))return B.issues.push({expected:"object",code:"invalid_type",input:q,inst:Q}),B;if(z&&A&&L?.async===!1&&L.jitless!==!0){if(!J)J=G(X.shape);if(B=J(B,L),!K)return B;return SY([],q,B,L,U,Q)}return Y(B,L)}});function i8(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)=>!e0(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,N0())))}),X}var EQ=F("$ZodUnion",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(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)=>n1(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 A=H._zod.run({value:G.value,issues:[]},J);if(A instanceof Promise)z.push(A),$=!0;else{if(A.issues.length===0)return A;z.push(A)}}if(!$)return i8(z,G,Q,J);return Promise.all(z).then((H)=>{return i8(H,G,Q,J)})}}),CY=F("$ZodDiscriminatedUnion",(Q,X)=>{EQ.init(Q,X);let Y=Q._zod.parse;m(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 A of H)G[z].add(A)}}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(!U1($))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}}),kY=F("$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,A])=>{return r8(Y,H,A)});return r8(Y,J,$)}});function PQ(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(s0(Q)&&s0(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 $=PQ(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],$=PQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function r8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(e0(Q))return Q;let W=PQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var vY=F("$ZodRecord",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!s0(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 A=X.valueType._zod.run({value:G[H],issues:[]},W);if(A instanceof Promise)J.push(A.then((K)=>{if(K.issues.length)Y.issues.push(...m0(H,K.issues));Y.value[H]=K.value}));else{if(A.issues.length)Y.issues.push(...m0(H,A.issues));Y.value[H]=A.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((A)=>E0(A,W,N0())),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((A)=>{if(A.issues.length)Y.issues.push(...m0($,A.issues));Y.value[z.value]=A.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 xY=F("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=DQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>qQ.has(typeof G)).map((G)=>typeof G==="string"?l0(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}}),_Y=F("$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"?l0(Y):Y?l0(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 yY=F("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new p1(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 f0;return Y.value=G,Y}});function n8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var gY=F("$ZodOptional",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n1(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)=>n8(J,Y.value));return n8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),uY=F("$ZodNullable",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n1(Y.source)}|null)$`):void 0}),m(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)}}),hY=F("$ZodDefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(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)=>d8(J,X));return d8(G,X)}});function d8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var fY=F("$ZodPrefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(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)}}),lY=F("$ZodNonOptional",(Q,X)=>{i.init(Q,X),m(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)=>o8(J,Q));return o8(G,Q)}});function o8(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 mY=F("$ZodCatch",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(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,N0()))},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,N0()))},input:Y.value}),Y.issues=[];return Y}});var cY=F("$ZodPipe",(Q,X)=>{i.init(Q,X),m(Q._zod,"values",()=>X.in._zod.values),m(Q._zod,"optin",()=>X.in._zod.optin),m(Q._zod,"optout",()=>X.out._zod.optout),m(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(($)=>t6($,X.in,W));return t6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>t6(J,X.out,W));return t6(G,X.out,W)}});function t6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var pY=F("$ZodReadonly",(Q,X)=>{i.init(Q,X),m(Q._zod,"propValues",()=>X.innerType._zod.propValues),m(Q._zod,"values",()=>X.innerType._zod.values),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(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(t8);return t8(G)}});function t8(Q){return Q.value=Object.freeze(Q.value),Q}var iY=F("$ZodCustom",(Q,X)=>{W0.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)=>a8(J,Y,W,Q));a8(G,Y,W,Q);return}});function a8(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 $H=(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},zH=()=>{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 ${$H(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${p6(W.values[0])}`;return`Invalid option: expected one of ${l6(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":""}: ${l6(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 TQ(){return{localeError:zH()}}var uM=Symbol("ZodOutput"),hM=Symbol("ZodInput");class rY{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 HH(){return new rY}var e1=HH();function nY(Q,X){return new Q({type:"string",...P(X)})}function dY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...P(X)})}function SQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...P(X)})}function oY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...P(X)})}function tY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(X)})}function aY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(X)})}function sY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(X)})}function eY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...P(X)})}function QW(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...P(X)})}function XW(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(X)})}function YW(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...P(X)})}function WW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(X)})}function GW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...P(X)})}function JW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...P(X)})}function $W(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(X)})}function zW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(X)})}function HW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(X)})}function AW(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(X)})}function KW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(X)})}function UW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...P(X)})}function BW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...P(X)})}function DW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...P(X)})}function LW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...P(X)})}function FW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(X)})}function qW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...P(X)})}function OW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...P(X)})}function MW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...P(X)})}function VW(Q,X){return new Q({type:"number",checks:[],...P(X)})}function ZW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...P(X)})}function NW(Q,X){return new Q({type:"boolean",...P(X)})}function wW(Q,X){return new Q({type:"null",...P(X)})}function bW(Q){return new Q({type:"unknown"})}function jW(Q,X){return new Q({type:"never",...P(X)})}function e6(Q,X){return new wQ({check:"less_than",...P(X),value:Q,inclusive:!1})}function Q6(Q,X){return new wQ({check:"less_than",...P(X),value:Q,inclusive:!0})}function Q4(Q,X){return new bQ({check:"greater_than",...P(X),value:Q,inclusive:!1})}function X6(Q,X){return new bQ({check:"greater_than",...P(X),value:Q,inclusive:!0})}function X4(Q,X){return new R8({check:"multiple_of",...P(X),value:Q})}function Y4(Q,X){return new k8({check:"max_length",...P(X),maximum:Q})}function b1(Q,X){return new v8({check:"min_length",...P(X),minimum:Q})}function W4(Q,X){return new x8({check:"length_equals",...P(X),length:Q})}function RQ(Q,X){return new _8({check:"string_format",format:"regex",...P(X),pattern:Q})}function CQ(Q){return new y8({check:"string_format",format:"lowercase",...P(Q)})}function kQ(Q){return new g8({check:"string_format",format:"uppercase",...P(Q)})}function vQ(Q,X){return new u8({check:"string_format",format:"includes",...P(X),includes:Q})}function xQ(Q,X){return new h8({check:"string_format",format:"starts_with",...P(X),prefix:Q})}function _Q(Q,X){return new f8({check:"string_format",format:"ends_with",...P(X),suffix:Q})}function B1(Q){return new l8({check:"overwrite",tx:Q})}function yQ(Q){return B1((X)=>X.normalize(Q))}function gQ(){return B1((Q)=>Q.trim())}function uQ(){return B1((Q)=>Q.toLowerCase())}function hQ(){return B1((Q)=>Q.toUpperCase())}function PW(Q,X,Y){return new Q({type:"array",element:X,...P(Y)})}function IW(Q,X,Y){let W=P(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function EW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...P(Y)})}function TW(Q){let X=AH((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 AH(Q,X){let Y=new W0({check:"custom",...P(X)});return Y._zod.check=Q,Y}function j1(Q){return!!Q._zod}function Q1(Q,X){if(j1(Q))return t1(Q,X);return Q.safeParse(X)}function G4(Q){if(!Q)return;let X;if(j1(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 SW(Q){if(j1(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 W6={};xX(W6,{time:()=>mQ,duration:()=>cQ,datetime:()=>fQ,date:()=>lQ,ZodISOTime:()=>kW,ZodISODuration:()=>vW,ZodISODateTime:()=>RW,ZodISODate:()=>CW});var RW=F("ZodISODateTime",(Q,X)=>{AY.init(Q,X),d.init(Q,X)});function fQ(Q){return FW(RW,Q)}var CW=F("ZodISODate",(Q,X)=>{KY.init(Q,X),d.init(Q,X)});function lQ(Q){return qW(CW,Q)}var kW=F("ZodISOTime",(Q,X)=>{UY.init(Q,X),d.init(Q,X)});function mQ(Q){return OW(kW,Q)}var vW=F("ZodISODuration",(Q,X)=>{BY.init(Q,X),d.init(Q,X)});function cQ(Q){return MW(vW,Q)}var xW=(Q,X)=>{i6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>iX(Q,Y)},flatten:{value:(Y)=>pX(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}}})},jV=F("ZodError",xW),M0=F("ZodError",xW,{Parent:Error});var _W=r6(M0),yW=n6(M0),gW=o1(M0),uW=a1(M0),hW=rX(M0),fW=nX(M0),lW=dX(M0),mW=oX(M0),cW=tX(M0),pW=aX(M0),iW=sX(M0),rW=eX(M0);var s=F("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(h.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>I0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>_W(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>gW(Q,Y,W),Q.parseAsync=async(Y,W)=>yW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>uW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>hW(Q,Y,W),Q.decode=(Y,W)=>fW(Q,Y,W),Q.encodeAsync=async(Y,W)=>lW(Q,Y,W),Q.decodeAsync=async(Y,W)=>mW(Q,Y,W),Q.safeEncode=(Y,W)=>cW(Q,Y,W),Q.safeDecode=(Y,W)=>pW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>iW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>rW(Q,Y,W),Q.refine=(Y,W)=>Q.check(J3(Y,W)),Q.superRefine=(Y)=>Q.check($3(Y)),Q.overwrite=(Y)=>Q.check(B1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>oW(Q),Q.nullish=()=>a(oW(Q)),Q.nonoptional=(Y)=>eH(Q,Y),Q.array=()=>_(Q),Q.or=(Y)=>p([Q,Y]),Q.and=(Y)=>$4(Q,Y),Q.transform=(Y)=>iQ(Q,QG(Y)),Q.default=(Y)=>tH(Q,Y),Q.prefault=(Y)=>sH(Q,Y),Q.catch=(Y)=>X3(Q,Y),Q.pipe=(Y)=>iQ(Q,Y),Q.readonly=()=>G3(Q),Q.describe=(Y)=>{let W=Q.clone();return e1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return e1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return e1.get(Q);let W=Q.clone();return e1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),tW=F("_ZodString",(Q,X)=>{s6.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(RQ(...W)),Q.includes=(...W)=>Q.check(vQ(...W)),Q.startsWith=(...W)=>Q.check(xQ(...W)),Q.endsWith=(...W)=>Q.check(_Q(...W)),Q.min=(...W)=>Q.check(b1(...W)),Q.max=(...W)=>Q.check(Y4(...W)),Q.length=(...W)=>Q.check(W4(...W)),Q.nonempty=(...W)=>Q.check(b1(1,...W)),Q.lowercase=(W)=>Q.check(CQ(W)),Q.uppercase=(W)=>Q.check(kQ(W)),Q.trim=()=>Q.check(gQ()),Q.normalize=(...W)=>Q.check(yQ(...W)),Q.toLowerCase=()=>Q.check(uQ()),Q.toUpperCase=()=>Q.check(hQ())}),MH=F("ZodString",(Q,X)=>{s6.init(Q,X),tW.init(Q,X),Q.email=(Y)=>Q.check(dY(VH,Y)),Q.url=(Y)=>Q.check(eY(ZH,Y)),Q.jwt=(Y)=>Q.check(LW(_H,Y)),Q.emoji=(Y)=>Q.check(QW(NH,Y)),Q.guid=(Y)=>Q.check(SQ(nW,Y)),Q.uuid=(Y)=>Q.check(oY(J4,Y)),Q.uuidv4=(Y)=>Q.check(tY(J4,Y)),Q.uuidv6=(Y)=>Q.check(aY(J4,Y)),Q.uuidv7=(Y)=>Q.check(sY(J4,Y)),Q.nanoid=(Y)=>Q.check(XW(wH,Y)),Q.guid=(Y)=>Q.check(SQ(nW,Y)),Q.cuid=(Y)=>Q.check(YW(bH,Y)),Q.cuid2=(Y)=>Q.check(WW(jH,Y)),Q.ulid=(Y)=>Q.check(GW(PH,Y)),Q.base64=(Y)=>Q.check(UW(kH,Y)),Q.base64url=(Y)=>Q.check(BW(vH,Y)),Q.xid=(Y)=>Q.check(JW(IH,Y)),Q.ksuid=(Y)=>Q.check($W(EH,Y)),Q.ipv4=(Y)=>Q.check(zW(TH,Y)),Q.ipv6=(Y)=>Q.check(HW(SH,Y)),Q.cidrv4=(Y)=>Q.check(AW(RH,Y)),Q.cidrv6=(Y)=>Q.check(KW(CH,Y)),Q.e164=(Y)=>Q.check(DW(xH,Y)),Q.datetime=(Y)=>Q.check(fQ(Y)),Q.date=(Y)=>Q.check(lQ(Y)),Q.time=(Y)=>Q.check(mQ(Y)),Q.duration=(Y)=>Q.check(cQ(Y))});function D(Q){return nY(MH,Q)}var d=F("ZodStringFormat",(Q,X)=>{r.init(Q,X),tW.init(Q,X)}),VH=F("ZodEmail",(Q,X)=>{QY.init(Q,X),d.init(Q,X)});var nW=F("ZodGUID",(Q,X)=>{s8.init(Q,X),d.init(Q,X)});var J4=F("ZodUUID",(Q,X)=>{e8.init(Q,X),d.init(Q,X)});var ZH=F("ZodURL",(Q,X)=>{XY.init(Q,X),d.init(Q,X)});var NH=F("ZodEmoji",(Q,X)=>{YY.init(Q,X),d.init(Q,X)});var wH=F("ZodNanoID",(Q,X)=>{WY.init(Q,X),d.init(Q,X)});var bH=F("ZodCUID",(Q,X)=>{GY.init(Q,X),d.init(Q,X)});var jH=F("ZodCUID2",(Q,X)=>{JY.init(Q,X),d.init(Q,X)});var PH=F("ZodULID",(Q,X)=>{$Y.init(Q,X),d.init(Q,X)});var IH=F("ZodXID",(Q,X)=>{zY.init(Q,X),d.init(Q,X)});var EH=F("ZodKSUID",(Q,X)=>{HY.init(Q,X),d.init(Q,X)});var TH=F("ZodIPv4",(Q,X)=>{DY.init(Q,X),d.init(Q,X)});var SH=F("ZodIPv6",(Q,X)=>{LY.init(Q,X),d.init(Q,X)});var RH=F("ZodCIDRv4",(Q,X)=>{FY.init(Q,X),d.init(Q,X)});var CH=F("ZodCIDRv6",(Q,X)=>{qY.init(Q,X),d.init(Q,X)});var kH=F("ZodBase64",(Q,X)=>{MY.init(Q,X),d.init(Q,X)});var vH=F("ZodBase64URL",(Q,X)=>{VY.init(Q,X),d.init(Q,X)});var xH=F("ZodE164",(Q,X)=>{ZY.init(Q,X),d.init(Q,X)});var _H=F("ZodJWT",(Q,X)=>{NY.init(Q,X),d.init(Q,X)});var aW=F("ZodNumber",(Q,X)=>{IQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(Q4(W,G)),Q.gte=(W,G)=>Q.check(X6(W,G)),Q.min=(W,G)=>Q.check(X6(W,G)),Q.lt=(W,G)=>Q.check(e6(W,G)),Q.lte=(W,G)=>Q.check(Q6(W,G)),Q.max=(W,G)=>Q.check(Q6(W,G)),Q.int=(W)=>Q.check(dW(W)),Q.safe=(W)=>Q.check(dW(W)),Q.positive=(W)=>Q.check(Q4(0,W)),Q.nonnegative=(W)=>Q.check(X6(0,W)),Q.negative=(W)=>Q.check(e6(0,W)),Q.nonpositive=(W)=>Q.check(Q6(0,W)),Q.multipleOf=(W,G)=>Q.check(X4(W,G)),Q.step=(W,G)=>Q.check(X4(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 l(Q){return VW(aW,Q)}var yH=F("ZodNumberFormat",(Q,X)=>{wY.init(Q,X),aW.init(Q,X)});function dW(Q){return ZW(yH,Q)}var gH=F("ZodBoolean",(Q,X)=>{bY.init(Q,X),s.init(Q,X)});function Y0(Q){return NW(gH,Q)}var uH=F("ZodNull",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function rQ(Q){return wW(uH,Q)}var hH=F("ZodUnknown",(Q,X)=>{PY.init(Q,X),s.init(Q,X)});function o(){return bW(hH)}var fH=F("ZodNever",(Q,X)=>{IY.init(Q,X),s.init(Q,X)});function lH(Q){return jW(fH,Q)}var mH=F("ZodArray",(Q,X)=>{EY.init(Q,X),s.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(b1(Y,W)),Q.nonempty=(Y)=>Q.check(b1(1,Y)),Q.max=(Y,W)=>Q.check(Y4(Y,W)),Q.length=(Y,W)=>Q.check(W4(Y,W)),Q.unwrap=()=>Q.element});function _(Q,X){return PW(mH,Q,X)}var sW=F("ZodObject",(Q,X)=>{RY.init(Q,X),s.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>D0(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:lH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return h.extend(Q,Y)},Q.safeExtend=(Y)=>{return h.safeExtend(Q,Y)},Q.merge=(Y)=>h.merge(Q,Y),Q.pick=(Y)=>h.pick(Q,Y),Q.omit=(Y)=>h.omit(Q,Y),Q.partial=(...Y)=>h.partial(XG,Q,Y[0]),Q.required=(...Y)=>h.required(YG,Q,Y[0])});function w(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new sW(Y)}function K0(Q,X){return new sW({type:"object",shape:Q,catchall:o(),...h.normalizeParams(X)})}var eW=F("ZodUnion",(Q,X)=>{EQ.init(Q,X),s.init(Q,X),Q.options=X.options});function p(Q,X){return new eW({type:"union",options:Q,...h.normalizeParams(X)})}var cH=F("ZodDiscriminatedUnion",(Q,X)=>{eW.init(Q,X),CY.init(Q,X)});function nQ(Q,X,Y){return new cH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var pH=F("ZodIntersection",(Q,X)=>{kY.init(Q,X),s.init(Q,X)});function $4(Q,X){return new pH({type:"intersection",left:Q,right:X})}var iH=F("ZodRecord",(Q,X)=>{vY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new iH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var pQ=F("ZodEnum",(Q,X)=>{xY.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 pQ({...X,checks:[],...h.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 pQ({...X,checks:[],...h.normalizeParams(G),entries:J})}});function D0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new pQ({type:"enum",entries:Y,...h.normalizeParams(X)})}var rH=F("ZodLiteral",(Q,X)=>{_Y.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 b(Q,X){return new rH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var nH=F("ZodTransform",(Q,X)=>{yY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new p1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(h.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(h.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 QG(Q){return new nH({type:"transform",transform:Q})}var XG=F("ZodOptional",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new XG({type:"optional",innerType:Q})}var dH=F("ZodNullable",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function oW(Q){return new dH({type:"nullable",innerType:Q})}var oH=F("ZodDefault",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function tH(Q,X){return new oH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var aH=F("ZodPrefault",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function sH(Q,X){return new aH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var YG=F("ZodNonOptional",(Q,X)=>{lY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function eH(Q,X){return new YG({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var Q3=F("ZodCatch",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function X3(Q,X){return new Q3({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var Y3=F("ZodPipe",(Q,X)=>{cY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function iQ(Q,X){return new Y3({type:"pipe",in:Q,out:X})}var W3=F("ZodReadonly",(Q,X)=>{pY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function G3(Q){return new W3({type:"readonly",innerType:Q})}var WG=F("ZodCustom",(Q,X)=>{iY.init(Q,X),s.init(Q,X)});function GG(Q,X){return IW(WG,Q??(()=>!0),X)}function J3(Q,X={}){return EW(WG,Q,X)}function $3(Q){return TW(Q)}function dQ(Q,X){return iQ(QG(Q),X)}N0(TQ());var oQ="2025-11-25";var JG=[oQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",H4="2.0",G0=GG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),$G=p([D(),l().int()]),zG=D(),VZ=K0({ttl:p([l(),rQ()]).optional(),pollInterval:l().optional()}),z3=w({ttl:l().optional()}),H3=w({taskId:D()}),tQ=K0({progressToken:$G.optional(),[X1]:H3.optional()}),V0=w({_meta:tQ.optional()}),G6=V0.extend({task:z3.optional()}),HG=(Q)=>G6.safeParse(Q).success,J0=w({method:D(),params:V0.loose().optional()}),w0=w({_meta:tQ.optional()}),b0=w({method:D(),params:w0.loose().optional()}),$0=K0({_meta:tQ.optional()}),A4=p([D(),l().int()]),AG=w({jsonrpc:b(H4),id:A4,...J0.shape}).strict(),aQ=(Q)=>AG.safeParse(Q).success,KG=w({jsonrpc:b(H4),...b0.shape}).strict(),UG=(Q)=>KG.safeParse(Q).success,sQ=w({jsonrpc:b(H4),id:A4,result:$0}).strict(),J6=(Q)=>sQ.safeParse(Q).success;var y;(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"})(y||(y={}));var eQ=w({jsonrpc:b(H4),id:A4.optional(),error:w({code:l().int(),message:D(),data:o().optional()})}).strict();var BG=(Q)=>eQ.safeParse(Q).success;var DG=p([AG,KG,sQ,eQ]),ZZ=p([sQ,eQ]),K4=$0.strict(),A3=w0.extend({requestId:A4.optional(),reason:D().optional()}),U4=b0.extend({method:b("notifications/cancelled"),params:A3}),K3=w({src:D(),mimeType:D().optional(),sizes:_(D()).optional(),theme:D0(["light","dark"]).optional()}),$6=w({icons:_(K3).optional()}),P1=w({name:D(),title:D().optional()}),LG=P1.extend({...P1.shape,...$6.shape,version:D(),websiteUrl:D().optional(),description:D().optional()}),U3=$4(w({applyDefaults:Y0().optional()}),t(D(),o())),B3=dQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},$4(w({form:U3.optional(),url:G0.optional()}),t(D(),o()).optional())),D3=K0({list:G0.optional(),cancel:G0.optional(),requests:K0({sampling:K0({createMessage:G0.optional()}).optional(),elicitation:K0({create:G0.optional()}).optional()}).optional()}),L3=K0({list:G0.optional(),cancel:G0.optional(),requests:K0({tools:K0({call:G0.optional()}).optional()}).optional()}),F3=w({experimental:t(D(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:B3.optional(),roots:w({listChanged:Y0().optional()}).optional(),tasks:D3.optional()}),q3=V0.extend({protocolVersion:D(),capabilities:F3,clientInfo:LG}),Q9=J0.extend({method:b("initialize"),params:q3});var O3=w({experimental:t(D(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:Y0().optional()}).optional(),resources:w({subscribe:Y0().optional(),listChanged:Y0().optional()}).optional(),tools:w({listChanged:Y0().optional()}).optional(),tasks:L3.optional()}),M3=$0.extend({protocolVersion:D(),capabilities:O3,serverInfo:LG,instructions:D().optional()}),X9=b0.extend({method:b("notifications/initialized"),params:w0.optional()});var B4=J0.extend({method:b("ping"),params:V0.optional()}),V3=w({progress:l(),total:a(l()),message:a(D())}),Z3=w({...w0.shape,...V3.shape,progressToken:$G}),D4=b0.extend({method:b("notifications/progress"),params:Z3}),N3=V0.extend({cursor:zG.optional()}),z6=J0.extend({params:N3.optional()}),H6=$0.extend({nextCursor:zG.optional()}),w3=D0(["working","input_required","completed","failed","cancelled"]),A6=w({taskId:D(),status:w3,ttl:p([l(),rQ()]),createdAt:D(),lastUpdatedAt:D(),pollInterval:a(l()),statusMessage:a(D())}),I1=$0.extend({task:A6}),b3=w0.merge(A6),K6=b0.extend({method:b("notifications/tasks/status"),params:b3}),L4=J0.extend({method:b("tasks/get"),params:V0.extend({taskId:D()})}),F4=$0.merge(A6),q4=J0.extend({method:b("tasks/result"),params:V0.extend({taskId:D()})}),NZ=$0.loose(),O4=z6.extend({method:b("tasks/list")}),M4=H6.extend({tasks:_(A6)}),V4=J0.extend({method:b("tasks/cancel"),params:V0.extend({taskId:D()})}),FG=$0.merge(A6),qG=w({uri:D(),mimeType:a(D()),_meta:t(D(),o()).optional()}),OG=qG.extend({text:D()}),Y9=D().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),MG=qG.extend({blob:Y9}),U6=D0(["user","assistant"]),E1=w({audience:_(U6).optional(),priority:l().min(0).max(1).optional(),lastModified:W6.datetime({offset:!0}).optional()}),VG=w({...P1.shape,...$6.shape,uri:D(),description:a(D()),mimeType:a(D()),annotations:E1.optional(),_meta:a(K0({}))}),j3=w({...P1.shape,...$6.shape,uriTemplate:D(),description:a(D()),mimeType:a(D()),annotations:E1.optional(),_meta:a(K0({}))}),W9=z6.extend({method:b("resources/list")}),P3=H6.extend({resources:_(VG)}),I3=z6.extend({method:b("resources/templates/list")}),E3=H6.extend({resourceTemplates:_(j3)}),G9=V0.extend({uri:D()}),T3=G9,J9=J0.extend({method:b("resources/read"),params:T3}),S3=$0.extend({contents:_(p([OG,MG]))}),R3=b0.extend({method:b("notifications/resources/list_changed"),params:w0.optional()}),C3=G9,k3=J0.extend({method:b("resources/subscribe"),params:C3}),v3=G9,x3=J0.extend({method:b("resources/unsubscribe"),params:v3}),_3=w0.extend({uri:D()}),y3=b0.extend({method:b("notifications/resources/updated"),params:_3}),g3=w({name:D(),description:a(D()),required:a(Y0())}),u3=w({...P1.shape,...$6.shape,description:a(D()),arguments:a(_(g3)),_meta:a(K0({}))}),h3=z6.extend({method:b("prompts/list")}),f3=H6.extend({prompts:_(u3)}),l3=V0.extend({name:D(),arguments:t(D(),D()).optional()}),m3=J0.extend({method:b("prompts/get"),params:l3}),$9=w({type:b("text"),text:D(),annotations:E1.optional(),_meta:t(D(),o()).optional()}),z9=w({type:b("image"),data:Y9,mimeType:D(),annotations:E1.optional(),_meta:t(D(),o()).optional()}),H9=w({type:b("audio"),data:Y9,mimeType:D(),annotations:E1.optional(),_meta:t(D(),o()).optional()}),c3=w({type:b("tool_use"),name:D(),id:D(),input:t(D(),o()),_meta:t(D(),o()).optional()}),p3=w({type:b("resource"),resource:p([OG,MG]),annotations:E1.optional(),_meta:t(D(),o()).optional()}),i3=VG.extend({type:b("resource_link")}),A9=p([$9,z9,H9,i3,p3]),r3=w({role:U6,content:A9}),n3=$0.extend({description:D().optional(),messages:_(r3)}),d3=b0.extend({method:b("notifications/prompts/list_changed"),params:w0.optional()}),o3=w({title:D().optional(),readOnlyHint:Y0().optional(),destructiveHint:Y0().optional(),idempotentHint:Y0().optional(),openWorldHint:Y0().optional()}),t3=w({taskSupport:D0(["required","optional","forbidden"]).optional()}),ZG=w({...P1.shape,...$6.shape,description:D().optional(),inputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()).optional(),annotations:o3.optional(),execution:t3.optional(),_meta:t(D(),o()).optional()}),K9=z6.extend({method:b("tools/list")}),a3=H6.extend({tools:_(ZG)}),Z4=$0.extend({content:_(A9).default([]),structuredContent:t(D(),o()).optional(),isError:Y0().optional()}),wZ=Z4.or($0.extend({toolResult:o()})),s3=G6.extend({name:D(),arguments:t(D(),o()).optional()}),B6=J0.extend({method:b("tools/call"),params:s3}),e3=b0.extend({method:b("notifications/tools/list_changed"),params:w0.optional()}),bZ=w({autoRefresh:Y0().default(!0),debounceMs:l().int().nonnegative().default(300)}),D6=D0(["debug","info","notice","warning","error","critical","alert","emergency"]),QA=V0.extend({level:D6}),U9=J0.extend({method:b("logging/setLevel"),params:QA}),XA=w0.extend({level:D6,logger:D().optional(),data:o()}),YA=b0.extend({method:b("notifications/message"),params:XA}),WA=w({name:D().optional()}),GA=w({hints:_(WA).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),JA=w({mode:D0(["auto","required","none"]).optional()}),$A=w({type:b("tool_result"),toolUseId:D().describe("The unique identifier for the corresponding tool call."),content:_(A9).default([]),structuredContent:w({}).loose().optional(),isError:Y0().optional(),_meta:t(D(),o()).optional()}),zA=nQ("type",[$9,z9,H9]),z4=nQ("type",[$9,z9,H9,c3,$A]),HA=w({role:U6,content:p([z4,_(z4)]),_meta:t(D(),o()).optional()}),AA=G6.extend({messages:_(HA),modelPreferences:GA.optional(),systemPrompt:D().optional(),includeContext:D0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(D()).optional(),metadata:G0.optional(),tools:_(ZG).optional(),toolChoice:JA.optional()}),KA=J0.extend({method:b("sampling/createMessage"),params:AA}),B9=$0.extend({model:D(),stopReason:a(D0(["endTurn","stopSequence","maxTokens"]).or(D())),role:U6,content:zA}),D9=$0.extend({model:D(),stopReason:a(D0(["endTurn","stopSequence","maxTokens","toolUse"]).or(D())),role:U6,content:p([z4,_(z4)])}),UA=w({type:b("boolean"),title:D().optional(),description:D().optional(),default:Y0().optional()}),BA=w({type:b("string"),title:D().optional(),description:D().optional(),minLength:l().optional(),maxLength:l().optional(),format:D0(["email","uri","date","date-time"]).optional(),default:D().optional()}),DA=w({type:D0(["number","integer"]),title:D().optional(),description:D().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),LA=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),default:D().optional()}),FA=w({type:b("string"),title:D().optional(),description:D().optional(),oneOf:_(w({const:D(),title:D()})),default:D().optional()}),qA=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),enumNames:_(D()).optional(),default:D().optional()}),OA=p([LA,FA]),MA=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(D())}),default:_(D()).optional()}),VA=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:D(),title:D()}))}),default:_(D()).optional()}),ZA=p([MA,VA]),NA=p([qA,OA,ZA]),wA=p([NA,UA,BA,DA]),bA=G6.extend({mode:b("form").optional(),message:D(),requestedSchema:w({type:b("object"),properties:t(D(),wA),required:_(D()).optional()})}),jA=G6.extend({mode:b("url"),message:D(),elicitationId:D(),url:D().url()}),PA=p([bA,jA]),IA=J0.extend({method:b("elicitation/create"),params:PA}),EA=w0.extend({elicitationId:D()}),TA=b0.extend({method:b("notifications/elicitation/complete"),params:EA}),N4=$0.extend({action:D0(["accept","decline","cancel"]),content:dQ((Q)=>Q===null?void 0:Q,t(D(),p([D(),l(),Y0(),_(D())])).optional())}),SA=w({type:b("ref/resource"),uri:D()});var RA=w({type:b("ref/prompt"),name:D()}),CA=V0.extend({ref:p([RA,SA]),argument:w({name:D(),value:D()}),context:w({arguments:t(D(),D()).optional()}).optional()}),kA=J0.extend({method:b("completion/complete"),params:CA});var vA=$0.extend({completion:K0({values:_(D()).max(100),total:a(l().int()),hasMore:a(Y0())})}),xA=w({uri:D().startsWith("file://"),name:D().optional(),_meta:t(D(),o()).optional()}),_A=J0.extend({method:b("roots/list"),params:V0.optional()}),L9=$0.extend({roots:_(xA)}),yA=b0.extend({method:b("notifications/roots/list_changed"),params:w0.optional()}),jZ=p([B4,Q9,kA,U9,m3,h3,W9,I3,J9,k3,x3,B6,K9,L4,q4,O4,V4]),PZ=p([U4,D4,X9,yA,K6]),IZ=p([K4,B9,D9,N4,L9,F4,M4,I1]),EZ=p([B4,KA,IA,_A,L4,q4,O4,V4]),TZ=p([U4,D4,YA,y3,R3,e3,d3,K6,TA]),SZ=p([K4,M3,vA,n3,f3,P3,E3,S3,Z4,a3,F4,M4,I1]);class k 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===y.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new NG(W.elicitations,X)}return new k(Q,X,Y)}}class NG extends k{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(y.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function Y1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var gA=Symbol("Let zodToJsonSchema decide on which parser to use");var HN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function F9(Q){let Y=G4(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=SW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function q9(Q,X){let Y=Q1(Q,X);if(!Y.success)throw Y.error;return Y.data}var cA=60000;class O9{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(U4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(D4,(X)=>{this._onprogress(X)}),this.setRequestHandler(B4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(L4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(q4,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,A=this._requestResolvers.get(H);if(A)if(this._requestResolvers.delete(H),$.type==="response")A(z);else{let K=z,U=new k(K.error.code,K.error.message,K.error.data);A(U)}else{let K=$.type==="response"?"Response":"Error";this._onerror(Error(`${K} 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 k(y.InvalidParams,`Task not found: ${G}`);if(!Y1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(Y1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(O4,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 k(y.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(V4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,`Task not found: ${X.params.taskId}`);if(Y1(W.status))throw new k(y.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 k(y.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof k)throw W;throw new k(y.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),k.fromError(y.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),J6(G)||BG(G))this._onresponse(G);else if(aQ(G))this._onrequest(G,J);else if(UG(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=k.fromError(y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[X1]?.taskId;if(Y===void 0){let A={jsonrpc:"2.0",id:Q.id,error:{code:y.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId).catch((K)=>this._onerror(Error(`Failed to enqueue error response: ${K}`)));else W?.send(A).catch((K)=>this._onerror(Error(`Failed to send an error response: ${K}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=HG(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(A)=>{let K={relatedRequestId:Q.id};if(G)K.relatedTask={taskId:G};await this.notification(A,K)},sendRequest:async(A,K,U)=>{let B={...U,relatedRequestId:Q.id};if(G&&!B.relatedTask)B.relatedTask={taskId:G};let L=B.relatedTask?.taskId??G;if(L&&z)await z.updateTaskStatus(L,"input_required");return await this.request(A,K,B)},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(A)=>{if(J.signal.aborted)return;let K={result:A,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)},async(A)=>{if(J.signal.aborted)return;let K={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(A.code)?A.code:y.InternalError,message:A.message??"Internal error",...A.data!==void 0&&{data:A.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)}).catch((A)=>this._onerror(Error(`Failed to send response: ${A}`))).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),J6(Q))Y(Q);else{let J=new k(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(J6(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(J6(Q))W(Q);else{let J=k.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 k?J:new k(y.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,I1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new k(y.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},Y1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new k(y.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new k(y.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 k?J:new k(y.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((H,A)=>{let K=(M)=>{A(M)};if(!this._transport){K(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(M){K(M);return}Y?.signal?.throwIfAborted();let U=this._requestMessageId++,B={...Q,jsonrpc:"2.0",id:U};if(Y?.onprogress)this._progressHandlers.set(U,Y.onprogress),B.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:U}};if($)B.params={...B.params,task:$};if(z)B.params={...B.params,_meta:{...B.params?._meta||{},[X1]:z}};let L=(M)=>{this._responseHandlers.delete(U),this._progressHandlers.delete(U),this._cleanupTimeout(U),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:U,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((I)=>this._onerror(Error(`Failed to send cancellation: ${I}`)));let T=M instanceof k?M:new k(y.RequestTimeout,String(M));A(T)};this._responseHandlers.set(U,(M)=>{if(Y?.signal?.aborted)return;if(M instanceof Error)return A(M);try{let T=Q1(X,M.result);if(!T.success)A(T.error);else H(T.data)}catch(T){A(T)}}),Y?.signal?.addEventListener("abort",()=>{L(Y?.signal?.reason)});let q=Y?.timeout??cA,O=()=>L(k.fromError(y.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(U,q,Y?.maxTotalTimeout,O,Y?.resetTimeoutOnProgress??!1);let V=z?.taskId;if(V){let M=(T)=>{let I=this._responseHandlers.get(U);if(I)I(T);else this._onerror(Error(`Response handler missing for side-channeled request ${U}`))};this._requestResolvers.set(U,M),this._enqueueTaskMessage(V,{type:"request",message:B,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(U),A(T)})}else this._transport.send(B,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((M)=>{this._cleanupTimeout(U),A(M)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},F4,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},M4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},FG,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[X1]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[X1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=F9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=q9(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=F9(Q);this._notificationHandlers.set(Y,(W)=>{let G=q9(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"&&aQ(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new k(y.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 k(y.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new k(y.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 k(y.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=K6.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),Y1($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new k(y.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(Y1($.status))throw new k(y.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=K6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),Y1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function wG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function bG(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(wG($)&&wG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var Q5=vX(UX(),1),X5=vX(e7(),1);function sO(){let Q=new Q5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return X5.default(Q),Q}class NX{constructor(Q){this._ajv=Q??sO()}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 wX{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 Y5(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 W5(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 bX extends O9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(D6.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 NX,this.setRequestHandler(Q9,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(X9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(U9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=D6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new wX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=bG(this._capabilities,Q)}setRequestHandler(Q,X){let W=G4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(j1(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 A=Q1(B6,z);if(!A.success){let L=A.error instanceof Error?A.error.message:String(A.error);throw new k(y.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:K}=A.data,U=await Promise.resolve(X(z,H));if(K.task){let L=Q1(I1,U);if(!L.success){let q=L.error instanceof Error?L.error.message:String(L.error);throw new k(y.InvalidParams,`Invalid task creation result: ${q}`)}return L.data}let B=Q1(Z4,U);if(!B.success){let L=B.error instanceof Error?B.error.message:String(B.error);throw new k(y.InvalidParams,`Invalid tools/call result: ${L}`)}return B.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){W5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;Y5(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:JG.includes(X)?X:oQ,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"},K4)}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((K)=>K.type==="tool_use").map((K)=>K.id)),A=new Set(W.filter((K)=>K.type==="tool_result").map((K)=>K.toolUseId));if(H.size!==A.size||![...H].every((K)=>A.has(K)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},D9,X);return this.request({method:"sampling/createMessage",params:Q},B9,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},N4,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},N4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new k(y.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof k)throw J;throw new k(y.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},L9,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 J5 from"node:process";class jX{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),
|
|
30
|
-
`}class PX{constructor(Q
|
|
31
|
-
`)}var IX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],z5={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",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",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 WM(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function u0(Q){let X=Q?.trim();return X?X:void 0}function o0(Q){return encodeURIComponent(Q)}function Q0(Q,X){return`${Q}${X}`}function X0(Q,X=""){return`/dashboard/company/${o0(Q)}${X}`}function H5(Q,X,Y){return Q0(Q,`${X0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function GM(Q,X){let Y=IX.map((W)=>[W,X?H5(Q,X,W):""]);return Object.fromEntries(Y)}function K1(Q={},X){let Y=WM(X),W=u0(Q.companyId),G={},J=GM(Y,W);if(!W)return{appUrl:Y,routeTemplates:z5,settingsTabValues:IX,urls:G,settingsUrls:J};G.dashboard=Q0(Y,X0(W)),G.campaigns=Q0(Y,X0(W,"/campaign")),G.sequences=Q0(Y,X0(W,"/sequences")),G.settings=Q0(Y,X0(W,"/settings")),G.emails=Q0(Y,X0(W,"/emails")),G.subscribers=Q0(Y,X0(W,"/subscribers")),G.sentEmails=Q0(Y,X0(W,"/sent-emails")),G.segments=Q0(Y,X0(W,"/segments")),G.metrics=Q0(Y,X0(W,"/metrics")),G.transactional=Q0(Y,X0(W,"/transactional"));let $=u0(Q.campaignId);if($)G.campaign=Q0(Y,X0(W,`/campaign/${o0($)}`));let z=u0(Q.sequenceId);if(z)G.sequence=Q0(Y,X0(W,`/sequences/${o0(z)}`));let H=u0(Q.emailId)??u0(Q.templateId);if(H)G.email=Q0(Y,X0(W,`/emails/${o0(H)}`)),G.template=G.email;let A=u0(Q.transactionalId);if(A)G.transactionalEmail=Q0(Y,X0(W,`/transactional/${o0(A)}`));let K=u0(Q.emailSendId);if(K)G.emailSend=Q0(Y,X0(W,`/sent-emails/${o0(K)}`));let U=u0(Q.domainId);if(U)G.domain=Q0(Y,X0(W,`/settings/domain/${o0(U)}`)),G.domainVerify=`${G.domain}/verify`;let B=u0(Q.status);if(B)G.campaignList=Q0(Y,X0(W,`/campaign/list/${o0(B)}`)),G.sequenceList=Q0(Y,X0(W,`/sequences/list/${o0(B)}`));let L=u0(Q.settingsTab);if(L)G.settingsTab=H5(Y,W,L);return{appUrl:Y,routeTemplates:z5,settingsTabValues:IX,urls:G,settingsUrls:J}}var A5=[{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 K5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await Z("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await Z("GET","/api/v1/account"),W=f1()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await Z("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await Z("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await Z("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await Z("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await Z("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await Z("GET","/api/v1/templates");break;case"sequenzy://segments":X=await Z("GET","/api/v1/segments");break;case"sequenzy://tags":X=await Z("GET","/api/v1/tags");break;case"sequenzy://health":X=await Z("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=K1();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:V1(X)}]}}}var JM={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},$M={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 D5(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 L5(Q){if(typeof Q!=="object"||Q===null)return Q;let X=Q;if(X.kind==="filter"){let Y=D5([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(L5):[]}}function m1(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 zQ(Q,X){if(X.labels===void 0)return;if(!Array.isArray(X.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(X.labels.some((Y)=>typeof Y!=="string"||Y.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function zM(Q){let X=Q.filters!==void 0,Y=Q.root!==void 0;if(X&&Y)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!X&&!Y)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(X){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `create_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `create_segment`.")}if(Y&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.")}function HM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let X={...Q};if(delete X.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)X.enrollmentFieldPath=null;return X}function AM(Q){let X=S(Q,"subscriberId"),Y=Q.fieldValues,W=Y===void 0?void 0:Array.isArray(Y)?Y:void 0;if(Y!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((z)=>typeof z==="string"?z.trim():"").filter((z)=>z.length>0)??[];if(W?.some((z)=>typeof z!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(X!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let J=S(Q,"fieldPath"),$=S(Q,"reason");return{...X!==void 0&&{subscriberId:X},...J!==void 0&&{fieldPath:J},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...$!==void 0&&{reason:$}}}function KM(Q){m1("create_campaign",Q),zQ("create_campaign",Q);let X=S(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&&S(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function UM(Q){m1("create_transactional_email",Q);let X=S(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(X&&(Y||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, 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_transactional_email`.");if(!X&&!Y&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!X&&S(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var U5={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 BM(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 Z0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function B5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function DM(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 LM(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 K=DM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),U=await Z("GET",`/api/v1/subscribers?${K.toString()}`,void 0,X);$=U.pagination?.total??U.subscribers.length,z=U.pagination?.totalPages??1,H+=1,G.push(...U.subscribers??[]);let B=Y!==void 0&&G.length>=Y,L=U.pagination?J>=U.pagination.totalPages:(U.subscribers??[]).length<W;if(B||L)break;J+=1}let A=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:A,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:A.length,truncated:Y!==void 0&&$>0&&A.length<$}}function FM(Q){let X=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,Y=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...X?{email:X}:{},...Y?{externalId:Y}:{}}}function u6(Q,X){let Y=FM(X);if(!Y.email&&!Y.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return Y}function TX(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function EX(Q,X){return Z("GET",TX(Q),void 0,X)}function S(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function F5(Q){let X=S(Q,"companyId");if(X)return X;let Y=f1();if(Y)return Y;try{return(await Z("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function l1(Q,X){if(!Z0(Q)||!X)return Q;return{...Q,url:X}}function $Q(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!Z0(W))return W;let G=S(W,"id");if(!G)return W;let J=K1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G},...Y==="transactional"&&{transactionalId:G}}),$=Y==="campaign"?J.urls.campaign:Y==="sequence"?J.urls.sequence:Y==="template"?J.urls.email:J.urls.transactionalEmail;return l1(W,$)})}function qM(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!Z0(X))return X;let Y=S(X,"id");if(!Y)return X;let W=K1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var OM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function MM(Q,X,Y){if(!Z0(Y)||!OM.has(Q))return Y;let W=Z0(Y.company)?Y.company:void 0,J=S(Y,"selectedCompanyId")??S(Y,"currentCompanyId")??S(Y,"companyId")??(W?S(W,"id"):void 0)??(W?S(W,"companyId"):void 0)??await F5(X);if(!J)return Y;let $=Z0(Y.campaign)?Y.campaign:void 0,z=Z0(Y.sequence)?Y.sequence:void 0,H=Z0(Y.template)?Y.template:void 0,A=Z0(Y.transactional)&&!Array.isArray(Y.transactional)?Y.transactional:void 0,K={companyId:J,campaignId:S(X,"campaignId")??S(Y,"campaignId")??($?S($,"id"):void 0),sequenceId:S(X,"sequenceId")??S(Y,"sequenceId")??(z?S(z,"id"):void 0),emailId:S(Y,"templateId")??(H?S(H,"id"):void 0)??(A?S(A,"emailId"):void 0)??S(X,"templateId"),transactionalId:S(X,"transactionalId")??(A?S(A,"id"):void 0)??S(X,"idOrSlug"),emailSendId:S(X,"emailSendId")??S(Y,"emailSendId")??(Z0(Y.emailSend)?S(Y.emailSend,"id"):void 0),status:S(X,"status")},U=K1(K),B=W?K1({companyId:J}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:qM(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:$Q(Y.campaigns,J,"campaign")},...Array.isArray(Y.sequences)&&{sequences:$Q(Y.sequences,J,"sequence")},...Array.isArray(Y.templates)&&{templates:$Q(Y.templates,J,"template")},...Array.isArray(Y.transactional)&&{transactional:$Q(Y.transactional,J,"transactional")},...W&&B!==void 0&&{company:{...W,url:B.urls.dashboard,settingsUrl:B.urls.settings}},...$&&U.urls.campaign!==void 0&&{campaign:l1($,U.urls.campaign)},...z&&U.urls.sequence!==void 0&&{sequence:l1(z,U.urls.sequence)},...H&&U.urls.email!==void 0&&{template:l1(H,U.urls.email)},...A&&U.urls.transactionalEmail!==void 0&&{transactional:l1(A,U.urls.transactionalEmail)},...Z0(Y.emailSend)&&U.urls.emailSend!==void 0&&{emailSend:l1(Y.emailSend,U.urls.emailSend)},appUrls:U.urls}}var q5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
28
|
+
`)}L.write("payload.value = newResult;"),L.write("return payload;");let S=L.compile();return(E,x)=>S(B,E,x)},$,J=U1,z=!f6.jitless,A=z&&FQ.value,K=X.catchall,U;Q._zod.parse=(B,L)=>{U??(U=W.value);let q=B.value;if(!J(q))return B.issues.push({expected:"object",code:"invalid_type",input:q,inst:Q}),B;if(z&&A&&L?.async===!1&&L.jitless!==!0){if(!$)$=G(X.shape);if(B=$(B,L),!K)return B;return SY([],q,B,L,U,Q)}return Y(B,L)}});function i8(Q,X,Y,W){for(let $ of Q)if($.issues.length===0)return X.value=$.value,X;let G=Q.filter(($)=>!e0($));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(($)=>$.issues.map((J)=>E0(J,W,N0())))}),X}var EQ=F("$ZodUnion",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map(($)=>$._zod.pattern);return new RegExp(`^(${G.map(($)=>n1($.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,$)=>{if(Y)return W(G,$);let J=!1,z=[];for(let H of X.options){let A=H._zod.run({value:G.value,issues:[]},$);if(A instanceof Promise)z.push(A),J=!0;else{if(A.issues.length===0)return A;z.push(A)}}if(!J)return i8(z,G,Q,$);return Promise.all(z).then((H)=>{return i8(H,G,Q,$)})}}),CY=F("$ZodDiscriminatedUnion",(Q,X)=>{EQ.init(Q,X);let Y=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let $ of X.options){let J=$._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let[z,H]of Object.entries(J)){if(!G[z])G[z]=new Set;for(let A of H)G[z].add(A)}}return G});let W=w1(()=>{let G=X.options,$=new Map;for(let J of G){let z=J._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let H of z){if($.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);$.set(H,J)}}return $});Q._zod.parse=(G,$)=>{let J=G.value;if(!U1(J))return G.issues.push({code:"invalid_type",expected:"object",input:J,inst:Q}),G;let z=W.value.get(J?.[X.discriminator]);if(z)return z._zod.run(G,$);if(X.unionFallback)return Y(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:J,path:[X.discriminator],inst:Q}),G}}),kY=F("$ZodIntersection",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,$=X.left._zod.run({value:G,issues:[]},W),J=X.right._zod.run({value:G,issues:[]},W);if($ instanceof Promise||J instanceof Promise)return Promise.all([$,J]).then(([H,A])=>{return n8(Y,H,A)});return n8(Y,$,J)}});function PQ(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(s0(Q)&&s0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter(($)=>Y.indexOf($)!==-1),G={...Q,...X};for(let $ of W){let J=PQ(Q[$],X[$]);if(!J.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],$=X[W],J=PQ(G,$);if(!J.valid)return{valid:!1,mergeErrorPath:[W,...J.mergeErrorPath]};Y.push(J.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function n8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(e0(Q))return Q;let W=PQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var vY=F("$ZodRecord",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!s0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let $=[];if(X.keyType._zod.values){let J=X.keyType._zod.values;Y.value={};for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let A=X.valueType._zod.run({value:G[H],issues:[]},W);if(A instanceof Promise)$.push(A.then((K)=>{if(K.issues.length)Y.issues.push(...m0(H,K.issues));Y.value[H]=K.value}));else{if(A.issues.length)Y.issues.push(...m0(H,A.issues));Y.value[H]=A.value}}let z;for(let H in G)if(!J.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 J of Reflect.ownKeys(G)){if(J==="__proto__")continue;let z=X.keyType._zod.run({value:J,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((A)=>E0(A,W,N0())),input:J,path:[J],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[J],issues:[]},W);if(H instanceof Promise)$.push(H.then((A)=>{if(A.issues.length)Y.issues.push(...m0(J,A.issues));Y.value[z.value]=A.value}));else{if(H.issues.length)Y.issues.push(...m0(J,H.issues));Y.value[z.value]=H.value}}}if($.length)return Promise.all($).then(()=>Y);return Y}});var xY=F("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=DQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>qQ.has(typeof G)).map((G)=>typeof G==="string"?l0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,$)=>{let J=G.value;if(W.has(J))return G;return G.issues.push({code:"invalid_value",values:Y,input:J,inst:Q}),G}}),_Y=F("$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"?l0(Y):Y?l0(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 yY=F("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new c1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((J)=>{return Y.value=J,Y});if(G instanceof Promise)throw new f0;return Y.value=G,Y}});function r8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var gY=F("$ZodOptional",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n1(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(($)=>r8($,Y.value));return r8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),uY=F("$ZodNullable",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n1(Y.source)}|null)$`):void 0}),m(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)}}),hY=F("$ZodDefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(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(($)=>d8($,X));return d8(G,X)}});function d8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var fY=F("$ZodPrefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(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)}}),lY=F("$ZodNonOptional",(Q,X)=>{i.init(Q,X),m(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(($)=>o8($,Q));return o8(G,Q)}});function o8(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 mY=F("$ZodCatch",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(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(($)=>{if(Y.value=$.value,$.issues.length)Y.value=X.catchValue({...Y,error:{issues:$.issues.map((J)=>E0(J,W,N0()))},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(($)=>E0($,W,N0()))},input:Y.value}),Y.issues=[];return Y}});var cY=F("$ZodPipe",(Q,X)=>{i.init(Q,X),m(Q._zod,"values",()=>X.in._zod.values),m(Q._zod,"optin",()=>X.in._zod.optin),m(Q._zod,"optout",()=>X.out._zod.optout),m(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let $=X.out._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>t6(J,X.in,W));return t6($,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then(($)=>t6($,X.out,W));return t6(G,X.out,W)}});function t6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var pY=F("$ZodReadonly",(Q,X)=>{i.init(Q,X),m(Q._zod,"propValues",()=>X.innerType._zod.propValues),m(Q._zod,"values",()=>X.innerType._zod.values),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(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(t8);return t8(G)}});function t8(Q){return Q.value=Object.freeze(Q.value),Q}var iY=F("$ZodCustom",(Q,X)=>{W0.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(($)=>a8($,Y,W,Q));a8(G,Y,W,Q);return}});function a8(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(b1(G))}}var zH=(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},HH=()=>{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 ${zH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${p6(W.values[0])}`;return`Invalid option: expected one of ${l6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",$=X(W.origin);if($)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",$=X(W.origin);if($)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${$.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":""}: ${l6(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 TQ(){return{localeError:HH()}}var fM=Symbol("ZodOutput"),lM=Symbol("ZodInput");class nY{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 AH(){return new nY}var s1=AH();function rY(Q,X){return new Q({type:"string",...I(X)})}function dY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...I(X)})}function SQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...I(X)})}function oY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...I(X)})}function tY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(X)})}function aY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(X)})}function sY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(X)})}function eY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...I(X)})}function QW(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...I(X)})}function XW(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(X)})}function YW(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...I(X)})}function WW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(X)})}function GW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...I(X)})}function $W(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...I(X)})}function JW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(X)})}function zW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(X)})}function HW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(X)})}function AW(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(X)})}function KW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(X)})}function UW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...I(X)})}function BW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...I(X)})}function DW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...I(X)})}function LW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...I(X)})}function FW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(X)})}function qW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...I(X)})}function OW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...I(X)})}function MW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...I(X)})}function VW(Q,X){return new Q({type:"number",checks:[],...I(X)})}function ZW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...I(X)})}function NW(Q,X){return new Q({type:"boolean",...I(X)})}function wW(Q,X){return new Q({type:"null",...I(X)})}function bW(Q){return new Q({type:"unknown"})}function jW(Q,X){return new Q({type:"never",...I(X)})}function e6(Q,X){return new wQ({check:"less_than",...I(X),value:Q,inclusive:!1})}function e1(Q,X){return new wQ({check:"less_than",...I(X),value:Q,inclusive:!0})}function Q4(Q,X){return new bQ({check:"greater_than",...I(X),value:Q,inclusive:!1})}function Q6(Q,X){return new bQ({check:"greater_than",...I(X),value:Q,inclusive:!0})}function X4(Q,X){return new R8({check:"multiple_of",...I(X),value:Q})}function Y4(Q,X){return new k8({check:"max_length",...I(X),maximum:Q})}function j1(Q,X){return new v8({check:"min_length",...I(X),minimum:Q})}function W4(Q,X){return new x8({check:"length_equals",...I(X),length:Q})}function RQ(Q,X){return new _8({check:"string_format",format:"regex",...I(X),pattern:Q})}function CQ(Q){return new y8({check:"string_format",format:"lowercase",...I(Q)})}function kQ(Q){return new g8({check:"string_format",format:"uppercase",...I(Q)})}function vQ(Q,X){return new u8({check:"string_format",format:"includes",...I(X),includes:Q})}function xQ(Q,X){return new h8({check:"string_format",format:"starts_with",...I(X),prefix:Q})}function _Q(Q,X){return new f8({check:"string_format",format:"ends_with",...I(X),suffix:Q})}function B1(Q){return new l8({check:"overwrite",tx:Q})}function yQ(Q){return B1((X)=>X.normalize(Q))}function gQ(){return B1((Q)=>Q.trim())}function uQ(){return B1((Q)=>Q.toLowerCase())}function hQ(){return B1((Q)=>Q.toUpperCase())}function PW(Q,X,Y){return new Q({type:"array",element:X,...I(Y)})}function IW(Q,X,Y){let W=I(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function EW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...I(Y)})}function TW(Q){let X=KH((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(b1(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(b1(G))}},Q(Y.value,Y)});return X}function KH(Q,X){let Y=new W0({check:"custom",...I(X)});return Y._zod.check=Q,Y}function P1(Q){return!!Q._zod}function Q1(Q,X){if(P1(Q))return o1(Q,X);return Q.safeParse(X)}function G4(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 SW(Q){if(P1(Q)){let $=Q._zod?.def;if($){if($.value!==void 0)return $.value;if(Array.isArray($.values)&&$.values.length>0)return $.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 Y6={};xX(Y6,{time:()=>mQ,duration:()=>cQ,datetime:()=>fQ,date:()=>lQ,ZodISOTime:()=>kW,ZodISODuration:()=>vW,ZodISODateTime:()=>RW,ZodISODate:()=>CW});var RW=F("ZodISODateTime",(Q,X)=>{AY.init(Q,X),d.init(Q,X)});function fQ(Q){return FW(RW,Q)}var CW=F("ZodISODate",(Q,X)=>{KY.init(Q,X),d.init(Q,X)});function lQ(Q){return qW(CW,Q)}var kW=F("ZodISOTime",(Q,X)=>{UY.init(Q,X),d.init(Q,X)});function mQ(Q){return OW(kW,Q)}var vW=F("ZodISODuration",(Q,X)=>{BY.init(Q,X),d.init(Q,X)});function cQ(Q){return MW(vW,Q)}var xW=(Q,X)=>{i6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>iX(Q,Y)},flatten:{value:(Y)=>pX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,N1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,N1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},IV=F("ZodError",xW),V0=F("ZodError",xW,{Parent:Error});var _W=n6(V0),yW=r6(V0),gW=d1(V0),uW=t1(V0),hW=nX(V0),fW=rX(V0),lW=dX(V0),mW=oX(V0),cW=tX(V0),pW=aX(V0),iW=sX(V0),nW=eX(V0);var s=F("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(h.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>I0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>_W(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>gW(Q,Y,W),Q.parseAsync=async(Y,W)=>yW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>uW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>hW(Q,Y,W),Q.decode=(Y,W)=>fW(Q,Y,W),Q.encodeAsync=async(Y,W)=>lW(Q,Y,W),Q.decodeAsync=async(Y,W)=>mW(Q,Y,W),Q.safeEncode=(Y,W)=>cW(Q,Y,W),Q.safeDecode=(Y,W)=>pW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>iW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>nW(Q,Y,W),Q.refine=(Y,W)=>Q.check(J3(Y,W)),Q.superRefine=(Y)=>Q.check(z3(Y)),Q.overwrite=(Y)=>Q.check(B1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>oW(Q),Q.nullish=()=>a(oW(Q)),Q.nonoptional=(Y)=>Q3(Q,Y),Q.array=()=>_(Q),Q.or=(Y)=>p([Q,Y]),Q.and=(Y)=>J4(Q,Y),Q.transform=(Y)=>iQ(Q,QG(Y)),Q.default=(Y)=>aH(Q,Y),Q.prefault=(Y)=>eH(Q,Y),Q.catch=(Y)=>Y3(Q,Y),Q.pipe=(Y)=>iQ(Q,Y),Q.readonly=()=>$3(Q),Q.describe=(Y)=>{let W=Q.clone();return s1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return s1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return s1.get(Q);let W=Q.clone();return s1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),tW=F("_ZodString",(Q,X)=>{s6.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(RQ(...W)),Q.includes=(...W)=>Q.check(vQ(...W)),Q.startsWith=(...W)=>Q.check(xQ(...W)),Q.endsWith=(...W)=>Q.check(_Q(...W)),Q.min=(...W)=>Q.check(j1(...W)),Q.max=(...W)=>Q.check(Y4(...W)),Q.length=(...W)=>Q.check(W4(...W)),Q.nonempty=(...W)=>Q.check(j1(1,...W)),Q.lowercase=(W)=>Q.check(CQ(W)),Q.uppercase=(W)=>Q.check(kQ(W)),Q.trim=()=>Q.check(gQ()),Q.normalize=(...W)=>Q.check(yQ(...W)),Q.toLowerCase=()=>Q.check(uQ()),Q.toUpperCase=()=>Q.check(hQ())}),VH=F("ZodString",(Q,X)=>{s6.init(Q,X),tW.init(Q,X),Q.email=(Y)=>Q.check(dY(ZH,Y)),Q.url=(Y)=>Q.check(eY(NH,Y)),Q.jwt=(Y)=>Q.check(LW(yH,Y)),Q.emoji=(Y)=>Q.check(QW(wH,Y)),Q.guid=(Y)=>Q.check(SQ(rW,Y)),Q.uuid=(Y)=>Q.check(oY($4,Y)),Q.uuidv4=(Y)=>Q.check(tY($4,Y)),Q.uuidv6=(Y)=>Q.check(aY($4,Y)),Q.uuidv7=(Y)=>Q.check(sY($4,Y)),Q.nanoid=(Y)=>Q.check(XW(bH,Y)),Q.guid=(Y)=>Q.check(SQ(rW,Y)),Q.cuid=(Y)=>Q.check(YW(jH,Y)),Q.cuid2=(Y)=>Q.check(WW(PH,Y)),Q.ulid=(Y)=>Q.check(GW(IH,Y)),Q.base64=(Y)=>Q.check(UW(vH,Y)),Q.base64url=(Y)=>Q.check(BW(xH,Y)),Q.xid=(Y)=>Q.check($W(EH,Y)),Q.ksuid=(Y)=>Q.check(JW(TH,Y)),Q.ipv4=(Y)=>Q.check(zW(SH,Y)),Q.ipv6=(Y)=>Q.check(HW(RH,Y)),Q.cidrv4=(Y)=>Q.check(AW(CH,Y)),Q.cidrv6=(Y)=>Q.check(KW(kH,Y)),Q.e164=(Y)=>Q.check(DW(_H,Y)),Q.datetime=(Y)=>Q.check(fQ(Y)),Q.date=(Y)=>Q.check(lQ(Y)),Q.time=(Y)=>Q.check(mQ(Y)),Q.duration=(Y)=>Q.check(cQ(Y))});function D(Q){return rY(VH,Q)}var d=F("ZodStringFormat",(Q,X)=>{n.init(Q,X),tW.init(Q,X)}),ZH=F("ZodEmail",(Q,X)=>{QY.init(Q,X),d.init(Q,X)});var rW=F("ZodGUID",(Q,X)=>{s8.init(Q,X),d.init(Q,X)});var $4=F("ZodUUID",(Q,X)=>{e8.init(Q,X),d.init(Q,X)});var NH=F("ZodURL",(Q,X)=>{XY.init(Q,X),d.init(Q,X)});var wH=F("ZodEmoji",(Q,X)=>{YY.init(Q,X),d.init(Q,X)});var bH=F("ZodNanoID",(Q,X)=>{WY.init(Q,X),d.init(Q,X)});var jH=F("ZodCUID",(Q,X)=>{GY.init(Q,X),d.init(Q,X)});var PH=F("ZodCUID2",(Q,X)=>{$Y.init(Q,X),d.init(Q,X)});var IH=F("ZodULID",(Q,X)=>{JY.init(Q,X),d.init(Q,X)});var EH=F("ZodXID",(Q,X)=>{zY.init(Q,X),d.init(Q,X)});var TH=F("ZodKSUID",(Q,X)=>{HY.init(Q,X),d.init(Q,X)});var SH=F("ZodIPv4",(Q,X)=>{DY.init(Q,X),d.init(Q,X)});var RH=F("ZodIPv6",(Q,X)=>{LY.init(Q,X),d.init(Q,X)});var CH=F("ZodCIDRv4",(Q,X)=>{FY.init(Q,X),d.init(Q,X)});var kH=F("ZodCIDRv6",(Q,X)=>{qY.init(Q,X),d.init(Q,X)});var vH=F("ZodBase64",(Q,X)=>{MY.init(Q,X),d.init(Q,X)});var xH=F("ZodBase64URL",(Q,X)=>{VY.init(Q,X),d.init(Q,X)});var _H=F("ZodE164",(Q,X)=>{ZY.init(Q,X),d.init(Q,X)});var yH=F("ZodJWT",(Q,X)=>{NY.init(Q,X),d.init(Q,X)});var aW=F("ZodNumber",(Q,X)=>{IQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(Q4(W,G)),Q.gte=(W,G)=>Q.check(Q6(W,G)),Q.min=(W,G)=>Q.check(Q6(W,G)),Q.lt=(W,G)=>Q.check(e6(W,G)),Q.lte=(W,G)=>Q.check(e1(W,G)),Q.max=(W,G)=>Q.check(e1(W,G)),Q.int=(W)=>Q.check(dW(W)),Q.safe=(W)=>Q.check(dW(W)),Q.positive=(W)=>Q.check(Q4(0,W)),Q.nonnegative=(W)=>Q.check(Q6(0,W)),Q.negative=(W)=>Q.check(e6(0,W)),Q.nonpositive=(W)=>Q.check(e1(0,W)),Q.multipleOf=(W,G)=>Q.check(X4(W,G)),Q.step=(W,G)=>Q.check(X4(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 l(Q){return VW(aW,Q)}var gH=F("ZodNumberFormat",(Q,X)=>{wY.init(Q,X),aW.init(Q,X)});function dW(Q){return ZW(gH,Q)}var uH=F("ZodBoolean",(Q,X)=>{bY.init(Q,X),s.init(Q,X)});function Y0(Q){return NW(uH,Q)}var hH=F("ZodNull",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function nQ(Q){return wW(hH,Q)}var fH=F("ZodUnknown",(Q,X)=>{PY.init(Q,X),s.init(Q,X)});function o(){return bW(fH)}var lH=F("ZodNever",(Q,X)=>{IY.init(Q,X),s.init(Q,X)});function mH(Q){return jW(lH,Q)}var cH=F("ZodArray",(Q,X)=>{EY.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(Y4(Y,W)),Q.length=(Y,W)=>Q.check(W4(Y,W)),Q.unwrap=()=>Q.element});function _(Q,X){return PW(cH,Q,X)}var sW=F("ZodObject",(Q,X)=>{RY.init(Q,X),s.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>L0(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:mH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return h.extend(Q,Y)},Q.safeExtend=(Y)=>{return h.safeExtend(Q,Y)},Q.merge=(Y)=>h.merge(Q,Y),Q.pick=(Y)=>h.pick(Q,Y),Q.omit=(Y)=>h.omit(Q,Y),Q.partial=(...Y)=>h.partial(XG,Q,Y[0]),Q.required=(...Y)=>h.required(YG,Q,Y[0])});function w(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new sW(Y)}function K0(Q,X){return new sW({type:"object",shape:Q,catchall:o(),...h.normalizeParams(X)})}var eW=F("ZodUnion",(Q,X)=>{EQ.init(Q,X),s.init(Q,X),Q.options=X.options});function p(Q,X){return new eW({type:"union",options:Q,...h.normalizeParams(X)})}var pH=F("ZodDiscriminatedUnion",(Q,X)=>{eW.init(Q,X),CY.init(Q,X)});function rQ(Q,X,Y){return new pH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var iH=F("ZodIntersection",(Q,X)=>{kY.init(Q,X),s.init(Q,X)});function J4(Q,X){return new iH({type:"intersection",left:Q,right:X})}var nH=F("ZodRecord",(Q,X)=>{vY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new nH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var pQ=F("ZodEnum",(Q,X)=>{xY.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 $={};for(let J of W)if(Y.has(J))$[J]=X.entries[J];else throw Error(`Key ${J} not found in enum`);return new pQ({...X,checks:[],...h.normalizeParams(G),entries:$})},Q.exclude=(W,G)=>{let $={...X.entries};for(let J of W)if(Y.has(J))delete $[J];else throw Error(`Key ${J} not found in enum`);return new pQ({...X,checks:[],...h.normalizeParams(G),entries:$})}});function L0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new pQ({type:"enum",entries:Y,...h.normalizeParams(X)})}var rH=F("ZodLiteral",(Q,X)=>{_Y.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 b(Q,X){return new rH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var dH=F("ZodTransform",(Q,X)=>{yY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new c1(Q.constructor.name);Y.addIssue=($)=>{if(typeof $==="string")Y.issues.push(h.issue($,Y.value,X));else{let J=$;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=Y.value),J.inst??(J.inst=Q),Y.issues.push(h.issue(J))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then(($)=>{return Y.value=$,Y});return Y.value=G,Y}});function QG(Q){return new dH({type:"transform",transform:Q})}var XG=F("ZodOptional",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new XG({type:"optional",innerType:Q})}var oH=F("ZodNullable",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function oW(Q){return new oH({type:"nullable",innerType:Q})}var tH=F("ZodDefault",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function aH(Q,X){return new tH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var sH=F("ZodPrefault",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function eH(Q,X){return new sH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var YG=F("ZodNonOptional",(Q,X)=>{lY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function Q3(Q,X){return new YG({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var X3=F("ZodCatch",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function Y3(Q,X){return new X3({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var W3=F("ZodPipe",(Q,X)=>{cY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function iQ(Q,X){return new W3({type:"pipe",in:Q,out:X})}var G3=F("ZodReadonly",(Q,X)=>{pY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function $3(Q){return new G3({type:"readonly",innerType:Q})}var WG=F("ZodCustom",(Q,X)=>{iY.init(Q,X),s.init(Q,X)});function GG(Q,X){return IW(WG,Q??(()=>!0),X)}function J3(Q,X={}){return EW(WG,Q,X)}function z3(Q){return TW(Q)}function dQ(Q,X){return iQ(QG(Q),X)}N0(TQ());var oQ="2025-11-25";var $G=[oQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",H4="2.0",G0=GG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),JG=p([D(),l().int()]),zG=D(),NZ=K0({ttl:p([l(),nQ()]).optional(),pollInterval:l().optional()}),H3=w({ttl:l().optional()}),A3=w({taskId:D()}),tQ=K0({progressToken:JG.optional(),[X1]:A3.optional()}),Z0=w({_meta:tQ.optional()}),W6=Z0.extend({task:H3.optional()}),HG=(Q)=>W6.safeParse(Q).success,$0=w({method:D(),params:Z0.loose().optional()}),w0=w({_meta:tQ.optional()}),b0=w({method:D(),params:w0.loose().optional()}),J0=K0({_meta:tQ.optional()}),A4=p([D(),l().int()]),AG=w({jsonrpc:b(H4),id:A4,...$0.shape}).strict(),aQ=(Q)=>AG.safeParse(Q).success,KG=w({jsonrpc:b(H4),...b0.shape}).strict(),UG=(Q)=>KG.safeParse(Q).success,sQ=w({jsonrpc:b(H4),id:A4,result:J0}).strict(),G6=(Q)=>sQ.safeParse(Q).success;var y;(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"})(y||(y={}));var eQ=w({jsonrpc:b(H4),id:A4.optional(),error:w({code:l().int(),message:D(),data:o().optional()})}).strict();var BG=(Q)=>eQ.safeParse(Q).success;var DG=p([AG,KG,sQ,eQ]),wZ=p([sQ,eQ]),K4=J0.strict(),K3=w0.extend({requestId:A4.optional(),reason:D().optional()}),U4=b0.extend({method:b("notifications/cancelled"),params:K3}),U3=w({src:D(),mimeType:D().optional(),sizes:_(D()).optional(),theme:L0(["light","dark"]).optional()}),$6=w({icons:_(U3).optional()}),I1=w({name:D(),title:D().optional()}),LG=I1.extend({...I1.shape,...$6.shape,version:D(),websiteUrl:D().optional(),description:D().optional()}),B3=J4(w({applyDefaults:Y0().optional()}),t(D(),o())),D3=dQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},J4(w({form:B3.optional(),url:G0.optional()}),t(D(),o()).optional())),L3=K0({list:G0.optional(),cancel:G0.optional(),requests:K0({sampling:K0({createMessage:G0.optional()}).optional(),elicitation:K0({create:G0.optional()}).optional()}).optional()}),F3=K0({list:G0.optional(),cancel:G0.optional(),requests:K0({tools:K0({call:G0.optional()}).optional()}).optional()}),q3=w({experimental:t(D(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:D3.optional(),roots:w({listChanged:Y0().optional()}).optional(),tasks:L3.optional()}),O3=Z0.extend({protocolVersion:D(),capabilities:q3,clientInfo:LG}),Q9=$0.extend({method:b("initialize"),params:O3});var M3=w({experimental:t(D(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:Y0().optional()}).optional(),resources:w({subscribe:Y0().optional(),listChanged:Y0().optional()}).optional(),tools:w({listChanged:Y0().optional()}).optional(),tasks:F3.optional()}),V3=J0.extend({protocolVersion:D(),capabilities:M3,serverInfo:LG,instructions:D().optional()}),X9=b0.extend({method:b("notifications/initialized"),params:w0.optional()});var B4=$0.extend({method:b("ping"),params:Z0.optional()}),Z3=w({progress:l(),total:a(l()),message:a(D())}),N3=w({...w0.shape,...Z3.shape,progressToken:JG}),D4=b0.extend({method:b("notifications/progress"),params:N3}),w3=Z0.extend({cursor:zG.optional()}),J6=$0.extend({params:w3.optional()}),z6=J0.extend({nextCursor:zG.optional()}),b3=L0(["working","input_required","completed","failed","cancelled"]),H6=w({taskId:D(),status:b3,ttl:p([l(),nQ()]),createdAt:D(),lastUpdatedAt:D(),pollInterval:a(l()),statusMessage:a(D())}),E1=J0.extend({task:H6}),j3=w0.merge(H6),A6=b0.extend({method:b("notifications/tasks/status"),params:j3}),L4=$0.extend({method:b("tasks/get"),params:Z0.extend({taskId:D()})}),F4=J0.merge(H6),q4=$0.extend({method:b("tasks/result"),params:Z0.extend({taskId:D()})}),bZ=J0.loose(),O4=J6.extend({method:b("tasks/list")}),M4=z6.extend({tasks:_(H6)}),V4=$0.extend({method:b("tasks/cancel"),params:Z0.extend({taskId:D()})}),FG=J0.merge(H6),qG=w({uri:D(),mimeType:a(D()),_meta:t(D(),o()).optional()}),OG=qG.extend({text:D()}),Y9=D().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),MG=qG.extend({blob:Y9}),K6=L0(["user","assistant"]),T1=w({audience:_(K6).optional(),priority:l().min(0).max(1).optional(),lastModified:Y6.datetime({offset:!0}).optional()}),VG=w({...I1.shape,...$6.shape,uri:D(),description:a(D()),mimeType:a(D()),annotations:T1.optional(),_meta:a(K0({}))}),P3=w({...I1.shape,...$6.shape,uriTemplate:D(),description:a(D()),mimeType:a(D()),annotations:T1.optional(),_meta:a(K0({}))}),W9=J6.extend({method:b("resources/list")}),I3=z6.extend({resources:_(VG)}),E3=J6.extend({method:b("resources/templates/list")}),T3=z6.extend({resourceTemplates:_(P3)}),G9=Z0.extend({uri:D()}),S3=G9,$9=$0.extend({method:b("resources/read"),params:S3}),R3=J0.extend({contents:_(p([OG,MG]))}),C3=b0.extend({method:b("notifications/resources/list_changed"),params:w0.optional()}),k3=G9,v3=$0.extend({method:b("resources/subscribe"),params:k3}),x3=G9,_3=$0.extend({method:b("resources/unsubscribe"),params:x3}),y3=w0.extend({uri:D()}),g3=b0.extend({method:b("notifications/resources/updated"),params:y3}),u3=w({name:D(),description:a(D()),required:a(Y0())}),h3=w({...I1.shape,...$6.shape,description:a(D()),arguments:a(_(u3)),_meta:a(K0({}))}),f3=J6.extend({method:b("prompts/list")}),l3=z6.extend({prompts:_(h3)}),m3=Z0.extend({name:D(),arguments:t(D(),D()).optional()}),c3=$0.extend({method:b("prompts/get"),params:m3}),J9=w({type:b("text"),text:D(),annotations:T1.optional(),_meta:t(D(),o()).optional()}),z9=w({type:b("image"),data:Y9,mimeType:D(),annotations:T1.optional(),_meta:t(D(),o()).optional()}),H9=w({type:b("audio"),data:Y9,mimeType:D(),annotations:T1.optional(),_meta:t(D(),o()).optional()}),p3=w({type:b("tool_use"),name:D(),id:D(),input:t(D(),o()),_meta:t(D(),o()).optional()}),i3=w({type:b("resource"),resource:p([OG,MG]),annotations:T1.optional(),_meta:t(D(),o()).optional()}),n3=VG.extend({type:b("resource_link")}),A9=p([J9,z9,H9,n3,i3]),r3=w({role:K6,content:A9}),d3=J0.extend({description:D().optional(),messages:_(r3)}),o3=b0.extend({method:b("notifications/prompts/list_changed"),params:w0.optional()}),t3=w({title:D().optional(),readOnlyHint:Y0().optional(),destructiveHint:Y0().optional(),idempotentHint:Y0().optional(),openWorldHint:Y0().optional()}),a3=w({taskSupport:L0(["required","optional","forbidden"]).optional()}),ZG=w({...I1.shape,...$6.shape,description:D().optional(),inputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()).optional(),annotations:t3.optional(),execution:a3.optional(),_meta:t(D(),o()).optional()}),K9=J6.extend({method:b("tools/list")}),s3=z6.extend({tools:_(ZG)}),Z4=J0.extend({content:_(A9).default([]),structuredContent:t(D(),o()).optional(),isError:Y0().optional()}),jZ=Z4.or(J0.extend({toolResult:o()})),e3=W6.extend({name:D(),arguments:t(D(),o()).optional()}),U6=$0.extend({method:b("tools/call"),params:e3}),QA=b0.extend({method:b("notifications/tools/list_changed"),params:w0.optional()}),PZ=w({autoRefresh:Y0().default(!0),debounceMs:l().int().nonnegative().default(300)}),B6=L0(["debug","info","notice","warning","error","critical","alert","emergency"]),XA=Z0.extend({level:B6}),U9=$0.extend({method:b("logging/setLevel"),params:XA}),YA=w0.extend({level:B6,logger:D().optional(),data:o()}),WA=b0.extend({method:b("notifications/message"),params:YA}),GA=w({name:D().optional()}),$A=w({hints:_(GA).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),JA=w({mode:L0(["auto","required","none"]).optional()}),zA=w({type:b("tool_result"),toolUseId:D().describe("The unique identifier for the corresponding tool call."),content:_(A9).default([]),structuredContent:w({}).loose().optional(),isError:Y0().optional(),_meta:t(D(),o()).optional()}),HA=rQ("type",[J9,z9,H9]),z4=rQ("type",[J9,z9,H9,p3,zA]),AA=w({role:K6,content:p([z4,_(z4)]),_meta:t(D(),o()).optional()}),KA=W6.extend({messages:_(AA),modelPreferences:$A.optional(),systemPrompt:D().optional(),includeContext:L0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(D()).optional(),metadata:G0.optional(),tools:_(ZG).optional(),toolChoice:JA.optional()}),UA=$0.extend({method:b("sampling/createMessage"),params:KA}),B9=J0.extend({model:D(),stopReason:a(L0(["endTurn","stopSequence","maxTokens"]).or(D())),role:K6,content:HA}),D9=J0.extend({model:D(),stopReason:a(L0(["endTurn","stopSequence","maxTokens","toolUse"]).or(D())),role:K6,content:p([z4,_(z4)])}),BA=w({type:b("boolean"),title:D().optional(),description:D().optional(),default:Y0().optional()}),DA=w({type:b("string"),title:D().optional(),description:D().optional(),minLength:l().optional(),maxLength:l().optional(),format:L0(["email","uri","date","date-time"]).optional(),default:D().optional()}),LA=w({type:L0(["number","integer"]),title:D().optional(),description:D().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),FA=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),default:D().optional()}),qA=w({type:b("string"),title:D().optional(),description:D().optional(),oneOf:_(w({const:D(),title:D()})),default:D().optional()}),OA=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),enumNames:_(D()).optional(),default:D().optional()}),MA=p([FA,qA]),VA=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(D())}),default:_(D()).optional()}),ZA=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:D(),title:D()}))}),default:_(D()).optional()}),NA=p([VA,ZA]),wA=p([OA,MA,NA]),bA=p([wA,BA,DA,LA]),jA=W6.extend({mode:b("form").optional(),message:D(),requestedSchema:w({type:b("object"),properties:t(D(),bA),required:_(D()).optional()})}),PA=W6.extend({mode:b("url"),message:D(),elicitationId:D(),url:D().url()}),IA=p([jA,PA]),EA=$0.extend({method:b("elicitation/create"),params:IA}),TA=w0.extend({elicitationId:D()}),SA=b0.extend({method:b("notifications/elicitation/complete"),params:TA}),N4=J0.extend({action:L0(["accept","decline","cancel"]),content:dQ((Q)=>Q===null?void 0:Q,t(D(),p([D(),l(),Y0(),_(D())])).optional())}),RA=w({type:b("ref/resource"),uri:D()});var CA=w({type:b("ref/prompt"),name:D()}),kA=Z0.extend({ref:p([CA,RA]),argument:w({name:D(),value:D()}),context:w({arguments:t(D(),D()).optional()}).optional()}),vA=$0.extend({method:b("completion/complete"),params:kA});var xA=J0.extend({completion:K0({values:_(D()).max(100),total:a(l().int()),hasMore:a(Y0())})}),_A=w({uri:D().startsWith("file://"),name:D().optional(),_meta:t(D(),o()).optional()}),yA=$0.extend({method:b("roots/list"),params:Z0.optional()}),L9=J0.extend({roots:_(_A)}),gA=b0.extend({method:b("notifications/roots/list_changed"),params:w0.optional()}),IZ=p([B4,Q9,vA,U9,c3,f3,W9,E3,$9,v3,_3,U6,K9,L4,q4,O4,V4]),EZ=p([U4,D4,X9,gA,A6]),TZ=p([K4,B9,D9,N4,L9,F4,M4,E1]),SZ=p([B4,UA,EA,yA,L4,q4,O4,V4]),RZ=p([U4,D4,WA,g3,C3,QA,o3,A6,SA]),CZ=p([K4,V3,xA,d3,l3,I3,T3,R3,Z4,s3,F4,M4,E1]);class k 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===y.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new NG(W.elicitations,X)}return new k(Q,X,Y)}}class NG extends k{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(y.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function Y1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var uA=Symbol("Let zodToJsonSchema decide on which parser to use");var KN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function F9(Q){let Y=G4(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=SW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function q9(Q,X){let Y=Q1(Q,X);if(!Y.success)throw Y.error;return Y.data}var pA=60000;class O9{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(U4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(D4,(X)=>{this._onprogress(X)}),this.setRequestHandler(B4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(L4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(q4,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if(J.type==="response"||J.type==="error"){let z=J.message,H=z.id,A=this._requestResolvers.get(H);if(A)if(this._requestResolvers.delete(H),J.type==="response")A(z);else{let K=z,U=new k(K.error.code,K.error.message,K.error.data);A(U)}else{let K=J.type==="response"?"Response":"Error";this._onerror(Error(`${K} handler missing for request ${H}`))}continue}await this._transport?.send(J.message,{relatedRequestId:Y.requestId})}}let $=await this._taskStore.getTask(G,Y.sessionId);if(!$)throw new k(y.InvalidParams,`Task not found: ${G}`);if(!Y1($.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(Y1($.status)){let J=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...J,_meta:{...J._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(O4,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 k(y.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(V4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,`Task not found: ${X.params.taskId}`);if(Y1(W.status))throw new k(y.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 k(y.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof k)throw W;throw new k(y.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),k.fromError(y.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,$)=>{if(W?.(G,$),G6(G)||BG(G))this._onresponse(G);else if(aQ(G))this._onrequest(G,$);else if(UG(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=k.fromError(y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[X1]?.taskId;if(Y===void 0){let A={jsonrpc:"2.0",id:Q.id,error:{code:y.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId).catch((K)=>this._onerror(Error(`Failed to enqueue error response: ${K}`)));else W?.send(A).catch((K)=>this._onerror(Error(`Failed to send an error response: ${K}`)));return}let $=new AbortController;this._requestHandlerAbortControllers.set(Q.id,$);let J=HG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:$.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(A)=>{let K={relatedRequestId:Q.id};if(G)K.relatedTask={taskId:G};await this.notification(A,K)},sendRequest:async(A,K,U)=>{let B={...U,relatedRequestId:Q.id};if(G&&!B.relatedTask)B.relatedTask={taskId:G};let L=B.relatedTask?.taskId??G;if(L&&z)await z.updateTaskStatus(L,"input_required");return await this.request(A,K,B)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:J?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(A)=>{if($.signal.aborted)return;let K={result:A,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)},async(A)=>{if($.signal.aborted)return;let K={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(A.code)?A.code:y.InternalError,message:A.message??"Internal error",...A.data!==void 0&&{data:A.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)}).catch((A)=>this._onerror(Error(`Failed to send response: ${A}`))).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 $=this._responseHandlers.get(W),J=this._timeoutInfo.get(W);if(J&&$&&J.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),$(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),G6(Q))Y(Q);else{let $=new k(Q.error.code,Q.error.message,Q.error.data);Y($)}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(G6(Q)&&Q.result&&typeof Q.result==="object"){let $=Q.result;if($.task&&typeof $.task==="object"){let J=$.task;if(typeof J.taskId==="string")G=!0,this._taskProgressTokens.set(J.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(G6(Q))W(Q);else{let $=k.fromError(Q.error.code,Q.error.message,Q.error.data);W($)}}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($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}return}let G;try{let $=await this.request(Q,E1,Y);if($.task)G=$.task.taskId,yield{type:"taskCreated",task:$.task};else throw new k(y.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:J},Y1(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if(J.status==="failed")yield{type:"error",error:new k(y.InternalError,`Task ${G} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k(y.InternalError,`Task ${G} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$,task:J,relatedTask:z}=Y??{};return new Promise((H,A)=>{let K=(M)=>{A(M)};if(!this._transport){K(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),J)this.assertTaskCapability(Q.method)}catch(M){K(M);return}Y?.signal?.throwIfAborted();let U=this._requestMessageId++,B={...Q,jsonrpc:"2.0",id:U};if(Y?.onprogress)this._progressHandlers.set(U,Y.onprogress),B.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:U}};if(J)B.params={...B.params,task:J};if(z)B.params={...B.params,_meta:{...B.params?._meta||{},[X1]:z}};let L=(M)=>{this._responseHandlers.delete(U),this._progressHandlers.delete(U),this._cleanupTimeout(U),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:U,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let S=M instanceof k?M:new k(y.RequestTimeout,String(M));A(S)};this._responseHandlers.set(U,(M)=>{if(Y?.signal?.aborted)return;if(M instanceof Error)return A(M);try{let S=Q1(X,M.result);if(!S.success)A(S.error);else H(S.data)}catch(S){A(S)}}),Y?.signal?.addEventListener("abort",()=>{L(Y?.signal?.reason)});let q=Y?.timeout??pA,O=()=>L(k.fromError(y.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(U,q,Y?.maxTotalTimeout,O,Y?.resetTimeoutOnProgress??!1);let V=z?.taskId;if(V){let M=(S)=>{let E=this._responseHandlers.get(U);if(E)E(S);else this._onerror(Error(`Response handler missing for side-channeled request ${U}`))};this._requestResolvers.set(U,M),this._enqueueTaskMessage(V,{type:"request",message:B,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(U),A(S)})}else this._transport.send(B,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((M)=>{this._cleanupTimeout(U),A(M)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},F4,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},M4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},FG,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let J={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:J,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 J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[X1]:X.relatedTask}}};this._transport?.send(J,X).catch((z)=>this._onerror(z))});return}let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[X1]:X.relatedTask}}};await this._transport.send($,X)}setRequestHandler(Q,X){let Y=F9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let $=q9(Q,W);return Promise.resolve(X($,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=F9(Q);this._notificationHandlers.set(Y,(W)=>{let G=q9(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"&&aQ(W.message)){let G=W.message.id,$=this._requestResolvers.get(G);if($)$(new k(y.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 k(y.InvalidRequest,"Request cancelled"));return}let $=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout($),G(new k(y.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 k(y.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,$)=>{await Y.storeTaskResult(W,G,$,X);let J=await Y.getTask(W,X);if(J){let z=A6.parse({method:"notifications/tasks/status",params:J});if(await this.notification(z),Y1(J.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,$)=>{let J=await Y.getTask(W,X);if(!J)throw new k(y.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(Y1(J.status))throw new k(y.InvalidParams,`Cannot update task "${W}" from terminal status "${J.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,$,X);let z=await Y.getTask(W,X);if(z){let H=A6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),Y1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function wG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function bG(Q,X){let Y={...Q};for(let W in X){let G=W,$=X[G];if($===void 0)continue;let J=Y[G];if(wG(J)&&wG($))Y[G]={...J,...$};else Y[G]=$}return Y}var Q5=vX(UX(),1),X5=vX(e7(),1);function eO(){let Q=new Q5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return X5.default(Q),Q}class NX{constructor(Q){this._ajv=Q??eO()}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 wX{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 Y5(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 W5(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 bX extends O9{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 NX,this.setRequestHandler(Q9,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(X9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(U9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:$}=Y.params,J=B6.safeParse($);if(J.success)this._loggingLevels.set(G,J.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new wX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=bG(this._capabilities,Q)}setRequestHandler(Q,X){let W=G4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(P1(W)){let J=W;G=J._zod?.def?.value??J.value}else{let J=W;G=J._def?.value??J.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let J=async(z,H)=>{let A=Q1(U6,z);if(!A.success){let L=A.error instanceof Error?A.error.message:String(A.error);throw new k(y.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:K}=A.data,U=await Promise.resolve(X(z,H));if(K.task){let L=Q1(E1,U);if(!L.success){let q=L.error instanceof Error?L.error.message:String(L.error);throw new k(y.InvalidParams,`Invalid task creation result: ${q}`)}return L.data}let B=Q1(Z4,U);if(!B.success){let L=B.error instanceof Error?B.error.message:String(B.error);throw new k(y.InvalidParams,`Invalid tools/call result: ${L}`)}return B.data};return super.setRequestHandler(Q,J)}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){W5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;Y5(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:$G.includes(X)?X:oQ,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"},K4)}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"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,J=$?Array.isArray($.content)?$.content:[$.content]:[],z=J.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(J.filter((K)=>K.type==="tool_use").map((K)=>K.id)),A=new Set(W.filter((K)=>K.type==="tool_result").map((K)=>K.toolUseId));if(H.size!==A.size||![...H].every((K)=>A.has(K)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},D9,X);return this.request({method:"sampling/createMessage",params:Q},B9,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},N4,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},N4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let J=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!J.valid)throw new k(y.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorMessage}`)}catch($){if($ instanceof k)throw $;throw new k(y.InternalError,`Error validating elicitation response: ${$ instanceof Error?$.message:String($)}`)}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},L9,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 $5 from"node:process";class jX{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),QM(X)}clear(){this._buffer=void 0}}function QM(Q){return DG.parse(JSON.parse(Q))}function G5(Q){return JSON.stringify(Q)+`
|
|
30
|
+
`}class PX{constructor(Q=$5.stdin,X=$5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new jX,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=G5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var J5={name:"@sequenzy/mcp",version:"0.0.36",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 f1 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 YM(Q){if(Q instanceof f1)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 WM(Q){let X=YM(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 V1(Q){let X=WM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
|
|
31
|
+
`)}var IX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],z5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignPreview:"/dashboard/company/{companyId}/campaign/{campaignId}?step=review",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",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",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 GM(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function u0(Q){let X=Q?.trim();return X?X:void 0}function o0(Q){return encodeURIComponent(Q)}function Q0(Q,X){return`${Q}${X}`}function X0(Q,X=""){return`/dashboard/company/${o0(Q)}${X}`}function H5(Q,X,Y){return Q0(Q,`${X0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function $M(Q,X){let Y=IX.map((W)=>[W,X?H5(Q,X,W):""]);return Object.fromEntries(Y)}function K1(Q={},X){let Y=GM(X),W=u0(Q.companyId),G={},$=$M(Y,W);if(!W)return{appUrl:Y,routeTemplates:z5,settingsTabValues:IX,urls:G,settingsUrls:$};G.dashboard=Q0(Y,X0(W)),G.campaigns=Q0(Y,X0(W,"/campaign")),G.sequences=Q0(Y,X0(W,"/sequences")),G.settings=Q0(Y,X0(W,"/settings")),G.emails=Q0(Y,X0(W,"/emails")),G.subscribers=Q0(Y,X0(W,"/subscribers")),G.sentEmails=Q0(Y,X0(W,"/sent-emails")),G.segments=Q0(Y,X0(W,"/segments")),G.metrics=Q0(Y,X0(W,"/metrics")),G.transactional=Q0(Y,X0(W,"/transactional"));let J=u0(Q.campaignId);if(J)G.campaign=Q0(Y,X0(W,`/campaign/${o0(J)}`)),G.campaignPreview=`${G.campaign}?step=review`;let z=u0(Q.sequenceId);if(z)G.sequence=Q0(Y,X0(W,`/sequences/${o0(z)}`));let H=u0(Q.emailId)??u0(Q.templateId);if(H)G.email=Q0(Y,X0(W,`/emails/${o0(H)}`)),G.template=G.email;let A=u0(Q.transactionalId);if(A)G.transactionalEmail=Q0(Y,X0(W,`/transactional/${o0(A)}`));let K=u0(Q.emailSendId);if(K)G.emailSend=Q0(Y,X0(W,`/sent-emails/${o0(K)}`));let U=u0(Q.domainId);if(U)G.domain=Q0(Y,X0(W,`/settings/domain/${o0(U)}`)),G.domainVerify=`${G.domain}/verify`;let B=u0(Q.status);if(B)G.campaignList=Q0(Y,X0(W,`/campaign/list/${o0(B)}`)),G.sequenceList=Q0(Y,X0(W,`/sequences/list/${o0(B)}`));let L=u0(Q.settingsTab);if(L)G.settingsTab=H5(Y,W,L);return{appUrl:Y,routeTemplates:z5,settingsTabValues:IX,urls:G,settingsUrls:$}}var A5=[{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 K5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await Z("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await Z("GET","/api/v1/account"),W=l1()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await Z("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await Z("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await Z("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await Z("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await Z("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await Z("GET","/api/v1/templates");break;case"sequenzy://segments":X=await Z("GET","/api/v1/segments");break;case"sequenzy://tags":X=await Z("GET","/api/v1/tags");break;case"sequenzy://health":X=await Z("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=K1();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:V1(X)}]}}}var JM={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},zM={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 D5(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 L5(Q){if(typeof Q!=="object"||Q===null)return Q;let X=Q;if(X.kind==="filter"){let Y=D5([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(L5):[]}}function Z1(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 zQ(Q,X){if(X.labels===void 0)return;if(!Array.isArray(X.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(X.labels.some((Y)=>typeof Y!=="string"||Y.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function HM(Q){let X=Q.filters!==void 0,Y=Q.root!==void 0;if(X&&Y)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!X&&!Y)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(X){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `create_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `create_segment`.")}if(Y&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.")}function AM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let X={...Q};if(delete X.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)X.enrollmentFieldPath=null;return X}function KM(Q){let X=P(Q,"subscriberId"),Y=Q.fieldValues,W=Y===void 0?void 0:Array.isArray(Y)?Y:void 0;if(Y!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((z)=>typeof z==="string"?z.trim():"").filter((z)=>z.length>0)??[];if(W?.some((z)=>typeof z!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(X!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let $=P(Q,"fieldPath"),J=P(Q,"reason");return{...X!==void 0&&{subscriberId:X},...$!==void 0&&{fieldPath:$},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...J!==void 0&&{reason:J}}}function UM(Q){Z1("create_campaign",Q),zQ("create_campaign",Q);let X=P(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&&P(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function BM(Q){if(P(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!D0(Q.targetLists))throw Error("`targetLists` must be an object when calling `schedule_campaign`.");if(Q.sendTimeOptimization!==void 0){if(typeof Q.sendTimeOptimization!=="boolean")throw Error("`sendTimeOptimization` must be a boolean when calling `schedule_campaign`.")}if(Q.spreadOverHours!==void 0){if(typeof Q.spreadOverHours!=="number"||!Number.isInteger(Q.spreadOverHours)||Q.spreadOverHours<1||Q.spreadOverHours>72)throw Error("`spreadOverHours` must be an integer between 1 and 72 when calling `schedule_campaign`.")}}function DM(Q){Z1("create_transactional_email",Q);let X=P(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(X&&(Y||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, 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_transactional_email`.");if(!X&&!Y&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!X&&P(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var U5={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 LM(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 D0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function B5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function FM(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 qM(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=[],$=1,J=0,z=0,H=0;while(!0){let K=FM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:$,pageSize:W}),U=await Z("GET",`/api/v1/subscribers?${K.toString()}`,void 0,X);J=U.pagination?.total??U.subscribers.length,z=U.pagination?.totalPages??1,H+=1,G.push(...U.subscribers??[]);let B=Y!==void 0&&G.length>=Y,L=U.pagination?$>=U.pagination.totalPages:(U.subscribers??[]).length<W;if(B||L)break;$+=1}let A=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:A,pagination:{page:1,limit:W,total:J,totalPages:z,fetchedPages:H},returned:A.length,truncated:Y!==void 0&&J>0&&A.length<J}}function OM(Q){let X=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,Y=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...X?{email:X}:{},...Y?{externalId:Y}:{}}}function g6(Q,X){let Y=OM(X);if(!Y.email&&!Y.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return Y}function TX(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function EX(Q,X){return Z("GET",TX(Q),void 0,X)}function P(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function F5(Q){let X=P(Q,"companyId");if(X)return X;let Y=l1();if(Y)return Y;try{return(await Z("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function u6(Q,X){if(!D0(Q)||!X)return Q;return{...Q,url:X}}function q5(Q,X){if(!D0(Q))return Q;return{...Q,...X.campaign!==void 0&&{url:X.campaign},...X.campaignPreview!==void 0&&{previewUrl:X.campaignPreview}}}function JQ(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!D0(W))return W;let G=P(W,"id");if(!G)return W;let $=K1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G},...Y==="transactional"&&{transactionalId:G}});if(Y==="campaign")return q5(W,$.urls);let J=Y==="sequence"?$.urls.sequence:Y==="template"?$.urls.email:$.urls.transactionalEmail;return u6(W,J)})}function MM(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!D0(X))return X;let Y=P(X,"id");if(!Y)return X;let W=K1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var VM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","schedule_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_ab_tests","get_ab_test","get_ab_test_stats","update_ab_test_variant","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function ZM(Q,X,Y){if(!D0(Y)||!VM.has(Q))return Y;let W=D0(Y.company)?Y.company:void 0,$=P(Y,"selectedCompanyId")??P(Y,"currentCompanyId")??P(Y,"companyId")??(W?P(W,"id"):void 0)??(W?P(W,"companyId"):void 0)??await F5(X);if(!$)return Y;let J=D0(Y.campaign)?Y.campaign:void 0,z=D0(Y.sequence)?Y.sequence:void 0,H=D0(Y.template)?Y.template:void 0,A=D0(Y.transactional)&&!Array.isArray(Y.transactional)?Y.transactional:void 0,K={companyId:$,campaignId:P(X,"campaignId")??P(Y,"campaignId")??(J?P(J,"id"):void 0),sequenceId:P(X,"sequenceId")??P(Y,"sequenceId")??(z?P(z,"id"):void 0),emailId:P(Y,"templateId")??(H?P(H,"id"):void 0)??(A?P(A,"emailId"):void 0)??P(X,"templateId"),transactionalId:P(X,"transactionalId")??(A?P(A,"id"):void 0)??P(X,"idOrSlug"),emailSendId:P(X,"emailSendId")??P(Y,"emailSendId")??(D0(Y.emailSend)?P(Y.emailSend,"id"):void 0),status:P(X,"status")},U=K1(K),B=W?K1({companyId:$}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:MM(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:JQ(Y.campaigns,$,"campaign")},...Array.isArray(Y.sequences)&&{sequences:JQ(Y.sequences,$,"sequence")},...Array.isArray(Y.templates)&&{templates:JQ(Y.templates,$,"template")},...Array.isArray(Y.transactional)&&{transactional:JQ(Y.transactional,$,"transactional")},...W&&B!==void 0&&{company:{...W,url:B.urls.dashboard,settingsUrl:B.urls.settings}},...J&&U.urls.campaign!==void 0&&{campaign:q5(J,U.urls)},...z&&U.urls.sequence!==void 0&&{sequence:u6(z,U.urls.sequence)},...H&&U.urls.email!==void 0&&{template:u6(H,U.urls.email)},...A&&U.urls.transactionalEmail!==void 0&&{transactional:u6(A,U.urls.transactionalEmail)},...D0(Y.emailSend)&&U.urls.emailSend!==void 0&&{emailSend:u6(Y.emailSend,U.urls.emailSend)},appUrls:U.urls}}var O5=[{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"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{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:JM,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:{...$M,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, `blocks`, or `labels` 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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},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)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{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:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",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"},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",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."},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},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"],additionalProperties:!1}},{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"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{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:JM,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:{...zM,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, `blocks`, or `labels` 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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},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_ab_tests",description:"List A/B tests and their variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Optional sequence ID to filter automation A/B tests."}}}},{name:"get_ab_test",description:"Get A/B test details, variants, and per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"}},required:["abTestId"]}},{name:"get_ab_test_stats",description:"Get A/B test aggregate stats and per-variant stats. Supports period or custom start/end ranges.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},period:{type:"string",description:"Optional period: 1h, 24h, 7d, 30d, or 90d."},start:{type:"string",description:"Custom range start as ISO 8601. Requires end."},end:{type:"string",description:"Custom range end as ISO 8601. Requires start."}},required:["abTestId"]}},{name:"update_ab_test_variant",description:"Update a draft A/B test variant. Provide at least one of subject, previewText, html, or blocks. Use either html or blocks, not both.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},variantId:{type:"string",description:"A/B test variant ID"},subject:{type:"string",description:"Variant subject line"},previewText:{type:"string",description:"Variant preview text. Pass an empty string to clear it."},html:{type:"string",description:"Replacement HTML body. Mutually exclusive with blocks."},blocks:{type:"array",description:"Replacement Sequenzy email blocks. Mutually exclusive with html.",items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{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)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{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:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",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"},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",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."},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["campaignId"],additionalProperties:!1}},{name:"schedule_campaign",description:"Schedule a draft or already scheduled campaign. Returns dashboard edit and preview URLs.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},scheduledAt:{type:"string",description:"Future ISO 8601 timestamp for the send, for example 2026-06-01T14:00:00Z."},targetLists:{type:"object",description:"Optional campaign targeting object. Omit to use saved targeting or all active subscribers. Examples: {type:'all'}, {type:'lists', listIds:['list_123']}, {type:'segment', segmentId:'seg_123'}, or {type:'filtered', filters:[...], filterJoinOperator:'and'}.",additionalProperties:!0},sendTimeOptimization:{type:"boolean",description:"Whether to use send-time optimization."},spreadOverHours:{type:"number",description:"Spread delivery over an integer number of hours from 1 to 72. When set, spread delivery takes precedence over send-time optimization."}},required:["campaignId","scheduledAt"],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"],additionalProperties:!1}},{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
|
|
|
@@ -174,4 +174,4 @@ BUILT-IN EVENTS (auto-fired by payment integrations):
|
|
|
174
174
|
|
|
175
175
|
OTHER BUILT-IN EVENTS:
|
|
176
176
|
- email.opened, email.clicked, email.replied, email.bounced, email.unsubscribed
|
|
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. Blocks can include repeat blocks over array variables such as items.",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. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",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:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},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. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",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","in_segment","event_received","link_clicked","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."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},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:U5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:U5},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:"cancel_sequence_enrollments",description:"Cancel active/waiting enrollments in one sequence. Provide sequenceId and exactly one target: subscriberId for one subscriber, or fieldValues to match stored entry event properties. For fieldValues, fieldPath is optional when the sequence has enrollmentFieldPath configured; otherwise provide a dot path such as order.id.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID whose enrollments should be cancelled."},subscriberId:{type:"string",description:"Subscriber ID to cancel in this sequence. Provide subscriberId or fieldValues, not both."},fieldPath:{type:"string",description:"Dot-path inside the token's stored entry event properties, such as order.id or event.id. Optional when the sequence has enrollmentFieldPath configured."},fieldValues:{type:"array",items:{type:"string"},description:"Entry field values to match. Cancels all active/waiting enrollments in the sequence whose entry field value is in this list. Provide fieldValues or subscriberId, not both."},dryRun:{type:"boolean",description:"When true, returns matching enrollments without cancelling them. Field-value cancellation defaults to dryRun on the API unless explicitly false."},reason:{type:"string",description:"Optional cancellation reason stored on matched enrollment tokens."}},required:["sequenceId"],additionalProperties:!1}},{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:"list_transactional_emails",description:"List transactional email templates, including their API slugs and linked email IDs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_transactional_email",description:"Get a transactional email by ID or slug, including subject, preview text, blocks, variables, and linked dashboard URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."}},required:["idOrSlug"]}},{name:"create_transactional_email",description:"Create a saved transactional email template with an API slug. Provide `prompt` to generate the email with AI, or provide either `html` or Sequenzy `blocks` for the email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Transactional email name."},slug:{type:"string",description:"Optional API slug used when sending by slug, for example `password-reset`. If omitted, Sequenzy generates one from the name."},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},previewText:{type:["string","null"],description:"Email preview text."},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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }. Mutually exclusive with `html`.",items:{type:"object"}},prompt:{type:"string",description:"Generate transactional email blocks from a prompt. Mutually exclusive with `html` and `blocks`."},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`."},enabled:{type:"boolean",description:"Whether this transactional email can be sent immediately. Defaults to true."}},required:["name"],additionalProperties:!1}},{name:"update_transactional_email",description:"Update a transactional email by ID or slug. At least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` is required. Use `html` or `blocks` to replace the linked email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."},name:{type:"string",description:"Transactional email name."},enabled:{type:"boolean",description:"Whether this transactional email can be sent."},subject:{type:"string",description:"Email subject line."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks, including conditional and repeat blocks. Mutually exclusive with `html`.",items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{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. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{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 O5(Q,X){try{let Y;switch(Q){case"get_account":{let G=await Z("GET","/api/v1/account"),J=f1();Y={...G,selectedCompanyId:J??G.currentCompanyId};break}case"select_company":{let G=X.companyId,J=await Z("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"}`);SX(G),Y={success:!0,message:`Switched to company: ${$.name}`,companyId:$.id,companyName:$.name};break}case"get_app_urls":{let G=await F5(X);Y={...K1({companyId:G,campaignId:S(X,"campaignId"),sequenceId:S(X,"sequenceId"),emailId:S(X,"emailId")??S(X,"templateId"),transactionalId:S(X,"transactionalId"),emailSendId:S(X,"emailSendId"),domainId:S(X,"domainId"),status:S(X,"status"),settingsTab:S(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 Z("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((U)=>setTimeout(U,20000)),z++;let K=await Z("GET",`/api/v1/companies/${J}`);if(K.success)H=K.company.status}SX(J);let A=await Z("GET",`/api/v1/companies/${J}`);Y={success:!0,company:A.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${A.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=X.companyId;Y=await Z("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=X.companyId;Y=await Z("POST","/api/v1/api-keys",{name:X.name},G);break}case"list_websites":{let G=X.companyId;Y=await Z("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=X.companyId;Y=await Z("POST","/api/v1/websites",{domain:X.domain},G);break}case"check_website":{let G=X.companyId;Y=await Z("GET",`/api/v1/websites/${X.domain}`,void 0,G);break}case"get_integration_guide":Y=await Z("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let G=X.companyId,J=u6("add_subscriber",X);Y=await Z("POST","/api/v1/subscribers",{...J,customAttributes:X.attributes,tags:X.tags,lists:X.listIds},G);break}case"update_subscriber":{let G=X.companyId,J=u6("update_subscriber",X),$=await EX(J,G),z=Array.isArray($.subscriber.tags)?$.subscriber.tags.filter((B)=>typeof B==="string"):[],H=Array.isArray(X.addTags)?X.addTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(B5):[],A=new Set(Array.isArray(X.removeTags)?X.removeTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(B5):[]),K=z.filter((B)=>!A.has(B));for(let B of H)if(!K.includes(B))K.push(B);let U={};if(J.email&&J.externalId)U.externalId=J.externalId;if(Z0(X.attributes))U.customAttributes={...Z0($.subscriber.customAttributes)?$.subscriber.customAttributes:{},...X.attributes};if(X.addTags||X.removeTags)U.tags=K;Y=await Z("PATCH",TX(J),U,G);break}case"remove_subscriber":{let G=X.companyId,J=u6("remove_subscriber",X),$=TX(J);if(X.hardDelete===!0)Y=await Z("DELETE",$,void 0,G);else Y=await Z("PATCH",$,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=X.companyId,J=u6("get_subscriber",X);Y=await EX(J,G);break}case"search_subscribers":{let G=X.companyId;Y=await LM(X,G);break}case"list_tags":{let G=X.companyId;Y=await Z("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=X.companyId;Y=await Z("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=X.companyId;Y=await Z("POST","/api/v1/lists",X,G);break}case"list_segments":{let G=X.companyId;Y=await Z("GET","/api/v1/segments",void 0,G);break}case"create_segment":{zM(X);let G=X.companyId;Y=await Z("POST","/api/v1/segments",{...X,...X.filters!==void 0?{filters:D5(X.filters)}:{},...X.root!==void 0?{root:L5(X.root)}:{}},G);break}case"get_segment_count":{let G=X.companyId;Y=await Z("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,G);break}case"list_templates":{let G=X.companyId,J=new URLSearchParams,$=S(X,"label");if($)J.set("label",$);Y=await Z("GET",`/api/v1/templates${J.size>0?`?${J}`:""}`,void 0,G);break}case"get_template":{let G=X.companyId;Y=await Z("GET",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"create_template":{let G=X.companyId;m1("create_template",X,{requireContent:!0}),zQ("create_template",X),Y=await Z("POST","/api/v1/templates",X,G);break}case"update_template":{let G=X.companyId,J=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(m1("update_template",X),zQ("update_template",X),X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");Y=await Z("PUT",`/api/v1/templates/${X.templateId}`,X,G);break}case"delete_template":{let G=X.companyId;Y=await Z("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));let $=S(X,"label");if($)J.set("label",$);Y=await Z("GET",`/api/v1/campaigns?${J}`,void 0,G);break}case"get_campaign":{let G=X.companyId;Y=await Z("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,G);break}case"get_email_send":{let G=X.companyId;Y=await Z("GET",`/api/v1/email-sends/${encodeURIComponent(String(X.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=X.companyId;KM(X);let J=S(X,"prompt");if(J!==void 0){let $=await Z("POST","/api/v1/generate/email",{prompt:J,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G),z=S(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,A=typeof $.html==="string"&&$.html.trim()!==""?$.html:void 0;if(H===void 0&&A===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");Y=await Z("POST","/api/v1/campaigns",{name:X.name,subject:z,...H!==void 0?{blocks:H}:{html:A},...X.segmentId!==void 0&&{segmentId:X.segmentId},...X.labels!==void 0&&{labels:X.labels}},G);break}Y=await Z("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","labels"]),$=Object.keys(X).filter((z)=>!J.has(z));if($.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, and \`labels\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((z)=>`\`${z}\``).join(", ")}.`);if(m1("update_campaign",X),zQ("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&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, `replyTo`, `replyProfileId`, or `labels` when calling `update_campaign`.");Y=await Z("PUT",`/api/v1/campaigns/${X.campaignId}`,X,G);break}case"send_test_email":{let G=X.companyId;Y=await Z("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},G);break}case"list_sequences":{let G=X.companyId;Y=await Z("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=X.companyId;Y=await Z("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 Z("POST","/api/v1/sequences",X,G);if(!$.success){Y=$;break}let z=$.sequence.id;if(J){let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)Y={success:!0,sequence:B.sequence,message:`Sequence "${B.sequence.name}" created with explicit steps. Review it before enabling.`};else Y=B;break}let H=6,A=0,K="pending";while(K!=="complete"&&A<H){await new Promise((L)=>setTimeout(L,20000)),A++;let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)K=B.sequence.enrichmentStatus}let U=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(U.success)Y={success:!0,sequence:U.sequence,message:U.sequence.enrichmentStatus==="complete"?`Sequence "${U.sequence.name}" created with ${U.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${U.sequence.name}" created. Email enrichment is still in progress (${U.sequence.enrichedCount}/${U.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=U;break}case"update_sequence":{let G=X.companyId,J=HM(X);Y=await Z("PUT",`/api/v1/sequences/${X.sequenceId}`,J,G);break}case"enable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=X.companyId,J=AM(X);Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enrollments/cancel`,J,G);break}case"delete_sequence":{let G=X.companyId;Y=await Z("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=X.companyId;Y=await Z("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=X.companyId;Y=await Z("GET",`/api/v1/transactional/${X.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=X.companyId,J=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),$=Object.keys(X).filter((A)=>!J.has(A));if($.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${$.length===1?"":"s"}: ${$.map((A)=>`\`${A}\``).join(", ")}.`);UM(X);let z=S(X,"prompt");if(z!==void 0){let A={companyId:G??f1()??"",name:typeof X.name==="string"&&X.name.trim()!==""?X.name.trim():"",slug:typeof X.slug==="string"&&X.slug.trim()!==""?X.slug.trim():"",promptLength:z.length,style:typeof X.style==="string"?X.style:"",tone:typeof X.tone==="string"?X.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",A);let K=await Z("POST","/api/v1/generate/email",{prompt:z,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...A,subject:K.subject??"",previewTextLength:typeof K.previewText==="string"?K.previewText.length:0,blockCount:Array.isArray(K.blocks)?K.blocks.length:0,htmlLength:typeof K.html==="string"?K.html.length:0});let U=S(X,"subject")??(typeof K.subject==="string"&&K.subject.trim()!==""?K.subject.trim():void 0);if(!U)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let B=Array.isArray(K.blocks)&&K.blocks.length>0?K.blocks:void 0,L=typeof K.html==="string"&&K.html.trim()!==""?K.html:void 0,q=S(X,"previewText")??(typeof K.previewText==="string"?K.previewText.trim():void 0);if(B===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...A,subject:U,contentSource:B!==void 0?"blocks":"html",blockCount:B?.length??0,htmlLength:L?.length??0}),Y=await Z("POST","/api/v1/transactional",{name:X.name,...X.slug!==void 0&&{slug:X.slug},subject:U,...q!==void 0&&{previewText:q},...B!==void 0?{blocks:B}:{html:L},...X.enabled!==void 0&&{enabled:X.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",A)}catch(K){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...A,error:K instanceof Error?K.message:String(K)}),K}break}let H=Object.fromEntries(Object.entries(X).filter(([A])=>A!=="companyId"));Y=await Z("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=X.companyId,J=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),$=Object.keys(X).filter((H)=>!J.has(H));if($.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${$.length===1?"":"s"}: ${$.map((H)=>`\`${H}\``).join(", ")}.`);if(m1("update_transactional_email",X),X.name===void 0&&X.enabled===void 0&&X.subject===void 0&&X.previewText===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let z=Object.fromEntries(Object.entries(X).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));Y=await Z("PATCH",`/api/v1/transactional/${X.idOrSlug}`,z,G);break}case"send_email":{let G=X.companyId;Y=await Z("POST","/api/v1/transactional/send",X,G);break}case"get_stats":{let G=X.companyId,J=X.period??"7d";Y=await Z("GET",`/api/v1/metrics?period=${J}`,void 0,G);break}case"get_campaign_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/campaigns/${X.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/sequences/${X.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=X.companyId,J=u6("get_subscriber_activity",X),$=await EX(J,G);Y={success:$.success,email:$.subscriber.email,emailStats:$.subscriber.emailStats??null,activity:$.subscriber.activity??[],sequenceEnrollments:$.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/email",X,G);break}case"generate_sequence":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/sequence",X,G);break}case"generate_subject_lines":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/subjects",X,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=BM(Y);if(W)throw W;return Y=await MM(Q,X,Y),{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{isError:!0,content:[{type:"text",text:V1(Y)}]}}}var VM=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",M5=process.env.SEQUENZY_API_KEY,RX=null;if(!M5)console.error(V1(new h1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1);function f1(){return RX}function SX(Q){RX=Q}var h6=new bX({name:"sequenzy",version:$5.version},{capabilities:{tools:{},resources:{}}});function ZM(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 Z(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${M5}`},J=W??RX;if(J)G["x-company-id"]=J;let $;try{$=await fetch(`${VM}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0})}catch(z){throw new h1(z instanceof Error?z.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!$.ok){let z=await $.text(),H=ZM(z);throw new h1(H.message,$.status,z,H.code)}return $.json()}h6.setRequestHandler(K9,async()=>{return{tools:q5}});h6.setRequestHandler(B6,async(Q)=>{let{name:X,arguments:Y}=Q.params;return O5(X,Y??{})});h6.setRequestHandler(W9,async()=>{return{resources:A5}});h6.setRequestHandler(J9,async(Q)=>{let{uri:X}=Q.params;return K5(X)});async function NM(){let Q=new PX;await h6.connect(Q),console.error("Sequenzy MCP server running on stdio")}NM().catch((Q)=>{console.error(V1(Q)),process.exit(1)});export{SX as setSelectedCompanyId,f1 as getSelectedCompanyId,Z 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. Blocks can include repeat blocks over array variables such as items.",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. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",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:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},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. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",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","in_segment","event_received","link_clicked","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."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},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:U5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:U5},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:"cancel_sequence_enrollments",description:"Cancel active/waiting enrollments in one sequence. Provide sequenceId and exactly one target: subscriberId for one subscriber, or fieldValues to match stored entry event properties. For fieldValues, fieldPath is optional when the sequence has enrollmentFieldPath configured; otherwise provide a dot path such as order.id.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID whose enrollments should be cancelled."},subscriberId:{type:"string",description:"Subscriber ID to cancel in this sequence. Provide subscriberId or fieldValues, not both."},fieldPath:{type:"string",description:"Dot-path inside the token's stored entry event properties, such as order.id or event.id. Optional when the sequence has enrollmentFieldPath configured."},fieldValues:{type:"array",items:{type:"string"},description:"Entry field values to match. Cancels all active/waiting enrollments in the sequence whose entry field value is in this list. Provide fieldValues or subscriberId, not both."},dryRun:{type:"boolean",description:"When true, returns matching enrollments without cancelling them. Field-value cancellation defaults to dryRun on the API unless explicitly false."},reason:{type:"string",description:"Optional cancellation reason stored on matched enrollment tokens."}},required:["sequenceId"],additionalProperties:!1}},{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:"list_transactional_emails",description:"List transactional email templates, including their API slugs and linked email IDs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_transactional_email",description:"Get a transactional email by ID or slug, including subject, preview text, blocks, variables, and linked dashboard URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."}},required:["idOrSlug"]}},{name:"create_transactional_email",description:"Create a saved transactional email template with an API slug. Provide `prompt` to generate the email with AI, or provide either `html` or Sequenzy `blocks` for the email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Transactional email name."},slug:{type:"string",description:"Optional API slug used when sending by slug, for example `password-reset`. If omitted, Sequenzy generates one from the name."},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},previewText:{type:["string","null"],description:"Email preview text."},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 and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }. Mutually exclusive with `html`.",items:{type:"object"}},prompt:{type:"string",description:"Generate transactional email blocks from a prompt. Mutually exclusive with `html` and `blocks`."},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`."},enabled:{type:"boolean",description:"Whether this transactional email can be sent immediately. Defaults to true."}},required:["name"],additionalProperties:!1}},{name:"update_transactional_email",description:"Update a transactional email by ID or slug. At least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` is required. Use `html` or `blocks` to replace the linked email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."},name:{type:"string",description:"Transactional email name."},enabled:{type:"boolean",description:"Whether this transactional email can be sent."},subject:{type:"string",description:"Email subject line."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks, including conditional and repeat blocks. Mutually exclusive with `html`.",items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{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. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{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 M5(Q,X){try{let Y;switch(Q){case"get_account":{let G=await Z("GET","/api/v1/account"),$=l1();Y={...G,selectedCompanyId:$??G.currentCompanyId};break}case"select_company":{let G=X.companyId,$=await Z("GET","/api/v1/account"),J=$.companies?.find((z)=>z.id===G);if(!J)throw Error(`Company not found. Available companies: ${$.companies?.map((z)=>`${z.name} (${z.id})`).join(", ")??"none"}`);SX(G),Y={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"get_app_urls":{let G=await F5(X);Y={...K1({companyId:G,campaignId:P(X,"campaignId"),sequenceId:P(X,"sequenceId"),emailId:P(X,"emailId")??P(X,"templateId"),transactionalId:P(X,"transactionalId"),emailSendId:P(X,"emailSendId"),domainId:P(X,"domainId"),status:P(X,"status"),settingsTab:P(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 Z("POST","/api/v1/companies",{name:X.name,domain:X.domain});if(!G.success)throw Error("Failed to create company");let $=G.company.id,J=6,z=0,H=G.company.status;while(H==="processing"&&z<J){await new Promise((U)=>setTimeout(U,20000)),z++;let K=await Z("GET",`/api/v1/companies/${$}`);if(K.success)H=K.company.status}SX($);let A=await Z("GET",`/api/v1/companies/${$}`);Y={success:!0,company:A.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${A.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=X.companyId;Y=await Z("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=X.companyId;Y=await Z("POST","/api/v1/api-keys",{name:X.name},G);break}case"list_websites":{let G=X.companyId;Y=await Z("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=X.companyId;Y=await Z("POST","/api/v1/websites",{domain:X.domain},G);break}case"check_website":{let G=X.companyId;Y=await Z("GET",`/api/v1/websites/${X.domain}`,void 0,G);break}case"get_integration_guide":Y=await Z("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let G=X.companyId,$=g6("add_subscriber",X);Y=await Z("POST","/api/v1/subscribers",{...$,customAttributes:X.attributes,tags:X.tags,lists:X.listIds},G);break}case"update_subscriber":{let G=X.companyId,$=g6("update_subscriber",X),J=await EX($,G),z=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((B)=>typeof B==="string"):[],H=Array.isArray(X.addTags)?X.addTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(B5):[],A=new Set(Array.isArray(X.removeTags)?X.removeTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(B5):[]),K=z.filter((B)=>!A.has(B));for(let B of H)if(!K.includes(B))K.push(B);let U={};if($.email&&$.externalId)U.externalId=$.externalId;if(D0(X.attributes))U.customAttributes={...D0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...X.attributes};if(X.addTags||X.removeTags)U.tags=K;Y=await Z("PATCH",TX($),U,G);break}case"remove_subscriber":{let G=X.companyId,$=g6("remove_subscriber",X),J=TX($);if(X.hardDelete===!0)Y=await Z("DELETE",J,void 0,G);else Y=await Z("PATCH",J,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=X.companyId,$=g6("get_subscriber",X);Y=await EX($,G);break}case"search_subscribers":{let G=X.companyId;Y=await qM(X,G);break}case"list_tags":{let G=X.companyId;Y=await Z("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=X.companyId;Y=await Z("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=X.companyId;Y=await Z("POST","/api/v1/lists",X,G);break}case"list_segments":{let G=X.companyId;Y=await Z("GET","/api/v1/segments",void 0,G);break}case"create_segment":{HM(X);let G=X.companyId;Y=await Z("POST","/api/v1/segments",{...X,...X.filters!==void 0?{filters:D5(X.filters)}:{},...X.root!==void 0?{root:L5(X.root)}:{}},G);break}case"get_segment_count":{let G=X.companyId;Y=await Z("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,G);break}case"list_templates":{let G=X.companyId,$=new URLSearchParams,J=P(X,"label");if(J)$.set("label",J);Y=await Z("GET",`/api/v1/templates${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_template":{let G=X.companyId;Y=await Z("GET",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"create_template":{let G=X.companyId;Z1("create_template",X,{requireContent:!0}),zQ("create_template",X),Y=await Z("POST","/api/v1/templates",X,G);break}case"update_template":{let G=X.companyId,$=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(Z1("update_template",X),zQ("update_template",X),X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");Y=await Z("PUT",`/api/v1/templates/${X.templateId}`,X,G);break}case"delete_template":{let G=X.companyId;Y=await Z("DELETE",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"list_ab_tests":{let G=X.companyId,$=new URLSearchParams,J=P(X,"sequenceId");if(J)$.set("sequenceId",J);Y=await Z("GET",`/api/v1/ab-tests${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_ab_test":{let G=X.companyId;Y=await Z("GET",`/api/v1/ab-tests/${X.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=X.companyId,$=new URLSearchParams,J=P(X,"period"),z=P(X,"start"),H=P(X,"end");if(J)$.set("period",J);if(z)$.set("start",z);if(H)$.set("end",H);Y=await Z("GET",`/api/v1/ab-tests/${X.abTestId}/stats${$.size>0?`?${$}`:""}`,void 0,G);break}case"update_ab_test_variant":{let G=X.companyId,$=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(Z1("update_ab_test_variant",X),X.subject===void 0&&X.previewText===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `subject`, `previewText`, `html`, or `blocks` when calling `update_ab_test_variant`.");Y=await Z("PATCH",`/api/v1/ab-tests/${X.abTestId}/variants/${X.variantId}`,X,G);break}case"list_campaigns":{let G=X.companyId,$=new URLSearchParams;if(X.status)$.set("status",String(X.status));let J=P(X,"label");if(J)$.set("label",J);Y=await Z("GET",`/api/v1/campaigns?${$}`,void 0,G);break}case"get_campaign":{let G=X.companyId;Y=await Z("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,G);break}case"get_email_send":{let G=X.companyId;Y=await Z("GET",`/api/v1/email-sends/${encodeURIComponent(String(X.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=X.companyId;UM(X);let $=P(X,"prompt");if($!==void 0){let J=await Z("POST","/api/v1/generate/email",{prompt:$,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G),z=P(X,"subject")??(typeof J.subject==="string"&&J.subject.trim()!==""?J.subject.trim():void 0);if(!z)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(J.blocks)&&J.blocks.length>0?J.blocks:void 0,A=typeof J.html==="string"&&J.html.trim()!==""?J.html:void 0;if(H===void 0&&A===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");Y=await Z("POST","/api/v1/campaigns",{name:X.name,subject:z,...H!==void 0?{blocks:H}:{html:A},...X.segmentId!==void 0&&{segmentId:X.segmentId},...X.labels!==void 0&&{labels:X.labels}},G);break}Y=await Z("POST","/api/v1/campaigns",X,G);break}case"update_campaign":{let G=X.companyId,$=new Set(["companyId","campaignId","name","subject","html","blocks","replyTo","replyProfileId","labels"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(Z1("update_campaign",X),zQ("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&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, `replyTo`, `replyProfileId`, or `labels` when calling `update_campaign`.");Y=await Z("PUT",`/api/v1/campaigns/${X.campaignId}`,X,G);break}case"schedule_campaign":{let G=X.companyId,$=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);BM(X),Y=await Z("POST",`/api/v1/campaigns/${X.campaignId}/schedule`,{scheduledAt:X.scheduledAt,...X.targetLists!==void 0&&{targetLists:X.targetLists},...X.sendTimeOptimization!==void 0&&{sendTimeOptimization:X.sendTimeOptimization},...X.spreadOverHours!==void 0&&{spreadOverHours:X.spreadOverHours}},G);break}case"send_test_email":{let G=X.companyId;Y=await Z("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},G);break}case"list_sequences":{let G=X.companyId;Y=await Z("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=X.companyId;Y=await Z("GET",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"create_sequence":{let G=X.companyId,$=Array.isArray(X.steps)&&X.steps.length>0,J=await Z("POST","/api/v1/sequences",X,G);if(!J.success){Y=J;break}let z=J.sequence.id;if($){let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)Y={success:!0,sequence:B.sequence,message:`Sequence "${B.sequence.name}" created with explicit steps. Review it before enabling.`};else Y=B;break}let H=6,A=0,K="pending";while(K!=="complete"&&A<H){await new Promise((L)=>setTimeout(L,20000)),A++;let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)K=B.sequence.enrichmentStatus}let U=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(U.success)Y={success:!0,sequence:U.sequence,message:U.sequence.enrichmentStatus==="complete"?`Sequence "${U.sequence.name}" created with ${U.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${U.sequence.name}" created. Email enrichment is still in progress (${U.sequence.enrichedCount}/${U.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=U;break}case"update_sequence":{let G=X.companyId,$=AM(X);Y=await Z("PUT",`/api/v1/sequences/${X.sequenceId}`,$,G);break}case"enable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=X.companyId,$=KM(X);Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enrollments/cancel`,$,G);break}case"delete_sequence":{let G=X.companyId;Y=await Z("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=X.companyId;Y=await Z("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=X.companyId;Y=await Z("GET",`/api/v1/transactional/${X.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=X.companyId,$=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),J=Object.keys(X).filter((A)=>!$.has(A));if(J.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${J.length===1?"":"s"}: ${J.map((A)=>`\`${A}\``).join(", ")}.`);DM(X);let z=P(X,"prompt");if(z!==void 0){let A={companyId:G??l1()??"",name:typeof X.name==="string"&&X.name.trim()!==""?X.name.trim():"",slug:typeof X.slug==="string"&&X.slug.trim()!==""?X.slug.trim():"",promptLength:z.length,style:typeof X.style==="string"?X.style:"",tone:typeof X.tone==="string"?X.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",A);let K=await Z("POST","/api/v1/generate/email",{prompt:z,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...A,subject:K.subject??"",previewTextLength:typeof K.previewText==="string"?K.previewText.length:0,blockCount:Array.isArray(K.blocks)?K.blocks.length:0,htmlLength:typeof K.html==="string"?K.html.length:0});let U=P(X,"subject")??(typeof K.subject==="string"&&K.subject.trim()!==""?K.subject.trim():void 0);if(!U)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let B=Array.isArray(K.blocks)&&K.blocks.length>0?K.blocks:void 0,L=typeof K.html==="string"&&K.html.trim()!==""?K.html:void 0,q=P(X,"previewText")??(typeof K.previewText==="string"?K.previewText.trim():void 0);if(B===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...A,subject:U,contentSource:B!==void 0?"blocks":"html",blockCount:B?.length??0,htmlLength:L?.length??0}),Y=await Z("POST","/api/v1/transactional",{name:X.name,...X.slug!==void 0&&{slug:X.slug},subject:U,...q!==void 0&&{previewText:q},...B!==void 0?{blocks:B}:{html:L},...X.enabled!==void 0&&{enabled:X.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",A)}catch(K){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...A,error:K instanceof Error?K.message:String(K)}),K}break}let H=Object.fromEntries(Object.entries(X).filter(([A])=>A!=="companyId"));Y=await Z("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=X.companyId,$=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),J=Object.keys(X).filter((H)=>!$.has(H));if(J.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((H)=>`\`${H}\``).join(", ")}.`);if(Z1("update_transactional_email",X),X.name===void 0&&X.enabled===void 0&&X.subject===void 0&&X.previewText===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let z=Object.fromEntries(Object.entries(X).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));Y=await Z("PATCH",`/api/v1/transactional/${X.idOrSlug}`,z,G);break}case"send_email":{let G=X.companyId;Y=await Z("POST","/api/v1/transactional/send",X,G);break}case"get_stats":{let G=X.companyId,$=X.period??"7d";Y=await Z("GET",`/api/v1/metrics?period=${$}`,void 0,G);break}case"get_campaign_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/campaigns/${X.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/sequences/${X.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=X.companyId,$=g6("get_subscriber_activity",X),J=await EX($,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 Z("POST","/api/v1/generate/email",X,G);break}case"generate_sequence":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/sequence",X,G);break}case"generate_subject_lines":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/subjects",X,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=LM(Y);if(W)throw W;return Y=await ZM(Q,X,Y),{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{isError:!0,content:[{type:"text",text:V1(Y)}]}}}var NM=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",V5=process.env.SEQUENZY_API_KEY,RX=null;if(!V5)console.error(V1(new f1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1);function l1(){return RX}function SX(Q){RX=Q}var h6=new bX({name:"sequenzy",version:J5.version},{capabilities:{tools:{},resources:{}}});function wM(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 Z(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${V5}`},$=W??RX;if($)G["x-company-id"]=$;let J;try{J=await fetch(`${NM}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0})}catch(z){throw new f1(z instanceof Error?z.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!J.ok){let z=await J.text(),H=wM(z);throw new f1(H.message,J.status,z,H.code)}return J.json()}h6.setRequestHandler(K9,async()=>{return{tools:O5}});h6.setRequestHandler(U6,async(Q)=>{let{name:X,arguments:Y}=Q.params;return M5(X,Y??{})});h6.setRequestHandler(W9,async()=>{return{resources:A5}});h6.setRequestHandler($9,async(Q)=>{let{uri:X}=Q.params;return K5(X)});async function bM(){let Q=new PX;await h6.connect(Q),console.error("Sequenzy MCP server running on stdio")}bM().catch((Q)=>{console.error(V1(Q)),process.exit(1)});export{SX as setSelectedCompanyId,l1 as getSelectedCompanyId,Z as apiRequest};
|